gnuside-aloha-rails 0.23.3

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