sunspot_solr 2.2.0 → 2.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (508) hide show
  1. checksums.yaml +7 -0
  2. data/bin/sunspot-solr +2 -10
  3. data/lib/sunspot/solr/installer/config_installer.rb +55 -21
  4. data/lib/sunspot/solr/installer.rb +1 -1
  5. data/lib/sunspot/solr/java.rb +1 -1
  6. data/lib/sunspot/solr/server.rb +23 -24
  7. data/solr/.gitignore +2 -0
  8. data/solr/README.txt +181 -42
  9. data/solr/bin/init.d/solr +78 -0
  10. data/solr/bin/install_solr_service.sh +270 -0
  11. data/solr/bin/oom_solr.sh +30 -0
  12. data/solr/bin/post +228 -0
  13. data/solr/bin/solr +1350 -0
  14. data/solr/bin/solr.cmd +1230 -0
  15. data/solr/bin/solr.in.cmd +97 -0
  16. data/solr/bin/solr.in.sh +117 -0
  17. data/solr/server/README.txt +110 -0
  18. data/solr/server/contexts/solr-jetty-context.xml +8 -0
  19. data/solr/server/etc/jetty-http.xml +47 -0
  20. data/solr/{etc/jetty.xml → server/etc/jetty-https-ssl.xml} +175 -167
  21. data/solr/server/etc/jetty-https.xml +53 -0
  22. data/solr/server/etc/jetty-ssl.xml +46 -0
  23. data/solr/server/etc/jetty.xml +189 -0
  24. data/solr/{etc → server/etc}/webdefault.xml +527 -527
  25. data/solr/server/lib/ext/jcl-over-slf4j-1.7.7.jar +0 -0
  26. data/solr/server/lib/ext/jul-to-slf4j-1.7.7.jar +0 -0
  27. data/solr/server/lib/ext/log4j-1.2.17.jar +0 -0
  28. data/solr/server/lib/ext/slf4j-api-1.7.7.jar +0 -0
  29. data/solr/server/lib/ext/slf4j-log4j12-1.7.7.jar +0 -0
  30. data/solr/server/lib/javax.servlet-api-3.1.0.jar +0 -0
  31. data/solr/server/lib/jetty-continuation-9.2.11.v20150529.jar +0 -0
  32. data/solr/server/lib/jetty-deploy-9.2.11.v20150529.jar +0 -0
  33. data/solr/server/lib/jetty-http-9.2.11.v20150529.jar +0 -0
  34. data/solr/server/lib/jetty-io-9.2.11.v20150529.jar +0 -0
  35. data/solr/server/lib/jetty-jmx-9.2.11.v20150529.jar +0 -0
  36. data/solr/server/lib/jetty-rewrite-9.2.11.v20150529.jar +0 -0
  37. data/solr/server/lib/jetty-security-9.2.11.v20150529.jar +0 -0
  38. data/solr/server/lib/jetty-server-9.2.11.v20150529.jar +0 -0
  39. data/solr/server/lib/jetty-servlet-9.2.11.v20150529.jar +0 -0
  40. data/solr/server/lib/jetty-servlets-9.2.11.v20150529.jar +0 -0
  41. data/solr/server/lib/jetty-util-9.2.11.v20150529.jar +0 -0
  42. data/solr/server/lib/jetty-webapp-9.2.11.v20150529.jar +0 -0
  43. data/solr/server/lib/jetty-xml-9.2.11.v20150529.jar +0 -0
  44. data/solr/server/modules/http.mod +9 -0
  45. data/solr/server/modules/https.mod +9 -0
  46. data/solr/server/modules/server.mod +11 -0
  47. data/solr/server/modules/ssl.mod +9 -0
  48. data/solr/server/resources/jetty-logging.properties +1 -0
  49. data/solr/server/resources/log4j.properties +24 -0
  50. data/solr/server/solr/README.txt +77 -0
  51. data/solr/server/solr/solr.xml +51 -0
  52. data/solr/server/solr/zoo.cfg +17 -0
  53. data/solr/server/solr-webapp/webapp/WEB-INF/lib/antlr-runtime-3.5.jar +0 -0
  54. data/solr/server/solr-webapp/webapp/WEB-INF/lib/asm-4.1.jar +0 -0
  55. data/solr/server/solr-webapp/webapp/WEB-INF/lib/asm-commons-4.1.jar +0 -0
  56. data/solr/server/solr-webapp/webapp/WEB-INF/lib/commons-cli-1.2.jar +0 -0
  57. data/solr/server/solr-webapp/webapp/WEB-INF/lib/commons-codec-1.10.jar +0 -0
  58. data/solr/server/solr-webapp/webapp/WEB-INF/lib/commons-collections-3.2.1.jar +0 -0
  59. data/solr/server/solr-webapp/webapp/WEB-INF/lib/commons-configuration-1.6.jar +0 -0
  60. data/solr/server/solr-webapp/webapp/WEB-INF/lib/commons-exec-1.3.jar +0 -0
  61. data/solr/server/solr-webapp/webapp/WEB-INF/lib/commons-fileupload-1.2.1.jar +0 -0
  62. data/solr/server/solr-webapp/webapp/WEB-INF/lib/commons-io-2.4.jar +0 -0
  63. data/solr/server/solr-webapp/webapp/WEB-INF/lib/commons-lang-2.6.jar +0 -0
  64. data/solr/server/solr-webapp/webapp/WEB-INF/lib/concurrentlinkedhashmap-lru-1.2.jar +0 -0
  65. data/solr/server/solr-webapp/webapp/WEB-INF/lib/dom4j-1.6.1.jar +0 -0
  66. data/solr/server/solr-webapp/webapp/WEB-INF/lib/guava-14.0.1.jar +0 -0
  67. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-annotations-2.6.0.jar +0 -0
  68. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-auth-2.6.0.jar +0 -0
  69. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-common-2.6.0.jar +0 -0
  70. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-hdfs-2.6.0.jar +0 -0
  71. data/solr/server/solr-webapp/webapp/WEB-INF/lib/hppc-0.5.2.jar +0 -0
  72. data/solr/server/solr-webapp/webapp/WEB-INF/lib/htrace-core-3.0.4.jar +0 -0
  73. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpclient-4.4.1.jar +0 -0
  74. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpcore-4.4.1.jar +0 -0
  75. data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpmime-4.4.1.jar +0 -0
  76. data/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-core-2.5.4.jar +0 -0
  77. data/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-dataformat-smile-2.5.4.jar +0 -0
  78. data/solr/server/solr-webapp/webapp/WEB-INF/lib/joda-time-2.2.jar +0 -0
  79. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-analyzers-common-5.3.1.jar +0 -0
  80. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-analyzers-kuromoji-5.3.1.jar +0 -0
  81. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-analyzers-phonetic-5.3.1.jar +0 -0
  82. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-backward-codecs-5.3.1.jar +0 -0
  83. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-codecs-5.3.1.jar +0 -0
  84. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-core-5.3.1.jar +0 -0
  85. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-expressions-5.3.1.jar +0 -0
  86. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-grouping-5.3.1.jar +0 -0
  87. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-highlighter-5.3.1.jar +0 -0
  88. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-join-5.3.1.jar +0 -0
  89. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-memory-5.3.1.jar +0 -0
  90. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-misc-5.3.1.jar +0 -0
  91. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-queries-5.3.1.jar +0 -0
  92. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-queryparser-5.3.1.jar +0 -0
  93. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-sandbox-5.3.1.jar +0 -0
  94. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-spatial-5.3.1.jar +0 -0
  95. data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-suggest-5.3.1.jar +0 -0
  96. data/solr/server/solr-webapp/webapp/WEB-INF/lib/noggit-0.6.jar +0 -0
  97. data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet-2.3.0.jar +0 -0
  98. data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet.ext.servlet-2.3.0.jar +0 -0
  99. data/solr/server/solr-webapp/webapp/WEB-INF/lib/protobuf-java-2.5.0.jar +0 -0
  100. data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-core-5.3.1.jar +0 -0
  101. data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-solrj-5.3.1.jar +0 -0
  102. data/solr/server/solr-webapp/webapp/WEB-INF/lib/spatial4j-0.4.1.jar +0 -0
  103. data/solr/server/solr-webapp/webapp/WEB-INF/lib/stax2-api-3.1.4.jar +0 -0
  104. data/solr/server/solr-webapp/webapp/WEB-INF/lib/t-digest-3.1.jar +0 -0
  105. data/solr/server/solr-webapp/webapp/WEB-INF/lib/woodstox-core-asl-4.4.1.jar +0 -0
  106. data/solr/server/solr-webapp/webapp/WEB-INF/lib/zookeeper-3.4.6.jar +0 -0
  107. data/solr/server/solr-webapp/webapp/WEB-INF/web.xml +169 -0
  108. data/solr/server/solr-webapp/webapp/WEB-INF/weblogic.xml +28 -0
  109. data/solr/server/solr-webapp/webapp/admin.html +164 -0
  110. data/solr/server/solr-webapp/webapp/css/angular/analysis.css +304 -0
  111. data/solr/server/solr-webapp/webapp/css/angular/chosen.css +465 -0
  112. data/solr/server/solr-webapp/webapp/css/angular/cloud.css +398 -0
  113. data/solr/server/solr-webapp/webapp/css/angular/common.css +724 -0
  114. data/solr/server/solr-webapp/webapp/css/angular/cores.css +233 -0
  115. data/solr/server/solr-webapp/webapp/css/angular/dataimport.css +370 -0
  116. data/solr/server/solr-webapp/webapp/css/angular/documents.css +179 -0
  117. data/solr/server/solr-webapp/webapp/css/angular/files.css +53 -0
  118. data/solr/server/solr-webapp/webapp/css/angular/index.css +206 -0
  119. data/solr/server/solr-webapp/webapp/css/angular/logging.css +376 -0
  120. data/solr/server/solr-webapp/webapp/css/angular/menu.css +321 -0
  121. data/solr/server/solr-webapp/webapp/css/angular/plugins.css +212 -0
  122. data/solr/server/solr-webapp/webapp/css/angular/query.css +162 -0
  123. data/solr/server/solr-webapp/webapp/css/angular/replication.css +500 -0
  124. data/solr/server/solr-webapp/webapp/css/angular/schema-browser.css +567 -0
  125. data/solr/server/solr-webapp/webapp/css/angular/segments.css +173 -0
  126. data/solr/server/solr-webapp/webapp/css/angular/threads.css +161 -0
  127. data/solr/server/solr-webapp/webapp/css/chosen.css +421 -0
  128. data/solr/server/solr-webapp/webapp/css/styles/analysis.css +311 -0
  129. data/solr/server/solr-webapp/webapp/css/styles/cloud.css +410 -0
  130. data/solr/server/solr-webapp/webapp/css/styles/common.css +701 -0
  131. data/solr/server/solr-webapp/webapp/css/styles/cores.css +244 -0
  132. data/solr/server/solr-webapp/webapp/css/styles/dashboard.css +155 -0
  133. data/solr/server/solr-webapp/webapp/css/styles/dataimport.css +403 -0
  134. data/solr/server/solr-webapp/webapp/css/styles/documents.css +197 -0
  135. data/solr/server/solr-webapp/webapp/css/styles/files.css +54 -0
  136. data/solr/server/solr-webapp/webapp/css/styles/index.css +207 -0
  137. data/solr/server/solr-webapp/webapp/css/styles/java-properties.css +52 -0
  138. data/solr/server/solr-webapp/webapp/css/styles/logging.css +391 -0
  139. data/solr/server/solr-webapp/webapp/css/styles/menu.css +329 -0
  140. data/solr/server/solr-webapp/webapp/css/styles/plugins.css +195 -0
  141. data/solr/server/solr-webapp/webapp/css/styles/query.css +173 -0
  142. data/solr/server/solr-webapp/webapp/css/styles/replication.css +515 -0
  143. data/solr/server/solr-webapp/webapp/css/styles/schema-browser.css +578 -0
  144. data/solr/server/solr-webapp/webapp/css/styles/segments.css +145 -0
  145. data/solr/server/solr-webapp/webapp/css/styles/threads.css +172 -0
  146. data/solr/server/solr-webapp/webapp/favicon.ico +0 -0
  147. data/solr/server/solr-webapp/webapp/img/ZeroClipboard.swf +0 -0
  148. data/solr/server/solr-webapp/webapp/img/chosen-sprite-2x.png +0 -0
  149. data/solr/server/solr-webapp/webapp/img/chosen-sprite.png +0 -0
  150. data/solr/server/solr-webapp/webapp/img/div.gif +0 -0
  151. data/solr/server/solr-webapp/webapp/img/favicon.ico +0 -0
  152. data/solr/server/solr-webapp/webapp/img/filetypes/7z.png +0 -0
  153. data/solr/server/solr-webapp/webapp/img/filetypes/README +27 -0
  154. data/solr/server/solr-webapp/webapp/img/filetypes/ai.png +0 -0
  155. data/solr/server/solr-webapp/webapp/img/filetypes/aiff.png +0 -0
  156. data/solr/server/solr-webapp/webapp/img/filetypes/asc.png +0 -0
  157. data/solr/server/solr-webapp/webapp/img/filetypes/audio.png +0 -0
  158. data/solr/server/solr-webapp/webapp/img/filetypes/bin.png +0 -0
  159. data/solr/server/solr-webapp/webapp/img/filetypes/bz2.png +0 -0
  160. data/solr/server/solr-webapp/webapp/img/filetypes/c.png +0 -0
  161. data/solr/server/solr-webapp/webapp/img/filetypes/cfc.png +0 -0
  162. data/solr/server/solr-webapp/webapp/img/filetypes/cfm.png +0 -0
  163. data/solr/server/solr-webapp/webapp/img/filetypes/chm.png +0 -0
  164. data/solr/server/solr-webapp/webapp/img/filetypes/class.png +0 -0
  165. data/solr/server/solr-webapp/webapp/img/filetypes/conf.png +0 -0
  166. data/solr/server/solr-webapp/webapp/img/filetypes/cpp.png +0 -0
  167. data/solr/server/solr-webapp/webapp/img/filetypes/cs.png +0 -0
  168. data/solr/server/solr-webapp/webapp/img/filetypes/css.png +0 -0
  169. data/solr/server/solr-webapp/webapp/img/filetypes/csv.png +0 -0
  170. data/solr/server/solr-webapp/webapp/img/filetypes/deb.png +0 -0
  171. data/solr/server/solr-webapp/webapp/img/filetypes/divx.png +0 -0
  172. data/solr/server/solr-webapp/webapp/img/filetypes/doc.png +0 -0
  173. data/solr/server/solr-webapp/webapp/img/filetypes/dot.png +0 -0
  174. data/solr/server/solr-webapp/webapp/img/filetypes/eml.png +0 -0
  175. data/solr/server/solr-webapp/webapp/img/filetypes/enc.png +0 -0
  176. data/solr/server/solr-webapp/webapp/img/filetypes/file.png +0 -0
  177. data/solr/server/solr-webapp/webapp/img/filetypes/gif.png +0 -0
  178. data/solr/server/solr-webapp/webapp/img/filetypes/gz.png +0 -0
  179. data/solr/server/solr-webapp/webapp/img/filetypes/hlp.png +0 -0
  180. data/solr/server/solr-webapp/webapp/img/filetypes/htm.png +0 -0
  181. data/solr/server/solr-webapp/webapp/img/filetypes/html.png +0 -0
  182. data/solr/server/solr-webapp/webapp/img/filetypes/image.png +0 -0
  183. data/solr/server/solr-webapp/webapp/img/filetypes/iso.png +0 -0
  184. data/solr/server/solr-webapp/webapp/img/filetypes/jar.png +0 -0
  185. data/solr/server/solr-webapp/webapp/img/filetypes/java.png +0 -0
  186. data/solr/server/solr-webapp/webapp/img/filetypes/jpeg.png +0 -0
  187. data/solr/server/solr-webapp/webapp/img/filetypes/jpg.png +0 -0
  188. data/solr/server/solr-webapp/webapp/img/filetypes/js.png +0 -0
  189. data/solr/server/solr-webapp/webapp/img/filetypes/lua.png +0 -0
  190. data/solr/server/solr-webapp/webapp/img/filetypes/m.png +0 -0
  191. data/solr/server/solr-webapp/webapp/img/filetypes/mm.png +0 -0
  192. data/solr/server/solr-webapp/webapp/img/filetypes/mov.png +0 -0
  193. data/solr/server/solr-webapp/webapp/img/filetypes/mp3.png +0 -0
  194. data/solr/server/solr-webapp/webapp/img/filetypes/mpg.png +0 -0
  195. data/solr/server/solr-webapp/webapp/img/filetypes/odc.png +0 -0
  196. data/solr/server/solr-webapp/webapp/img/filetypes/odf.png +0 -0
  197. data/solr/server/solr-webapp/webapp/img/filetypes/odg.png +0 -0
  198. data/solr/server/solr-webapp/webapp/img/filetypes/odi.png +0 -0
  199. data/solr/server/solr-webapp/webapp/img/filetypes/odp.png +0 -0
  200. data/solr/server/solr-webapp/webapp/img/filetypes/ods.png +0 -0
  201. data/solr/server/solr-webapp/webapp/img/filetypes/odt.png +0 -0
  202. data/solr/server/solr-webapp/webapp/img/filetypes/ogg.png +0 -0
  203. data/solr/server/solr-webapp/webapp/img/filetypes/pdf.png +0 -0
  204. data/solr/server/solr-webapp/webapp/img/filetypes/pgp.png +0 -0
  205. data/solr/server/solr-webapp/webapp/img/filetypes/php.png +0 -0
  206. data/solr/server/solr-webapp/webapp/img/filetypes/pl.png +0 -0
  207. data/solr/server/solr-webapp/webapp/img/filetypes/png.png +0 -0
  208. data/solr/server/solr-webapp/webapp/img/filetypes/ppt.png +0 -0
  209. data/solr/server/solr-webapp/webapp/img/filetypes/ps.png +0 -0
  210. data/solr/server/solr-webapp/webapp/img/filetypes/py.png +0 -0
  211. data/solr/server/solr-webapp/webapp/img/filetypes/ram.png +0 -0
  212. data/solr/server/solr-webapp/webapp/img/filetypes/rar.png +0 -0
  213. data/solr/server/solr-webapp/webapp/img/filetypes/rb.png +0 -0
  214. data/solr/server/solr-webapp/webapp/img/filetypes/rm.png +0 -0
  215. data/solr/server/solr-webapp/webapp/img/filetypes/rpm.png +0 -0
  216. data/solr/server/solr-webapp/webapp/img/filetypes/rtf.png +0 -0
  217. data/solr/server/solr-webapp/webapp/img/filetypes/sig.png +0 -0
  218. data/solr/server/solr-webapp/webapp/img/filetypes/sql.png +0 -0
  219. data/solr/server/solr-webapp/webapp/img/filetypes/swf.png +0 -0
  220. data/solr/server/solr-webapp/webapp/img/filetypes/sxc.png +0 -0
  221. data/solr/server/solr-webapp/webapp/img/filetypes/sxd.png +0 -0
  222. data/solr/server/solr-webapp/webapp/img/filetypes/sxi.png +0 -0
  223. data/solr/server/solr-webapp/webapp/img/filetypes/sxw.png +0 -0
  224. data/solr/server/solr-webapp/webapp/img/filetypes/tar.png +0 -0
  225. data/solr/server/solr-webapp/webapp/img/filetypes/tex.png +0 -0
  226. data/solr/server/solr-webapp/webapp/img/filetypes/tgz.png +0 -0
  227. data/solr/server/solr-webapp/webapp/img/filetypes/txt.png +0 -0
  228. data/solr/server/solr-webapp/webapp/img/filetypes/vcf.png +0 -0
  229. data/solr/server/solr-webapp/webapp/img/filetypes/video.png +0 -0
  230. data/solr/server/solr-webapp/webapp/img/filetypes/vsd.png +0 -0
  231. data/solr/server/solr-webapp/webapp/img/filetypes/wav.png +0 -0
  232. data/solr/server/solr-webapp/webapp/img/filetypes/wma.png +0 -0
  233. data/solr/server/solr-webapp/webapp/img/filetypes/wmv.png +0 -0
  234. data/solr/server/solr-webapp/webapp/img/filetypes/xls.png +0 -0
  235. data/solr/server/solr-webapp/webapp/img/filetypes/xml.png +0 -0
  236. data/solr/server/solr-webapp/webapp/img/filetypes/xpi.png +0 -0
  237. data/solr/server/solr-webapp/webapp/img/filetypes/xvid.png +0 -0
  238. data/solr/server/solr-webapp/webapp/img/filetypes/zip.png +0 -0
  239. data/solr/server/solr-webapp/webapp/img/ico/arrow-000-small.png +0 -0
  240. data/solr/server/solr-webapp/webapp/img/ico/arrow-circle.png +0 -0
  241. data/solr/server/solr-webapp/webapp/img/ico/arrow-switch.png +0 -0
  242. data/solr/server/solr-webapp/webapp/img/ico/asterisk.png +0 -0
  243. data/solr/server/solr-webapp/webapp/img/ico/battery.png +0 -0
  244. data/solr/server/solr-webapp/webapp/img/ico/block-small.png +0 -0
  245. data/solr/server/solr-webapp/webapp/img/ico/block.png +0 -0
  246. data/solr/server/solr-webapp/webapp/img/ico/book-open-text.png +0 -0
  247. data/solr/server/solr-webapp/webapp/img/ico/box.png +0 -0
  248. data/solr/server/solr-webapp/webapp/img/ico/bug.png +0 -0
  249. data/solr/server/solr-webapp/webapp/img/ico/chart.png +0 -0
  250. data/solr/server/solr-webapp/webapp/img/ico/chevron-small-expand.png +0 -0
  251. data/solr/server/solr-webapp/webapp/img/ico/chevron-small.png +0 -0
  252. data/solr/server/solr-webapp/webapp/img/ico/clipboard-list.png +0 -0
  253. data/solr/server/solr-webapp/webapp/img/ico/clipboard-paste-document-text.png +0 -0
  254. data/solr/server/solr-webapp/webapp/img/ico/clipboard-paste.png +0 -0
  255. data/solr/server/solr-webapp/webapp/img/ico/clock-select-remain.png +0 -0
  256. data/solr/server/solr-webapp/webapp/img/ico/clock-select.png +0 -0
  257. data/solr/server/solr-webapp/webapp/img/ico/construction.png +0 -0
  258. data/solr/server/solr-webapp/webapp/img/ico/cross-0.png +0 -0
  259. data/solr/server/solr-webapp/webapp/img/ico/cross-1.png +0 -0
  260. data/solr/server/solr-webapp/webapp/img/ico/cross-button.png +0 -0
  261. data/solr/server/solr-webapp/webapp/img/ico/cross.png +0 -0
  262. data/solr/server/solr-webapp/webapp/img/ico/dashboard.png +0 -0
  263. data/solr/server/solr-webapp/webapp/img/ico/database--plus.png +0 -0
  264. data/solr/server/solr-webapp/webapp/img/ico/database.png +0 -0
  265. data/solr/server/solr-webapp/webapp/img/ico/databases.png +0 -0
  266. data/solr/server/solr-webapp/webapp/img/ico/disk-black.png +0 -0
  267. data/solr/server/solr-webapp/webapp/img/ico/document-convert.png +0 -0
  268. data/solr/server/solr-webapp/webapp/img/ico/document-import.png +0 -0
  269. data/solr/server/solr-webapp/webapp/img/ico/document-list.png +0 -0
  270. data/solr/server/solr-webapp/webapp/img/ico/document-text.png +0 -0
  271. data/solr/server/solr-webapp/webapp/img/ico/documents-stack.png +0 -0
  272. data/solr/server/solr-webapp/webapp/img/ico/download-cloud.png +0 -0
  273. data/solr/server/solr-webapp/webapp/img/ico/drive-upload.png +0 -0
  274. data/solr/server/solr-webapp/webapp/img/ico/exclamation-button.png +0 -0
  275. data/solr/server/solr-webapp/webapp/img/ico/eye.png +0 -0
  276. data/solr/server/solr-webapp/webapp/img/ico/folder-export.png +0 -0
  277. data/solr/server/solr-webapp/webapp/img/ico/folder-tree.png +0 -0
  278. data/solr/server/solr-webapp/webapp/img/ico/folder.png +0 -0
  279. data/solr/server/solr-webapp/webapp/img/ico/funnel-small.png +0 -0
  280. data/solr/server/solr-webapp/webapp/img/ico/funnel.png +0 -0
  281. data/solr/server/solr-webapp/webapp/img/ico/gear.png +0 -0
  282. data/solr/server/solr-webapp/webapp/img/ico/globe-network.png +0 -0
  283. data/solr/server/solr-webapp/webapp/img/ico/globe.png +0 -0
  284. data/solr/server/solr-webapp/webapp/img/ico/hammer-screwdriver.png +0 -0
  285. data/solr/server/solr-webapp/webapp/img/ico/hammer.png +0 -0
  286. data/solr/server/solr-webapp/webapp/img/ico/hand.png +0 -0
  287. data/solr/server/solr-webapp/webapp/img/ico/highlighter-text.png +0 -0
  288. data/solr/server/solr-webapp/webapp/img/ico/home.png +0 -0
  289. data/solr/server/solr-webapp/webapp/img/ico/hourglass--exclamation.png +0 -0
  290. data/solr/server/solr-webapp/webapp/img/ico/hourglass.png +0 -0
  291. data/solr/server/solr-webapp/webapp/img/ico/inbox-document-text.png +0 -0
  292. data/solr/server/solr-webapp/webapp/img/ico/information-button.png +0 -0
  293. data/solr/server/solr-webapp/webapp/img/ico/information-small.png +0 -0
  294. data/solr/server/solr-webapp/webapp/img/ico/information-white.png +0 -0
  295. data/solr/server/solr-webapp/webapp/img/ico/information.png +0 -0
  296. data/solr/server/solr-webapp/webapp/img/ico/jar.png +0 -0
  297. data/solr/server/solr-webapp/webapp/img/ico/magnifier.png +0 -0
  298. data/solr/server/solr-webapp/webapp/img/ico/mail.png +0 -0
  299. data/solr/server/solr-webapp/webapp/img/ico/memory.png +0 -0
  300. data/solr/server/solr-webapp/webapp/img/ico/minus-button.png +0 -0
  301. data/solr/server/solr-webapp/webapp/img/ico/molecule.png +0 -0
  302. data/solr/server/solr-webapp/webapp/img/ico/network-cloud.png +0 -0
  303. data/solr/server/solr-webapp/webapp/img/ico/network-status-away.png +0 -0
  304. data/solr/server/solr-webapp/webapp/img/ico/network-status-busy.png +0 -0
  305. data/solr/server/solr-webapp/webapp/img/ico/network-status-offline.png +0 -0
  306. data/solr/server/solr-webapp/webapp/img/ico/network-status.png +0 -0
  307. data/solr/server/solr-webapp/webapp/img/ico/network.png +0 -0
  308. data/solr/server/solr-webapp/webapp/img/ico/node-design.png +0 -0
  309. data/solr/server/solr-webapp/webapp/img/ico/node-master.png +0 -0
  310. data/solr/server/solr-webapp/webapp/img/ico/node-select.png +0 -0
  311. data/solr/server/solr-webapp/webapp/img/ico/node-slave.png +0 -0
  312. data/solr/server/solr-webapp/webapp/img/ico/node.png +0 -0
  313. data/solr/server/solr-webapp/webapp/img/ico/pencil-small.png +0 -0
  314. data/solr/server/solr-webapp/webapp/img/ico/pencil.png +0 -0
  315. data/solr/server/solr-webapp/webapp/img/ico/plus-button.png +0 -0
  316. data/solr/server/solr-webapp/webapp/img/ico/processor.png +0 -0
  317. data/solr/server/solr-webapp/webapp/img/ico/prohibition.png +0 -0
  318. data/solr/server/solr-webapp/webapp/img/ico/property.png +0 -0
  319. data/solr/server/solr-webapp/webapp/img/ico/question-small-white.png +0 -0
  320. data/solr/server/solr-webapp/webapp/img/ico/question-white.png +0 -0
  321. data/solr/server/solr-webapp/webapp/img/ico/question.png +0 -0
  322. data/solr/server/solr-webapp/webapp/img/ico/receipt-invoice.png +0 -0
  323. data/solr/server/solr-webapp/webapp/img/ico/receipt.png +0 -0
  324. data/solr/server/solr-webapp/webapp/img/ico/script-code.png +0 -0
  325. data/solr/server/solr-webapp/webapp/img/ico/server-cast.png +0 -0
  326. data/solr/server/solr-webapp/webapp/img/ico/server.png +0 -0
  327. data/solr/server/solr-webapp/webapp/img/ico/sitemap.png +0 -0
  328. data/solr/server/solr-webapp/webapp/img/ico/slash.png +0 -0
  329. data/solr/server/solr-webapp/webapp/img/ico/status-away.png +0 -0
  330. data/solr/server/solr-webapp/webapp/img/ico/status-busy.png +0 -0
  331. data/solr/server/solr-webapp/webapp/img/ico/status-offline.png +0 -0
  332. data/solr/server/solr-webapp/webapp/img/ico/status.png +0 -0
  333. data/solr/server/solr-webapp/webapp/img/ico/system-monitor--exclamation.png +0 -0
  334. data/solr/server/solr-webapp/webapp/img/ico/system-monitor.png +0 -0
  335. data/solr/server/solr-webapp/webapp/img/ico/table.png +0 -0
  336. data/solr/server/solr-webapp/webapp/img/ico/terminal.png +0 -0
  337. data/solr/server/solr-webapp/webapp/img/ico/tick-circle.png +0 -0
  338. data/solr/server/solr-webapp/webapp/img/ico/tick-red.png +0 -0
  339. data/solr/server/solr-webapp/webapp/img/ico/tick.png +0 -0
  340. data/solr/server/solr-webapp/webapp/img/ico/toggle-small-expand.png +0 -0
  341. data/solr/server/solr-webapp/webapp/img/ico/toggle-small.png +0 -0
  342. data/solr/server/solr-webapp/webapp/img/ico/toolbox.png +0 -0
  343. data/solr/server/solr-webapp/webapp/img/ico/ui-accordion.png +0 -0
  344. data/solr/server/solr-webapp/webapp/img/ico/ui-address-bar.png +0 -0
  345. data/solr/server/solr-webapp/webapp/img/ico/ui-check-box-uncheck.png +0 -0
  346. data/solr/server/solr-webapp/webapp/img/ico/ui-check-box.png +0 -0
  347. data/solr/server/solr-webapp/webapp/img/ico/ui-radio-button-uncheck.png +0 -0
  348. data/solr/server/solr-webapp/webapp/img/ico/ui-radio-button.png +0 -0
  349. data/solr/server/solr-webapp/webapp/img/ico/ui-text-field-select.png +0 -0
  350. data/solr/server/solr-webapp/webapp/img/ico/users.png +0 -0
  351. data/solr/server/solr-webapp/webapp/img/ico/wooden-box.png +0 -0
  352. data/solr/server/solr-webapp/webapp/img/ico/zone.png +0 -0
  353. data/solr/server/solr-webapp/webapp/img/loader-light.gif +0 -0
  354. data/solr/server/solr-webapp/webapp/img/loader.gif +0 -0
  355. data/solr/server/solr-webapp/webapp/img/lucene-ico.png +0 -0
  356. data/solr/server/solr-webapp/webapp/img/solr-ico.png +0 -0
  357. data/solr/server/solr-webapp/webapp/img/solr.svg +39 -0
  358. data/solr/server/solr-webapp/webapp/img/tree.png +0 -0
  359. data/solr/server/solr-webapp/webapp/index.html +208 -0
  360. data/solr/server/solr-webapp/webapp/js/angular/app.js +713 -0
  361. data/solr/server/solr-webapp/webapp/js/angular/controllers/analysis.js +199 -0
  362. data/solr/server/solr-webapp/webapp/js/angular/controllers/cloud.js +528 -0
  363. data/solr/server/solr-webapp/webapp/js/angular/controllers/core-overview.js +225 -0
  364. data/solr/server/solr-webapp/webapp/js/angular/controllers/cores.js +465 -0
  365. data/solr/server/solr-webapp/webapp/js/angular/controllers/dataimport.js +284 -0
  366. data/solr/server/solr-webapp/webapp/js/angular/controllers/documents.js +139 -0
  367. data/solr/server/solr-webapp/webapp/js/angular/controllers/files.js +92 -0
  368. data/solr/server/solr-webapp/webapp/js/angular/controllers/index.js +95 -0
  369. data/solr/server/solr-webapp/webapp/js/angular/controllers/java-properties.js +45 -0
  370. data/solr/server/solr-webapp/webapp/js/angular/controllers/logging.js +146 -0
  371. data/solr/server/solr-webapp/webapp/js/angular/controllers/plugins.js +166 -0
  372. data/solr/server/solr-webapp/webapp/js/angular/controllers/query.js +99 -0
  373. data/solr/server/solr-webapp/webapp/js/angular/controllers/replication.js +227 -0
  374. data/solr/server/solr-webapp/webapp/js/angular/controllers/schema-browser.js +432 -0
  375. data/solr/server/solr-webapp/webapp/js/angular/controllers/segments.js +94 -0
  376. data/solr/server/solr-webapp/webapp/js/angular/controllers/threads.js +51 -0
  377. data/solr/server/solr-webapp/webapp/js/angular/services.js +214 -0
  378. data/solr/server/solr-webapp/webapp/js/lib/ZeroClipboard.js +342 -0
  379. data/solr/server/solr-webapp/webapp/js/lib/chosen.js +982 -0
  380. data/solr/server/solr-webapp/webapp/js/lib/console.js +29 -0
  381. data/solr/server/solr-webapp/webapp/js/lib/d3.js +9373 -0
  382. data/solr/server/solr-webapp/webapp/js/lib/highlight.js +31 -0
  383. data/solr/server/solr-webapp/webapp/js/lib/jquery-1.7.2.min.js +30 -0
  384. data/solr/server/solr-webapp/webapp/js/lib/jquery.ajaxfileupload.js +184 -0
  385. data/solr/server/solr-webapp/webapp/js/lib/jquery.blockUI.js +523 -0
  386. data/solr/server/solr-webapp/webapp/js/lib/jquery.cookie.js +71 -0
  387. data/solr/server/solr-webapp/webapp/js/lib/jquery.form.js +806 -0
  388. data/solr/server/solr-webapp/webapp/js/lib/jquery.jstree.js +3534 -0
  389. data/solr/server/solr-webapp/webapp/js/lib/jquery.sammy.js +1863 -0
  390. data/solr/server/solr-webapp/webapp/js/lib/jquery.timeago.js +189 -0
  391. data/solr/server/solr-webapp/webapp/js/lib/linker.js +48 -0
  392. data/solr/server/solr-webapp/webapp/js/lib/naturalSort.js +82 -0
  393. data/solr/server/solr-webapp/webapp/js/lib/order.js +216 -0
  394. data/solr/server/solr-webapp/webapp/js/main.js +60 -0
  395. data/solr/server/solr-webapp/webapp/js/require.js +11349 -0
  396. data/solr/server/solr-webapp/webapp/js/scripts/analysis.js +545 -0
  397. data/solr/server/solr-webapp/webapp/js/scripts/app.js +680 -0
  398. data/solr/server/solr-webapp/webapp/js/scripts/cloud.js +877 -0
  399. data/solr/server/solr-webapp/webapp/js/scripts/cores.js +719 -0
  400. data/solr/server/solr-webapp/webapp/js/scripts/dashboard.js +562 -0
  401. data/solr/server/solr-webapp/webapp/js/scripts/dataimport.js +812 -0
  402. data/solr/server/solr-webapp/webapp/js/scripts/documents.js +370 -0
  403. data/solr/server/solr-webapp/webapp/js/scripts/files.js +265 -0
  404. data/solr/server/solr-webapp/webapp/js/scripts/index.js +340 -0
  405. data/solr/server/solr-webapp/webapp/js/scripts/java-properties.js +106 -0
  406. data/solr/server/solr-webapp/webapp/js/scripts/logging.js +578 -0
  407. data/solr/server/solr-webapp/webapp/js/scripts/ping.js +72 -0
  408. data/solr/server/solr-webapp/webapp/js/scripts/plugins.js +462 -0
  409. data/solr/server/solr-webapp/webapp/js/scripts/query.js +229 -0
  410. data/solr/server/solr-webapp/webapp/js/scripts/replication.js +527 -0
  411. data/solr/server/solr-webapp/webapp/js/scripts/schema-browser.js +1229 -0
  412. data/solr/server/solr-webapp/webapp/js/scripts/segments.js +206 -0
  413. data/solr/server/solr-webapp/webapp/js/scripts/threads.js +158 -0
  414. data/solr/server/solr-webapp/webapp/libs/angular-chosen.js +139 -0
  415. data/solr/server/solr-webapp/webapp/libs/angular-cookies.js +229 -0
  416. data/solr/server/solr-webapp/webapp/libs/angular-cookies.min.js +31 -0
  417. data/solr/server/solr-webapp/webapp/libs/angular-resource.min.js +36 -0
  418. data/solr/server/solr-webapp/webapp/libs/angular-route.js +1018 -0
  419. data/solr/server/solr-webapp/webapp/libs/angular-route.min.js +38 -0
  420. data/solr/server/solr-webapp/webapp/libs/angular-sanitize.js +703 -0
  421. data/solr/server/solr-webapp/webapp/libs/angular-sanitize.min.js +39 -0
  422. data/solr/server/solr-webapp/webapp/libs/angular.js +26093 -0
  423. data/solr/server/solr-webapp/webapp/libs/angular.min.js +273 -0
  424. data/solr/server/solr-webapp/webapp/libs/chosen.jquery.js +1194 -0
  425. data/solr/server/solr-webapp/webapp/libs/chosen.jquery.min.js +30 -0
  426. data/solr/server/solr-webapp/webapp/libs/d3.js +9373 -0
  427. data/solr/server/solr-webapp/webapp/libs/highlight.js +31 -0
  428. data/solr/server/solr-webapp/webapp/libs/jquery-2.1.3.min.js +29 -0
  429. data/solr/server/solr-webapp/webapp/libs/jquery.jstree.js +3534 -0
  430. data/solr/server/solr-webapp/webapp/libs/ngtimeago.js +102 -0
  431. data/solr/server/solr-webapp/webapp/partials/analysis.html +128 -0
  432. data/solr/server/solr-webapp/webapp/partials/cloud.html +104 -0
  433. data/solr/server/solr-webapp/webapp/partials/core_overview.html +227 -0
  434. data/solr/server/solr-webapp/webapp/partials/cores.html +231 -0
  435. data/solr/server/solr-webapp/webapp/partials/dataimport.html +209 -0
  436. data/solr/server/solr-webapp/webapp/partials/documents.html +118 -0
  437. data/solr/server/solr-webapp/webapp/partials/files.html +47 -0
  438. data/solr/server/solr-webapp/webapp/partials/index.html +261 -0
  439. data/solr/server/solr-webapp/webapp/partials/java-properties.html +27 -0
  440. data/solr/server/solr-webapp/webapp/partials/logging-levels.html +56 -0
  441. data/solr/server/solr-webapp/webapp/partials/logging.html +56 -0
  442. data/solr/server/solr-webapp/webapp/partials/plugins.html +72 -0
  443. data/solr/server/solr-webapp/webapp/partials/query.html +356 -0
  444. data/solr/server/solr-webapp/webapp/partials/replication.html +239 -0
  445. data/solr/server/solr-webapp/webapp/partials/schema-browser.html +206 -0
  446. data/solr/server/solr-webapp/webapp/partials/segments.html +99 -0
  447. data/solr/server/solr-webapp/webapp/partials/threads.html +65 -0
  448. data/solr/server/solr-webapp/webapp/tpl/analysis.html +83 -0
  449. data/solr/server/solr-webapp/webapp/tpl/cloud.html +87 -0
  450. data/solr/server/solr-webapp/webapp/tpl/cores.html +226 -0
  451. data/solr/server/solr-webapp/webapp/tpl/dashboard.html +201 -0
  452. data/solr/server/solr-webapp/webapp/tpl/dataimport.html +183 -0
  453. data/solr/server/solr-webapp/webapp/tpl/documents.html +107 -0
  454. data/solr/server/solr-webapp/webapp/tpl/files.html +44 -0
  455. data/solr/server/solr-webapp/webapp/tpl/index.html +250 -0
  456. data/solr/server/solr-webapp/webapp/tpl/logging.html +23 -0
  457. data/solr/server/solr-webapp/webapp/tpl/plugins.html +39 -0
  458. data/solr/server/solr-webapp/webapp/tpl/query.html +361 -0
  459. data/solr/server/solr-webapp/webapp/tpl/replication.html +216 -0
  460. data/solr/server/solr-webapp/webapp/tpl/schema-browser.html +192 -0
  461. data/solr/server/solr-webapp/webapp/tpl/segments.html +49 -0
  462. data/solr/server/solr-webapp/webapp/tpl/threads.html +56 -0
  463. data/solr/server/start.jar +0 -0
  464. data/solr/solr/README.txt +77 -0
  465. data/solr/solr/configsets/sunspot/conf/_rest_managed.json +1 -0
  466. data/solr/solr/configsets/sunspot/conf/currency.xml +67 -0
  467. data/solr/solr/{conf/stopwords.txt → configsets/sunspot/conf/lang/stopwords_en.txt} +1 -5
  468. data/solr/solr/{conf → configsets/sunspot/conf}/schema.xml +38 -35
  469. data/solr/solr/{conf → configsets/sunspot/conf}/solrconfig.xml +269 -318
  470. data/solr/solr/{conf → configsets/sunspot/conf}/synonyms.txt +3 -5
  471. data/solr/solr/default/core.properties +3 -0
  472. data/solr/solr/development/core.properties +3 -0
  473. data/solr/solr/solr.xml +49 -6
  474. data/solr/solr/test/core.properties +3 -0
  475. data/solr/solr/zoo.cfg +17 -0
  476. data/spec/server_spec.rb +3 -14
  477. data/sunspot_solr.gemspec +1 -1
  478. metadata +479 -48
  479. data/solr/contexts/solr.xml +0 -7
  480. data/solr/lib/jetty-continuation-8.1.8.v20121106.jar +0 -0
  481. data/solr/lib/jetty-deploy-8.1.8.v20121106.jar +0 -0
  482. data/solr/lib/jetty-http-8.1.8.v20121106.jar +0 -0
  483. data/solr/lib/jetty-io-8.1.8.v20121106.jar +0 -0
  484. data/solr/lib/jetty-jmx-8.1.8.v20121106.jar +0 -0
  485. data/solr/lib/jetty-security-8.1.8.v20121106.jar +0 -0
  486. data/solr/lib/jetty-server-8.1.8.v20121106.jar +0 -0
  487. data/solr/lib/jetty-servlet-8.1.8.v20121106.jar +0 -0
  488. data/solr/lib/jetty-util-8.1.8.v20121106.jar +0 -0
  489. data/solr/lib/jetty-webapp-8.1.8.v20121106.jar +0 -0
  490. data/solr/lib/jetty-xml-8.1.8.v20121106.jar +0 -0
  491. data/solr/lib/jsp-2.1/ant-1.6.5.jar +0 -0
  492. data/solr/lib/jsp-2.1/core-3.1.1.jar +0 -0
  493. data/solr/lib/jsp-2.1/jsp-2.1.jar +0 -0
  494. data/solr/lib/jsp-2.1/jsp-api-2.1.jar +0 -0
  495. data/solr/lib/servlet-api-3.0.jar +0 -0
  496. data/solr/solr/conf/xslt/example.xsl +0 -132
  497. data/solr/solr/conf/xslt/example_atom.xsl +0 -67
  498. data/solr/solr/conf/xslt/example_rss.xsl +0 -66
  499. data/solr/solr/conf/xslt/luke.xsl +0 -337
  500. data/solr/solr/default/README.txt +0 -54
  501. data/solr/start.jar +0 -0
  502. data/solr/webapps/solr.war +0 -0
  503. /data/solr/solr/{conf → configsets/sunspot/conf}/admin-extra.html +0 -0
  504. /data/solr/solr/{conf → configsets/sunspot/conf}/elevate.xml +0 -0
  505. /data/solr/solr/{conf → configsets/sunspot/conf}/mapping-ISOLatin1Accent.txt +0 -0
  506. /data/solr/solr/{conf → configsets/sunspot/conf}/protwords.txt +0 -0
  507. /data/solr/solr/{conf → configsets/sunspot/conf}/scripts.conf +0 -0
  508. /data/solr/solr/{conf → configsets/sunspot/conf}/spellings.txt +0 -0
@@ -0,0 +1,3534 @@
1
+ /*
2
+
3
+ The MIT License (MIT)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
22
+
23
+ */
24
+
25
+ /*
26
+ * jsTree 1.0-rc1
27
+ * http://jstree.com/
28
+ *
29
+ * Copyright (c) 2010 Ivan Bozhanov (vakata.com)
30
+ *
31
+ * Dual licensed under the MIT and GPL licenses (same as jQuery):
32
+ * http://www.opensource.org/licenses/mit-license.php
33
+ * http://www.gnu.org/licenses/gpl.html
34
+ *
35
+ * Date: 2010-07-01 10:51:11 +0300 (четв, 01 юли 2010) $
36
+ * Revision: 191 $
37
+ */
38
+
39
+ /*jslint browser: true, onevar: true, undef: true, bitwise: true, strict: true */
40
+ /*global window : false, clearInterval: false, clearTimeout: false, document: false, setInterval: false, setTimeout: false, jQuery: false, navigator: false, XSLTProcessor: false, DOMParser: false, XMLSerializer: false*/
41
+
42
+ "use strict";
43
+ // Common functions not related to jsTree
44
+ // decided to move them to a `vakata` "namespace"
45
+ (function ($) {
46
+ $.vakata = {};
47
+ // CSS related functions
48
+ $.vakata.css = {
49
+ get_css : function(rule_name, delete_flag, sheet) {
50
+ rule_name = rule_name.toLowerCase();
51
+ var css_rules = sheet.cssRules || sheet.rules,
52
+ j = 0;
53
+ do {
54
+ if(css_rules.length && j > css_rules.length + 5) { return false; }
55
+ if(css_rules[j].selectorText && css_rules[j].selectorText.toLowerCase() == rule_name) {
56
+ if(delete_flag === true) {
57
+ if(sheet.removeRule) { sheet.removeRule(j); }
58
+ if(sheet.deleteRule) { sheet.deleteRule(j); }
59
+ return true;
60
+ }
61
+ else { return css_rules[j]; }
62
+ }
63
+ }
64
+ while (css_rules[++j]);
65
+ return false;
66
+ },
67
+ add_css : function(rule_name, sheet) {
68
+ if($.jstree.css.get_css(rule_name, false, sheet)) { return false; }
69
+ if(sheet.insertRule) { sheet.insertRule(rule_name + ' { }', 0); } else { sheet.addRule(rule_name, null, 0); }
70
+ return $.vakata.css.get_css(rule_name);
71
+ },
72
+ remove_css : function(rule_name, sheet) {
73
+ return $.vakata.css.get_css(rule_name, true, sheet);
74
+ },
75
+ add_sheet : function(opts) {
76
+ var tmp;
77
+ if(opts.str) {
78
+ tmp = document.createElement("style");
79
+ tmp.setAttribute('type',"text/css");
80
+ if(tmp.styleSheet) {
81
+ document.getElementsByTagName("head")[0].appendChild(tmp);
82
+ tmp.styleSheet.cssText = opts.str;
83
+ }
84
+ else {
85
+ tmp.appendChild(document.createTextNode(opts.str));
86
+ document.getElementsByTagName("head")[0].appendChild(tmp);
87
+ }
88
+ return tmp.sheet || tmp.styleSheet;
89
+ }
90
+ if(opts.url) {
91
+ if(document.createStyleSheet) {
92
+ try { tmp = document.createStyleSheet(opts.url); } catch (e) { }
93
+ }
94
+ else {
95
+ tmp = document.createElement('link');
96
+ tmp.rel = 'stylesheet';
97
+ tmp.type = 'text/css';
98
+ tmp.media = "all";
99
+ tmp.href = opts.url;
100
+ document.getElementsByTagName("head")[0].appendChild(tmp);
101
+ return tmp.styleSheet;
102
+ }
103
+ }
104
+ }
105
+ };
106
+ })(jQuery);
107
+
108
+ /*
109
+ * jsTree core 1.0
110
+ */
111
+ (function ($) {
112
+ // private variables
113
+ var instances = [], // instance array (used by $.jstree.reference/create/focused)
114
+ focused_instance = -1, // the index in the instance array of the currently focused instance
115
+ plugins = {}, // list of included plugins
116
+ prepared_move = {}, // for the move plugin
117
+ is_ie6 = false;
118
+
119
+ // jQuery plugin wrapper (thanks to jquery UI widget function)
120
+ $.fn.jstree = function (settings) {
121
+ var isMethodCall = (typeof settings == 'string'), // is this a method call like $().jstree("open_node")
122
+ args = Array.prototype.slice.call(arguments, 1),
123
+ returnValue = this;
124
+
125
+ // extend settings and allow for multiple hashes and metadata
126
+ if(!isMethodCall && $.meta) { args.push($.metadata.get(this).jstree); }
127
+ settings = !isMethodCall && args.length ? $.extend.apply(null, [true, settings].concat(args)) : settings;
128
+ // block calls to "private" methods
129
+ if(isMethodCall && settings.substring(0, 1) == '_') { return returnValue; }
130
+
131
+ // if a method call execute the method on all selected instances
132
+ if(isMethodCall) {
133
+ this.each(function() {
134
+ var instance = instances[$.data(this, "jstree-instance-id")],
135
+ methodValue = (instance && $.isFunction(instance[settings])) ? instance[settings].apply(instance, args) : instance;
136
+ if(typeof methodValue !== "undefined" && (settings.indexOf("is_" === 0) || (methodValue !== true && methodValue !== false))) { returnValue = methodValue; return false; }
137
+ });
138
+ }
139
+ else {
140
+ this.each(function() {
141
+ var instance_id = $.data(this, "jstree-instance-id"),
142
+ s = false;
143
+ // if an instance already exists, destroy it first
144
+ if(typeof instance_id !== "undefined" && instances[instance_id]) { instances[instance_id].destroy(); }
145
+ // push a new empty object to the instances array
146
+ instance_id = parseInt(instances.push({}),10) - 1;
147
+ // store the jstree instance id to the container element
148
+ $.data(this, "jstree-instance-id", instance_id);
149
+ // clean up all plugins
150
+ if(!settings) { settings = {}; }
151
+ settings.plugins = $.isArray(settings.plugins) ? settings.plugins : $.jstree.defaults.plugins;
152
+ if($.inArray("core", settings.plugins) === -1) { settings.plugins.unshift("core"); }
153
+
154
+ // only unique plugins (NOT WORKING)
155
+ // settings.plugins = settings.plugins.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");
156
+
157
+ // extend defaults with passed data
158
+ s = $.extend(true, {}, $.jstree.defaults, settings);
159
+ s.plugins = settings.plugins;
160
+ $.each(plugins, function (i, val) { if($.inArray(i, s.plugins) === -1) { s[i] = null; delete s[i]; } });
161
+ // push the new object to the instances array (at the same time set the default classes to the container) and init
162
+ instances[instance_id] = new $.jstree._instance(instance_id, $(this).addClass("jstree jstree-" + instance_id), s);
163
+ // init all activated plugins for this instance
164
+ $.each(instances[instance_id]._get_settings().plugins, function (i, val) { instances[instance_id].data[val] = {}; });
165
+ $.each(instances[instance_id]._get_settings().plugins, function (i, val) { if(plugins[val]) { plugins[val].__init.apply(instances[instance_id]); } });
166
+ // initialize the instance
167
+ instances[instance_id].init();
168
+ });
169
+ }
170
+ // return the jquery selection (or if it was a method call that returned a value - the returned value)
171
+ return returnValue;
172
+ };
173
+ // object to store exposed functions and objects
174
+ $.jstree = {
175
+ defaults : {
176
+ plugins : []
177
+ },
178
+ _focused : function () { return instances[focused_instance] || null; },
179
+ _reference : function (needle) {
180
+ // get by instance id
181
+ if(instances[needle]) { return instances[needle]; }
182
+ // get by DOM (if still no luck - return null
183
+ var o = $(needle);
184
+ if(!o.length && typeof needle === "string") { o = $("#" + needle); }
185
+ if(!o.length) { return null; }
186
+ return instances[o.closest(".jstree").data("jstree-instance-id")] || null;
187
+ },
188
+ _instance : function (index, container, settings) {
189
+ // for plugins to store data in
190
+ this.data = { core : {} };
191
+ this.get_settings = function () { return $.extend(true, {}, settings); };
192
+ this._get_settings = function () { return settings; };
193
+ this.get_index = function () { return index; };
194
+ this.get_container = function () { return container; };
195
+ this._set_settings = function (s) {
196
+ settings = $.extend(true, {}, settings, s);
197
+ };
198
+ },
199
+ _fn : { },
200
+ plugin : function (pname, pdata) {
201
+ pdata = $.extend({}, {
202
+ __init : $.noop,
203
+ __destroy : $.noop,
204
+ _fn : {},
205
+ defaults : false
206
+ }, pdata);
207
+ plugins[pname] = pdata;
208
+
209
+ $.jstree.defaults[pname] = pdata.defaults;
210
+ $.each(pdata._fn, function (i, val) {
211
+ val.plugin = pname;
212
+ val.old = $.jstree._fn[i];
213
+ $.jstree._fn[i] = function () {
214
+ var rslt,
215
+ func = val,
216
+ args = Array.prototype.slice.call(arguments),
217
+ evnt = new $.Event("before.jstree"),
218
+ rlbk = false;
219
+
220
+ // Check if function belongs to the included plugins of this instance
221
+ do {
222
+ if(func && func.plugin && $.inArray(func.plugin, this._get_settings().plugins) !== -1) { break; }
223
+ func = func.old;
224
+ } while(func);
225
+ if(!func) { return; }
226
+
227
+ // a chance to stop execution (or change arguments):
228
+ // * just bind to jstree.before
229
+ // * check the additional data object (func property)
230
+ // * call event.stopImmediatePropagation()
231
+ // * return false (or an array of arguments)
232
+ rslt = this.get_container().triggerHandler(evnt, { "func" : i, "inst" : this, "args" : args });
233
+ if(rslt === false) { return; }
234
+ if(typeof rslt !== "undefined") { args = rslt; }
235
+
236
+ // context and function to trigger events, then finally call the function
237
+ if(i.indexOf("_") === 0) {
238
+ rslt = func.apply(this, args);
239
+ }
240
+ else {
241
+ rslt = func.apply(
242
+ $.extend({}, this, {
243
+ __callback : function (data) {
244
+ this.get_container().triggerHandler( i + '.jstree', { "inst" : this, "args" : args, "rslt" : data, "rlbk" : rlbk });
245
+ },
246
+ __rollback : function () {
247
+ rlbk = this.get_rollback();
248
+ return rlbk;
249
+ },
250
+ __call_old : function (replace_arguments) {
251
+ return func.old.apply(this, (replace_arguments ? Array.prototype.slice.call(arguments, 1) : args ) );
252
+ }
253
+ }), args);
254
+ }
255
+
256
+ // return the result
257
+ return rslt;
258
+ };
259
+ $.jstree._fn[i].old = val.old;
260
+ $.jstree._fn[i].plugin = pname;
261
+ });
262
+ },
263
+ rollback : function (rb) {
264
+ if(rb) {
265
+ if(!$.isArray(rb)) { rb = [ rb ]; }
266
+ $.each(rb, function (i, val) {
267
+ instances[val.i].set_rollback(val.h, val.d);
268
+ });
269
+ }
270
+ }
271
+ };
272
+ // set the prototype for all instances
273
+ $.jstree._fn = $.jstree._instance.prototype = {};
274
+
275
+ // css functions - used internally
276
+
277
+ // load the css when DOM is ready
278
+ $(function() {
279
+ // code is copied form jQuery ($.browser is deprecated + there is a bug in IE)
280
+ var u = navigator.userAgent.toLowerCase(),
281
+ v = (u.match( /.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
282
+ css_string = '' +
283
+ '.jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } ' +
284
+ '.jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; } ' +
285
+ '.jstree-rtl li { margin-left:0; margin-right:18px; } ' +
286
+ '.jstree > ul > li { margin-left:0px; } ' +
287
+ '.jstree-rtl > ul > li { margin-right:0px; } ' +
288
+ '.jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } ' +
289
+ '.jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } ' +
290
+ '.jstree a:focus { outline: none; } ' +
291
+ '.jstree a > ins { height:16px; width:16px; } ' +
292
+ '.jstree a > .jstree-icon { margin-right:3px; } ' +
293
+ '.jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } ' +
294
+ 'li.jstree-open > ul { display:block; } ' +
295
+ 'li.jstree-closed > ul { display:none; } ';
296
+ // Correct IE 6 (does not support the > CSS selector)
297
+ if(/msie/.test(u) && parseInt(v, 10) == 6) {
298
+ is_ie6 = true;
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
+ css_string += '.jstree li a { border-width:0 !important; padding:0px 2px !important; } ';
312
+ }
313
+ $.vakata.css.add_sheet({ str : css_string });
314
+ });
315
+
316
+ // core functions (open, close, create, update, delete)
317
+ $.jstree.plugin("core", {
318
+ __init : function () {
319
+ this.data.core.to_open = $.map($.makeArray(this.get_settings().core.initially_open), function (n) { return "#" + n.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'); });
320
+ },
321
+ defaults : {
322
+ html_titles : false,
323
+ animation : 500,
324
+ initially_open : [],
325
+ rtl : false,
326
+ strings : {
327
+ loading : "Loading ...",
328
+ new_node : "New node"
329
+ }
330
+ },
331
+ _fn : {
332
+ init : function () {
333
+ this.set_focus();
334
+ if(this._get_settings().core.rtl) {
335
+ this.get_container().addClass("jstree-rtl").css("direction", "rtl");
336
+ }
337
+ this.get_container().html("<ul><li class='jstree-last jstree-leaf'><ins>&#160;</ins><a class='jstree-loading' href='#'><ins class='jstree-icon'>&#160;</ins>" + this._get_settings().core.strings.loading + "</a></li></ul>");
338
+ this.data.core.li_height = this.get_container().find("ul li.jstree-closed, ul li.jstree-leaf").eq(0).height() || 18;
339
+
340
+ this.get_container()
341
+ .delegate("li > ins", "click.jstree", $.proxy(function (event) {
342
+ var trgt = $(event.target);
343
+ if(trgt.is("ins") && event.pageY - trgt.offset().top < this.data.core.li_height) { this.toggle_node(trgt); }
344
+ }, this))
345
+ .bind("mousedown.jstree", $.proxy(function () {
346
+ this.set_focus(); // This used to be setTimeout(set_focus,0) - why?
347
+ }, this))
348
+ .bind("dblclick.jstree", function (event) {
349
+ var sel;
350
+ if(document.selection && document.selection.empty) { document.selection.empty(); }
351
+ else {
352
+ if(window.getSelection) {
353
+ sel = window.getSelection();
354
+ try {
355
+ sel.removeAllRanges();
356
+ sel.collapse();
357
+ } catch (err) { }
358
+ }
359
+ }
360
+ });
361
+ this.__callback();
362
+ this.load_node(-1, function () { this.loaded(); this.reopen(); });
363
+ },
364
+ destroy : function () {
365
+ var i,
366
+ n = this.get_index(),
367
+ s = this._get_settings(),
368
+ _this = this;
369
+
370
+ $.each(s.plugins, function (i, val) {
371
+ try { plugins[val].__destroy.apply(_this); } catch(err) { }
372
+ });
373
+ this.__callback();
374
+ // set focus to another instance if this one is focused
375
+ if(this.is_focused()) {
376
+ for(i in instances) {
377
+ if(instances.hasOwnProperty(i) && i != n) {
378
+ instances[i].set_focus();
379
+ break;
380
+ }
381
+ }
382
+ }
383
+ // if no other instance found
384
+ if(n === focused_instance) { focused_instance = -1; }
385
+ // remove all traces of jstree in the DOM (only the ones set using jstree*) and cleans all events
386
+ this.get_container()
387
+ .unbind(".jstree")
388
+ .undelegate(".jstree")
389
+ .removeData("jstree-instance-id")
390
+ .find("[class^='jstree']")
391
+ .andSelf()
392
+ .attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); });
393
+ // remove the actual data
394
+ instances[n] = null;
395
+ delete instances[n];
396
+ },
397
+ save_opened : function () {
398
+ var _this = this;
399
+ this.data.core.to_open = [];
400
+ this.get_container().find(".jstree-open").each(function () {
401
+ _this.data.core.to_open.push("#" + this.id.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'));
402
+ });
403
+ this.__callback(_this.data.core.to_open);
404
+ },
405
+ reopen : function (is_callback) {
406
+ var _this = this,
407
+ done = true,
408
+ current = [],
409
+ remaining = [];
410
+ if(!is_callback) { this.data.core.reopen = false; this.data.core.refreshing = true; }
411
+ if(this.data.core.to_open.length) {
412
+ $.each(this.data.core.to_open, function (i, val) {
413
+ if(val == "#") { return true; }
414
+ if($(val).length && $(val).is(".jstree-closed")) { current.push(val); }
415
+ else { remaining.push(val); }
416
+ });
417
+ if(current.length) {
418
+ this.data.core.to_open = remaining;
419
+ $.each(current, function (i, val) {
420
+ _this.open_node(val, function () { _this.reopen(true); }, true);
421
+ });
422
+ done = false;
423
+ }
424
+ }
425
+ if(done) {
426
+ // TODO: find a more elegant approach to syncronizing returning requests
427
+ if(this.data.core.reopen) { clearTimeout(this.data.core.reopen); }
428
+ this.data.core.reopen = setTimeout(function () { _this.__callback({}, _this); }, 50);
429
+ this.data.core.refreshing = false;
430
+ }
431
+ },
432
+ refresh : function (obj) {
433
+ var _this = this;
434
+ this.save_opened();
435
+ if(!obj) { obj = -1; }
436
+ obj = this._get_node(obj);
437
+ if(!obj) { obj = -1; }
438
+ if(obj !== -1) { obj.children("UL").remove(); }
439
+ this.load_node(obj, function () { _this.__callback({ "obj" : obj}); _this.reopen(); });
440
+ },
441
+ // Dummy function to fire after the first load (so that there is a jstree.loaded event)
442
+ loaded : function () {
443
+ this.__callback();
444
+ },
445
+ // deal with focus
446
+ set_focus : function () {
447
+ var f = $.jstree._focused();
448
+ if(f && f !== this) {
449
+ f.get_container().removeClass("jstree-focused");
450
+ }
451
+ if(f !== this) {
452
+ this.get_container().addClass("jstree-focused");
453
+ focused_instance = this.get_index();
454
+ }
455
+ this.__callback();
456
+ },
457
+ is_focused : function () {
458
+ return focused_instance == this.get_index();
459
+ },
460
+
461
+ // traverse
462
+ _get_node : function (obj) {
463
+ var $obj = $(obj, this.get_container());
464
+ if($obj.is(".jstree") || obj == -1) { return -1; }
465
+ $obj = $obj.closest("li", this.get_container());
466
+ return $obj.length ? $obj : false;
467
+ },
468
+ _get_next : function (obj, strict) {
469
+ obj = this._get_node(obj);
470
+ if(obj === -1) { return this.get_container().find("> ul > li:first-child"); }
471
+ if(!obj.length) { return false; }
472
+ if(strict) { return (obj.nextAll("li").size() > 0) ? obj.nextAll("li:eq(0)") : false; }
473
+
474
+ if(obj.hasClass("jstree-open")) { return obj.find("li:eq(0)"); }
475
+ else if(obj.nextAll("li").size() > 0) { return obj.nextAll("li:eq(0)"); }
476
+ else { return obj.parentsUntil(".jstree","li").next("li").eq(0); }
477
+ },
478
+ _get_prev : function (obj, strict) {
479
+ obj = this._get_node(obj);
480
+ if(obj === -1) { return this.get_container().find("> ul > li:last-child"); }
481
+ if(!obj.length) { return false; }
482
+ if(strict) { return (obj.prevAll("li").length > 0) ? obj.prevAll("li:eq(0)") : false; }
483
+
484
+ if(obj.prev("li").length) {
485
+ obj = obj.prev("li").eq(0);
486
+ while(obj.hasClass("jstree-open")) { obj = obj.children("ul:eq(0)").children("li:last"); }
487
+ return obj;
488
+ }
489
+ else { var o = obj.parentsUntil(".jstree","li:eq(0)"); return o.length ? o : false; }
490
+ },
491
+ _get_parent : function (obj) {
492
+ obj = this._get_node(obj);
493
+ if(obj == -1 || !obj.length) { return false; }
494
+ var o = obj.parentsUntil(".jstree", "li:eq(0)");
495
+ return o.length ? o : -1;
496
+ },
497
+ _get_children : function (obj) {
498
+ obj = this._get_node(obj);
499
+ if(obj === -1) { return this.get_container().children("ul:eq(0)").children("li"); }
500
+ if(!obj.length) { return false; }
501
+ return obj.children("ul:eq(0)").children("li");
502
+ },
503
+ get_path : function (obj, id_mode) {
504
+ var p = [],
505
+ _this = this;
506
+ obj = this._get_node(obj);
507
+ if(obj === -1 || !obj || !obj.length) { return false; }
508
+ obj.parentsUntil(".jstree", "li").each(function () {
509
+ p.push( id_mode ? this.id : _this.get_text(this) );
510
+ });
511
+ p.reverse();
512
+ p.push( id_mode ? obj.attr("id") : this.get_text(obj) );
513
+ return p;
514
+ },
515
+
516
+ is_open : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-open"); },
517
+ is_closed : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-closed"); },
518
+ is_leaf : function (obj) { obj = this._get_node(obj); return obj && obj !== -1 && obj.hasClass("jstree-leaf"); },
519
+ // open/close
520
+ open_node : function (obj, callback, skip_animation) {
521
+ obj = this._get_node(obj);
522
+ if(!obj.length) { return false; }
523
+ if(!obj.hasClass("jstree-closed")) { if(callback) { callback.call(); } return false; }
524
+ var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation,
525
+ t = this;
526
+ if(!this._is_loaded(obj)) {
527
+ obj.children("a").addClass("jstree-loading");
528
+ this.load_node(obj, function () { t.open_node(obj, callback, skip_animation); }, callback);
529
+ }
530
+ else {
531
+ if(s) { obj.children("ul").css("display","none"); }
532
+ obj.removeClass("jstree-closed").addClass("jstree-open").children("a").removeClass("jstree-loading");
533
+ if(s) { obj.children("ul").stop(true).slideDown(s, function () { this.style.display = ""; }); }
534
+ this.__callback({ "obj" : obj });
535
+ if(callback) { callback.call(); }
536
+ }
537
+ },
538
+ close_node : function (obj, skip_animation) {
539
+ obj = this._get_node(obj);
540
+ var s = skip_animation || is_ie6 ? 0 : this._get_settings().core.animation;
541
+ if(!obj.length || !obj.hasClass("jstree-open")) { return false; }
542
+ if(s) { obj.children("ul").attr("style","display:block !important"); }
543
+ obj.removeClass("jstree-open").addClass("jstree-closed");
544
+ if(s) { obj.children("ul").stop(true).slideUp(s, function () { this.style.display = ""; }); }
545
+ this.__callback({ "obj" : obj });
546
+ },
547
+ toggle_node : function (obj) {
548
+ obj = this._get_node(obj);
549
+ if(obj.hasClass("jstree-closed")) { return this.open_node(obj); }
550
+ if(obj.hasClass("jstree-open")) { return this.close_node(obj); }
551
+ },
552
+ open_all : function (obj, original_obj) {
553
+ obj = obj ? this._get_node(obj) : this.get_container();
554
+ if(!obj || obj === -1) { obj = this.get_container(); }
555
+ if(original_obj) {
556
+ obj = obj.find("li.jstree-closed");
557
+ }
558
+ else {
559
+ original_obj = obj;
560
+ if(obj.is(".jstree-closed")) { obj = obj.find("li.jstree-closed").andSelf(); }
561
+ else { obj = obj.find("li.jstree-closed"); }
562
+ }
563
+ var _this = this;
564
+ obj.each(function () {
565
+ var __this = this;
566
+ if(!_this._is_loaded(this)) { _this.open_node(this, function() { _this.open_all(__this, original_obj); }, true); }
567
+ else { _this.open_node(this, false, true); }
568
+ });
569
+ // so that callback is fired AFTER all nodes are open
570
+ if(original_obj.find('li.jstree-closed').length === 0) { this.__callback({ "obj" : original_obj }); }
571
+ },
572
+ close_all : function (obj) {
573
+ var _this = this;
574
+ obj = obj ? this._get_node(obj) : this.get_container();
575
+ if(!obj || obj === -1) { obj = this.get_container(); }
576
+ obj.find("li.jstree-open").andSelf().each(function () { _this.close_node(this); });
577
+ this.__callback({ "obj" : obj });
578
+ },
579
+ clean_node : function (obj) {
580
+ obj = obj && obj != -1 ? $(obj) : this.get_container();
581
+ obj = obj.is("li") ? obj.find("li").andSelf() : obj.find("li");
582
+ obj.removeClass("jstree-last")
583
+ .filter("li:last-child").addClass("jstree-last").end()
584
+ .filter(":has(li)")
585
+ .not(".jstree-open").removeClass("jstree-leaf").addClass("jstree-closed");
586
+ obj.not(".jstree-open, .jstree-closed").addClass("jstree-leaf").children("ul").remove();
587
+ this.__callback({ "obj" : obj });
588
+ },
589
+ // rollback
590
+ get_rollback : function () {
591
+ this.__callback();
592
+ return { i : this.get_index(), h : this.get_container().children("ul").clone(true), d : this.data };
593
+ },
594
+ set_rollback : function (html, data) {
595
+ this.get_container().empty().append(html);
596
+ this.data = data;
597
+ this.__callback();
598
+ },
599
+ // Dummy functions to be overwritten by any datastore plugin included
600
+ load_node : function (obj, s_call, e_call) { this.__callback({ "obj" : obj }); },
601
+ _is_loaded : function (obj) { return true; },
602
+
603
+ // Basic operations: create
604
+ create_node : function (obj, position, js, callback, is_loaded) {
605
+ obj = this._get_node(obj);
606
+ position = typeof position === "undefined" ? "last" : position;
607
+ var d = $("<li>"),
608
+ s = this._get_settings().core,
609
+ tmp;
610
+
611
+ if(obj !== -1 && !obj.length) { return false; }
612
+ if(!is_loaded && !this._is_loaded(obj)) { this.load_node(obj, function () { this.create_node(obj, position, js, callback, true); }); return false; }
613
+
614
+ this.__rollback();
615
+
616
+ if(typeof js === "string") { js = { "data" : js }; }
617
+ if(!js) { js = {}; }
618
+ if(js.attr) { d.attr(js.attr); }
619
+ if(js.state) { d.addClass("jstree-" + js.state); }
620
+ if(!js.data) { js.data = s.strings.new_node; }
621
+ if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }
622
+ $.each(js.data, function (i, m) {
623
+ tmp = $("<a>");
624
+ if($.isFunction(m)) { m = m.call(this, js); }
625
+ if(typeof m == "string") { tmp.attr('href','#')[ s.html_titles ? "html" : "text" ](m); }
626
+ else {
627
+ if(!m.attr) { m.attr = {}; }
628
+ if(!m.attr.href) { m.attr.href = '#'; }
629
+ tmp.attr(m.attr)[ s.html_titles ? "html" : "text" ](m.title);
630
+ if(m.language) { tmp.addClass(m.language); }
631
+ }
632
+ tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");
633
+ if(m.icon) {
634
+ if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }
635
+ else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }
636
+ }
637
+ d.append(tmp);
638
+ });
639
+ d.prepend("<ins class='jstree-icon'>&#160;</ins>");
640
+ if(obj === -1) {
641
+ obj = this.get_container();
642
+ if(position === "before") { position = "first"; }
643
+ if(position === "after") { position = "last"; }
644
+ }
645
+ switch(position) {
646
+ case "before": obj.before(d); tmp = this._get_parent(obj); break;
647
+ case "after" : obj.after(d); tmp = this._get_parent(obj); break;
648
+ case "inside":
649
+ case "first" :
650
+ if(!obj.children("ul").length) { obj.append("<ul>"); }
651
+ obj.children("ul").prepend(d);
652
+ tmp = obj;
653
+ break;
654
+ case "last":
655
+ if(!obj.children("ul").length) { obj.append("<ul>"); }
656
+ obj.children("ul").append(d);
657
+ tmp = obj;
658
+ break;
659
+ default:
660
+ if(!obj.children("ul").length) { obj.append("<ul>"); }
661
+ if(!position) { position = 0; }
662
+ tmp = obj.children("ul").children("li").eq(position);
663
+ if(tmp.length) { tmp.before(d); }
664
+ else { obj.children("ul").append(d); }
665
+ tmp = obj;
666
+ break;
667
+ }
668
+ if(tmp === -1 || tmp.get(0) === this.get_container().get(0)) { tmp = -1; }
669
+ this.clean_node(tmp);
670
+ this.__callback({ "obj" : d, "parent" : tmp });
671
+ if(callback) { callback.call(this, d); }
672
+ return d;
673
+ },
674
+ // Basic operations: rename (deal with text)
675
+ get_text : function (obj) {
676
+ obj = this._get_node(obj);
677
+ if(!obj.length) { return false; }
678
+ var s = this._get_settings().core.html_titles;
679
+ obj = obj.children("a:eq(0)");
680
+ if(s) {
681
+ obj = obj.clone();
682
+ obj.children("INS").remove();
683
+ return obj.html();
684
+ }
685
+ else {
686
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
687
+ return obj.nodeValue;
688
+ }
689
+ },
690
+ set_text : function (obj, val) {
691
+ obj = this._get_node(obj);
692
+ if(!obj.length) { return false; }
693
+ obj = obj.children("a:eq(0)");
694
+ if(this._get_settings().core.html_titles) {
695
+ var tmp = obj.children("INS").clone();
696
+ obj.html(val).prepend(tmp);
697
+ this.__callback({ "obj" : obj, "name" : val });
698
+ return true;
699
+ }
700
+ else {
701
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
702
+ this.__callback({ "obj" : obj, "name" : val });
703
+ return (obj.nodeValue = val);
704
+ }
705
+ },
706
+ rename_node : function (obj, val) {
707
+ obj = this._get_node(obj);
708
+ this.__rollback();
709
+ if(obj && obj.length && this.set_text.apply(this, Array.prototype.slice.call(arguments))) { this.__callback({ "obj" : obj, "name" : val }); }
710
+ },
711
+ // Basic operations: deleting nodes
712
+ delete_node : function (obj) {
713
+ obj = this._get_node(obj);
714
+ if(!obj.length) { return false; }
715
+ this.__rollback();
716
+ var p = this._get_parent(obj), prev = this._get_prev(obj);
717
+ obj = obj.remove();
718
+ if(p !== -1 && p.find("> ul > li").length === 0) {
719
+ p.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
720
+ }
721
+ this.clean_node(p);
722
+ this.__callback({ "obj" : obj, "prev" : prev });
723
+ return obj;
724
+ },
725
+ prepare_move : function (o, r, pos, cb, is_cb) {
726
+ var p = {};
727
+
728
+ p.ot = $.jstree._reference(p.o) || this;
729
+ p.o = p.ot._get_node(o);
730
+ p.r = r === - 1 ? -1 : this._get_node(r);
731
+ p.p = (typeof p === "undefined") ? "last" : pos; // TODO: move to a setting
732
+ 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) {
733
+ this.__callback(prepared_move);
734
+ if(cb) { cb.call(this, prepared_move); }
735
+ return;
736
+ }
737
+ p.ot = $.jstree._reference(p.o) || this;
738
+ p.rt = r === -1 ? p.ot : $.jstree._reference(p.r) || this;
739
+ if(p.r === -1) {
740
+ p.cr = -1;
741
+ switch(p.p) {
742
+ case "first":
743
+ case "before":
744
+ case "inside":
745
+ p.cp = 0;
746
+ break;
747
+ case "after":
748
+ case "last":
749
+ p.cp = p.rt.get_container().find(" > ul > li").length;
750
+ break;
751
+ default:
752
+ p.cp = p.p;
753
+ break;
754
+ }
755
+ }
756
+ else {
757
+ if(!/^(before|after)$/.test(p.p) && !this._is_loaded(p.r)) {
758
+ return this.load_node(p.r, function () { this.prepare_move(o, r, pos, cb, true); });
759
+ }
760
+ switch(p.p) {
761
+ case "before":
762
+ p.cp = p.r.index();
763
+ p.cr = p.rt._get_parent(p.r);
764
+ break;
765
+ case "after":
766
+ p.cp = p.r.index() + 1;
767
+ p.cr = p.rt._get_parent(p.r);
768
+ break;
769
+ case "inside":
770
+ case "first":
771
+ p.cp = 0;
772
+ p.cr = p.r;
773
+ break;
774
+ case "last":
775
+ p.cp = p.r.find(" > ul > li").length;
776
+ p.cr = p.r;
777
+ break;
778
+ default:
779
+ p.cp = p.p;
780
+ p.cr = p.r;
781
+ break;
782
+ }
783
+ }
784
+ p.np = p.cr == -1 ? p.rt.get_container() : p.cr;
785
+ p.op = p.ot._get_parent(p.o);
786
+ p.or = p.np.find(" > ul > li:nth-child(" + (p.cp + 1) + ")");
787
+
788
+ prepared_move = p;
789
+ this.__callback(prepared_move);
790
+ if(cb) { cb.call(this, prepared_move); }
791
+ },
792
+ check_move : function () {
793
+ var obj = prepared_move, ret = true;
794
+ if(obj.or[0] === obj.o[0]) { return false; }
795
+ obj.o.each(function () {
796
+ if(obj.r.parentsUntil(".jstree").andSelf().filter("li").index(this) !== -1) { ret = false; return false; }
797
+ });
798
+ return ret;
799
+ },
800
+ move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {
801
+ if(!is_prepared) {
802
+ return this.prepare_move(obj, ref, position, function (p) {
803
+ this.move_node(p, false, false, is_copy, true, skip_check);
804
+ });
805
+ }
806
+ if(!skip_check && !this.check_move()) { return false; }
807
+
808
+ this.__rollback();
809
+ var o = false;
810
+ if(is_copy) {
811
+ o = obj.o.clone();
812
+ o.find("*[id]").andSelf().each(function () {
813
+ if(this.id) { this.id = "copy_" + this.id; }
814
+ });
815
+ }
816
+ else { o = obj.o; }
817
+
818
+ if(obj.or.length) { obj.or.before(o); }
819
+ else {
820
+ if(!obj.np.children("ul").length) { $("<ul>").appendTo(obj.np); }
821
+ obj.np.children("ul:eq(0)").append(o);
822
+ }
823
+
824
+ try {
825
+ obj.ot.clean_node(obj.op);
826
+ obj.rt.clean_node(obj.np);
827
+ if(!obj.op.find("> ul > li").length) {
828
+ obj.op.removeClass("jstree-open jstree-closed").addClass("jstree-leaf").children("ul").remove();
829
+ }
830
+ } catch (e) { }
831
+
832
+ if(is_copy) {
833
+ prepared_move.cy = true;
834
+ prepared_move.oc = o;
835
+ }
836
+ this.__callback(prepared_move);
837
+ return prepared_move;
838
+ },
839
+ _get_move : function () { return prepared_move; }
840
+ }
841
+ });
842
+ })(jQuery);
843
+ //*/
844
+
845
+ /*
846
+ * jsTree ui plugin 1.0
847
+ * This plugins handles selecting/deselecting/hovering/dehovering nodes
848
+ */
849
+ (function ($) {
850
+ $.jstree.plugin("ui", {
851
+ __init : function () {
852
+ this.data.ui.selected = $();
853
+ this.data.ui.last_selected = false;
854
+ this.data.ui.hovered = null;
855
+ this.data.ui.to_select = this.get_settings().ui.initially_select;
856
+
857
+ this.get_container()
858
+ .delegate("a", "click.jstree", $.proxy(function (event) {
859
+ event.preventDefault();
860
+ this.select_node(event.currentTarget, true, event);
861
+ }, this))
862
+ .delegate("a", "mouseenter.jstree", $.proxy(function (event) {
863
+ this.hover_node(event.target);
864
+ }, this))
865
+ .delegate("a", "mouseleave.jstree", $.proxy(function (event) {
866
+ this.dehover_node(event.target);
867
+ }, this))
868
+ .bind("reopen.jstree", $.proxy(function () {
869
+ this.reselect();
870
+ }, this))
871
+ .bind("get_rollback.jstree", $.proxy(function () {
872
+ this.dehover_node();
873
+ this.save_selected();
874
+ }, this))
875
+ .bind("set_rollback.jstree", $.proxy(function () {
876
+ this.reselect();
877
+ }, this))
878
+ .bind("close_node.jstree", $.proxy(function (event, data) {
879
+ var s = this._get_settings().ui,
880
+ obj = this._get_node(data.rslt.obj),
881
+ clk = (obj && obj.length) ? obj.children("ul").find(".jstree-clicked") : $(),
882
+ _this = this;
883
+ if(s.selected_parent_close === false || !clk.length) { return; }
884
+ clk.each(function () {
885
+ _this.deselect_node(this);
886
+ if(s.selected_parent_close === "select_parent") { _this.select_node(obj); }
887
+ });
888
+ }, this))
889
+ .bind("delete_node.jstree", $.proxy(function (event, data) {
890
+ var s = this._get_settings().ui.select_prev_on_delete,
891
+ obj = this._get_node(data.rslt.obj),
892
+ clk = (obj && obj.length) ? obj.find(".jstree-clicked") : [],
893
+ _this = this;
894
+ clk.each(function () { _this.deselect_node(this); });
895
+ if(s && clk.length) { this.select_node(data.rslt.prev); }
896
+ }, this))
897
+ .bind("move_node.jstree", $.proxy(function (event, data) {
898
+ if(data.rslt.cy) {
899
+ data.rslt.oc.find(".jstree-clicked").removeClass("jstree-clicked");
900
+ }
901
+ }, this));
902
+ },
903
+ defaults : {
904
+ select_limit : -1, // 0, 1, 2 ... or -1 for unlimited
905
+ select_multiple_modifier : "ctrl", // on, or ctrl, shift, alt
906
+ selected_parent_close : "select_parent", // false, "deselect", "select_parent"
907
+ select_prev_on_delete : true,
908
+ disable_selecting_children : false,
909
+ initially_select : []
910
+ },
911
+ _fn : {
912
+ _get_node : function (obj, allow_multiple) {
913
+ if(typeof obj === "undefined" || obj === null) { return allow_multiple ? this.data.ui.selected : this.data.ui.last_selected; }
914
+ var $obj = $(obj, this.get_container());
915
+ if($obj.is(".jstree") || obj == -1) { return -1; }
916
+ $obj = $obj.closest("li", this.get_container());
917
+ return $obj.length ? $obj : false;
918
+ },
919
+ save_selected : function () {
920
+ var _this = this;
921
+ this.data.ui.to_select = [];
922
+ this.data.ui.selected.each(function () { _this.data.ui.to_select.push("#" + this.id.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/')); });
923
+ this.__callback(this.data.ui.to_select);
924
+ },
925
+ reselect : function () {
926
+ var _this = this,
927
+ s = this.data.ui.to_select;
928
+ s = $.map($.makeArray(s), function (n) { return "#" + n.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'); });
929
+ this.deselect_all();
930
+ $.each(s, function (i, val) { if(val && val !== "#") { _this.select_node(val); } });
931
+ this.__callback();
932
+ },
933
+ refresh : function (obj) {
934
+ this.save_selected();
935
+ return this.__call_old();
936
+ },
937
+ hover_node : function (obj) {
938
+ obj = this._get_node(obj);
939
+ if(!obj.length) { return false; }
940
+ //if(this.data.ui.hovered && obj.get(0) === this.data.ui.hovered.get(0)) { return; }
941
+ if(!obj.hasClass("jstree-hovered")) { this.dehover_node(); }
942
+ this.data.ui.hovered = obj.children("a").addClass("jstree-hovered").parent();
943
+ this.__callback({ "obj" : obj });
944
+ },
945
+ dehover_node : function () {
946
+ var obj = this.data.ui.hovered, p;
947
+ if(!obj || !obj.length) { return false; }
948
+ p = obj.children("a").removeClass("jstree-hovered").parent();
949
+ if(this.data.ui.hovered[0] === p[0]) { this.data.ui.hovered = null; }
950
+ this.__callback({ "obj" : obj });
951
+ },
952
+ select_node : function (obj, check, e) {
953
+ obj = this._get_node(obj);
954
+ if(obj == -1 || !obj || !obj.length) { return false; }
955
+ var s = this._get_settings().ui,
956
+ is_multiple = (s.select_multiple_modifier == "on" || (s.select_multiple_modifier !== false && e && e[s.select_multiple_modifier + "Key"])),
957
+ is_selected = this.is_selected(obj),
958
+ proceed = true;
959
+ if(check) {
960
+ if(s.disable_selecting_children && is_multiple && obj.parents("li", this.get_container()).children(".jstree-clicked").length) {
961
+ return false;
962
+ }
963
+ proceed = false;
964
+ switch(!0) {
965
+ case (is_selected && !is_multiple):
966
+ this.deselect_all();
967
+ is_selected = false;
968
+ proceed = true;
969
+ break;
970
+ case (!is_selected && !is_multiple):
971
+ if(s.select_limit == -1 || s.select_limit > 0) {
972
+ this.deselect_all();
973
+ proceed = true;
974
+ }
975
+ break;
976
+ case (is_selected && is_multiple):
977
+ this.deselect_node(obj);
978
+ break;
979
+ case (!is_selected && is_multiple):
980
+ if(s.select_limit == -1 || this.data.ui.selected.length + 1 <= s.select_limit) {
981
+ proceed = true;
982
+ }
983
+ break;
984
+ }
985
+ }
986
+ if(proceed && !is_selected) {
987
+ obj.children("a").addClass("jstree-clicked");
988
+ this.data.ui.selected = this.data.ui.selected.add(obj);
989
+ this.data.ui.last_selected = obj;
990
+ this.__callback({ "obj" : obj });
991
+ }
992
+ },
993
+ deselect_node : function (obj) {
994
+ obj = this._get_node(obj);
995
+ if(!obj.length) { return false; }
996
+ if(this.is_selected(obj)) {
997
+ obj.children("a").removeClass("jstree-clicked");
998
+ this.data.ui.selected = this.data.ui.selected.not(obj);
999
+ if(this.data.ui.last_selected.get(0) === obj.get(0)) { this.data.ui.last_selected = this.data.ui.selected.eq(0); }
1000
+ this.__callback({ "obj" : obj });
1001
+ }
1002
+ },
1003
+ toggle_select : function (obj) {
1004
+ obj = this._get_node(obj);
1005
+ if(!obj.length) { return false; }
1006
+ if(this.is_selected(obj)) { this.deselect_node(obj); }
1007
+ else { this.select_node(obj); }
1008
+ },
1009
+ is_selected : function (obj) { return this.data.ui.selected.index(this._get_node(obj)) >= 0; },
1010
+ get_selected : function (context) {
1011
+ return context ? $(context).find(".jstree-clicked").parent() : this.data.ui.selected;
1012
+ },
1013
+ deselect_all : function (context) {
1014
+ if(context) { $(context).find(".jstree-clicked").removeClass("jstree-clicked"); }
1015
+ else { this.get_container().find(".jstree-clicked").removeClass("jstree-clicked"); }
1016
+ this.data.ui.selected = $([]);
1017
+ this.data.ui.last_selected = false;
1018
+ this.__callback();
1019
+ }
1020
+ }
1021
+ });
1022
+ // include the selection plugin by default
1023
+ $.jstree.defaults.plugins.push("ui");
1024
+ })(jQuery);
1025
+ //*/
1026
+
1027
+ /*
1028
+ * jsTree CRRM plugin 1.0
1029
+ * Handles creating/renaming/removing/moving nodes by user interaction.
1030
+ */
1031
+ (function ($) {
1032
+ $.jstree.plugin("crrm", {
1033
+ __init : function () {
1034
+ this.get_container()
1035
+ .bind("move_node.jstree", $.proxy(function (e, data) {
1036
+ if(this._get_settings().crrm.move.open_onmove) {
1037
+ var t = this;
1038
+ data.rslt.np.parentsUntil(".jstree").andSelf().filter(".jstree-closed").each(function () {
1039
+ t.open_node(this, false, true);
1040
+ });
1041
+ }
1042
+ }, this));
1043
+ },
1044
+ defaults : {
1045
+ input_width_limit : 200,
1046
+ move : {
1047
+ always_copy : false, // false, true or "multitree"
1048
+ open_onmove : true,
1049
+ default_position : "last",
1050
+ check_move : function (m) { return true; }
1051
+ }
1052
+ },
1053
+ _fn : {
1054
+ _show_input : function (obj, callback) {
1055
+ obj = this._get_node(obj);
1056
+ var rtl = this._get_settings().core.rtl,
1057
+ w = this._get_settings().crrm.input_width_limit,
1058
+ w1 = obj.children("ins").width(),
1059
+ w2 = obj.find("> a:visible > ins").width() * obj.find("> a:visible > ins").length,
1060
+ t = this.get_text(obj),
1061
+ h1 = $("<div>", { css : { "position" : "absolute", "top" : "-200px", "left" : (rtl ? "0px" : "-1000px"), "visibility" : "hidden" } }).appendTo("body"),
1062
+ h2 = obj.css("position","relative").append(
1063
+ $("<input>", {
1064
+ "value" : t,
1065
+ // "size" : t.length,
1066
+ "css" : {
1067
+ "padding" : "0",
1068
+ "border" : "1px solid silver",
1069
+ "position" : "absolute",
1070
+ "left" : (rtl ? "auto" : (w1 + w2 + 4) + "px"),
1071
+ "right" : (rtl ? (w1 + w2 + 4) + "px" : "auto"),
1072
+ "top" : "0px",
1073
+ "height" : (this.data.core.li_height - 2) + "px",
1074
+ "lineHeight" : (this.data.core.li_height - 2) + "px",
1075
+ "width" : "150px" // will be set a bit further down
1076
+ },
1077
+ "blur" : $.proxy(function () {
1078
+ var i = obj.children("input"),
1079
+ v = i.val();
1080
+ if(v === "") { v = t; }
1081
+ i.remove(); // rollback purposes
1082
+ this.set_text(obj,t); // rollback purposes
1083
+ this.rename_node(obj, v);
1084
+ callback.call(this, obj, v, t);
1085
+ obj.css("position","");
1086
+ }, this),
1087
+ "keyup" : function (event) {
1088
+ var key = event.keyCode || event.which;
1089
+ if(key == 27) { this.value = t; this.blur(); return; }
1090
+ else if(key == 13) { this.blur(); return; }
1091
+ else {
1092
+ h2.width(Math.min(h1.text("pW" + this.value).width(),w));
1093
+ }
1094
+ }
1095
+ })
1096
+ ).children("input");
1097
+ this.set_text(obj, "");
1098
+ h1.css({
1099
+ fontFamily : h2.css('fontFamily') || '',
1100
+ fontSize : h2.css('fontSize') || '',
1101
+ fontWeight : h2.css('fontWeight') || '',
1102
+ fontStyle : h2.css('fontStyle') || '',
1103
+ fontStretch : h2.css('fontStretch') || '',
1104
+ fontVariant : h2.css('fontVariant') || '',
1105
+ letterSpacing : h2.css('letterSpacing') || '',
1106
+ wordSpacing : h2.css('wordSpacing') || ''
1107
+ });
1108
+ h2.width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select();
1109
+ },
1110
+ rename : function (obj) {
1111
+ obj = this._get_node(obj);
1112
+ this.__rollback();
1113
+ var f = this.__callback;
1114
+ this._show_input(obj, function (obj, new_name, old_name) {
1115
+ f.call(this, { "obj" : obj, "new_name" : new_name, "old_name" : old_name });
1116
+ });
1117
+ },
1118
+ create : function (obj, position, js, callback, skip_rename) {
1119
+ var t, _this = this;
1120
+ obj = this._get_node(obj);
1121
+ if(!obj) { obj = -1; }
1122
+ this.__rollback();
1123
+ t = this.create_node(obj, position, js, function (t) {
1124
+ var p = this._get_parent(t),
1125
+ pos = $(t).index();
1126
+ if(callback) { callback.call(this, t); }
1127
+ if(p.length && p.hasClass("jstree-closed")) { this.open_node(p, false, true); }
1128
+ if(!skip_rename) {
1129
+ this._show_input(t, function (obj, new_name, old_name) {
1130
+ _this.__callback({ "obj" : obj, "name" : new_name, "parent" : p, "position" : pos });
1131
+ });
1132
+ }
1133
+ else { _this.__callback({ "obj" : t, "name" : this.get_text(t), "parent" : p, "position" : pos }); }
1134
+ });
1135
+ return t;
1136
+ },
1137
+ remove : function (obj) {
1138
+ obj = this._get_node(obj, true);
1139
+ this.__rollback();
1140
+ this.delete_node(obj);
1141
+ this.__callback({ "obj" : obj });
1142
+ },
1143
+ check_move : function () {
1144
+ if(!this.__call_old()) { return false; }
1145
+ var s = this._get_settings().crrm.move;
1146
+ if(!s.check_move.call(this, this._get_move())) { return false; }
1147
+ return true;
1148
+ },
1149
+ move_node : function (obj, ref, position, is_copy, is_prepared, skip_check) {
1150
+ var s = this._get_settings().crrm.move;
1151
+ if(!is_prepared) {
1152
+ if(!position) { position = s.default_position; }
1153
+ if(position === "inside" && !s.default_position.match(/^(before|after)$/)) { position = s.default_position; }
1154
+ return this.__call_old(true, obj, ref, position, is_copy, false, skip_check);
1155
+ }
1156
+ // if the move is already prepared
1157
+ if(s.always_copy === true || (s.always_copy === "multitree" && obj.rt.get_index() !== obj.ot.get_index() )) {
1158
+ is_copy = true;
1159
+ }
1160
+ this.__call_old(true, obj, ref, position, is_copy, true, skip_check);
1161
+ },
1162
+
1163
+ cut : function (obj) {
1164
+ obj = this._get_node(obj);
1165
+ this.data.crrm.cp_nodes = false;
1166
+ this.data.crrm.ct_nodes = false;
1167
+ if(!obj || !obj.length) { return false; }
1168
+ this.data.crrm.ct_nodes = obj;
1169
+ },
1170
+ copy : function (obj) {
1171
+ obj = this._get_node(obj);
1172
+ this.data.crrm.cp_nodes = false;
1173
+ this.data.crrm.ct_nodes = false;
1174
+ if(!obj || !obj.length) { return false; }
1175
+ this.data.crrm.cp_nodes = obj;
1176
+ },
1177
+ paste : function (obj) {
1178
+ obj = this._get_node(obj);
1179
+ if(!obj || !obj.length) { return false; }
1180
+ if(!this.data.crrm.ct_nodes && !this.data.crrm.cp_nodes) { return false; }
1181
+ if(this.data.crrm.ct_nodes) { this.move_node(this.data.crrm.ct_nodes, obj); }
1182
+ if(this.data.crrm.cp_nodes) { this.move_node(this.data.crrm.cp_nodes, obj, false, true); }
1183
+ this.data.crrm.cp_nodes = false;
1184
+ this.data.crrm.ct_nodes = false;
1185
+ }
1186
+ }
1187
+ });
1188
+ // include the crr plugin by default
1189
+ $.jstree.defaults.plugins.push("crrm");
1190
+ })(jQuery);
1191
+
1192
+ /*
1193
+ * jsTree themes plugin 1.0
1194
+ * Handles loading and setting themes, as well as detecting path to themes, etc.
1195
+ */
1196
+ (function ($) {
1197
+ var themes_loaded = [];
1198
+ // this variable stores the path to the themes folder - if left as false - it will be autodetected
1199
+ $.jstree._themes = false;
1200
+ $.jstree.plugin("themes", {
1201
+ __init : function () {
1202
+ this.get_container()
1203
+ .bind("init.jstree", $.proxy(function () {
1204
+ var s = this._get_settings().themes;
1205
+ this.data.themes.dots = s.dots;
1206
+ this.data.themes.icons = s.icons;
1207
+ //alert(s.dots);
1208
+ this.set_theme(s.theme, s.url);
1209
+ }, this))
1210
+ .bind("loaded.jstree", $.proxy(function () {
1211
+ // bound here too, as simple HTML tree's won't honor dots & icons otherwise
1212
+ if(!this.data.themes.dots) { this.hide_dots(); }
1213
+ else { this.show_dots(); }
1214
+ if(!this.data.themes.icons) { this.hide_icons(); }
1215
+ else { this.show_icons(); }
1216
+ }, this));
1217
+ },
1218
+ defaults : {
1219
+ theme : "default",
1220
+ url : false,
1221
+ dots : true,
1222
+ icons : true
1223
+ },
1224
+ _fn : {
1225
+ set_theme : function (theme_name, theme_url) {
1226
+ if(!theme_name) { return false; }
1227
+ if(!theme_url) { theme_url = $.jstree._themes + theme_name + '/style.css'; }
1228
+ if($.inArray(theme_url, themes_loaded) == -1) {
1229
+ $.vakata.css.add_sheet({ "url" : theme_url, "rel" : "jstree" });
1230
+ themes_loaded.push(theme_url);
1231
+ }
1232
+ if(this.data.themes.theme != theme_name) {
1233
+ this.get_container().removeClass('jstree-' + this.data.themes.theme);
1234
+ this.data.themes.theme = theme_name;
1235
+ }
1236
+ this.get_container().addClass('jstree-' + theme_name);
1237
+ if(!this.data.themes.dots) { this.hide_dots(); }
1238
+ else { this.show_dots(); }
1239
+ if(!this.data.themes.icons) { this.hide_icons(); }
1240
+ else { this.show_icons(); }
1241
+ this.__callback();
1242
+ },
1243
+ get_theme : function () { return this.data.themes.theme; },
1244
+
1245
+ show_dots : function () { this.data.themes.dots = true; this.get_container().children("ul").removeClass("jstree-no-dots"); },
1246
+ hide_dots : function () { this.data.themes.dots = false; this.get_container().children("ul").addClass("jstree-no-dots"); },
1247
+ toggle_dots : function () { if(this.data.themes.dots) { this.hide_dots(); } else { this.show_dots(); } },
1248
+
1249
+ show_icons : function () { this.data.themes.icons = true; this.get_container().children("ul").removeClass("jstree-no-icons"); },
1250
+ hide_icons : function () { this.data.themes.icons = false; this.get_container().children("ul").addClass("jstree-no-icons"); },
1251
+ toggle_icons: function () { if(this.data.themes.icons) { this.hide_icons(); } else { this.show_icons(); } }
1252
+ }
1253
+ });
1254
+ // autodetect themes path
1255
+ $(function () {
1256
+ if($.jstree._themes === false) {
1257
+ $("script").each(function () {
1258
+ if(this.src.toString().match(/jquery\.jstree[^\/]*?\.js(\?.*)?$/)) {
1259
+ $.jstree._themes = this.src.toString().replace(/jquery\.jstree[^\/]*?\.js(\?.*)?$/, "") + 'themes/';
1260
+ return false;
1261
+ }
1262
+ });
1263
+ }
1264
+ if($.jstree._themes === false) { $.jstree._themes = "themes/"; }
1265
+ });
1266
+ // include the themes plugin by default
1267
+ $.jstree.defaults.plugins.push("themes");
1268
+ })(jQuery);
1269
+ //*/
1270
+
1271
+ /*
1272
+ * jsTree hotkeys plugin 1.0
1273
+ * Enables keyboard navigation for all tree instances
1274
+ * Depends on the jstree ui & jquery hotkeys plugins
1275
+ */
1276
+ (function ($) {
1277
+ var bound = [];
1278
+ function exec(i, event) {
1279
+ var f = $.jstree._focused(), tmp;
1280
+ if(f && f.data && f.data.hotkeys && f.data.hotkeys.enabled) {
1281
+ tmp = f._get_settings().hotkeys[i];
1282
+ if(tmp) { return tmp.call(f, event); }
1283
+ }
1284
+ }
1285
+ $.jstree.plugin("hotkeys", {
1286
+ __init : function () {
1287
+ if(typeof $.hotkeys === "undefined") { throw "jsTree hotkeys: jQuery hotkeys plugin not included."; }
1288
+ if(!this.data.ui) { throw "jsTree hotkeys: jsTree UI plugin not included."; }
1289
+ $.each(this._get_settings().hotkeys, function (i, val) {
1290
+ if($.inArray(i, bound) == -1) {
1291
+ $(document).bind("keydown", i, function (event) { return exec(i, event); });
1292
+ bound.push(i);
1293
+ }
1294
+ });
1295
+ this.enable_hotkeys();
1296
+ },
1297
+ defaults : {
1298
+ "up" : function () {
1299
+ var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1300
+ this.hover_node(this._get_prev(o));
1301
+ return false;
1302
+ },
1303
+ "down" : function () {
1304
+ var o = this.data.ui.hovered || this.data.ui.last_selected || -1;
1305
+ this.hover_node(this._get_next(o));
1306
+ return false;
1307
+ },
1308
+ "left" : function () {
1309
+ var o = this.data.ui.hovered || this.data.ui.last_selected;
1310
+ if(o) {
1311
+ if(o.hasClass("jstree-open")) { this.close_node(o); }
1312
+ else { this.hover_node(this._get_prev(o)); }
1313
+ }
1314
+ return false;
1315
+ },
1316
+ "right" : function () {
1317
+ var o = this.data.ui.hovered || this.data.ui.last_selected;
1318
+ if(o && o.length) {
1319
+ if(o.hasClass("jstree-closed")) { this.open_node(o); }
1320
+ else { this.hover_node(this._get_next(o)); }
1321
+ }
1322
+ return false;
1323
+ },
1324
+ "space" : function () {
1325
+ if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").click(); }
1326
+ return false;
1327
+ },
1328
+ "ctrl+space" : function (event) {
1329
+ event.type = "click";
1330
+ if(this.data.ui.hovered) { this.data.ui.hovered.children("a:eq(0)").trigger(event); }
1331
+ return false;
1332
+ },
1333
+ "f2" : function () { this.rename(this.data.ui.hovered || this.data.ui.last_selected); },
1334
+ "del" : function () { this.remove(this.data.ui.hovered || this._get_node(null)); }
1335
+ },
1336
+ _fn : {
1337
+ enable_hotkeys : function () {
1338
+ this.data.hotkeys.enabled = true;
1339
+ },
1340
+ disable_hotkeys : function () {
1341
+ this.data.hotkeys.enabled = false;
1342
+ }
1343
+ }
1344
+ });
1345
+ })(jQuery);
1346
+ //*/
1347
+
1348
+ /*
1349
+ * jsTree JSON 1.0
1350
+ * The JSON data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.
1351
+ */
1352
+ (function ($) {
1353
+ $.jstree.plugin("json_data", {
1354
+ defaults : {
1355
+ data : false,
1356
+ ajax : false,
1357
+ correct_state : true,
1358
+ progressive_render : false
1359
+ },
1360
+ _fn : {
1361
+ load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_json(obj, function () { _this.__callback({ "obj" : obj }); s_call.call(this); }, e_call); },
1362
+ _is_loaded : function (obj) {
1363
+ var s = this._get_settings().json_data, d;
1364
+ obj = this._get_node(obj);
1365
+ if(obj && obj !== -1 && s.progressive_render && !obj.is(".jstree-open, .jstree-leaf") && obj.children("ul").children("li").length === 0 && obj.data("jstree-children")) {
1366
+ d = this._parse_json(obj.data("jstree-children"));
1367
+ if(d) {
1368
+ obj.append(d);
1369
+ $.removeData(obj, "jstree-children");
1370
+ }
1371
+ this.clean_node(obj);
1372
+ return true;
1373
+ }
1374
+ return obj == -1 || !obj || !s.ajax || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
1375
+ },
1376
+ load_node_json : function (obj, s_call, e_call) {
1377
+ var s = this.get_settings().json_data, d,
1378
+ error_func = function () {},
1379
+ success_func = function () {};
1380
+ obj = this._get_node(obj);
1381
+ if(obj && obj !== -1) {
1382
+ if(obj.data("jstree-is-loading")) { return; }
1383
+ else { obj.data("jstree-is-loading",true); }
1384
+ }
1385
+ switch(!0) {
1386
+ case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";
1387
+ case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
1388
+ if(!obj || obj == -1) {
1389
+ d = this._parse_json(s.data);
1390
+ if(d) {
1391
+ this.get_container().children("ul").empty().append(d.children());
1392
+ this.clean_node();
1393
+ }
1394
+ else {
1395
+ if(s.correct_state) { this.get_container().children("ul").empty(); }
1396
+ }
1397
+ }
1398
+ if(s_call) { s_call.call(this); }
1399
+ break;
1400
+ case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
1401
+ error_func = function (x, t, e) {
1402
+ var ef = this.get_settings().json_data.ajax.error;
1403
+ if(ef) { ef.call(this, x, t, e); }
1404
+ if(obj != -1 && obj.length) {
1405
+ obj.children(".jstree-loading").removeClass("jstree-loading");
1406
+ obj.data("jstree-is-loading",false);
1407
+ if(t === "success" && s.correct_state) { obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf"); }
1408
+ }
1409
+ else {
1410
+ if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
1411
+ }
1412
+ if(e_call) { e_call.call(this); }
1413
+ };
1414
+ success_func = function (d, t, x) {
1415
+ var sf = this.get_settings().json_data.ajax.success;
1416
+ if(sf) { d = sf.call(this,d,t,x) || d; }
1417
+ if(d === "" || (!$.isArray(d) && !$.isPlainObject(d))) {
1418
+ return error_func.call(this, x, t, "");
1419
+ }
1420
+ d = this._parse_json(d);
1421
+ if(d) {
1422
+ if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
1423
+ else { obj.append(d).children(".jstree-loading").removeClass("jstree-loading"); obj.data("jstree-is-loading",false); }
1424
+ this.clean_node(obj);
1425
+ if(s_call) { s_call.call(this); }
1426
+ }
1427
+ else {
1428
+ if(obj === -1 || !obj) {
1429
+ if(s.correct_state) {
1430
+ this.get_container().children("ul").empty();
1431
+ if(s_call) { s_call.call(this); }
1432
+ }
1433
+ }
1434
+ else {
1435
+ obj.children(".jstree-loading").removeClass("jstree-loading");
1436
+ obj.data("jstree-is-loading",false);
1437
+ if(s.correct_state) {
1438
+ obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
1439
+ if(s_call) { s_call.call(this); }
1440
+ }
1441
+ }
1442
+ }
1443
+ };
1444
+ s.ajax.context = this;
1445
+ s.ajax.error = error_func;
1446
+ s.ajax.success = success_func;
1447
+ if(!s.ajax.dataType) { s.ajax.dataType = "json"; }
1448
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
1449
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
1450
+ $.ajax(s.ajax);
1451
+ break;
1452
+ }
1453
+ },
1454
+ _parse_json : function (js, is_callback) {
1455
+ var d = false,
1456
+ p = this._get_settings(),
1457
+ s = p.json_data,
1458
+ t = p.core.html_titles,
1459
+ tmp, i, j, ul1, ul2;
1460
+
1461
+ if(!js) { return d; }
1462
+ if($.isFunction(js)) {
1463
+ js = js.call(this);
1464
+ }
1465
+ if($.isArray(js)) {
1466
+ d = $();
1467
+ if(!js.length) { return false; }
1468
+ for(i = 0, j = js.length; i < j; i++) {
1469
+ tmp = this._parse_json(js[i], true);
1470
+ if(tmp.length) { d = d.add(tmp); }
1471
+ }
1472
+ }
1473
+ else {
1474
+ if(typeof js == "string") { js = { data : js }; }
1475
+ if(!js.data && js.data !== "") { return d; }
1476
+ d = $("<li>");
1477
+ if(js.attr) { d.attr(js.attr); }
1478
+ if(js.metadata) { d.data("jstree", js.metadata); }
1479
+ if(js.state) { d.addClass("jstree-" + js.state); }
1480
+ if(!$.isArray(js.data)) { tmp = js.data; js.data = []; js.data.push(tmp); }
1481
+ $.each(js.data, function (i, m) {
1482
+ tmp = $("<a>");
1483
+ if($.isFunction(m)) { m = m.call(this, js); }
1484
+ if(typeof m == "string") { tmp.attr('href','#')[ t ? "html" : "text" ](m); }
1485
+ else {
1486
+ if(!m.attr) { m.attr = {}; }
1487
+ if(!m.attr.href) { m.attr.href = '#'; }
1488
+ tmp.attr(m.attr)[ t ? "html" : "text" ](m.title);
1489
+ if(m.language) { tmp.addClass(m.language); }
1490
+ }
1491
+ tmp.prepend("<ins class='jstree-icon'>&#160;</ins>");
1492
+ if(!m.icon && js.icon) { m.icon = js.icon; }
1493
+ if(m.icon) {
1494
+ if(m.icon.indexOf("/") === -1) { tmp.children("ins").addClass(m.icon); }
1495
+ else { tmp.children("ins").css("background","url('" + m.icon + "') center center no-repeat"); }
1496
+ }
1497
+ d.append(tmp);
1498
+ });
1499
+ d.prepend("<ins class='jstree-icon'>&#160;</ins>");
1500
+ if(js.children) {
1501
+ if(s.progressive_render && js.state !== "open") {
1502
+ d.addClass("jstree-closed").data("jstree-children", js.children);
1503
+ }
1504
+ else {
1505
+ if($.isFunction(js.children)) {
1506
+ js.children = js.children.call(this, js);
1507
+ }
1508
+ if($.isArray(js.children) && js.children.length) {
1509
+ tmp = this._parse_json(js.children, true);
1510
+ if(tmp.length) {
1511
+ ul2 = $("<ul>");
1512
+ ul2.append(tmp);
1513
+ d.append(ul2);
1514
+ }
1515
+ }
1516
+ }
1517
+ }
1518
+ }
1519
+ if(!is_callback) {
1520
+ ul1 = $("<ul>");
1521
+ ul1.append(d);
1522
+ d = ul1;
1523
+ }
1524
+ return d;
1525
+ },
1526
+ get_json : function (obj, li_attr, a_attr, is_callback) {
1527
+ var result = [],
1528
+ s = this._get_settings(),
1529
+ _this = this,
1530
+ tmp1, tmp2, li, a, t, lang;
1531
+ obj = this._get_node(obj);
1532
+ if(!obj || obj === -1) { obj = this.get_container().find("> ul > li"); }
1533
+ li_attr = $.isArray(li_attr) ? li_attr : [ "id", "class" ];
1534
+ if(!is_callback && this.data.types) { li_attr.push(s.types.type_attr); }
1535
+ a_attr = $.isArray(a_attr) ? a_attr : [ ];
1536
+
1537
+ obj.each(function () {
1538
+ li = $(this);
1539
+ tmp1 = { data : [] };
1540
+ if(li_attr.length) { tmp1.attr = { }; }
1541
+ $.each(li_attr, function (i, v) {
1542
+ tmp2 = li.attr(v);
1543
+ if(tmp2 && tmp2.length && tmp2.replace(/jstree[^ ]*|$/ig,'').length) {
1544
+ tmp1.attr[v] = tmp2.replace(/jstree[^ ]*|$/ig,'');
1545
+ }
1546
+ });
1547
+ if(li.hasClass("jstree-open")) { tmp1.state = "open"; }
1548
+ if(li.hasClass("jstree-closed")) { tmp1.state = "closed"; }
1549
+ a = li.children("a");
1550
+ a.each(function () {
1551
+ t = $(this);
1552
+ if(
1553
+ a_attr.length ||
1554
+ $.inArray("languages", s.plugins) !== -1 ||
1555
+ t.children("ins").get(0).style.backgroundImage.length ||
1556
+ (t.children("ins").get(0).className && t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').length)
1557
+ ) {
1558
+ lang = false;
1559
+ if($.inArray("languages", s.plugins) !== -1 && $.isArray(s.languages) && s.languages.length) {
1560
+ $.each(s.languages, function (l, lv) {
1561
+ if(t.hasClass(lv)) {
1562
+ lang = lv;
1563
+ return false;
1564
+ }
1565
+ });
1566
+ }
1567
+ tmp2 = { attr : { }, title : _this.get_text(t, lang) };
1568
+ $.each(a_attr, function (k, z) {
1569
+ tmp1.attr[z] = (t.attr(z) || "").replace(/jstree[^ ]*|$/ig,'');
1570
+ });
1571
+ $.each(s.languages, function (k, z) {
1572
+ if(t.hasClass(z)) { tmp2.language = z; return true; }
1573
+ });
1574
+ if(t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"").length) {
1575
+ tmp2.icon = t.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"");
1576
+ }
1577
+ if(t.children("ins").get(0).style.backgroundImage.length) {
1578
+ tmp2.icon = t.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","");
1579
+ }
1580
+ }
1581
+ else {
1582
+ tmp2 = _this.get_text(t);
1583
+ }
1584
+ if(a.length > 1) { tmp1.data.push(tmp2); }
1585
+ else { tmp1.data = tmp2; }
1586
+ });
1587
+ li = li.find("> ul > li");
1588
+ if(li.length) { tmp1.children = _this.get_json(li, li_attr, a_attr, true); }
1589
+ result.push(tmp1);
1590
+ });
1591
+ return result;
1592
+ }
1593
+ }
1594
+ });
1595
+ })(jQuery);
1596
+ //*/
1597
+
1598
+ /*
1599
+ * jsTree languages plugin 1.0
1600
+ * Adds support for multiple language versions in one tree
1601
+ * This basically allows for many titles coexisting in one node, but only one of them being visible at any given time
1602
+ * This is useful for maintaining the same structure in many languages (hence the name of the plugin)
1603
+ */
1604
+ (function ($) {
1605
+ $.jstree.plugin("languages", {
1606
+ __init : function () { this._load_css(); },
1607
+ defaults : [],
1608
+ _fn : {
1609
+ set_lang : function (i) {
1610
+ var langs = this._get_settings().languages,
1611
+ st = false,
1612
+ selector = ".jstree-" + this.get_index() + ' a';
1613
+ if(!$.isArray(langs) || langs.length === 0) { return false; }
1614
+ if($.inArray(i,langs) == -1) {
1615
+ if(!!langs[i]) { i = langs[i]; }
1616
+ else { return false; }
1617
+ }
1618
+ if(i == this.data.languages.current_language) { return true; }
1619
+ st = $.vakata.css.get_css(selector + "." + this.data.languages.current_language, false, this.data.languages.language_css);
1620
+ if(st !== false) { st.style.display = "none"; }
1621
+ st = $.vakata.css.get_css(selector + "." + i, false, this.data.languages.language_css);
1622
+ if(st !== false) { st.style.display = ""; }
1623
+ this.data.languages.current_language = i;
1624
+ this.__callback(i);
1625
+ return true;
1626
+ },
1627
+ get_lang : function () {
1628
+ return this.data.languages.current_language;
1629
+ },
1630
+ get_text : function (obj, lang) {
1631
+ obj = this._get_node(obj) || this.data.ui.last_selected;
1632
+ if(!obj.size()) { return false; }
1633
+ var langs = this._get_settings().languages,
1634
+ s = this._get_settings().core.html_titles;
1635
+ if($.isArray(langs) && langs.length) {
1636
+ lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
1637
+ obj = obj.children("a." + lang);
1638
+ }
1639
+ else { obj = obj.children("a:eq(0)"); }
1640
+ if(s) {
1641
+ obj = obj.clone();
1642
+ obj.children("INS").remove();
1643
+ return obj.html();
1644
+ }
1645
+ else {
1646
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
1647
+ return obj.nodeValue;
1648
+ }
1649
+ },
1650
+ set_text : function (obj, val, lang) {
1651
+ obj = this._get_node(obj) || this.data.ui.last_selected;
1652
+ if(!obj.size()) { return false; }
1653
+ var langs = this._get_settings().languages,
1654
+ s = this._get_settings().core.html_titles,
1655
+ tmp;
1656
+ if($.isArray(langs) && langs.length) {
1657
+ lang = (lang && $.inArray(lang,langs) != -1) ? lang : this.data.languages.current_language;
1658
+ obj = obj.children("a." + lang);
1659
+ }
1660
+ else { obj = obj.children("a:eq(0)"); }
1661
+ if(s) {
1662
+ tmp = obj.children("INS").clone();
1663
+ obj.html(val).prepend(tmp);
1664
+ this.__callback({ "obj" : obj, "name" : val, "lang" : lang });
1665
+ return true;
1666
+ }
1667
+ else {
1668
+ obj = obj.contents().filter(function() { return this.nodeType == 3; })[0];
1669
+ this.__callback({ "obj" : obj, "name" : val, "lang" : lang });
1670
+ return (obj.nodeValue = val);
1671
+ }
1672
+ },
1673
+ _load_css : function () {
1674
+ var langs = this._get_settings().languages,
1675
+ str = "/* languages css */",
1676
+ selector = ".jstree-" + this.get_index() + ' a',
1677
+ ln;
1678
+ if($.isArray(langs) && langs.length) {
1679
+ this.data.languages.current_language = langs[0];
1680
+ for(ln = 0; ln < langs.length; ln++) {
1681
+ str += selector + "." + langs[ln] + " {";
1682
+ if(langs[ln] != this.data.languages.current_language) { str += " display:none; "; }
1683
+ str += " } ";
1684
+ }
1685
+ this.data.languages.language_css = $.vakata.css.add_sheet({ 'str' : str });
1686
+ }
1687
+ },
1688
+ create_node : function (obj, position, js, callback) {
1689
+ var t = this.__call_old(true, obj, position, js, function (t) {
1690
+ var langs = this._get_settings().languages,
1691
+ a = t.children("a"),
1692
+ ln;
1693
+ if($.isArray(langs) && langs.length) {
1694
+ for(ln = 0; ln < langs.length; ln++) {
1695
+ if(!a.is("." + langs[ln])) {
1696
+ t.append(a.eq(0).clone().removeClass(langs.join(" ")).addClass(langs[ln]));
1697
+ }
1698
+ }
1699
+ a.not("." + langs.join(", .")).remove();
1700
+ }
1701
+ if(callback) { callback.call(this, t); }
1702
+ });
1703
+ return t;
1704
+ }
1705
+ }
1706
+ });
1707
+ })(jQuery);
1708
+ //*/
1709
+
1710
+ /*
1711
+ * jsTree cookies plugin 1.0
1712
+ * Stores the currently opened/selected nodes in a cookie and then restores them
1713
+ * Depends on the jquery.cookie plugin
1714
+ */
1715
+ (function ($) {
1716
+ $.jstree.plugin("cookies", {
1717
+ __init : function () {
1718
+ if(typeof $.cookie === "undefined") { throw "jsTree cookie: jQuery cookie plugin not included."; }
1719
+
1720
+ var s = this._get_settings().cookies,
1721
+ tmp;
1722
+ if(!!s.save_opened) {
1723
+ tmp = $.cookie(s.save_opened);
1724
+ if(tmp && tmp.length) { this.data.core.to_open = tmp.split(","); }
1725
+ }
1726
+ if(!!s.save_selected) {
1727
+ tmp = $.cookie(s.save_selected);
1728
+ if(tmp && tmp.length && this.data.ui) { this.data.ui.to_select = tmp.split(","); }
1729
+ }
1730
+ this.get_container()
1731
+ .one( ( this.data.ui ? "reselect" : "reopen" ) + ".jstree", $.proxy(function () {
1732
+ this.get_container()
1733
+ .bind("open_node.jstree close_node.jstree select_node.jstree deselect_node.jstree", $.proxy(function (e) {
1734
+ if(this._get_settings().cookies.auto_save) { this.save_cookie((e.handleObj.namespace + e.handleObj.type).replace("jstree","")); }
1735
+ }, this));
1736
+ }, this));
1737
+ },
1738
+ defaults : {
1739
+ save_opened : "jstree_open",
1740
+ save_selected : "jstree_select",
1741
+ auto_save : true,
1742
+ cookie_options : {}
1743
+ },
1744
+ _fn : {
1745
+ save_cookie : function (c) {
1746
+ if(this.data.core.refreshing) { return; }
1747
+ var s = this._get_settings().cookies;
1748
+ if(!c) { // if called manually and not by event
1749
+ if(s.save_opened) {
1750
+ this.save_opened();
1751
+ $.cookie(s.save_opened, this.data.core.to_open.join(","), s.cookie_options);
1752
+ }
1753
+ if(s.save_selected && this.data.ui) {
1754
+ this.save_selected();
1755
+ $.cookie(s.save_selected, this.data.ui.to_select.join(","), s.cookie_options);
1756
+ }
1757
+ return;
1758
+ }
1759
+ switch(c) {
1760
+ case "open_node":
1761
+ case "close_node":
1762
+ if(!!s.save_opened) {
1763
+ this.save_opened();
1764
+ $.cookie(s.save_opened, this.data.core.to_open.join(","), s.cookie_options);
1765
+ }
1766
+ break;
1767
+ case "select_node":
1768
+ case "deselect_node":
1769
+ if(!!s.save_selected && this.data.ui) {
1770
+ this.save_selected();
1771
+ $.cookie(s.save_selected, this.data.ui.to_select.join(","), s.cookie_options);
1772
+ }
1773
+ break;
1774
+ }
1775
+ }
1776
+ }
1777
+ });
1778
+ // include cookies by default
1779
+ $.jstree.defaults.plugins.push("cookies");
1780
+ })(jQuery);
1781
+ //*/
1782
+
1783
+ /*
1784
+ * jsTree sort plugin 1.0
1785
+ * Sorts items alphabetically (or using any other function)
1786
+ */
1787
+ (function ($) {
1788
+ $.jstree.plugin("sort", {
1789
+ __init : function () {
1790
+ this.get_container()
1791
+ .bind("load_node.jstree", $.proxy(function (e, data) {
1792
+ var obj = this._get_node(data.rslt.obj);
1793
+ obj = obj === -1 ? this.get_container().children("ul") : obj.children("ul");
1794
+ this.sort(obj);
1795
+ }, this))
1796
+ .bind("rename_node.jstree", $.proxy(function (e, data) {
1797
+ this.sort(data.rslt.obj.parent());
1798
+ }, this))
1799
+ .bind("move_node.jstree", $.proxy(function (e, data) {
1800
+ var m = data.rslt.np == -1 ? this.get_container() : data.rslt.np;
1801
+ this.sort(m.children("ul"));
1802
+ }, this));
1803
+ },
1804
+ defaults : function (a, b) { return this.get_text(a) > this.get_text(b) ? 1 : -1; },
1805
+ _fn : {
1806
+ sort : function (obj) {
1807
+ var s = this._get_settings().sort,
1808
+ t = this;
1809
+ obj.append($.makeArray(obj.children("li")).sort($.proxy(s, t)));
1810
+ obj.find("> li > ul").each(function() { t.sort($(this)); });
1811
+ this.clean_node(obj);
1812
+ }
1813
+ }
1814
+ });
1815
+ })(jQuery);
1816
+ //*/
1817
+
1818
+ /*
1819
+ * jsTree DND plugin 1.0
1820
+ * Drag and drop plugin for moving/copying nodes
1821
+ */
1822
+ (function ($) {
1823
+ var o = false,
1824
+ r = false,
1825
+ m = false,
1826
+ sli = false,
1827
+ sti = false,
1828
+ dir1 = false,
1829
+ dir2 = false;
1830
+ $.vakata.dnd = {
1831
+ is_down : false,
1832
+ is_drag : false,
1833
+ helper : false,
1834
+ scroll_spd : 10,
1835
+ init_x : 0,
1836
+ init_y : 0,
1837
+ threshold : 5,
1838
+ user_data : {},
1839
+
1840
+ drag_start : function (e, data, html) {
1841
+ if($.vakata.dnd.is_drag) { $.vakata.drag_stop({}); }
1842
+ try {
1843
+ e.currentTarget.unselectable = "on";
1844
+ e.currentTarget.onselectstart = function() { return false; };
1845
+ if(e.currentTarget.style) { e.currentTarget.style.MozUserSelect = "none"; }
1846
+ } catch(err) { }
1847
+ $.vakata.dnd.init_x = e.pageX;
1848
+ $.vakata.dnd.init_y = e.pageY;
1849
+ $.vakata.dnd.user_data = data;
1850
+ $.vakata.dnd.is_down = true;
1851
+ $.vakata.dnd.helper = $("<div id='vakata-dragged'>").html(html).css("opacity", "0.75");
1852
+ $(document).bind("mousemove", $.vakata.dnd.drag);
1853
+ $(document).bind("mouseup", $.vakata.dnd.drag_stop);
1854
+ return false;
1855
+ },
1856
+ drag : function (e) {
1857
+ if(!$.vakata.dnd.is_down) { return; }
1858
+ if(!$.vakata.dnd.is_drag) {
1859
+ if(Math.abs(e.pageX - $.vakata.dnd.init_x) > 5 || Math.abs(e.pageY - $.vakata.dnd.init_y) > 5) {
1860
+ $.vakata.dnd.helper.appendTo("body");
1861
+ $.vakata.dnd.is_drag = true;
1862
+ $(document).triggerHandler("drag_start.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
1863
+ }
1864
+ else { return; }
1865
+ }
1866
+
1867
+ // maybe use a scrolling parent element instead of document?
1868
+ if(e.type === "mousemove") { // thought of adding scroll in order to move the helper, but mouse poisition is n/a
1869
+ var d = $(document), t = d.scrollTop(), l = d.scrollLeft();
1870
+ if(e.pageY - t < 20) {
1871
+ if(sti && dir1 === "down") { clearInterval(sti); sti = false; }
1872
+ if(!sti) { dir1 = "up"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() - $.vakata.dnd.scroll_spd); }, 150); }
1873
+ }
1874
+ else {
1875
+ if(sti && dir1 === "up") { clearInterval(sti); sti = false; }
1876
+ }
1877
+ if($(window).height() - (e.pageY - t) < 20) {
1878
+ if(sti && dir1 === "up") { clearInterval(sti); sti = false; }
1879
+ if(!sti) { dir1 = "down"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() + $.vakata.dnd.scroll_spd); }, 150); }
1880
+ }
1881
+ else {
1882
+ if(sti && dir1 === "down") { clearInterval(sti); sti = false; }
1883
+ }
1884
+
1885
+ if(e.pageX - l < 20) {
1886
+ if(sli && dir2 === "right") { clearInterval(sli); sli = false; }
1887
+ if(!sli) { dir2 = "left"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() - $.vakata.dnd.scroll_spd); }, 150); }
1888
+ }
1889
+ else {
1890
+ if(sli && dir2 === "left") { clearInterval(sli); sli = false; }
1891
+ }
1892
+ if($(window).width() - (e.pageX - l) < 20) {
1893
+ if(sli && dir2 === "left") { clearInterval(sli); sli = false; }
1894
+ if(!sli) { dir2 = "right"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() + $.vakata.dnd.scroll_spd); }, 150); }
1895
+ }
1896
+ else {
1897
+ if(sli && dir2 === "right") { clearInterval(sli); sli = false; }
1898
+ }
1899
+ }
1900
+
1901
+ $.vakata.dnd.helper.css({ left : (e.pageX + 5) + "px", top : (e.pageY + 10) + "px" });
1902
+ $(document).triggerHandler("drag.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
1903
+ },
1904
+ drag_stop : function (e) {
1905
+ $(document).unbind("mousemove", $.vakata.dnd.drag);
1906
+ $(document).unbind("mouseup", $.vakata.dnd.drag_stop);
1907
+ $(document).triggerHandler("drag_stop.vakata", { "event" : e, "data" : $.vakata.dnd.user_data });
1908
+ $.vakata.dnd.helper.remove();
1909
+ $.vakata.dnd.init_x = 0;
1910
+ $.vakata.dnd.init_y = 0;
1911
+ $.vakata.dnd.user_data = {};
1912
+ $.vakata.dnd.is_down = false;
1913
+ $.vakata.dnd.is_drag = false;
1914
+ }
1915
+ };
1916
+ $(function() {
1917
+ 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; } ';
1918
+ $.vakata.css.add_sheet({ str : css_string });
1919
+ });
1920
+
1921
+ $.jstree.plugin("dnd", {
1922
+ __init : function () {
1923
+ this.data.dnd = {
1924
+ active : false,
1925
+ after : false,
1926
+ inside : false,
1927
+ before : false,
1928
+ off : false,
1929
+ prepared : false,
1930
+ w : 0,
1931
+ to1 : false,
1932
+ to2 : false,
1933
+ cof : false,
1934
+ cw : false,
1935
+ ch : false,
1936
+ i1 : false,
1937
+ i2 : false
1938
+ };
1939
+ this.get_container()
1940
+ .bind("mouseenter.jstree", $.proxy(function () {
1941
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree && this.data.themes) {
1942
+ m.attr("class", "jstree-" + this.data.themes.theme);
1943
+ $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
1944
+ }
1945
+ }, this))
1946
+ .bind("mouseleave.jstree", $.proxy(function () {
1947
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
1948
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
1949
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
1950
+ }
1951
+ }, this))
1952
+ .bind("mousemove.jstree", $.proxy(function (e) {
1953
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
1954
+ var cnt = this.get_container()[0];
1955
+
1956
+ // Horizontal scroll
1957
+ if(e.pageX + 24 > this.data.dnd.cof.left + this.data.dnd.cw) {
1958
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
1959
+ this.data.dnd.i1 = setInterval($.proxy(function () { this.scrollLeft += $.vakata.dnd.scroll_spd; }, cnt), 100);
1960
+ }
1961
+ else if(e.pageX - 24 < this.data.dnd.cof.left) {
1962
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
1963
+ this.data.dnd.i1 = setInterval($.proxy(function () { this.scrollLeft -= $.vakata.dnd.scroll_spd; }, cnt), 100);
1964
+ }
1965
+ else {
1966
+ if(this.data.dnd.i1) { clearInterval(this.data.dnd.i1); }
1967
+ }
1968
+
1969
+ // Vertical scroll
1970
+ if(e.pageY + 24 > this.data.dnd.cof.top + this.data.dnd.ch) {
1971
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
1972
+ this.data.dnd.i2 = setInterval($.proxy(function () { this.scrollTop += $.vakata.dnd.scroll_spd; }, cnt), 100);
1973
+ }
1974
+ else if(e.pageY - 24 < this.data.dnd.cof.top) {
1975
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
1976
+ this.data.dnd.i2 = setInterval($.proxy(function () { this.scrollTop -= $.vakata.dnd.scroll_spd; }, cnt), 100);
1977
+ }
1978
+ else {
1979
+ if(this.data.dnd.i2) { clearInterval(this.data.dnd.i2); }
1980
+ }
1981
+
1982
+ }
1983
+ }, this))
1984
+ .delegate("a", "mousedown.jstree", $.proxy(function (e) {
1985
+ if(e.which === 1) {
1986
+ this.start_drag(e.currentTarget, e);
1987
+ return false;
1988
+ }
1989
+ }, this))
1990
+ .delegate("a", "mouseenter.jstree", $.proxy(function (e) {
1991
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
1992
+ this.dnd_enter(e.currentTarget);
1993
+ }
1994
+ }, this))
1995
+ .delegate("a", "mousemove.jstree", $.proxy(function (e) {
1996
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
1997
+ if(typeof this.data.dnd.off.top === "undefined") { this.data.dnd.off = $(e.target).offset(); }
1998
+ this.data.dnd.w = (e.pageY - (this.data.dnd.off.top || 0)) % this.data.core.li_height;
1999
+ if(this.data.dnd.w < 0) { this.data.dnd.w += this.data.core.li_height; }
2000
+ this.dnd_show();
2001
+ }
2002
+ }, this))
2003
+ .delegate("a", "mouseleave.jstree", $.proxy(function (e) {
2004
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2005
+ this.data.dnd.after = false;
2006
+ this.data.dnd.before = false;
2007
+ this.data.dnd.inside = false;
2008
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
2009
+ m.hide();
2010
+ if(r && r[0] === e.target.parentNode) {
2011
+ if(this.data.dnd.to1) {
2012
+ clearTimeout(this.data.dnd.to1);
2013
+ this.data.dnd.to1 = false;
2014
+ }
2015
+ if(this.data.dnd.to2) {
2016
+ clearTimeout(this.data.dnd.to2);
2017
+ this.data.dnd.to2 = false;
2018
+ }
2019
+ }
2020
+ }
2021
+ }, this))
2022
+ .delegate("a", "mouseup.jstree", $.proxy(function (e) {
2023
+ if($.vakata.dnd.is_drag && $.vakata.dnd.user_data.jstree) {
2024
+ this.dnd_finish(e);
2025
+ }
2026
+ }, this));
2027
+
2028
+ $(document)
2029
+ .bind("drag_stop.vakata", $.proxy(function () {
2030
+ this.data.dnd.after = false;
2031
+ this.data.dnd.before = false;
2032
+ this.data.dnd.inside = false;
2033
+ this.data.dnd.off = false;
2034
+ this.data.dnd.prepared = false;
2035
+ this.data.dnd.w = false;
2036
+ this.data.dnd.to1 = false;
2037
+ this.data.dnd.to2 = false;
2038
+ this.data.dnd.active = false;
2039
+ this.data.dnd.foreign = false;
2040
+ if(m) { m.css({ "top" : "-2000px" }); }
2041
+ }, this))
2042
+ .bind("drag_start.vakata", $.proxy(function (e, data) {
2043
+ if(data.data.jstree) {
2044
+ var et = $(data.event.target);
2045
+ if(et.closest(".jstree").hasClass("jstree-" + this.get_index())) {
2046
+ this.dnd_enter(et);
2047
+ }
2048
+ }
2049
+ }, this));
2050
+
2051
+ var s = this._get_settings().dnd;
2052
+ if(s.drag_target) {
2053
+ $(document)
2054
+ .delegate(s.drag_target, "mousedown.jstree", $.proxy(function (e) {
2055
+ o = e.target;
2056
+ $.vakata.dnd.drag_start(e, { jstree : true, obj : e.target }, "<ins class='jstree-icon'></ins>" + $(e.target).text() );
2057
+ if(this.data.themes) {
2058
+ m.attr("class", "jstree-" + this.data.themes.theme);
2059
+ $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
2060
+ }
2061
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
2062
+ var cnt = this.get_container();
2063
+ this.data.dnd.cof = cnt.offset();
2064
+ this.data.dnd.cw = parseInt(cnt.width(),10);
2065
+ this.data.dnd.ch = parseInt(cnt.height(),10);
2066
+ this.data.dnd.foreign = true;
2067
+ return false;
2068
+ }, this));
2069
+ }
2070
+ if(s.drop_target) {
2071
+ $(document)
2072
+ .delegate(s.drop_target, "mouseenter.jstree", $.proxy(function (e) {
2073
+ if(this.data.dnd.active && this._get_settings().dnd.drop_check.call(this, { "o" : o, "r" : $(e.target) })) {
2074
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");
2075
+ }
2076
+ }, this))
2077
+ .delegate(s.drop_target, "mouseleave.jstree", $.proxy(function (e) {
2078
+ if(this.data.dnd.active) {
2079
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid");
2080
+ }
2081
+ }, this))
2082
+ .delegate(s.drop_target, "mouseup.jstree", $.proxy(function (e) {
2083
+ if(this.data.dnd.active && $.vakata.dnd.helper.children("ins").hasClass("jstree-ok")) {
2084
+ this._get_settings().dnd.drop_finish.call(this, { "o" : o, "r" : $(e.target) });
2085
+ }
2086
+ }, this));
2087
+ }
2088
+ },
2089
+ defaults : {
2090
+ copy_modifier : "ctrl",
2091
+ check_timeout : 200,
2092
+ open_timeout : 500,
2093
+ drop_target : ".jstree-drop",
2094
+ drop_check : function (data) { return true; },
2095
+ drop_finish : $.noop,
2096
+ drag_target : ".jstree-draggable",
2097
+ drag_finish : $.noop,
2098
+ drag_check : function (data) { return { after : false, before : false, inside : true }; }
2099
+ },
2100
+ _fn : {
2101
+ dnd_prepare : function () {
2102
+ if(!r || !r.length) { return; }
2103
+ this.data.dnd.off = r.offset();
2104
+ if(this._get_settings().core.rtl) {
2105
+ this.data.dnd.off.right = this.data.dnd.off.left + r.width();
2106
+ }
2107
+ if(this.data.dnd.foreign) {
2108
+ var a = this._get_settings().dnd.drag_check.call(this, { "o" : o, "r" : r });
2109
+ this.data.dnd.after = a.after;
2110
+ this.data.dnd.before = a.before;
2111
+ this.data.dnd.inside = a.inside;
2112
+ this.data.dnd.prepared = true;
2113
+ return this.dnd_show();
2114
+ }
2115
+ this.prepare_move(o, r, "before");
2116
+ this.data.dnd.before = this.check_move();
2117
+ this.prepare_move(o, r, "after");
2118
+ this.data.dnd.after = this.check_move();
2119
+ if(this._is_loaded(r)) {
2120
+ this.prepare_move(o, r, "inside");
2121
+ this.data.dnd.inside = this.check_move();
2122
+ }
2123
+ else {
2124
+ this.data.dnd.inside = false;
2125
+ }
2126
+ this.data.dnd.prepared = true;
2127
+ return this.dnd_show();
2128
+ },
2129
+ dnd_show : function () {
2130
+ if(!this.data.dnd.prepared) { return; }
2131
+ var o = ["before","inside","after"],
2132
+ r = false,
2133
+ rtl = this._get_settings().core.rtl,
2134
+ pos;
2135
+ if(this.data.dnd.w < this.data.core.li_height/3) { o = ["before","inside","after"]; }
2136
+ else if(this.data.dnd.w <= this.data.core.li_height*2/3) {
2137
+ o = this.data.dnd.w < this.data.core.li_height/2 ? ["inside","before","after"] : ["inside","after","before"];
2138
+ }
2139
+ else { o = ["after","inside","before"]; }
2140
+ $.each(o, $.proxy(function (i, val) {
2141
+ if(this.data.dnd[val]) {
2142
+ $.vakata.dnd.helper.children("ins").attr("class","jstree-ok");
2143
+ r = val;
2144
+ return false;
2145
+ }
2146
+ }, this));
2147
+ if(r === false) { $.vakata.dnd.helper.children("ins").attr("class","jstree-invalid"); }
2148
+
2149
+ pos = rtl ? (this.data.dnd.off.right - 18) : (this.data.dnd.off.left + 10);
2150
+ switch(r) {
2151
+ case "before":
2152
+ m.css({ "left" : pos + "px", "top" : (this.data.dnd.off.top - 6) + "px" }).show();
2153
+ break;
2154
+ case "after":
2155
+ m.css({ "left" : pos + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height - 7) + "px" }).show();
2156
+ break;
2157
+ case "inside":
2158
+ m.css({ "left" : pos + ( rtl ? -4 : 4) + "px", "top" : (this.data.dnd.off.top + this.data.core.li_height/2 - 5) + "px" }).show();
2159
+ break;
2160
+ default:
2161
+ m.hide();
2162
+ break;
2163
+ }
2164
+ return r;
2165
+ },
2166
+ dnd_open : function () {
2167
+ this.data.dnd.to2 = false;
2168
+ this.open_node(r, $.proxy(this.dnd_prepare,this), true);
2169
+ },
2170
+ dnd_finish : function (e) {
2171
+ if(this.data.dnd.foreign) {
2172
+ if(this.data.dnd.after || this.data.dnd.before || this.data.dnd.inside) {
2173
+ this._get_settings().dnd.drag_finish.call(this, { "o" : o, "r" : r });
2174
+ }
2175
+ }
2176
+ else {
2177
+ this.dnd_prepare();
2178
+ this.move_node(o, r, this.dnd_show(), e[this._get_settings().dnd.copy_modifier + "Key"]);
2179
+ }
2180
+ o = false;
2181
+ r = false;
2182
+ m.hide();
2183
+ },
2184
+ dnd_enter : function (obj) {
2185
+ var s = this._get_settings().dnd;
2186
+ this.data.dnd.prepared = false;
2187
+ r = this._get_node(obj);
2188
+ if(s.check_timeout) {
2189
+ // do the calculations after a minimal timeout (users tend to drag quickly to the desired location)
2190
+ if(this.data.dnd.to1) { clearTimeout(this.data.dnd.to1); }
2191
+ this.data.dnd.to1 = setTimeout($.proxy(this.dnd_prepare, this), s.check_timeout);
2192
+ }
2193
+ else {
2194
+ this.dnd_prepare();
2195
+ }
2196
+ if(s.open_timeout) {
2197
+ if(this.data.dnd.to2) { clearTimeout(this.data.dnd.to2); }
2198
+ if(r && r.length && r.hasClass("jstree-closed")) {
2199
+ // if the node is closed - open it, then recalculate
2200
+ this.data.dnd.to2 = setTimeout($.proxy(this.dnd_open, this), s.open_timeout);
2201
+ }
2202
+ }
2203
+ else {
2204
+ if(r && r.length && r.hasClass("jstree-closed")) {
2205
+ this.dnd_open();
2206
+ }
2207
+ }
2208
+ },
2209
+ start_drag : function (obj, e) {
2210
+ o = this._get_node(obj);
2211
+ if(this.data.ui && this.is_selected(o)) { o = this._get_node(null, true); }
2212
+ $.vakata.dnd.drag_start(e, { jstree : true, obj : o }, "<ins class='jstree-icon'></ins>" + (o.length > 1 ? "Multiple selection" : this.get_text(o)) );
2213
+ if(this.data.themes) {
2214
+ m.attr("class", "jstree-" + this.data.themes.theme);
2215
+ $.vakata.dnd.helper.attr("class", "jstree-dnd-helper jstree-" + this.data.themes.theme);
2216
+ }
2217
+ var cnt = this.get_container();
2218
+ this.data.dnd.cof = cnt.children("ul").offset();
2219
+ this.data.dnd.cw = parseInt(cnt.width(),10);
2220
+ this.data.dnd.ch = parseInt(cnt.height(),10);
2221
+ this.data.dnd.active = true;
2222
+ }
2223
+ }
2224
+ });
2225
+ $(function() {
2226
+ var css_string = '' +
2227
+ '#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; } ' +
2228
+ '#vakata-dragged .jstree-ok { background:green; } ' +
2229
+ '#vakata-dragged .jstree-invalid { background:red; } ' +
2230
+ '#jstree-marker { padding:0; margin:0; line-height:12px; font-size:1px; overflow:hidden; height:12px; width:8px; position:absolute; top:-30px; z-index:10000; background-repeat:no-repeat; display:none; background-color:silver; } ';
2231
+ $.vakata.css.add_sheet({ str : css_string });
2232
+ m = $("<div>").attr({ id : "jstree-marker" }).hide().appendTo("body");
2233
+ $(document).bind("drag_start.vakata", function (e, data) {
2234
+ if(data.data.jstree) {
2235
+ m.show();
2236
+ }
2237
+ });
2238
+ $(document).bind("drag_stop.vakata", function (e, data) {
2239
+ if(data.data.jstree) { m.hide(); }
2240
+ });
2241
+ });
2242
+ })(jQuery);
2243
+ //*/
2244
+
2245
+ /*
2246
+ * jsTree checkbox plugin 1.0
2247
+ * Inserts checkboxes in front of every node
2248
+ * Depends on the ui plugin
2249
+ * DOES NOT WORK NICELY WITH MULTITREE DRAG'N'DROP
2250
+ */
2251
+ (function ($) {
2252
+ $.jstree.plugin("checkbox", {
2253
+ __init : function () {
2254
+ this.select_node = this.deselect_node = this.deselect_all = $.noop;
2255
+ this.get_selected = this.get_checked;
2256
+
2257
+ this.get_container()
2258
+ .bind("open_node.jstree create_node.jstree clean_node.jstree", $.proxy(function (e, data) {
2259
+ this._prepare_checkboxes(data.rslt.obj);
2260
+ }, this))
2261
+ .bind("loaded.jstree", $.proxy(function (e) {
2262
+ this._prepare_checkboxes();
2263
+ }, this))
2264
+ .delegate("a", "click.jstree", $.proxy(function (e) {
2265
+ if(this._get_node(e.target).hasClass("jstree-checked")) { this.uncheck_node(e.target); }
2266
+ else { this.check_node(e.target); }
2267
+ if(this.data.ui) { this.save_selected(); }
2268
+ if(this.data.cookies) { this.save_cookie("select_node"); }
2269
+ e.preventDefault();
2270
+ }, this));
2271
+ },
2272
+ __destroy : function () {
2273
+ this.get_container().find(".jstree-checkbox").remove();
2274
+ },
2275
+ _fn : {
2276
+ _prepare_checkboxes : function (obj) {
2277
+ obj = !obj || obj == -1 ? this.get_container() : this._get_node(obj);
2278
+ var c, _this = this, t;
2279
+ obj.each(function () {
2280
+ t = $(this);
2281
+ c = t.is("li") && t.hasClass("jstree-checked") ? "jstree-checked" : "jstree-unchecked";
2282
+ t.find("a").not(":has(.jstree-checkbox)").prepend("<ins class='jstree-checkbox'>&#160;</ins>").parent().not(".jstree-checked, .jstree-unchecked").addClass(c);
2283
+ });
2284
+ if(obj.is("li")) { this._repair_state(obj); }
2285
+ else { obj.find("> ul > li").each(function () { _this._repair_state(this); }); }
2286
+ },
2287
+ change_state : function (obj, state) {
2288
+ obj = this._get_node(obj);
2289
+ state = (state === false || state === true) ? state : obj.hasClass("jstree-checked");
2290
+ if(state) { obj.find("li").andSelf().removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked"); }
2291
+ else {
2292
+ obj.find("li").andSelf().removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");
2293
+ if(this.data.ui) { this.data.ui.last_selected = obj; }
2294
+ this.data.checkbox.last_selected = obj;
2295
+ }
2296
+ obj.parentsUntil(".jstree", "li").each(function () {
2297
+ var $this = $(this);
2298
+ if(state) {
2299
+ if($this.children("ul").children(".jstree-checked, .jstree-undetermined").length) {
2300
+ $this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2301
+ return false;
2302
+ }
2303
+ else {
2304
+ $this.removeClass("jstree-checked jstree-undetermined").addClass("jstree-unchecked");
2305
+ }
2306
+ }
2307
+ else {
2308
+ if($this.children("ul").children(".jstree-unchecked, .jstree-undetermined").length) {
2309
+ $this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2310
+ return false;
2311
+ }
2312
+ else {
2313
+ $this.removeClass("jstree-unchecked jstree-undetermined").addClass("jstree-checked");
2314
+ }
2315
+ }
2316
+ });
2317
+ if(this.data.ui) { this.data.ui.selected = this.get_checked(); }
2318
+ this.__callback(obj);
2319
+ },
2320
+ check_node : function (obj) {
2321
+ this.change_state(obj, false);
2322
+ },
2323
+ uncheck_node : function (obj) {
2324
+ this.change_state(obj, true);
2325
+ },
2326
+ check_all : function () {
2327
+ var _this = this;
2328
+ this.get_container().children("ul").children("li").each(function () {
2329
+ _this.check_node(this, false);
2330
+ });
2331
+ },
2332
+ uncheck_all : function () {
2333
+ var _this = this;
2334
+ this.get_container().children("ul").children("li").each(function () {
2335
+ _this.change_state(this, true);
2336
+ });
2337
+ },
2338
+
2339
+ is_checked : function(obj) {
2340
+ obj = this._get_node(obj);
2341
+ return obj.length ? obj.is(".jstree-checked") : false;
2342
+ },
2343
+ get_checked : function (obj) {
2344
+ obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);
2345
+ return obj.find("> ul > .jstree-checked, .jstree-undetermined > ul > .jstree-checked");
2346
+ },
2347
+ get_unchecked : function (obj) {
2348
+ obj = !obj || obj === -1 ? this.get_container() : this._get_node(obj);
2349
+ return obj.find("> ul > .jstree-unchecked, .jstree-undetermined > ul > .jstree-unchecked");
2350
+ },
2351
+
2352
+ show_checkboxes : function () { this.get_container().children("ul").removeClass("jstree-no-checkboxes"); },
2353
+ hide_checkboxes : function () { this.get_container().children("ul").addClass("jstree-no-checkboxes"); },
2354
+
2355
+ _repair_state : function (obj) {
2356
+ obj = this._get_node(obj);
2357
+ if(!obj.length) { return; }
2358
+ var a = obj.find("> ul > .jstree-checked").length,
2359
+ b = obj.find("> ul > .jstree-undetermined").length,
2360
+ c = obj.find("> ul > li").length;
2361
+
2362
+ if(c === 0) { if(obj.hasClass("jstree-undetermined")) { this.check_node(obj); } }
2363
+ else if(a === 0 && b === 0) { this.uncheck_node(obj); }
2364
+ else if(a === c) { this.check_node(obj); }
2365
+ else {
2366
+ obj.parentsUntil(".jstree","li").removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
2367
+ }
2368
+ },
2369
+ reselect : function () {
2370
+ if(this.data.ui) {
2371
+ var _this = this,
2372
+ s = this.data.ui.to_select;
2373
+ s = $.map($.makeArray(s), function (n) { return "#" + n.toString().replace(/^#/,"").replace('\\/','/').replace('/','\\/'); });
2374
+ this.deselect_all();
2375
+ $.each(s, function (i, val) { _this.check_node(val); });
2376
+ this.__callback();
2377
+ }
2378
+ }
2379
+ }
2380
+ });
2381
+ })(jQuery);
2382
+ //*/
2383
+
2384
+ /*
2385
+ * jsTree XML 1.0
2386
+ * The XML data store. Datastores are build by overriding the `load_node` and `_is_loaded` functions.
2387
+ */
2388
+ (function ($) {
2389
+ $.vakata.xslt = function (xml, xsl, callback) {
2390
+ var rs = "", xm, xs, processor, support;
2391
+ if(document.recalc) {
2392
+ xm = document.createElement('xml');
2393
+ xs = document.createElement('xml');
2394
+ xm.innerHTML = xml;
2395
+ xs.innerHTML = xsl;
2396
+ $("body").append(xm).append(xs);
2397
+ setTimeout( (function (xm, xs, callback) {
2398
+ return function () {
2399
+ callback.call(null, xm.transformNode(xs.XMLDocument));
2400
+ setTimeout( (function (xm, xs) { return function () { jQuery("body").remove(xm).remove(xs); }; })(xm, xs), 200);
2401
+ };
2402
+ }) (xm, xs, callback), 100);
2403
+ return true;
2404
+ }
2405
+ if(typeof window.DOMParser !== "undefined" && typeof window.XMLHttpRequest !== "undefined" && typeof window.XSLTProcessor !== "undefined") {
2406
+ processor = new XSLTProcessor();
2407
+ support = $.isFunction(processor.transformDocument) ? (typeof window.XMLSerializer !== "undefined") : true;
2408
+ if(!support) { return false; }
2409
+ xml = new DOMParser().parseFromString(xml, "text/xml");
2410
+ xsl = new DOMParser().parseFromString(xsl, "text/xml");
2411
+ if($.isFunction(processor.transformDocument)) {
2412
+ rs = document.implementation.createDocument("", "", null);
2413
+ processor.transformDocument(xml, xsl, rs, null);
2414
+ callback.call(null, XMLSerializer().serializeToString(rs));
2415
+ return true;
2416
+ }
2417
+ else {
2418
+ processor.importStylesheet(xsl);
2419
+ rs = processor.transformToFragment(xml, document);
2420
+ callback.call(null, $("<div>").append(rs).html());
2421
+ return true;
2422
+ }
2423
+ }
2424
+ return false;
2425
+ };
2426
+ var xsl = {
2427
+ 'nest' : '<?xml version="1.0" encoding="utf-8" ?>' +
2428
+ '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >' +
2429
+ '<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/html" />' +
2430
+ '<xsl:template match="/">' +
2431
+ ' <xsl:call-template name="nodes">' +
2432
+ ' <xsl:with-param name="node" select="/root" />' +
2433
+ ' </xsl:call-template>' +
2434
+ '</xsl:template>' +
2435
+ '<xsl:template name="nodes">' +
2436
+ ' <xsl:param name="node" />' +
2437
+ ' <ul>' +
2438
+ ' <xsl:for-each select="$node/item">' +
2439
+ ' <xsl:variable name="children" select="count(./item) &gt; 0" />' +
2440
+ ' <li>' +
2441
+ ' <xsl:attribute name="class">' +
2442
+ ' <xsl:if test="position() = last()">jstree-last </xsl:if>' +
2443
+ ' <xsl:choose>' +
2444
+ ' <xsl:when test="@state = \'open\'">jstree-open </xsl:when>' +
2445
+ ' <xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>' +
2446
+ ' <xsl:otherwise>jstree-leaf </xsl:otherwise>' +
2447
+ ' </xsl:choose>' +
2448
+ ' <xsl:value-of select="@class" />' +
2449
+ ' </xsl:attribute>' +
2450
+ ' <xsl:for-each select="@*">' +
2451
+ ' <xsl:if test="name() != \'class\' and name() != \'state\' and name() != \'hasChildren\'">' +
2452
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
2453
+ ' </xsl:if>' +
2454
+ ' </xsl:for-each>' +
2455
+ ' <ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>' +
2456
+ ' <xsl:for-each select="content/name">' +
2457
+ ' <a>' +
2458
+ ' <xsl:attribute name="href">' +
2459
+ ' <xsl:choose>' +
2460
+ ' <xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>' +
2461
+ ' <xsl:otherwise>#</xsl:otherwise>' +
2462
+ ' </xsl:choose>' +
2463
+ ' </xsl:attribute>' +
2464
+ ' <xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>' +
2465
+ ' <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>' +
2466
+ ' <xsl:for-each select="@*">' +
2467
+ ' <xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">' +
2468
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
2469
+ ' </xsl:if>' +
2470
+ ' </xsl:for-each>' +
2471
+ ' <ins>' +
2472
+ ' <xsl:attribute name="class">jstree-icon ' +
2473
+ ' <xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>' +
2474
+ ' </xsl:attribute>' +
2475
+ ' <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>' +
2476
+ ' <xsl:text>&#xa0;</xsl:text>' +
2477
+ ' </ins>' +
2478
+ ' <xsl:value-of select="current()" />' +
2479
+ ' </a>' +
2480
+ ' </xsl:for-each>' +
2481
+ ' <xsl:if test="$children or @hasChildren"><xsl:call-template name="nodes"><xsl:with-param name="node" select="current()" /></xsl:call-template></xsl:if>' +
2482
+ ' </li>' +
2483
+ ' </xsl:for-each>' +
2484
+ ' </ul>' +
2485
+ '</xsl:template>' +
2486
+ '</xsl:stylesheet>',
2487
+
2488
+ 'flat' : '<?xml version="1.0" encoding="utf-8" ?>' +
2489
+ '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >' +
2490
+ '<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/xml" />' +
2491
+ '<xsl:template match="/">' +
2492
+ ' <ul>' +
2493
+ ' <xsl:for-each select="//item[not(@parent_id) or @parent_id=0 or not(@parent_id = //item/@id)]">' + /* the last `or` may be removed */
2494
+ ' <xsl:call-template name="nodes">' +
2495
+ ' <xsl:with-param name="node" select="." />' +
2496
+ ' <xsl:with-param name="is_last" select="number(position() = last())" />' +
2497
+ ' </xsl:call-template>' +
2498
+ ' </xsl:for-each>' +
2499
+ ' </ul>' +
2500
+ '</xsl:template>' +
2501
+ '<xsl:template name="nodes">' +
2502
+ ' <xsl:param name="node" />' +
2503
+ ' <xsl:param name="is_last" />' +
2504
+ ' <xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) &gt; 0" />' +
2505
+ ' <li>' +
2506
+ ' <xsl:attribute name="class">' +
2507
+ ' <xsl:if test="$is_last = true()">jstree-last </xsl:if>' +
2508
+ ' <xsl:choose>' +
2509
+ ' <xsl:when test="@state = \'open\'">jstree-open </xsl:when>' +
2510
+ ' <xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>' +
2511
+ ' <xsl:otherwise>jstree-leaf </xsl:otherwise>' +
2512
+ ' </xsl:choose>' +
2513
+ ' <xsl:value-of select="@class" />' +
2514
+ ' </xsl:attribute>' +
2515
+ ' <xsl:for-each select="@*">' +
2516
+ ' <xsl:if test="name() != \'parent_id\' and name() != \'hasChildren\' and name() != \'class\' and name() != \'state\'">' +
2517
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
2518
+ ' </xsl:if>' +
2519
+ ' </xsl:for-each>' +
2520
+ ' <ins class="jstree-icon"><xsl:text>&#xa0;</xsl:text></ins>' +
2521
+ ' <xsl:for-each select="content/name">' +
2522
+ ' <a>' +
2523
+ ' <xsl:attribute name="href">' +
2524
+ ' <xsl:choose>' +
2525
+ ' <xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>' +
2526
+ ' <xsl:otherwise>#</xsl:otherwise>' +
2527
+ ' </xsl:choose>' +
2528
+ ' </xsl:attribute>' +
2529
+ ' <xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>' +
2530
+ ' <xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>' +
2531
+ ' <xsl:for-each select="@*">' +
2532
+ ' <xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">' +
2533
+ ' <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>' +
2534
+ ' </xsl:if>' +
2535
+ ' </xsl:for-each>' +
2536
+ ' <ins>' +
2537
+ ' <xsl:attribute name="class">jstree-icon ' +
2538
+ ' <xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>' +
2539
+ ' </xsl:attribute>' +
2540
+ ' <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>' +
2541
+ ' <xsl:text>&#xa0;</xsl:text>' +
2542
+ ' </ins>' +
2543
+ ' <xsl:value-of select="current()" />' +
2544
+ ' </a>' +
2545
+ ' </xsl:for-each>' +
2546
+ ' <xsl:if test="$children">' +
2547
+ ' <ul>' +
2548
+ ' <xsl:for-each select="//item[@parent_id=$node/attribute::id]">' +
2549
+ ' <xsl:call-template name="nodes">' +
2550
+ ' <xsl:with-param name="node" select="." />' +
2551
+ ' <xsl:with-param name="is_last" select="number(position() = last())" />' +
2552
+ ' </xsl:call-template>' +
2553
+ ' </xsl:for-each>' +
2554
+ ' </ul>' +
2555
+ ' </xsl:if>' +
2556
+ ' </li>' +
2557
+ '</xsl:template>' +
2558
+ '</xsl:stylesheet>'
2559
+ };
2560
+ $.jstree.plugin("xml_data", {
2561
+ defaults : {
2562
+ data : false,
2563
+ ajax : false,
2564
+ xsl : "flat",
2565
+ clean_node : false,
2566
+ correct_state : true
2567
+ },
2568
+ _fn : {
2569
+ load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_xml(obj, function () { _this.__callback({ "obj" : obj }); s_call.call(this); }, e_call); },
2570
+ _is_loaded : function (obj) {
2571
+ var s = this._get_settings().xml_data;
2572
+ obj = this._get_node(obj);
2573
+ return obj == -1 || !obj || !s.ajax || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
2574
+ },
2575
+ load_node_xml : function (obj, s_call, e_call) {
2576
+ var s = this.get_settings().xml_data,
2577
+ error_func = function () {},
2578
+ success_func = function () {};
2579
+
2580
+ obj = this._get_node(obj);
2581
+ if(obj && obj !== -1) {
2582
+ if(obj.data("jstree-is-loading")) { return; }
2583
+ else { obj.data("jstree-is-loading",true); }
2584
+ }
2585
+ switch(!0) {
2586
+ case (!s.data && !s.ajax): throw "Neither data nor ajax settings supplied.";
2587
+ case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
2588
+ if(!obj || obj == -1) {
2589
+ this.parse_xml(s.data, $.proxy(function (d) {
2590
+ if(d) {
2591
+ d = d.replace(/ ?xmlns="[^"]*"/ig, "");
2592
+ if(d.length > 10) {
2593
+ d = $(d);
2594
+ this.get_container().children("ul").empty().append(d.children());
2595
+ if(s.clean_node) { this.clean_node(obj); }
2596
+ if(s_call) { s_call.call(this); }
2597
+ }
2598
+ }
2599
+ else {
2600
+ if(s.correct_state) {
2601
+ this.get_container().children("ul").empty();
2602
+ if(s_call) { s_call.call(this); }
2603
+ }
2604
+ }
2605
+ }, this));
2606
+ }
2607
+ break;
2608
+ case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
2609
+ error_func = function (x, t, e) {
2610
+ var ef = this.get_settings().xml_data.ajax.error;
2611
+ if(ef) { ef.call(this, x, t, e); }
2612
+ if(obj !== -1 && obj.length) {
2613
+ obj.children(".jstree-loading").removeClass("jstree-loading");
2614
+ obj.data("jstree-is-loading",false);
2615
+ if(t === "success" && s.correct_state) { obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf"); }
2616
+ }
2617
+ else {
2618
+ if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
2619
+ }
2620
+ if(e_call) { e_call.call(this); }
2621
+ };
2622
+ success_func = function (d, t, x) {
2623
+ d = x.responseText;
2624
+ var sf = this.get_settings().xml_data.ajax.success;
2625
+ if(sf) { d = sf.call(this,d,t,x) || d; }
2626
+ if(d == "") {
2627
+ return error_func.call(this, x, t, "");
2628
+ }
2629
+ this.parse_xml(d, $.proxy(function (d) {
2630
+ if(d) {
2631
+ d = d.replace(/ ?xmlns="[^"]*"/ig, "");
2632
+ if(d.length > 10) {
2633
+ d = $(d);
2634
+ if(obj === -1 || !obj) { this.get_container().children("ul").empty().append(d.children()); }
2635
+ else { obj.children(".jstree-loading").removeClass("jstree-loading"); obj.append(d); obj.data("jstree-is-loading",false); }
2636
+ if(s.clean_node) { this.clean_node(obj); }
2637
+ if(s_call) { s_call.call(this); }
2638
+ }
2639
+ else {
2640
+ if(obj && obj !== -1) {
2641
+ obj.children(".jstree-loading").removeClass("jstree-loading");
2642
+ obj.data("jstree-is-loading",false);
2643
+ if(s.correct_state) {
2644
+ obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
2645
+ if(s_call) { s_call.call(this); }
2646
+ }
2647
+ }
2648
+ else {
2649
+ if(s.correct_state) {
2650
+ this.get_container().children("ul").empty();
2651
+ if(s_call) { s_call.call(this); }
2652
+ }
2653
+ }
2654
+ }
2655
+ }
2656
+ }, this));
2657
+ };
2658
+ s.ajax.context = this;
2659
+ s.ajax.error = error_func;
2660
+ s.ajax.success = success_func;
2661
+ if(!s.ajax.dataType) { s.ajax.dataType = "xml"; }
2662
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
2663
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
2664
+ $.ajax(s.ajax);
2665
+ break;
2666
+ }
2667
+ },
2668
+ parse_xml : function (xml, callback) {
2669
+ var s = this._get_settings().xml_data;
2670
+ $.vakata.xslt(xml, xsl[s.xsl], callback);
2671
+ },
2672
+ get_xml : function (tp, obj, li_attr, a_attr, is_callback) {
2673
+ var result = "",
2674
+ s = this._get_settings(),
2675
+ _this = this,
2676
+ tmp1, tmp2, li, a, lang;
2677
+ if(!tp) { tp = "flat"; }
2678
+ if(!is_callback) { is_callback = 0; }
2679
+ obj = this._get_node(obj);
2680
+ if(!obj || obj === -1) { obj = this.get_container().find("> ul > li"); }
2681
+ li_attr = $.isArray(li_attr) ? li_attr : [ "id", "class" ];
2682
+ if(!is_callback && this.data.types && $.inArray(s.types.type_attr, li_attr) === -1) { li_attr.push(s.types.type_attr); }
2683
+
2684
+ a_attr = $.isArray(a_attr) ? a_attr : [ ];
2685
+
2686
+ if(!is_callback) { result += "<root>"; }
2687
+ obj.each(function () {
2688
+ result += "<item";
2689
+ li = $(this);
2690
+ $.each(li_attr, function (i, v) { result += " " + v + "=\"" + (li.attr(v) || "").replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"") + "\""; });
2691
+ if(li.hasClass("jstree-open")) { result += " state=\"open\""; }
2692
+ if(li.hasClass("jstree-closed")) { result += " state=\"closed\""; }
2693
+ if(tp === "flat") { result += " parent_id=\"" + is_callback + "\""; }
2694
+ result += ">";
2695
+ result += "<content>";
2696
+ a = li.children("a");
2697
+ a.each(function () {
2698
+ tmp1 = $(this);
2699
+ lang = false;
2700
+ result += "<name";
2701
+ if($.inArray("languages", s.plugins) !== -1) {
2702
+ $.each(s.languages, function (k, z) {
2703
+ if(tmp1.hasClass(z)) { result += " lang=\"" + z + "\""; lang = z; return false; }
2704
+ });
2705
+ }
2706
+ if(a_attr.length) {
2707
+ $.each(a_attr, function (k, z) {
2708
+ result += " " + z + "=\"" + (tmp1.attr(z) || "").replace(/jstree[^ ]*|$/ig,'') + "\"";
2709
+ });
2710
+ }
2711
+ if(tmp1.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"").length) {
2712
+ result += ' icon="' + tmp1.children("ins").get(0).className.replace(/jstree[^ ]*|$/ig,'').replace(/^\s+$/ig,"") + '"';
2713
+ }
2714
+ if(tmp1.children("ins").get(0).style.backgroundImage.length) {
2715
+ result += ' icon="' + tmp1.children("ins").get(0).style.backgroundImage.replace("url(","").replace(")","") + '"';
2716
+ }
2717
+ result += ">";
2718
+ result += "<![CDATA[" + _this.get_text(tmp1, lang) + "]]>";
2719
+ result += "</name>";
2720
+ });
2721
+ result += "</content>";
2722
+ tmp2 = li[0].id;
2723
+ li = li.find("> ul > li");
2724
+ if(li.length) { tmp2 = _this.get_xml(tp, li, li_attr, a_attr, tmp2); }
2725
+ else { tmp2 = ""; }
2726
+ if(tp == "nest") { result += tmp2; }
2727
+ result += "</item>";
2728
+ if(tp == "flat") { result += tmp2; }
2729
+ });
2730
+ if(!is_callback) { result += "</root>"; }
2731
+ return result;
2732
+ }
2733
+ }
2734
+ });
2735
+ })(jQuery);
2736
+ //*/
2737
+
2738
+ /*
2739
+ * jsTree search plugin 1.0
2740
+ * Enables both sync and async search on the tree
2741
+ * DOES NOT WORK WITH JSON PROGRESSIVE RENDER
2742
+ */
2743
+ (function ($) {
2744
+ $.expr[':'].jstree_contains = function(a,i,m){
2745
+ return (a.textContent || a.innerText || "").toLowerCase().indexOf(m[3].toLowerCase())>=0;
2746
+ };
2747
+ $.jstree.plugin("search", {
2748
+ __init : function () {
2749
+ this.data.search.str = "";
2750
+ this.data.search.result = $();
2751
+ },
2752
+ defaults : {
2753
+ ajax : false, // OR ajax object
2754
+ case_insensitive : false
2755
+ },
2756
+ _fn : {
2757
+ search : function (str, skip_async) {
2758
+ if(str === "") { return; }
2759
+ var s = this.get_settings().search,
2760
+ t = this,
2761
+ error_func = function () { },
2762
+ success_func = function () { };
2763
+ this.data.search.str = str;
2764
+
2765
+ if(!skip_async && s.ajax !== false && this.get_container().find(".jstree-closed:eq(0)").length > 0) {
2766
+ this.search.supress_callback = true;
2767
+ error_func = function () { };
2768
+ success_func = function (d, t, x) {
2769
+ var sf = this.get_settings().search.ajax.success;
2770
+ if(sf) { d = sf.call(this,d,t,x) || d; }
2771
+ this.data.search.to_open = d;
2772
+ this._search_open();
2773
+ };
2774
+ s.ajax.context = this;
2775
+ s.ajax.error = error_func;
2776
+ s.ajax.success = success_func;
2777
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, str); }
2778
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, str); }
2779
+ if(!s.ajax.data) { s.ajax.data = { "search_string" : str }; }
2780
+ if(!s.ajax.dataType || /^json/.exec(s.ajax.dataType)) { s.ajax.dataType = "json"; }
2781
+ $.ajax(s.ajax);
2782
+ return;
2783
+ }
2784
+ if(this.data.search.result.length) { this.clear_search(); }
2785
+ this.data.search.result = this.get_container().find("a" + (this.data.languages ? "." + this.get_lang() : "" ) + ":" + (s.case_insensitive ? "jstree_contains" : "contains") + "(" + this.data.search.str + ")");
2786
+ this.data.search.result.addClass("jstree-search").parents(".jstree-closed").each(function () {
2787
+ t.open_node(this, false, true);
2788
+ });
2789
+ this.__callback({ nodes : this.data.search.result, str : str });
2790
+ },
2791
+ clear_search : function (str) {
2792
+ this.data.search.result.removeClass("jstree-search");
2793
+ this.__callback(this.data.search.result);
2794
+ this.data.search.result = $();
2795
+ },
2796
+ _search_open : function (is_callback) {
2797
+ var _this = this,
2798
+ done = true,
2799
+ current = [],
2800
+ remaining = [];
2801
+ if(this.data.search.to_open.length) {
2802
+ $.each(this.data.search.to_open, function (i, val) {
2803
+ if(val == "#") { return true; }
2804
+ if($(val).length && $(val).is(".jstree-closed")) { current.push(val); }
2805
+ else { remaining.push(val); }
2806
+ });
2807
+ if(current.length) {
2808
+ this.data.search.to_open = remaining;
2809
+ $.each(current, function (i, val) {
2810
+ _this.open_node(val, function () { _this._search_open(true); });
2811
+ });
2812
+ done = false;
2813
+ }
2814
+ }
2815
+ if(done) { this.search(this.data.search.str, true); }
2816
+ }
2817
+ }
2818
+ });
2819
+ })(jQuery);
2820
+ //*/
2821
+
2822
+ /*
2823
+ * jsTree contextmenu plugin 1.0
2824
+ */
2825
+ (function ($) {
2826
+ $.vakata.context = {
2827
+ cnt : $("<div id='vakata-contextmenu'>"),
2828
+ vis : false,
2829
+ tgt : false,
2830
+ par : false,
2831
+ func : false,
2832
+ data : false,
2833
+ show : function (s, t, x, y, d, p) {
2834
+ var html = $.vakata.context.parse(s), h, w;
2835
+ if(!html) { return; }
2836
+ $.vakata.context.vis = true;
2837
+ $.vakata.context.tgt = t;
2838
+ $.vakata.context.par = p || t || null;
2839
+ $.vakata.context.data = d || null;
2840
+ $.vakata.context.cnt
2841
+ .html(html)
2842
+ .css({ "visibility" : "hidden", "display" : "block", "left" : 0, "top" : 0 });
2843
+ h = $.vakata.context.cnt.height();
2844
+ w = $.vakata.context.cnt.width();
2845
+ if(x + w > $(document).width()) {
2846
+ x = $(document).width() - (w + 5);
2847
+ $.vakata.context.cnt.find("li > ul").addClass("right");
2848
+ }
2849
+ if(y + h > $(document).height()) {
2850
+ y = y - (h + t[0].offsetHeight);
2851
+ $.vakata.context.cnt.find("li > ul").addClass("bottom");
2852
+ }
2853
+
2854
+ $.vakata.context.cnt
2855
+ .css({ "left" : x, "top" : y })
2856
+ .find("li:has(ul)")
2857
+ .bind("mouseenter", function (e) {
2858
+ var w = $(document).width(),
2859
+ h = $(document).height(),
2860
+ ul = $(this).children("ul").show();
2861
+ if(w !== $(document).width()) { ul.toggleClass("right"); }
2862
+ if(h !== $(document).height()) { ul.toggleClass("bottom"); }
2863
+ })
2864
+ .bind("mouseleave", function (e) {
2865
+ $(this).children("ul").hide();
2866
+ })
2867
+ .end()
2868
+ .css({ "visibility" : "visible" })
2869
+ .show();
2870
+ $(document).triggerHandler("context_show.vakata");
2871
+ },
2872
+ hide : function () {
2873
+ $.vakata.context.vis = false;
2874
+ $.vakata.context.cnt.attr("class","").hide();
2875
+ $(document).triggerHandler("context_hide.vakata");
2876
+ },
2877
+ parse : function (s, is_callback) {
2878
+ if(!s) { return false; }
2879
+ var str = "",
2880
+ tmp = false,
2881
+ was_sep = true;
2882
+ if(!is_callback) { $.vakata.context.func = {}; }
2883
+ str += "<ul>";
2884
+ $.each(s, function (i, val) {
2885
+ if(!val) { return true; }
2886
+ $.vakata.context.func[i] = val.action;
2887
+ if(!was_sep && val.separator_before) {
2888
+ str += "<li class='vakata-separator vakata-separator-before'></li>";
2889
+ }
2890
+ was_sep = false;
2891
+ str += "<li class='" + (val._class || "") + (val._disabled ? " jstree-contextmenu-disabled " : "") + "'><ins ";
2892
+ if(val.icon && val.icon.indexOf("/") === -1) { str += " class='" + val.icon + "' "; }
2893
+ if(val.icon && val.icon.indexOf("/") !== -1) { str += " style='background:url(" + val.icon + ") center center no-repeat;' "; }
2894
+ str += ">&#160;</ins><a href='#' rel='" + i + "'>";
2895
+ if(val.submenu) {
2896
+ str += "<span style='float:right;'>&raquo;</span>";
2897
+ }
2898
+ str += val.label + "</a>";
2899
+ if(val.submenu) {
2900
+ tmp = $.vakata.context.parse(val.submenu, true);
2901
+ if(tmp) { str += tmp; }
2902
+ }
2903
+ str += "</li>";
2904
+ if(val.separator_after) {
2905
+ str += "<li class='vakata-separator vakata-separator-after'></li>";
2906
+ was_sep = true;
2907
+ }
2908
+ });
2909
+ str = str.replace(/<li class\='vakata-separator vakata-separator-after'\><\/li\>$/,"");
2910
+ str += "</ul>";
2911
+ return str.length > 10 ? str : false;
2912
+ },
2913
+ exec : function (i) {
2914
+ if($.isFunction($.vakata.context.func[i])) {
2915
+ $.vakata.context.func[i].call($.vakata.context.data, $.vakata.context.par);
2916
+ return true;
2917
+ }
2918
+ else { return false; }
2919
+ }
2920
+ };
2921
+ $(function () {
2922
+ var css_string = '' +
2923
+ '#vakata-contextmenu { display:none; position:absolute; margin:0; padding:0; min-width:180px; background:#ebebeb; border:1px solid silver; z-index:10000; *width:180px; } ' +
2924
+ '#vakata-contextmenu ul { min-width:180px; *width:180px; } ' +
2925
+ '#vakata-contextmenu ul, #vakata-contextmenu li { margin:0; padding:0; list-style-type:none; display:block; } ' +
2926
+ '#vakata-contextmenu li { line-height:20px; min-height:20px; position:relative; padding:0px; } ' +
2927
+ '#vakata-contextmenu li a { padding:1px 6px; line-height:17px; display:block; text-decoration:none; margin:1px 1px 0 1px; } ' +
2928
+ '#vakata-contextmenu li ins { float:left; width:16px; height:16px; text-decoration:none; margin-right:2px; } ' +
2929
+ '#vakata-contextmenu li a:hover, #vakata-contextmenu li.vakata-hover > a { background:gray; color:white; } ' +
2930
+ '#vakata-contextmenu li ul { display:none; position:absolute; top:-2px; left:100%; background:#ebebeb; border:1px solid gray; } ' +
2931
+ '#vakata-contextmenu .right { right:100%; left:auto; } ' +
2932
+ '#vakata-contextmenu .bottom { bottom:-1px; top:auto; } ' +
2933
+ '#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; } ';
2934
+ $.vakata.css.add_sheet({ str : css_string });
2935
+ $.vakata.context.cnt
2936
+ .delegate("a","click", function (e) { e.preventDefault(); })
2937
+ .delegate("a","mouseup", function (e) {
2938
+ if(!$(this).parent().hasClass("jstree-contextmenu-disabled") && $.vakata.context.exec($(this).attr("rel"))) {
2939
+ $.vakata.context.hide();
2940
+ }
2941
+ else { $(this).blur(); }
2942
+ })
2943
+ .delegate("a","mouseover", function () {
2944
+ $.vakata.context.cnt.find(".vakata-hover").removeClass("vakata-hover");
2945
+ })
2946
+ .appendTo("body");
2947
+ $(document).bind("mousedown", function (e) { if($.vakata.context.vis && !$.contains($.vakata.context.cnt[0], e.target)) { $.vakata.context.hide(); } });
2948
+ if(typeof $.hotkeys !== "undefined") {
2949
+ $(document)
2950
+ .bind("keydown", "up", function (e) {
2951
+ if($.vakata.context.vis) {
2952
+ var o = $.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").prevAll("li:not(.vakata-separator)").first();
2953
+ if(!o.length) { o = $.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").last(); }
2954
+ o.addClass("vakata-hover");
2955
+ e.stopImmediatePropagation();
2956
+ e.preventDefault();
2957
+ }
2958
+ })
2959
+ .bind("keydown", "down", function (e) {
2960
+ if($.vakata.context.vis) {
2961
+ var o = $.vakata.context.cnt.find("ul:visible").last().children(".vakata-hover").removeClass("vakata-hover").nextAll("li:not(.vakata-separator)").first();
2962
+ if(!o.length) { o = $.vakata.context.cnt.find("ul:visible").last().children("li:not(.vakata-separator)").first(); }
2963
+ o.addClass("vakata-hover");
2964
+ e.stopImmediatePropagation();
2965
+ e.preventDefault();
2966
+ }
2967
+ })
2968
+ .bind("keydown", "right", function (e) {
2969
+ if($.vakata.context.vis) {
2970
+ $.vakata.context.cnt.find(".vakata-hover").children("ul").show().children("li:not(.vakata-separator)").removeClass("vakata-hover").first().addClass("vakata-hover");
2971
+ e.stopImmediatePropagation();
2972
+ e.preventDefault();
2973
+ }
2974
+ })
2975
+ .bind("keydown", "left", function (e) {
2976
+ if($.vakata.context.vis) {
2977
+ $.vakata.context.cnt.find(".vakata-hover").children("ul").hide().children(".vakata-separator").removeClass("vakata-hover");
2978
+ e.stopImmediatePropagation();
2979
+ e.preventDefault();
2980
+ }
2981
+ })
2982
+ .bind("keydown", "esc", function (e) {
2983
+ $.vakata.context.hide();
2984
+ e.preventDefault();
2985
+ })
2986
+ .bind("keydown", "space", function (e) {
2987
+ $.vakata.context.cnt.find(".vakata-hover").last().children("a").click();
2988
+ e.preventDefault();
2989
+ });
2990
+ }
2991
+ });
2992
+
2993
+ $.jstree.plugin("contextmenu", {
2994
+ __init : function () {
2995
+ this.get_container()
2996
+ .delegate("a", "contextmenu.jstree", $.proxy(function (e) {
2997
+ e.preventDefault();
2998
+ this.show_contextmenu(e.currentTarget, e.pageX, e.pageY);
2999
+ }, this))
3000
+ .bind("destroy.jstree", $.proxy(function () {
3001
+ if(this.data.contextmenu) {
3002
+ $.vakata.context.hide();
3003
+ }
3004
+ }, this));
3005
+ $(document).bind("context_hide.vakata", $.proxy(function () { this.data.contextmenu = false; }, this));
3006
+ },
3007
+ defaults : {
3008
+ select_node : false, // requires UI plugin
3009
+ show_at_node : true,
3010
+ items : { // Could be a function that should return an object like this one
3011
+ "create" : {
3012
+ "separator_before" : false,
3013
+ "separator_after" : true,
3014
+ "label" : "Create",
3015
+ "action" : function (obj) { this.create(obj); }
3016
+ },
3017
+ "rename" : {
3018
+ "separator_before" : false,
3019
+ "separator_after" : false,
3020
+ "label" : "Rename",
3021
+ "action" : function (obj) { this.rename(obj); }
3022
+ },
3023
+ "remove" : {
3024
+ "separator_before" : false,
3025
+ "icon" : false,
3026
+ "separator_after" : false,
3027
+ "label" : "Delete",
3028
+ "action" : function (obj) { this.remove(obj); }
3029
+ },
3030
+ "ccp" : {
3031
+ "separator_before" : true,
3032
+ "icon" : false,
3033
+ "separator_after" : false,
3034
+ "label" : "Edit",
3035
+ "action" : false,
3036
+ "submenu" : {
3037
+ "cut" : {
3038
+ "separator_before" : false,
3039
+ "separator_after" : false,
3040
+ "label" : "Cut",
3041
+ "action" : function (obj) { this.cut(obj); }
3042
+ },
3043
+ "copy" : {
3044
+ "separator_before" : false,
3045
+ "icon" : false,
3046
+ "separator_after" : false,
3047
+ "label" : "Copy",
3048
+ "action" : function (obj) { this.copy(obj); }
3049
+ },
3050
+ "paste" : {
3051
+ "separator_before" : false,
3052
+ "icon" : false,
3053
+ "separator_after" : false,
3054
+ "label" : "Paste",
3055
+ "action" : function (obj) { this.paste(obj); }
3056
+ }
3057
+ }
3058
+ }
3059
+ }
3060
+ },
3061
+ _fn : {
3062
+ show_contextmenu : function (obj, x, y) {
3063
+ obj = this._get_node(obj);
3064
+ var s = this.get_settings().contextmenu,
3065
+ a = obj.children("a:visible:eq(0)"),
3066
+ o = false;
3067
+ if(s.select_node && this.data.ui && !this.is_selected(obj)) {
3068
+ this.deselect_all();
3069
+ this.select_node(obj, true);
3070
+ }
3071
+ if(s.show_at_node || typeof x === "undefined" || typeof y === "undefined") {
3072
+ o = a.offset();
3073
+ x = o.left;
3074
+ y = o.top + this.data.core.li_height;
3075
+ }
3076
+ if($.isFunction(s.items)) { s.items = s.items.call(this, obj); }
3077
+ this.data.contextmenu = true;
3078
+ $.vakata.context.show(s.items, a, x, y, this, obj);
3079
+ if(this.data.themes) { $.vakata.context.cnt.attr("class", "jstree-" + this.data.themes.theme + "-context"); }
3080
+ }
3081
+ }
3082
+ });
3083
+ })(jQuery);
3084
+ //*/
3085
+
3086
+ /*
3087
+ * jsTree types plugin 1.0
3088
+ * Adds support types of nodes
3089
+ * You can set an attribute on each li node, that represents its type.
3090
+ * According to the type setting the node may get custom icon/validation rules
3091
+ */
3092
+ (function ($) {
3093
+ $.jstree.plugin("types", {
3094
+ __init : function () {
3095
+ var s = this._get_settings().types;
3096
+ this.data.types.attach_to = [];
3097
+ this.get_container()
3098
+ .bind("init.jstree", $.proxy(function () {
3099
+ var types = s.types,
3100
+ attr = s.type_attr,
3101
+ icons_css = "",
3102
+ _this = this;
3103
+
3104
+ $.each(types, function (i, tp) {
3105
+ $.each(tp, function (k, v) {
3106
+ if(!/^(max_depth|max_children|icon|valid_children)$/.test(k)) { _this.data.types.attach_to.push(k); }
3107
+ });
3108
+ if(!tp.icon) { return true; }
3109
+ if( tp.icon.image || tp.icon.position) {
3110
+ if(i == "default") { icons_css += '.jstree-' + _this.get_index() + ' a > .jstree-icon { '; }
3111
+ else { icons_css += '.jstree-' + _this.get_index() + ' li[' + attr + '=' + i + '] > a > .jstree-icon { '; }
3112
+ if(tp.icon.image) { icons_css += ' background-image:url(' + tp.icon.image + '); '; }
3113
+ if(tp.icon.position){ icons_css += ' background-position:' + tp.icon.position + '; '; }
3114
+ else { icons_css += ' background-position:0 0; '; }
3115
+ icons_css += '} ';
3116
+ }
3117
+ });
3118
+ if(icons_css != "") { $.vakata.css.add_sheet({ 'str' : icons_css }); }
3119
+ }, this))
3120
+ .bind("before.jstree", $.proxy(function (e, data) {
3121
+ if($.inArray(data.func, this.data.types.attach_to) !== -1) {
3122
+ var s = this._get_settings().types.types,
3123
+ t = this._get_type(data.args[0]);
3124
+ if(
3125
+ (
3126
+ (s[t] && typeof s[t][data.func] !== "undefined") ||
3127
+ (s["default"] && typeof s["default"][data.func] !== "undefined")
3128
+ ) && !this._check(data.func, data.args[0])
3129
+ ) {
3130
+ e.stopImmediatePropagation();
3131
+ return false;
3132
+ }
3133
+ }
3134
+ }, this));
3135
+ },
3136
+ defaults : {
3137
+ // defines maximum number of root nodes (-1 means unlimited, -2 means disable max_children checking)
3138
+ max_children : -1,
3139
+ // defines the maximum depth of the tree (-1 means unlimited, -2 means disable max_depth checking)
3140
+ max_depth : -1,
3141
+ // defines valid node types for the root nodes
3142
+ valid_children : "all",
3143
+
3144
+ // where is the type stores (the rel attribute of the LI element)
3145
+ type_attr : "rel",
3146
+ // a list of types
3147
+ types : {
3148
+ // the default type
3149
+ "default" : {
3150
+ "max_children" : -1,
3151
+ "max_depth" : -1,
3152
+ "valid_children": "all"
3153
+
3154
+ // Bound functions - you can bind any other function here (using boolean or function)
3155
+ //"select_node" : true,
3156
+ //"open_node" : true,
3157
+ //"close_node" : true,
3158
+ //"create_node" : true,
3159
+ //"delete_node" : true
3160
+ }
3161
+ }
3162
+ },
3163
+ _fn : {
3164
+ _get_type : function (obj) {
3165
+ obj = this._get_node(obj);
3166
+ return (!obj || !obj.length) ? false : obj.attr(this._get_settings().types.type_attr) || "default";
3167
+ },
3168
+ set_type : function (str, obj) {
3169
+ obj = this._get_node(obj);
3170
+ return (!obj.length || !str) ? false : obj.attr(this._get_settings().types.type_attr, str);
3171
+ },
3172
+ _check : function (rule, obj, opts) {
3173
+ var v = false, t = this._get_type(obj), d = 0, _this = this, s = this._get_settings().types;
3174
+ if(obj === -1) {
3175
+ if(!!s[rule]) { v = s[rule]; }
3176
+ else { return; }
3177
+ }
3178
+ else {
3179
+ if(t === false) { return; }
3180
+ if(!!s.types[t] && !!s.types[t][rule]) { v = s.types[t][rule]; }
3181
+ else if(!!s.types["default"] && !!s.types["default"][rule]) { v = s.types["default"][rule]; }
3182
+ }
3183
+ if($.isFunction(v)) { v = v.call(this, obj); }
3184
+ if(rule === "max_depth" && obj !== -1 && opts !== false && s.max_depth !== -2 && v !== 0) {
3185
+ // also include the node itself - otherwise if root node it is not checked
3186
+ this._get_node(obj).children("a:eq(0)").parentsUntil(".jstree","li").each(function (i) {
3187
+ // check if current depth already exceeds global tree depth
3188
+ if(s.max_depth !== -1 && s.max_depth - (i + 1) <= 0) { v = 0; return false; }
3189
+ d = (i === 0) ? v : _this._check(rule, this, false);
3190
+ // check if current node max depth is already matched or exceeded
3191
+ if(d !== -1 && d - (i + 1) <= 0) { v = 0; return false; }
3192
+ // otherwise - set the max depth to the current value minus current depth
3193
+ if(d >= 0 && (d - (i + 1) < v || v < 0) ) { v = d - (i + 1); }
3194
+ // if the global tree depth exists and it minus the nodes calculated so far is less than `v` or `v` is unlimited
3195
+ if(s.max_depth >= 0 && (s.max_depth - (i + 1) < v || v < 0) ) { v = s.max_depth - (i + 1); }
3196
+ });
3197
+ }
3198
+ return v;
3199
+ },
3200
+ check_move : function () {
3201
+ if(!this.__call_old()) { return false; }
3202
+ var m = this._get_move(),
3203
+ s = m.rt._get_settings().types,
3204
+ mc = m.rt._check("max_children", m.cr),
3205
+ md = m.rt._check("max_depth", m.cr),
3206
+ vc = m.rt._check("valid_children", m.cr),
3207
+ ch = 0, d = 1, t;
3208
+
3209
+ if(vc === "none") { return false; }
3210
+ if($.isArray(vc) && m.ot && m.ot._get_type) {
3211
+ m.o.each(function () {
3212
+ if($.inArray(m.ot._get_type(this), vc) === -1) { d = false; return false; }
3213
+ });
3214
+ if(d === false) { return false; }
3215
+ }
3216
+ if(s.max_children !== -2 && mc !== -1) {
3217
+ ch = m.cr === -1 ? this.get_container().children("> ul > li").not(m.o).length : m.cr.children("> ul > li").not(m.o).length;
3218
+ if(ch + m.o.length > mc) { return false; }
3219
+ }
3220
+ if(s.max_depth !== -2 && md !== -1) {
3221
+ d = 0;
3222
+ if(md === 0) { return false; }
3223
+ if(typeof m.o.d === "undefined") {
3224
+ // TODO: deal with progressive rendering and async when checking max_depth (how to know the depth of the moved node)
3225
+ t = m.o;
3226
+ while(t.length > 0) {
3227
+ t = t.find("> ul > li");
3228
+ d ++;
3229
+ }
3230
+ m.o.d = d;
3231
+ }
3232
+ if(md - m.o.d < 0) { return false; }
3233
+ }
3234
+ return true;
3235
+ },
3236
+ create_node : function (obj, position, js, callback, is_loaded, skip_check) {
3237
+ if(!skip_check && (is_loaded || this._is_loaded(obj))) {
3238
+ var p = (position && position.match(/^before|after$/i) && obj !== -1) ? this._get_parent(obj) : this._get_node(obj),
3239
+ s = this._get_settings().types,
3240
+ mc = this._check("max_children", p),
3241
+ md = this._check("max_depth", p),
3242
+ vc = this._check("valid_children", p),
3243
+ ch;
3244
+ if(!js) { js = {}; }
3245
+ if(vc === "none") { return false; }
3246
+ if($.isArray(vc)) {
3247
+ if(!js.attr || !js.attr[s.type_attr]) {
3248
+ if(!js.attr) { js.attr = {}; }
3249
+ js.attr[s.type_attr] = vc[0];
3250
+ }
3251
+ else {
3252
+ if($.inArray(js.attr[s.type_attr], vc) === -1) { return false; }
3253
+ }
3254
+ }
3255
+ if(s.max_children !== -2 && mc !== -1) {
3256
+ ch = p === -1 ? this.get_container().children("> ul > li").length : p.children("> ul > li").length;
3257
+ if(ch + 1 > mc) { return false; }
3258
+ }
3259
+ if(s.max_depth !== -2 && md !== -1 && (md - 1) < 0) { return false; }
3260
+ }
3261
+ return this.__call_old(true, obj, position, js, callback, is_loaded, skip_check);
3262
+ }
3263
+ }
3264
+ });
3265
+ })(jQuery);
3266
+ //*/
3267
+
3268
+ /*
3269
+ * jsTree HTML data 1.0
3270
+ * The HTML data store. Datastores are build by replacing the `load_node` and `_is_loaded` functions.
3271
+ */
3272
+ (function ($) {
3273
+ $.jstree.plugin("html_data", {
3274
+ __init : function () {
3275
+ // this used to use html() and clean the whitespace, but this way any attached data was lost
3276
+ this.data.html_data.original_container_html = this.get_container().find(" > ul > li").clone(true);
3277
+ // remove white space from LI node - otherwise nodes appear a bit to the right
3278
+ this.data.html_data.original_container_html.find("li").andSelf().contents().filter(function() { return this.nodeType == 3; }).remove();
3279
+ },
3280
+ defaults : {
3281
+ data : false,
3282
+ ajax : false,
3283
+ correct_state : true
3284
+ },
3285
+ _fn : {
3286
+ load_node : function (obj, s_call, e_call) { var _this = this; this.load_node_html(obj, function () { _this.__callback({ "obj" : obj }); s_call.call(this); }, e_call); },
3287
+ _is_loaded : function (obj) {
3288
+ obj = this._get_node(obj);
3289
+ return obj == -1 || !obj || !this._get_settings().html_data.ajax || obj.is(".jstree-open, .jstree-leaf") || obj.children("ul").children("li").size() > 0;
3290
+ },
3291
+ load_node_html : function (obj, s_call, e_call) {
3292
+ var d,
3293
+ s = this.get_settings().html_data,
3294
+ error_func = function () {},
3295
+ success_func = function () {};
3296
+ obj = this._get_node(obj);
3297
+ if(obj && obj !== -1) {
3298
+ if(obj.data("jstree-is-loading")) { return; }
3299
+ else { obj.data("jstree-is-loading",true); }
3300
+ }
3301
+ switch(!0) {
3302
+ case (!s.data && !s.ajax):
3303
+ if(!obj || obj == -1) {
3304
+ this.get_container()
3305
+ .children("ul").empty()
3306
+ .append(this.data.html_data.original_container_html)
3307
+ .find("li, a").filter(function () { return this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end()
3308
+ .filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");
3309
+ this.clean_node();
3310
+ }
3311
+ if(s_call) { s_call.call(this); }
3312
+ break;
3313
+ case (!!s.data && !s.ajax) || (!!s.data && !!s.ajax && (!obj || obj === -1)):
3314
+ if(!obj || obj == -1) {
3315
+ d = $(s.data);
3316
+ if(!d.is("ul")) { d = $("<ul>").append(d); }
3317
+ this.get_container()
3318
+ .children("ul").empty().append(d.children())
3319
+ .find("li, a").filter(function () { return this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end()
3320
+ .filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon");
3321
+ this.clean_node();
3322
+ }
3323
+ if(s_call) { s_call.call(this); }
3324
+ break;
3325
+ case (!s.data && !!s.ajax) || (!!s.data && !!s.ajax && obj && obj !== -1):
3326
+ obj = this._get_node(obj);
3327
+ error_func = function (x, t, e) {
3328
+ var ef = this.get_settings().html_data.ajax.error;
3329
+ if(ef) { ef.call(this, x, t, e); }
3330
+ if(obj != -1 && obj.length) {
3331
+ obj.children(".jstree-loading").removeClass("jstree-loading");
3332
+ obj.data("jstree-is-loading",false);
3333
+ if(t === "success" && s.correct_state) { obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf"); }
3334
+ }
3335
+ else {
3336
+ if(t === "success" && s.correct_state) { this.get_container().children("ul").empty(); }
3337
+ }
3338
+ if(e_call) { e_call.call(this); }
3339
+ };
3340
+ success_func = function (d, t, x) {
3341
+ var sf = this.get_settings().html_data.ajax.success;
3342
+ if(sf) { d = sf.call(this,d,t,x) || d; }
3343
+ if(d == "") {
3344
+ return error_func.call(this, x, t, "");
3345
+ }
3346
+ if(d) {
3347
+ d = $(d);
3348
+ if(!d.is("ul")) { d = $("<ul>").append(d); }
3349
+ if(obj == -1 || !obj) { this.get_container().children("ul").empty().append(d.children()).find("li, a").filter(function () { return this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"); }
3350
+ else { obj.children(".jstree-loading").removeClass("jstree-loading"); obj.append(d).find("li, a").filter(function () { return this.firstChild.tagName !== "INS"; }).prepend("<ins class='jstree-icon'>&#160;</ins>").end().filter("a").children("ins:first-child").not(".jstree-icon").addClass("jstree-icon"); obj.data("jstree-is-loading",false); }
3351
+ this.clean_node(obj);
3352
+ if(s_call) { s_call.call(this); }
3353
+ }
3354
+ else {
3355
+ if(obj && obj !== -1) {
3356
+ obj.children(".jstree-loading").removeClass("jstree-loading");
3357
+ obj.data("jstree-is-loading",false);
3358
+ if(s.correct_state) {
3359
+ obj.removeClass("jstree-open jstree-closed").addClass("jstree-leaf");
3360
+ if(s_call) { s_call.call(this); }
3361
+ }
3362
+ }
3363
+ else {
3364
+ if(s.correct_state) {
3365
+ this.get_container().children("ul").empty();
3366
+ if(s_call) { s_call.call(this); }
3367
+ }
3368
+ }
3369
+ }
3370
+ };
3371
+ s.ajax.context = this;
3372
+ s.ajax.error = error_func;
3373
+ s.ajax.success = success_func;
3374
+ if(!s.ajax.dataType) { s.ajax.dataType = "html"; }
3375
+ if($.isFunction(s.ajax.url)) { s.ajax.url = s.ajax.url.call(this, obj); }
3376
+ if($.isFunction(s.ajax.data)) { s.ajax.data = s.ajax.data.call(this, obj); }
3377
+ $.ajax(s.ajax);
3378
+ break;
3379
+ }
3380
+ }
3381
+ }
3382
+ });
3383
+ // include the HTML data plugin by default
3384
+ $.jstree.defaults.plugins.push("html_data");
3385
+ })(jQuery);
3386
+ //*/
3387
+
3388
+ /*
3389
+ * jsTree themeroller plugin 1.0
3390
+ * Adds support for jQuery UI themes. Include this at the end of your plugins list, also make sure "themes" is not included.
3391
+ */
3392
+ (function ($) {
3393
+ $.jstree.plugin("themeroller", {
3394
+ __init : function () {
3395
+ var s = this._get_settings().themeroller;
3396
+ this.get_container()
3397
+ .addClass("ui-widget-content")
3398
+ .delegate("a","mouseenter.jstree", function () {
3399
+ $(this).addClass(s.item_h);
3400
+ })
3401
+ .delegate("a","mouseleave.jstree", function () {
3402
+ $(this).removeClass(s.item_h);
3403
+ })
3404
+ .bind("open_node.jstree create_node.jstree", $.proxy(function (e, data) {
3405
+ this._themeroller(data.rslt.obj);
3406
+ }, this))
3407
+ .bind("loaded.jstree refresh.jstree", $.proxy(function (e) {
3408
+ this._themeroller();
3409
+ }, this))
3410
+ .bind("close_node.jstree", $.proxy(function (e, data) {
3411
+ data.rslt.obj.children("ins").removeClass(s.opened).addClass(s.closed);
3412
+ }, this))
3413
+ .bind("select_node.jstree", $.proxy(function (e, data) {
3414
+ data.rslt.obj.children("a").addClass(s.item_a);
3415
+ }, this))
3416
+ .bind("deselect_node.jstree deselect_all.jstree", $.proxy(function (e, data) {
3417
+ this.get_container()
3418
+ .find("." + s.item_a).removeClass(s.item_a).end()
3419
+ .find(".jstree-clicked").addClass(s.item_a);
3420
+ }, this))
3421
+ .bind("move_node.jstree", $.proxy(function (e, data) {
3422
+ this._themeroller(data.rslt.o);
3423
+ }, this));
3424
+ },
3425
+ __destroy : function () {
3426
+ var s = this._get_settings().themeroller,
3427
+ c = [ "ui-icon" ];
3428
+ $.each(s, function (i, v) {
3429
+ v = v.split(" ");
3430
+ if(v.length) { c = c.concat(v); }
3431
+ });
3432
+ this.get_container()
3433
+ .removeClass("ui-widget-content")
3434
+ .find("." + c.join(", .")).removeClass(c.join(" "));
3435
+ },
3436
+ _fn : {
3437
+ _themeroller : function (obj) {
3438
+ var s = this._get_settings().themeroller;
3439
+ obj = !obj || obj == -1 ? this.get_container() : this._get_node(obj).parent();
3440
+ obj
3441
+ .find("li.jstree-closed > ins.jstree-icon").removeClass(s.opened).addClass("ui-icon " + s.closed).end()
3442
+ .find("li.jstree-open > ins.jstree-icon").removeClass(s.closed).addClass("ui-icon " + s.opened).end()
3443
+ .find("a").addClass(s.item)
3444
+ .children("ins.jstree-icon").addClass("ui-icon " + s.item_icon);
3445
+ }
3446
+ },
3447
+ defaults : {
3448
+ "opened" : "ui-icon-triangle-1-se",
3449
+ "closed" : "ui-icon-triangle-1-e",
3450
+ "item" : "ui-state-default",
3451
+ "item_h" : "ui-state-hover",
3452
+ "item_a" : "ui-state-active",
3453
+ "item_icon" : "ui-icon-folder-collapsed"
3454
+ }
3455
+ });
3456
+ $(function() {
3457
+ var css_string = '.jstree .ui-icon { overflow:visible; } .jstree a { padding:0 2px; }';
3458
+ $.vakata.css.add_sheet({ str : css_string });
3459
+ });
3460
+ })(jQuery);
3461
+ //*/
3462
+
3463
+ /*
3464
+ * jsTree unique plugin 1.0
3465
+ * Forces different names amongst siblings (still a bit experimental)
3466
+ * NOTE: does not check language versions (it will not be possible to have nodes with the same title, even in different languages)
3467
+ */
3468
+ (function ($) {
3469
+ $.jstree.plugin("unique", {
3470
+ __init : function () {
3471
+ this.get_container()
3472
+ .bind("before.jstree", $.proxy(function (e, data) {
3473
+ var nms = [], res = true, p, t;
3474
+ if(data.func == "move_node") {
3475
+ // obj, ref, position, is_copy, is_prepared, skip_check
3476
+ if(data.args[4] === true) {
3477
+ if(data.args[0].o && data.args[0].o.length) {
3478
+ data.args[0].o.children("a").each(function () { nms.push($(this).text().replace(/^\s+/g,"")); });
3479
+ res = this._check_unique(nms, data.args[0].np.find("> ul > li").not(data.args[0].o));
3480
+ }
3481
+ }
3482
+ }
3483
+ if(data.func == "create_node") {
3484
+ // obj, position, js, callback, is_loaded
3485
+ if(data.args[4] || this._is_loaded(data.args[0])) {
3486
+ p = this._get_node(data.args[0]);
3487
+ if(data.args[1] && (data.args[1] === "before" || data.args[1] === "after")) {
3488
+ p = this._get_parent(data.args[0]);
3489
+ if(!p || p === -1) { p = this.get_container(); }
3490
+ }
3491
+ if(typeof data.args[2] === "string") { nms.push(data.args[2]); }
3492
+ else if(!data.args[2] || !data.args[2].data) { nms.push(this._get_settings().core.strings.new_node); }
3493
+ else { nms.push(data.args[2].data); }
3494
+ res = this._check_unique(nms, p.find("> ul > li"));
3495
+ }
3496
+ }
3497
+ if(data.func == "rename_node") {
3498
+ // obj, val
3499
+ nms.push(data.args[1]);
3500
+ t = this._get_node(data.args[0]);
3501
+ p = this._get_parent(t);
3502
+ if(!p || p === -1) { p = this.get_container(); }
3503
+ res = this._check_unique(nms, p.find("> ul > li").not(t));
3504
+ }
3505
+ if(!res) {
3506
+ e.stopPropagation();
3507
+ return false;
3508
+ }
3509
+ }, this));
3510
+ },
3511
+ _fn : {
3512
+ _check_unique : function (nms, p) {
3513
+ var cnms = [];
3514
+ p.children("a").each(function () { cnms.push($(this).text().replace(/^\s+/g,"")); });
3515
+ if(!cnms.length || !nms.length) { return true; }
3516
+ cnms = cnms.sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",");
3517
+ if((cnms.length + nms.length) != cnms.concat(nms).sort().join(",,").replace(/(,|^)([^,]+)(,,\2)+(,|$)/g,"$1$2$4").replace(/,,+/g,",").replace(/,$/,"").split(",").length) {
3518
+ return false;
3519
+ }
3520
+ return true;
3521
+ },
3522
+ check_move : function () {
3523
+ if(!this.__call_old()) { return false; }
3524
+ var p = this._get_move(), nms = [];
3525
+ if(p.o && p.o.length) {
3526
+ p.o.children("a").each(function () { nms.push($(this).text().replace(/^\s+/g,"")); });
3527
+ return this._check_unique(nms, p.np.find("> ul > li").not(p.o));
3528
+ }
3529
+ return true;
3530
+ }
3531
+ }
3532
+ });
3533
+ })(jQuery);
3534
+ //*/