spree_backend 3.2.9 → 3.3.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/backend/admin.js +16 -15
  3. data/app/assets/javascripts/spree/backend/checkouts/edit.js +25 -26
  4. data/app/assets/javascripts/spree/backend/general_settings.js.coffee +10 -12
  5. data/app/assets/javascripts/spree/backend/payments/edit.js.coffee +4 -6
  6. data/app/assets/javascripts/spree/backend/returns/return_item_selection.js +7 -1
  7. data/app/assets/javascripts/spree/backend/stock_transfer.js.coffee +4 -1
  8. data/app/assets/javascripts/spree/backend/user_picker.js +3 -1
  9. data/app/assets/javascripts/spree/backend.js +3 -3
  10. data/app/controllers/spree/admin/countries_controller.rb +1 -0
  11. data/app/controllers/spree/admin/log_entries_controller.rb +2 -2
  12. data/app/controllers/spree/admin/orders/customer_details_controller.rb +5 -6
  13. data/app/controllers/spree/admin/orders_controller.rb +4 -4
  14. data/app/controllers/spree/admin/payments_controller.rb +21 -10
  15. data/app/controllers/spree/admin/products_controller.rb +5 -0
  16. data/app/controllers/spree/admin/promotion_rules_controller.rb +11 -7
  17. data/app/controllers/spree/admin/stock_transfers_controller.rb +1 -1
  18. data/app/controllers/spree/admin/taxons_controller.rb +31 -23
  19. data/app/helpers/spree/admin/base_helper.rb +1 -1
  20. data/app/helpers/spree/admin/navigation_helper.rb +10 -4
  21. data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +2 -2
  22. data/app/views/spree/admin/general_settings/edit.html.erb +8 -8
  23. data/app/views/spree/admin/images/_form.html.erb +2 -2
  24. data/app/views/spree/admin/images/edit.html.erb +2 -2
  25. data/app/views/spree/admin/images/new.html.erb +1 -1
  26. data/app/views/spree/admin/option_types/_form.html.erb +2 -2
  27. data/app/views/spree/admin/option_types/index.html.erb +4 -4
  28. data/app/views/spree/admin/orders/_line_items.html.erb +40 -38
  29. data/app/views/spree/admin/orders/_shipment.html.erb +77 -76
  30. data/app/views/spree/admin/orders/customer_details/_form.html.erb +5 -5
  31. data/app/views/spree/admin/orders/index.html.erb +16 -16
  32. data/app/views/spree/admin/payment_methods/_form.html.erb +2 -2
  33. data/app/views/spree/admin/payments/_list.html.erb +1 -1
  34. data/app/views/spree/admin/products/_add_stock_form.html.erb +3 -3
  35. data/app/views/spree/admin/products/_form.html.erb +16 -16
  36. data/app/views/spree/admin/products/index.html.erb +4 -4
  37. data/app/views/spree/admin/products/new.html.erb +8 -8
  38. data/app/views/spree/admin/promotion_categories/index.html.erb +3 -3
  39. data/app/views/spree/admin/promotions/_form.html.erb +3 -3
  40. data/app/views/spree/admin/promotions/_promotion_rule.html.erb +1 -1
  41. data/app/views/spree/admin/promotions/actions/_create_adjustment.html.erb +2 -2
  42. data/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb +2 -2
  43. data/app/views/spree/admin/promotions/actions/_create_line_items.html.erb +2 -4
  44. data/app/views/spree/admin/promotions/edit.html.erb +3 -3
  45. data/app/views/spree/admin/promotions/index.html.erb +6 -6
  46. data/app/views/spree/admin/promotions/rules/_item_total.html.erb +2 -2
  47. data/app/views/spree/admin/promotions/rules/_option_value.html.erb +4 -4
  48. data/app/views/spree/admin/properties/_form.html.erb +2 -2
  49. data/app/views/spree/admin/properties/index.html.erb +6 -6
  50. data/app/views/spree/admin/prototypes/index.html.erb +4 -4
  51. data/app/views/spree/admin/reimbursement_types/_form.html.erb +4 -4
  52. data/app/views/spree/admin/reimbursements/edit.html.erb +1 -1
  53. data/app/views/spree/admin/return_authorizations/_form.html.erb +13 -1
  54. data/app/views/spree/admin/return_index/customer_returns.html.erb +2 -2
  55. data/app/views/spree/admin/return_index/return_authorizations.html.erb +5 -5
  56. data/app/views/spree/admin/shared/_content_header.html.erb +2 -2
  57. data/app/views/spree/admin/shared/_header.html.erb +2 -2
  58. data/app/views/spree/admin/shared/_index_table_options.html.erb +2 -2
  59. data/app/views/spree/admin/shared/_order_summary.html.erb +1 -1
  60. data/app/views/spree/admin/shared/_table_filter.html.erb +1 -1
  61. data/app/views/spree/admin/shared/_translations.html.erb +0 -1
  62. data/app/views/spree/admin/shared/_update_order_state.js.erb +1 -1
  63. data/app/views/spree/admin/shipping_methods/_form.html.erb +10 -10
  64. data/app/views/spree/admin/state_changes/index.html.erb +3 -3
  65. data/app/views/spree/admin/states/_form.html.erb +2 -2
  66. data/app/views/spree/admin/stock_locations/_form.html.erb +2 -2
  67. data/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb +4 -4
  68. data/app/views/spree/admin/stock_transfers/index.html.erb +3 -3
  69. data/app/views/spree/admin/stock_transfers/new.html.erb +2 -2
  70. data/app/views/spree/admin/store_credits/index.html.erb +1 -1
  71. data/app/views/spree/admin/tax_rates/_form.html.erb +2 -2
  72. data/app/views/spree/admin/taxonomies/_list.html.erb +2 -2
  73. data/app/views/spree/admin/taxonomies/{edit.erb → edit.html.erb} +0 -0
  74. data/app/views/spree/admin/taxonomies/index.html.erb +2 -2
  75. data/app/views/spree/admin/taxons/_form.html.erb +5 -5
  76. data/app/views/spree/admin/taxons/edit.html.erb +3 -0
  77. data/app/views/spree/admin/trackers/_form.html.erb +2 -2
  78. data/app/views/spree/admin/users/_addresses_form.html.erb +2 -2
  79. data/app/views/spree/admin/users/_form.html.erb +2 -2
  80. data/app/views/spree/admin/users/_user_page_actions.html.erb +1 -1
  81. data/app/views/spree/admin/users/index.html.erb +5 -5
  82. data/app/views/spree/admin/users/items.html.erb +1 -1
  83. data/app/views/spree/admin/users/orders.html.erb +1 -1
  84. data/app/views/spree/admin/variants/_form.html.erb +2 -2
  85. data/app/views/spree/admin/zones/_form.html.erb +2 -2
  86. data/app/views/spree/layouts/admin.html.erb +3 -3
  87. data/config/initializers/assets.rb +1 -1
  88. data/lib/spree/backend/engine.rb +0 -1
  89. data/spec/controllers/spree/admin/base_controller_spec.rb +46 -0
  90. data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +185 -0
  91. data/spec/controllers/spree/admin/general_settings_controller_spec.rb +41 -0
  92. data/spec/controllers/spree/admin/missing_products_controller_spec.rb +18 -0
  93. data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +199 -0
  94. data/spec/controllers/spree/admin/orders_controller_spec.rb +296 -0
  95. data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +64 -0
  96. data/spec/controllers/spree/admin/payments_controller_spec.rb +97 -0
  97. data/spec/controllers/spree/admin/products_controller_spec.rb +137 -0
  98. data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +21 -0
  99. data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +21 -0
  100. data/spec/controllers/spree/admin/promotions_controller_spec.rb +44 -0
  101. data/spec/controllers/spree/admin/refunds_controller_spec.rb +32 -0
  102. data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +74 -0
  103. data/spec/controllers/spree/admin/reports_controller_spec.rb +42 -0
  104. data/spec/controllers/spree/admin/resource_controller_spec.rb +252 -0
  105. data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +225 -0
  106. data/spec/controllers/spree/admin/return_index_controller_spec.rb +37 -0
  107. data/spec/controllers/spree/admin/return_items_controller_spec.rb +27 -0
  108. data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +14 -0
  109. data/spec/controllers/spree/admin/stock_items_controller_spec.rb +19 -0
  110. data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +41 -0
  111. data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +41 -0
  112. data/spec/controllers/spree/admin/tax_categories_controller_spec.rb +34 -0
  113. data/spec/controllers/spree/admin/users_controller_spec.rb +161 -0
  114. data/spec/controllers/spree/admin/variants_controller_spec.rb +32 -0
  115. data/spec/features/admin/configuration/analytics_tracker_spec.rb +47 -0
  116. data/spec/features/admin/configuration/countries_spec.rb +24 -0
  117. data/spec/features/admin/configuration/general_settings_spec.rb +44 -0
  118. data/spec/features/admin/configuration/payment_methods_spec.rb +63 -0
  119. data/spec/features/admin/configuration/roles_spec.rb +47 -0
  120. data/spec/features/admin/configuration/shipping_methods_spec.rb +62 -0
  121. data/spec/features/admin/configuration/states_spec.rb +68 -0
  122. data/spec/features/admin/configuration/stock_locations_spec.rb +48 -0
  123. data/spec/features/admin/configuration/store_credit_categories_spec.rb +50 -0
  124. data/spec/features/admin/configuration/tax_categories_spec.rb +56 -0
  125. data/spec/features/admin/configuration/tax_rates_spec.rb +18 -0
  126. data/spec/features/admin/configuration/zones_spec.rb +39 -0
  127. data/spec/features/admin/homepage_spec.rb +89 -0
  128. data/spec/features/admin/locale_spec.rb +31 -0
  129. data/spec/features/admin/orders/adjustments_promotions_spec.rb +53 -0
  130. data/spec/features/admin/orders/adjustments_spec.rb +124 -0
  131. data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +47 -0
  132. data/spec/features/admin/orders/customer_details_spec.rb +154 -0
  133. data/spec/features/admin/orders/line_items_spec.rb +51 -0
  134. data/spec/features/admin/orders/listing_spec.rb +224 -0
  135. data/spec/features/admin/orders/log_entries_spec.rb +55 -0
  136. data/spec/features/admin/orders/new_order_spec.rb +186 -0
  137. data/spec/features/admin/orders/order_details_spec.rb +660 -0
  138. data/spec/features/admin/orders/payments_spec.rb +244 -0
  139. data/spec/features/admin/orders/risk_analysis_spec.rb +48 -0
  140. data/spec/features/admin/orders/shipments_spec.rb +64 -0
  141. data/spec/features/admin/orders/state_changes_spec.rb +21 -0
  142. data/spec/features/admin/products/edit/images_spec.rb +86 -0
  143. data/spec/features/admin/products/edit/products_spec.rb +56 -0
  144. data/spec/features/admin/products/edit/taxons_spec.rb +41 -0
  145. data/spec/features/admin/products/edit/variants_spec.rb +56 -0
  146. data/spec/features/admin/products/option_types_spec.rb +114 -0
  147. data/spec/features/admin/products/products_spec.rb +445 -0
  148. data/spec/features/admin/products/properties_spec.rb +147 -0
  149. data/spec/features/admin/products/prototypes_spec.rb +112 -0
  150. data/spec/features/admin/products/stock_management_spec.rb +124 -0
  151. data/spec/features/admin/products/taxonomies_spec.rb +52 -0
  152. data/spec/features/admin/products/variant_spec.rb +50 -0
  153. data/spec/features/admin/promotions/adjustments_spec.rb +258 -0
  154. data/spec/features/admin/promotions/option_value_rule_spec.rb +70 -0
  155. data/spec/features/admin/promotions/tiered_calculator_spec.rb +70 -0
  156. data/spec/features/admin/refund_reasons/refund_reasons_spec.rb +57 -0
  157. data/spec/features/admin/reimbursement_type/edit_reimbursement_type_spec.rb +36 -0
  158. data/spec/features/admin/reimbursement_type/new_reimbursement_type_spec.rb +62 -0
  159. data/spec/features/admin/reports_spec.rb +61 -0
  160. data/spec/features/admin/return_authorization_reasons/return_authorization_reasons_spec.rb +63 -0
  161. data/spec/features/admin/returns/customer_returns_spec.rb +80 -0
  162. data/spec/features/admin/returns/return_authorizations_spec.rb +152 -0
  163. data/spec/features/admin/stock_transfer_spec.rb +91 -0
  164. data/spec/features/admin/store_credits_spec.rb +93 -0
  165. data/spec/features/admin/taxons_spec.rb +53 -0
  166. data/spec/features/admin/users_spec.rb +286 -0
  167. data/spec/helpers/admin/base_helper_spec.rb +30 -0
  168. data/spec/helpers/admin/navigation_helper_spec.rb +111 -0
  169. data/spec/helpers/admin/promotion_rules_helper_spec.rb +12 -0
  170. data/spec/helpers/admin/stock_movements_helper_spec.rb +30 -0
  171. data/spec/models/spree/resource_spec.rb +48 -0
  172. data/spec/routing/admin_path_spec.rb +22 -0
  173. data/spec/spec_helper.rb +144 -0
  174. data/spec/support/appear_before_matcher.rb +8 -0
  175. data/spec/support/ror_ringer.jpeg +0 -0
  176. data/spec/test_views/spree/admin/submodule/posts/edit.html.erb +1 -0
  177. data/spec/test_views/spree/admin/submodule/posts/new.html.erb +1 -0
  178. data/spec/test_views/spree/admin/widgets/edit.html.erb +1 -0
  179. data/spec/test_views/spree/admin/widgets/new.html.erb +1 -0
  180. data/spree_backend.gemspec +4 -4
  181. data/vendor/assets/javascripts/jquery.jstree/jquery.jstree.js +130 -154
  182. metadata +106 -29
  183. data/vendor/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  184. data/vendor/assets/images/jquery-ui/ui-bg_flat_0_eeeeee_40x100.png +0 -0
  185. data/vendor/assets/images/jquery-ui/ui-bg_flat_55_ffffff_40x100.png +0 -0
  186. data/vendor/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
  187. data/vendor/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  188. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_100_f6f6f6_1x100.png +0 -0
  189. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_25_0073ea_1x100.png +0 -0
  190. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_50_dddddd_1x100.png +0 -0
  191. data/vendor/assets/images/jquery-ui/ui-icons_0073ea_256x240.png +0 -0
  192. data/vendor/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
  193. data/vendor/assets/images/jquery-ui/ui-icons_666666_256x240.png +0 -0
  194. data/vendor/assets/images/jquery-ui/ui-icons_ff0084_256x240.png +0 -0
  195. data/vendor/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
  196. data/vendor/assets/stylesheets/jquery-ui.datepicker.css.erb +0 -357
@@ -13,7 +13,7 @@
13
13
  */
14
14
 
15
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, ActiveXObject: false */
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
17
 
18
18
  "use strict";
19
19
 
@@ -114,7 +114,7 @@
114
114
  if(isMethodCall) {
115
115
  if(settings.substring(0, 1) == '_') { return returnValue; }
116
116
  this.each(function() {
117
- var instance = instances[$.data(this, "jstree_instance_id")],
117
+ var instance = instances[$.data(this, "jstree-instance-id")],
118
118
  methodValue = (instance && $.isFunction(instance[settings])) ? instance[settings].apply(instance, args) : instance;
119
119
  if(typeof methodValue !== "undefined" && (settings.indexOf("is_") === 0 || (methodValue !== true && methodValue !== false))) { returnValue = methodValue; return false; }
120
120
  });
@@ -122,7 +122,7 @@
122
122
  else {
123
123
  this.each(function() {
124
124
  // extend settings and allow for multiple hashes and $.data
125
- var instance_id = $.data(this, "jstree_instance_id"),
125
+ var instance_id = $.data(this, "jstree-instance-id"),
126
126
  a = [],
127
127
  b = settings ? $.extend({}, true, settings) : {},
128
128
  c = $(this),
@@ -137,7 +137,7 @@
137
137
  // push a new empty object to the instances array
138
138
  instance_id = parseInt(instances.push({}),10) - 1;
139
139
  // store the jstree instance id to the container element
140
- $.data(this, "jstree_instance_id", instance_id);
140
+ $.data(this, "jstree-instance-id", instance_id);
141
141
  // clean up all plugins
142
142
  b.plugins = $.isArray(b.plugins) ? b.plugins : $.jstree.defaults.plugins.slice();
143
143
  b.plugins.unshift("core");
@@ -159,7 +159,7 @@
159
159
  $.each(instances[instance_id]._get_settings().plugins, function (i, val) { instances[instance_id].data[val] = {}; });
160
160
  $.each(instances[instance_id]._get_settings().plugins, function (i, val) { if(plugins[val]) { plugins[val].__init.apply(instances[instance_id]); } });
161
161
  // initialize the instance
162
- setTimeout(function() { if(instances[instance_id]) { instances[instance_id].init(); } }, 0);
162
+ setTimeout(function() { instances[instance_id].init(); }, 0);
163
163
  });
164
164
  }
165
165
  // return the jquery selection (or if it was a method call that returned a value - the returned value)
@@ -178,7 +178,7 @@
178
178
  var o = $(needle);
179
179
  if(!o.length && typeof needle === "string") { o = $("#" + needle); }
180
180
  if(!o.length) { return null; }
181
- return instances[o.closest(".jstree").data("jstree_instance_id")] || null;
181
+ return instances[o.closest(".jstree").data("jstree-instance-id")] || null;
182
182
  },
183
183
  _instance : function (index, container, settings) {
184
184
  // for plugins to store data in
@@ -356,8 +356,7 @@
356
356
  this.get_container()
357
357
  .delegate("li > ins", "click.jstree", $.proxy(function (event) {
358
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.toggle_node(trgt);
359
+ if(trgt.is("ins") && event.pageY - trgt.offset().top < this.data.core.li_height) { this.toggle_node(trgt); }
361
360
  }, this))
362
361
  .bind("mousedown.jstree", $.proxy(function () {
363
362
  this.set_focus(); // This used to be setTimeout(set_focus,0) - why?
@@ -434,9 +433,9 @@
434
433
  this.get_container()
435
434
  .unbind(".jstree")
436
435
  .undelegate(".jstree")
437
- .removeData("jstree_instance_id")
436
+ .removeData("jstree-instance-id")
438
437
  .find("[class^='jstree']")
439
- .addBack()
438
+ .andSelf()
440
439
  .attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); });
441
440
  $(document)
442
441
  .unbind(".jstree-" + n)
@@ -679,7 +678,7 @@
679
678
  }
680
679
  else {
681
680
  original_obj = obj;
682
- if(obj.is(".jstree-closed")) { obj = obj.find("li.jstree-closed").addBack(); }
681
+ if(obj.is(".jstree-closed")) { obj = obj.find("li.jstree-closed").andSelf(); }
683
682
  else { obj = obj.find("li.jstree-closed"); }
684
683
  }
685
684
  var _this = this;
@@ -695,12 +694,12 @@
695
694
  var _this = this;
696
695
  obj = obj ? this._get_node(obj) : this.get_container();
697
696
  if(!obj || obj === -1) { obj = this.get_container_ul(); }
698
- obj.find("li.jstree-open").addBack().each(function () { _this.close_node(this, !do_animation); });
697
+ obj.find("li.jstree-open").andSelf().each(function () { _this.close_node(this, !do_animation); });
699
698
  this.__callback({ "obj" : obj });
700
699
  },
701
700
  clean_node : function (obj) {
702
701
  obj = obj && obj != -1 ? $(obj) : this.get_container_ul();
703
- obj = obj.is("li") ? obj.find("li").addBack() : obj.find("li");
702
+ obj = obj.is("li") ? obj.find("li").andSelf() : obj.find("li");
704
703
  obj.removeClass("jstree-last")
705
704
  .filter("li:last-child").addClass("jstree-last").end()
706
705
  .filter(":has(li)")
@@ -753,7 +752,6 @@
753
752
  if(m.language) { tmp.addClass(m.language); }
754
753
  }
755
754
  tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");
756
- if(!m.icon && js.icon) { m.icon = js.icon; }
757
755
  if(m.icon) {
758
756
  if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }
759
757
  else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }
@@ -922,12 +920,10 @@
922
920
  check_move : function () {
923
921
  var obj = prepared_move, ret = true, r = obj.r === -1 ? this.get_container() : obj.r;
924
922
  if(!obj || !obj.o || obj.or[0] === obj.o[0]) { return false; }
925
- if(!obj.cy) {
926
- if(obj.op && obj.np && obj.op[0] === obj.np[0] && obj.cp - 1 === obj.o.index()) { return false; }
927
- obj.o.each(function () {
928
- if(r.parentsUntil(".jstree", "li").addBack().index(this) !== -1) { ret = false; return false; }
929
- });
930
- }
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
+ });
931
927
  return ret;
932
928
  },
933
929
  move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {
@@ -945,7 +941,7 @@
945
941
  var o = false;
946
942
  if(is_copy) {
947
943
  o = obj.o.clone(true);
948
- o.find("*[id]").addBack().each(function () {
944
+ o.find("*[id]").andSelf().each(function () {
949
945
  if(this.id) { this.id = "copy_" + this.id; }
950
946
  });
951
947
  }
@@ -1142,7 +1138,7 @@
1142
1138
  switch(!0) {
1143
1139
  case (is_range):
1144
1140
  this.data.ui.last_selected.addClass("jstree-last-selected");
1145
- obj = obj[ obj.index() < this.data.ui.last_selected.index() ? "nextUntil" : "prevUntil" ](".jstree-last-selected").addBack();
1141
+ obj = obj[ obj.index() < this.data.ui.last_selected.index() ? "nextUntil" : "prevUntil" ](".jstree-last-selected").andSelf();
1146
1142
  if(s.select_limit == -1 || obj.length < s.select_limit) {
1147
1143
  this.data.ui.last_selected.removeClass("jstree-last-selected");
1148
1144
  this.data.ui.selected.each(function () {
@@ -1246,7 +1242,7 @@
1246
1242
  .bind("move_node.jstree", $.proxy(function (e, data) {
1247
1243
  if(this._get_settings().crrm.move.open_onmove) {
1248
1244
  var t = this;
1249
- data.rslt.np.parentsUntil(".jstree").addBack().filter(".jstree-closed").each(function () {
1245
+ data.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function () {
1250
1246
  t.open_node(this, false, true);
1251
1247
  });
1252
1248
  }
@@ -1662,7 +1658,7 @@
1662
1658
  obj = this._get_node(obj);
1663
1659
  var s = this._get_settings().json_data;
1664
1660
  if(obj && obj !== -1 && s.progressive_unload && ($.isFunction(s.data) || !!s.ajax)) {
1665
- obj.removeData("jstree_children");
1661
+ obj.removeData("jstree-children");
1666
1662
  }
1667
1663
  return this.__call_old();
1668
1664
  },
@@ -1672,11 +1668,11 @@
1672
1668
  success_func = function () {};
1673
1669
  obj = this._get_node(obj);
1674
1670
 
1675
- 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")) {
1676
- d = this._parse_json(obj.data("jstree_children"), obj);
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);
1677
1673
  if(d) {
1678
1674
  obj.append(d);
1679
- if(!s.progressive_unload) { obj.removeData("jstree_children"); }
1675
+ if(!s.progressive_unload) { obj.removeData("jstree-children"); }
1680
1676
  }
1681
1677
  this.clean_node(obj);
1682
1678
  if(s_call) { s_call.call(this); }
@@ -1684,8 +1680,8 @@
1684
1680
  }
1685
1681
 
1686
1682
  if(obj && obj !== -1) {
1687
- if(obj.data("jstree_is_loading")) { return; }
1688
- else { obj.data("jstree_is_loading",true); }
1683
+ if(obj.data("jstree-is-loading")) { return; }
1684
+ else { obj.data("jstree-is-loading",true); }
1689
1685
  }
1690
1686
  switch(!0) {
1691
1687
  case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";
@@ -1699,14 +1695,14 @@
1699
1695
  }
1700
1696
  else {
1701
1697
  obj.children("a.jstree-loading").removeClass("jstree-loading");
1702
- obj.removeData("jstree_is_loading");
1698
+ obj.removeData("jstree-is-loading");
1703
1699
  if(s.correct_state) { this.correct_state(obj); }
1704
1700
  }
1705
1701
  if(e_call) { e_call.call(this); }
1706
1702
  }
1707
1703
  else {
1708
1704
  if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
1709
- else { obj.append(d).children("a.jstree-loading").removeClass("jstree-loading"); obj.removeData("jstree_is_loading"); }
1705
+ else { obj.append(d).children("a.jstree-loading").removeClass("jstree-loading"); obj.removeData("jstree-is-loading"); }
1710
1706
  this.clean_node(obj);
1711
1707
  if(s_call) { s_call.call(this); }
1712
1708
  }
@@ -1731,7 +1727,7 @@
1731
1727
  if(ef) { ef.call(this, x, t, e); }
1732
1728
  if(obj != -1 && obj.length) {
1733
1729
  obj.children("a.jstree-loading").removeClass("jstree-loading");
1734
- obj.removeData("jstree_is_loading");
1730
+ obj.removeData("jstree-is-loading");
1735
1731
  if(t === "success" && s.correct_state) { this.correct_state(obj); }
1736
1732
  }
1737
1733
  else {
@@ -1748,7 +1744,7 @@
1748
1744
  d = this._parse_json(d, obj);
1749
1745
  if(d) {
1750
1746
  if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
1751
- else { obj.append(d).children("a.jstree-loading").removeClass("jstree-loading"); obj.removeData("jstree_is_loading"); }
1747
+ else { obj.append(d).children("a.jstree-loading").removeClass("jstree-loading"); obj.removeData("jstree-is-loading"); }
1752
1748
  this.clean_node(obj);
1753
1749
  if(s_call) { s_call.call(this); }
1754
1750
  }
@@ -1761,7 +1757,7 @@
1761
1757
  }
1762
1758
  else {
1763
1759
  obj.children("a.jstree-loading").removeClass("jstree-loading");
1764
- obj.removeData("jstree_is_loading");
1760
+ obj.removeData("jstree-is-loading");
1765
1761
  if(s.correct_state) {
1766
1762
  this.correct_state(obj);
1767
1763
  if(s_call) { s_call.call(this); }
@@ -1788,16 +1784,14 @@
1788
1784
 
1789
1785
  if(!js) { return d; }
1790
1786
  if(s.progressive_unload && obj && obj !== -1) {
1791
- obj.data("jstree_children", d);
1787
+ obj.data("jstree-children", d);
1792
1788
  }
1793
1789
  if($.isArray(js)) {
1794
1790
  d = $('<ul>');
1795
1791
  if(!js.length) { return false; }
1796
1792
  for(i = 0, j = js.length; i < j; i++) {
1797
1793
  tmp = this._parse_json(js[i], obj, true);
1798
- if(tmp.length) {
1799
- d = d.append(tmp);
1800
- }
1794
+ if(tmp.length) { d = d.append(tmp); }
1801
1795
  }
1802
1796
  d = d.children();
1803
1797
  }
@@ -1830,10 +1824,10 @@
1830
1824
  d.prepend("<ins class='jstree-icon'>&#160;</ins>");
1831
1825
  if(js.children) {
1832
1826
  if(s.progressive_render && js.state !== "open") {
1833
- d.addClass("jstree-closed").data("jstree_children", js.children);
1827
+ d.addClass("jstree-closed").data("jstree-children", js.children);
1834
1828
  }
1835
1829
  else {
1836
- if(s.progressive_unload) { d.data("jstree_children", js.children); }
1830
+ if(s.progressive_unload) { d.data("jstree-children", js.children); }
1837
1831
  if($.isArray(js.children) && js.children.length) {
1838
1832
  tmp = this._parse_json(js.children, obj, true);
1839
1833
  if(tmp.length) {
@@ -1934,7 +1928,6 @@
1934
1928
  * This is useful for maintaining the same structure in many languages (hence the name of the plugin)
1935
1929
  */
1936
1930
  (function ($) {
1937
- var sh = false;
1938
1931
  $.jstree.plugin("languages", {
1939
1932
  __init : function () { this._load_css(); },
1940
1933
  defaults : [],
@@ -1949,9 +1942,9 @@
1949
1942
  else { return false; }
1950
1943
  }
1951
1944
  if(i == this.data.languages.current_language) { return true; }
1952
- st = $.vakata.css.get_css(selector + "." + this.data.languages.current_language, false, sh);
1945
+ st = $.vakata.css.get_css(selector + "." + this.data.languages.current_language, false, this.data.languages.language_css);
1953
1946
  if(st !== false) { st.style.display = "none"; }
1954
- st = $.vakata.css.get_css(selector + "." + i, false, sh);
1947
+ st = $.vakata.css.get_css(selector + "." + i, false, this.data.languages.language_css);
1955
1948
  if(st !== false) { st.style.display = ""; }
1956
1949
  this.data.languages.current_language = i;
1957
1950
  this.__callback(i);
@@ -2025,7 +2018,7 @@
2025
2018
  if(langs[ln] != this.data.languages.current_language) { str += " display:none; "; }
2026
2019
  str += " } ";
2027
2020
  }
2028
- sh = $.vakata.css.add_sheet({ 'str' : str, 'title' : "jstree-languages" });
2021
+ this.data.languages.language_css = $.vakata.css.add_sheet({ 'str' : str, 'title' : "jstree-languages" });
2029
2022
  }
2030
2023
  },
2031
2024
  create_node : function (obj, position, js, callback) {
@@ -2693,14 +2686,14 @@
2693
2686
  $(function() {
2694
2687
  var css_string = '' +
2695
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; ' +
2696
- ' -moz-border-radius:4px; border-radius:4px; -webkit-border-radius:4px; ' +
2689
+ ' border-radius:4px; -webkit-border-radius:4px; ' +
2697
2690
  '} ' +
2698
2691
  '#vakata-dragged .jstree-ok { background:green; } ' +
2699
2692
  '#vakata-dragged .jstree-invalid { background:red; } ' +
2700
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; } ' +
2701
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; ' +
2702
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; ' +
2703
- ' -moz-border-radius:1px; border-radius:1px; -webkit-border-radius:1px; ' +
2696
+ ' border-radius:1px; -webkit-border-radius:1px; ' +
2704
2697
  '}' +
2705
2698
  '';
2706
2699
  $.vakata.css.add_sheet({ str : css_string, title : "jstree" });
@@ -2807,7 +2800,7 @@
2807
2800
  obj.each(function () {
2808
2801
  t = $(this);
2809
2802
  c = t.is("li") && (t.hasClass("jstree-checked") || (rc && t.children(":checked").length)) ? "jstree-checked" : "jstree-unchecked";
2810
- t.find("li").addBack().each(function () {
2803
+ t.find("li").andSelf().each(function () {
2811
2804
  var $t = $(this), nm;
2812
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 );
2813
2806
  if(rc) {
@@ -2818,20 +2811,19 @@
2818
2811
  else {
2819
2812
  $t.children(":checkbox").addClass("jstree-real-checkbox");
2820
2813
  }
2821
- }
2822
- if(!ts) {
2823
- if(c === "jstree-checked" || $t.hasClass("jstree-checked") || $t.children(':checked').length) {
2824
- $t.find("li").addBack().addClass("jstree-checked").children(":checkbox").prop("checked", true);
2814
+ if(c === "jstree-checked") {
2815
+ $t.children(":checkbox").attr("checked","checked");
2825
2816
  }
2826
2817
  }
2827
- else {
2828
- if($t.hasClass("jstree-checked") || $t.children(':checked').length) {
2829
- $t.addClass("jstree-checked").children(":checkbox").prop("checked", true);
2830
- }
2818
+ if(c === "jstree-checked" && !ts) {
2819
+ $t.find("li").addClass("jstree-checked");
2831
2820
  }
2832
2821
  });
2833
2822
  });
2834
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); }); }
2835
2827
  obj.find(".jstree-checked").parent().parent().each(function () { _this._repair_state(this); });
2836
2828
  }
2837
2829
  },
@@ -2843,25 +2835,25 @@
2843
2835
  if(this._get_settings().checkbox.two_state) {
2844
2836
  if(state) {
2845
2837
  obj.removeClass("jstree-checked").addClass("jstree-unchecked");
2846
- if(rc) { obj.children(":checkbox").prop("checked", false); }
2838
+ if(rc) { obj.children(":checkbox").removeAttr("checked"); }
2847
2839
  }
2848
2840
  else {
2849
2841
  obj.removeClass("jstree-unchecked").addClass("jstree-checked");
2850
- if(rc) { obj.children(":checkbox").prop("checked", true); }
2842
+ if(rc) { obj.children(":checkbox").attr("checked","checked"); }
2851
2843
  }
2852
2844
  }
2853
2845
  else {
2854
2846
  if(state) {
2855
- coll = obj.find("li").addBack();
2847
+ coll = obj.find("li").andSelf();
2856
2848
  if(!coll.filter(".jstree-checked, .jstree-undetermined").length) { return false; }
2857
2849
  coll.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");
2858
- if(rc) { coll.children(":checkbox").prop("checked", false); }
2850
+ if(rc) { coll.children(":checkbox").removeAttr("checked"); }
2859
2851
  }
2860
2852
  else {
2861
- coll = obj.find("li").addBack();
2853
+ coll = obj.find("li").andSelf();
2862
2854
  if(!coll.filter(".jstree-unchecked, .jstree-undetermined").length) { return false; }
2863
2855
  coll.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");
2864
- if(rc) { coll.children(":checkbox").prop("checked", true); }
2856
+ if(rc) { coll.children(":checkbox").attr("checked","checked"); }
2865
2857
  if(this.data.ui) { this.data.ui.last_selected = obj; }
2866
2858
  this.data.checkbox.last_selected = obj;
2867
2859
  }
@@ -2869,24 +2861,24 @@
2869
2861
  var $this = $(this);
2870
2862
  if(state) {
2871
2863
  if($this.children("ul").children("li.jstree-checked, li.jstree-undetermined").length) {
2872
- $this.parentsUntil(".jstree", "li").addBack().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2873
- if(rc) { $this.parentsUntil(".jstree", "li").addBack().children(":checkbox").prop("checked", false); }
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"); }
2874
2866
  return false;
2875
2867
  }
2876
2868
  else {
2877
2869
  $this.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");
2878
- if(rc) { $this.children(":checkbox").prop("checked", false); }
2870
+ if(rc) { $this.children(":checkbox").removeAttr("checked"); }
2879
2871
  }
2880
2872
  }
2881
2873
  else {
2882
2874
  if($this.children("ul").children("li.jstree-unchecked, li.jstree-undetermined").length) {
2883
- $this.parentsUntil(".jstree", "li").addBack().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2884
- if(rc) { $this.parentsUntil(".jstree", "li").addBack().children(":checkbox").prop("checked", false); }
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"); }
2885
2877
  return false;
2886
2878
  }
2887
2879
  else {
2888
2880
  $this.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");
2889
- if(rc) { $this.children(":checkbox").prop("checked", true); }
2881
+ if(rc) { $this.children(":checkbox").attr("checked","checked"); }
2890
2882
  }
2891
2883
  }
2892
2884
  });
@@ -2944,10 +2936,6 @@
2944
2936
  _repair_state : function (obj) {
2945
2937
  obj = this._get_node(obj);
2946
2938
  if(!obj.length) { return; }
2947
- if(this._get_settings().checkbox.two_state) {
2948
- obj.find('li').addBack().not('.jstree-checked').removeClass('jstree-undetermined').addClass('jstree-unchecked').children(':checkbox').prop('checked', true);
2949
- return;
2950
- }
2951
2939
  var rc = this._get_settings().checkbox.real_checkboxes,
2952
2940
  a = obj.find("> ul > .jstree-checked").length,
2953
2941
  b = obj.find("> ul > .jstree-undetermined").length,
@@ -2956,8 +2944,8 @@
2956
2944
  else if(a === 0 && b === 0) { this.change_state(obj, true); }
2957
2945
  else if(a === c) { this.change_state(obj, false); }
2958
2946
  else {
2959
- obj.parentsUntil(".jstree","li").addBack().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2960
- if(rc) { obj.parentsUntil(".jstree", "li").addBack().children(":checkbox").prop("checked", false); }
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"); }
2961
2949
  }
2962
2950
  },
2963
2951
  reselect : function () {
@@ -2995,37 +2983,49 @@
2995
2983
  */
2996
2984
  (function ($) {
2997
2985
  $.vakata.xslt = function (xml, xsl, callback) {
2998
- var r = false, p, q, s;
2999
- // IE9
3000
- if(r === false && (window.ActiveXObject || "ActiveXObject" in window)) {
3001
- try {
3002
- r = new ActiveXObject("Msxml2.XSLTemplate");
3003
- q = new ActiveXObject("Msxml2.DOMDocument");
3004
- q.loadXML(xml);
3005
- s = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");
3006
- s.loadXML(xsl);
3007
- r.stylesheet = s;
3008
- p = r.createProcessor();
3009
- p.input = q;
3010
- p.transform();
3011
- r = p.output;
3012
- }
3013
- catch (e) { }
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;
3014
3001
  }
3015
- xml = $.parseXML(xml);
3016
- xsl = $.parseXML(xsl);
3017
- // FF, Chrome
3018
- if(r === false && typeof (XSLTProcessor) !== "undefined") {
3019
- p = new XSLTProcessor();
3020
- p.importStylesheet(xsl);
3021
- r = p.transformToFragment(xml, document);
3022
- r = $('<div />').append(r).html();
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
+
3023
3008
  }
3024
- // OLD IE
3025
- if(r === false && typeof (xml.transformNode) !== "undefined") {
3026
- r = xml.transformNode(xsl);
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
3027
  }
3028
- callback.call(null, r);
3028
+ return false;
3029
3029
  };
3030
3030
  var xsl = {
3031
3031
  'nest' : '<' + '?xml version="1.0" encoding="utf-8" ?>' +
@@ -3194,8 +3194,8 @@
3194
3194
 
3195
3195
  obj = this._get_node(obj);
3196
3196
  if(obj && obj !== -1) {
3197
- if(obj.data("jstree_is_loading")) { return; }
3198
- else { obj.data("jstree_is_loading",true); }
3197
+ if(obj.data("jstree-is-loading")) { return; }
3198
+ else { obj.data("jstree-is-loading",true); }
3199
3199
  }
3200
3200
  switch(!0) {
3201
3201
  case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";
@@ -3207,14 +3207,14 @@
3207
3207
  if(d.length > 10) {
3208
3208
  d = $(d);
3209
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"); }
3210
+ else { obj.children("a.jstree-loading").removeClass("jstree-loading"); obj.append(d); obj.removeData("jstree-is-loading"); }
3211
3211
  if(s.clean_node) { this.clean_node(obj); }
3212
3212
  if(s_call) { s_call.call(this); }
3213
3213
  }
3214
3214
  else {
3215
3215
  if(obj && obj !== -1) {
3216
3216
  obj.children("a.jstree-loading").removeClass("jstree-loading");
3217
- obj.removeData("jstree_is_loading");
3217
+ obj.removeData("jstree-is-loading");
3218
3218
  if(s.correct_state) {
3219
3219
  this.correct_state(obj);
3220
3220
  if(s_call) { s_call.call(this); }
@@ -3258,7 +3258,7 @@
3258
3258
  if(ef) { ef.call(this, x, t, e); }
3259
3259
  if(obj !== -1 && obj.length) {
3260
3260
  obj.children("a.jstree-loading").removeClass("jstree-loading");
3261
- obj.removeData("jstree_is_loading");
3261
+ obj.removeData("jstree-is-loading");
3262
3262
  if(t === "success" && s.correct_state) { this.correct_state(obj); }
3263
3263
  }
3264
3264
  else {
@@ -3279,14 +3279,14 @@
3279
3279
  if(d.length > 10) {
3280
3280
  d = $(d);
3281
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"); }
3282
+ else { obj.children("a.jstree-loading").removeClass("jstree-loading"); obj.append(d); obj.removeData("jstree-is-loading"); }
3283
3283
  if(s.clean_node) { this.clean_node(obj); }
3284
3284
  if(s_call) { s_call.call(this); }
3285
3285
  }
3286
3286
  else {
3287
3287
  if(obj && obj !== -1) {
3288
3288
  obj.children("a.jstree-loading").removeClass("jstree-loading");
3289
- obj.removeData("jstree_is_loading");
3289
+ obj.removeData("jstree-is-loading");
3290
3290
  if(s.correct_state) {
3291
3291
  this.correct_state(obj);
3292
3292
  if(s_call) { s_call.call(this); }
@@ -3401,26 +3401,12 @@
3401
3401
  * DOES NOT WORK WITH JSON PROGRESSIVE RENDER
3402
3402
  */
3403
3403
  (function ($) {
3404
- if($().jquery.split('.')[1] >= 8) {
3405
- $.expr[':'].jstree_contains = $.expr.createPseudo(function(search) {
3406
- return function(a) {
3407
- return (a.textContent || a.innerText || "").toLowerCase().indexOf(search.toLowerCase())>=0;
3408
- };
3409
- });
3410
- $.expr[':'].jstree_title_contains = $.expr.createPseudo(function(search) {
3411
- return function(a) {
3412
- return (a.getAttribute("title") || "").toLowerCase().indexOf(search.toLowerCase())>=0;
3413
- };
3414
- });
3415
- }
3416
- else {
3417
- $.expr[':'].jstree_contains = function(a,i,m){
3418
- return (a.textContent || a.innerText || "").toLowerCase().indexOf(m[3].toLowerCase())>=0;
3419
- };
3420
- $.expr[':'].jstree_title_contains = function(a,i,m) {
3421
- return (a.getAttribute("title") || "").toLowerCase().indexOf(m[3].toLowerCase())>=0;
3422
- };
3423
- }
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
+ };
3424
3410
  $.jstree.plugin("search", {
3425
3411
  __init : function () {
3426
3412
  this.data.search.str = "";
@@ -3429,7 +3415,7 @@
3429
3415
  this.get_container()
3430
3416
  .bind("search.jstree", function (e, data) {
3431
3417
  $(this).children("ul").find("li").hide().removeClass("jstree-last");
3432
- data.rslt.nodes.parentsUntil(".jstree").addBack().show()
3418
+ data.rslt.nodes.parentsUntil(".jstree").andSelf().show()
3433
3419
  .filter("ul").each(function () { $(this).children("li:visible").eq(-1).addClass("jstree-last"); });
3434
3420
  })
3435
3421
  .bind("clear_search.jstree", function () {
@@ -3700,11 +3686,6 @@
3700
3686
  this.show_contextmenu(e.currentTarget, e.pageX, e.pageY);
3701
3687
  }
3702
3688
  }, this))
3703
- .delegate("a", "click.jstree", $.proxy(function (e) {
3704
- if(this.data.contextmenu) {
3705
- $.vakata.context.hide();
3706
- }
3707
- }, this))
3708
3689
  .bind("destroy.jstree", $.proxy(function () {
3709
3690
  // TODO: move this to descruct method
3710
3691
  if(this.data.contextmenu) {
@@ -4015,7 +3996,7 @@
4015
3996
  // this used to use html() and clean the whitespace, but this way any attached data was lost
4016
3997
  this.data.html_data.original_container_html = this.get_container().find(" > ul > li").clone(true);
4017
3998
  // remove white space from LI node - otherwise nodes appear a bit to the right
4018
- this.data.html_data.original_container_html.find("li").addBack().contents().filter(function() { return this.nodeType == 3; }).remove();
3999
+ this.data.html_data.original_container_html.find("li").andSelf().contents().filter(function() { return this.nodeType == 3; }).remove();
4019
4000
  },
4020
4001
  defaults : {
4021
4002
  data : false,
@@ -4035,8 +4016,8 @@
4035
4016
  success_func = function () {};
4036
4017
  obj = this._get_node(obj);
4037
4018
  if(obj && obj !== -1) {
4038
- if(obj.data("jstree_is_loading")) { return; }
4039
- else { obj.data("jstree_is_loading",true); }
4019
+ if(obj.data("jstree-is-loading")) { return; }
4020
+ else { obj.data("jstree-is-loading",true); }
4040
4021
  }
4041
4022
  switch(!0) {
4042
4023
  case ($.isFunction(s.data)):
@@ -4045,14 +4026,14 @@
4045
4026
  d = $(d);
4046
4027
  if(!d.is("ul")) { d = $("<ul />").append(d); }
4047
4028
  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"); }
4048
- 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"); }
4029
+ 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"); }
4049
4030
  this.clean_node(obj);
4050
4031
  if(s_call) { s_call.call(this); }
4051
4032
  }
4052
4033
  else {
4053
4034
  if(obj && obj !== -1) {
4054
4035
  obj.children("a.jstree-loading").removeClass("jstree-loading");
4055
- obj.removeData("jstree_is_loading");
4036
+ obj.removeData("jstree-is-loading");
4056
4037
  if(s.correct_state) {
4057
4038
  this.correct_state(obj);
4058
4039
  if(s_call) { s_call.call(this); }
@@ -4097,7 +4078,7 @@
4097
4078
  if(ef) { ef.call(this, x, t, e); }
4098
4079
  if(obj != -1 && obj.length) {
4099
4080
  obj.children("a.jstree-loading").removeClass("jstree-loading");
4100
- obj.removeData("jstree_is_loading");
4081
+ obj.removeData("jstree-is-loading");
4101
4082
  if(t === "success" && s.correct_state) { this.correct_state(obj); }
4102
4083
  }
4103
4084
  else {
@@ -4115,14 +4096,14 @@
4115
4096
  d = $(d);
4116
4097
  if(!d.is("ul")) { d = $("<ul />").append(d); }
4117
4098
  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"); }
4118
- 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"); }
4099
+ 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"); }
4119
4100
  this.clean_node(obj);
4120
4101
  if(s_call) { s_call.call(this); }
4121
4102
  }
4122
4103
  else {
4123
4104
  if(obj && obj !== -1) {
4124
4105
  obj.children("a.jstree-loading").removeClass("jstree-loading");
4125
- obj.removeData("jstree_is_loading");
4106
+ obj.removeData("jstree-is-loading");
4126
4107
  if(s.correct_state) {
4127
4108
  this.correct_state(obj);
4128
4109
  if(s_call) { s_call.call(this); }
@@ -4233,8 +4214,7 @@
4233
4214
  _fn : {
4234
4215
  _themeroller : function (obj) {
4235
4216
  var s = this._get_settings().themeroller;
4236
- obj = (!obj || obj == -1) ? this.get_container_ul() : this._get_node(obj);
4237
- obj = (!obj || obj == -1) ? this.get_container_ul() : obj.parent();
4217
+ obj = !obj || obj == -1 ? this.get_container_ul() : this._get_node(obj).parent();
4238
4218
  obj
4239
4219
  .find("li.jstree-closed")
4240
4220
  .children("ins.jstree-icon").removeClass(s.opened).addClass("ui-icon " + s.closed).end()
@@ -4347,19 +4327,15 @@
4347
4327
  },
4348
4328
  _fn : {
4349
4329
  _check_unique : function (nms, p, func) {
4350
- var cnms = [], ok = true;
4330
+ var cnms = [];
4351
4331
  p.children("a").each(function () { cnms.push($(this).text().replace(/^\s+/g,"")); });
4352
4332
  if(!cnms.length || !nms.length) { return true; }
4353
- $.each(nms, function (i, v) {
4354
- if($.inArray(v, cnms) !== -1) {
4355
- ok = false;
4356
- return false;
4357
- }
4358
- });
4359
- if(!ok) {
4333
+ cnms = cnms.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");
4334
+ if((cnms.length + nms.length) != cnms.concat(nms).sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",").length) {
4360
4335
  this._get_settings().unique.error_callback.call(null, nms, p, func);
4336
+ return false;
4361
4337
  }
4362
- return ok;
4338
+ return true;
4363
4339
  },
4364
4340
  check_move : function () {
4365
4341
  if(!this.__call_old()) { return false; }
@@ -4446,7 +4422,7 @@
4446
4422
  obj = !obj || obj == -1 ? this.get_container().find("> ul > li") : this._get_node(obj);
4447
4423
  if(obj === false) { return; } // added for removing root nodes
4448
4424
  obj.each(function () {
4449
- $(this).find("li").addBack().each(function () {
4425
+ $(this).find("li").andSelf().each(function () {
4450
4426
  var $t = $(this);
4451
4427
  if($t.children(".jstree-wholerow-span").length) { return true; }
4452
4428
  $t.prepend("<span class='jstree-wholerow-span' style='width:" + ($t.parentsUntil(".jstree","li").length * 18) + "px;'>&#160;</span>");