my_admin 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (822) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +4 -0
  3. data/Gemfile +12 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.md +407 -0
  6. data/Rakefile +35 -0
  7. data/app/assets/fonts/my_admin/FontAwesome.otf +0 -0
  8. data/app/assets/fonts/my_admin/fontawesome-webfont.eot +0 -0
  9. data/app/assets/fonts/my_admin/fontawesome-webfont.svg +284 -0
  10. data/app/assets/fonts/my_admin/fontawesome-webfont.ttf +0 -0
  11. data/app/assets/fonts/my_admin/fontawesome-webfont.woff +0 -0
  12. data/app/assets/fonts/my_admin/glyphicons-regular.eot +0 -0
  13. data/app/assets/fonts/my_admin/glyphicons-regular.otf +0 -0
  14. data/app/assets/fonts/my_admin/glyphicons-regular.svg +435 -0
  15. data/app/assets/fonts/my_admin/glyphicons-regular.ttf +0 -0
  16. data/app/assets/fonts/my_admin/glyphicons-regular.woff +0 -0
  17. data/app/assets/images/my_admin/apple-touch-icon-precomposed.png +0 -0
  18. data/app/assets/images/my_admin/email-login.jpg +0 -0
  19. data/app/assets/images/my_admin/email-logo.jpg +0 -0
  20. data/app/assets/images/my_admin/favicon.ico +0 -0
  21. data/app/assets/images/my_admin/glyphicons-halflings-white.png +0 -0
  22. data/app/assets/images/my_admin/glyphicons-halflings.png +0 -0
  23. data/app/assets/images/my_admin/loading.gif +0 -0
  24. data/app/assets/images/my_admin/logo-big.png +0 -0
  25. data/app/assets/images/my_admin/logo-big@2x.png +0 -0
  26. data/app/assets/images/my_admin/logo.png +0 -0
  27. data/app/assets/images/my_admin/logo@2x.png +0 -0
  28. data/app/assets/images/my_admin/navigation-bg-small.png +0 -0
  29. data/app/assets/images/my_admin/navigation-bg.png +0 -0
  30. data/app/assets/images/my_admin/no_image.gif +0 -0
  31. data/app/assets/images/my_admin/plugins/chosen/chosen-sprite.png +0 -0
  32. data/app/assets/images/my_admin/plugins/colorbox/controls.png +0 -0
  33. data/app/assets/images/my_admin/plugins/colorbox/loading.gif +0 -0
  34. data/app/assets/images/my_admin/plugins/colorpicker/alpha.png +0 -0
  35. data/app/assets/images/my_admin/plugins/colorpicker/hue.png +0 -0
  36. data/app/assets/images/my_admin/plugins/colorpicker/saturation.png +0 -0
  37. data/app/assets/images/my_admin/plugins/elfinder/arrows-active.png +0 -0
  38. data/app/assets/images/my_admin/plugins/elfinder/arrows-normal.png +0 -0
  39. data/app/assets/images/my_admin/plugins/elfinder/crop.gif +0 -0
  40. data/app/assets/images/my_admin/plugins/elfinder/dialogs.png +0 -0
  41. data/app/assets/images/my_admin/plugins/elfinder/icons-big.png +0 -0
  42. data/app/assets/images/my_admin/plugins/elfinder/icons-small.png +0 -0
  43. data/app/assets/images/my_admin/plugins/elfinder/logo.png +0 -0
  44. data/app/assets/images/my_admin/plugins/elfinder/progress.gif +0 -0
  45. data/app/assets/images/my_admin/plugins/elfinder/quicklook-bg.png +0 -0
  46. data/app/assets/images/my_admin/plugins/elfinder/quicklook-icons.png +0 -0
  47. data/app/assets/images/my_admin/plugins/elfinder/resize.png +0 -0
  48. data/app/assets/images/my_admin/plugins/elfinder/spinner-mini.gif +0 -0
  49. data/app/assets/images/my_admin/plugins/elfinder/toolbar.png +0 -0
  50. data/app/assets/images/my_admin/plugins/gmap/here.png +0 -0
  51. data/app/assets/images/my_admin/plugins/gmap/icon_greenA.png +0 -0
  52. data/app/assets/images/my_admin/plugins/gmap/icon_greenB.png +0 -0
  53. data/app/assets/images/my_admin/plugins/gmap/zoomin.png +0 -0
  54. data/app/assets/images/my_admin/plugins/gmap/zoomout.png +0 -0
  55. data/app/assets/images/my_admin/plugins/gritter/gritter-light.png +0 -0
  56. data/app/assets/images/my_admin/plugins/gritter/gritter-long.png +0 -0
  57. data/app/assets/images/my_admin/plugins/gritter/gritter.png +0 -0
  58. data/app/assets/images/my_admin/plugins/gritter/ie-spacer.gif +0 -0
  59. data/app/assets/images/my_admin/plugins/icheck/flat/aero.png +0 -0
  60. data/app/assets/images/my_admin/plugins/icheck/flat/aero@2x.png +0 -0
  61. data/app/assets/images/my_admin/plugins/icheck/flat/blue.png +0 -0
  62. data/app/assets/images/my_admin/plugins/icheck/flat/blue@2x.png +0 -0
  63. data/app/assets/images/my_admin/plugins/icheck/flat/flat.png +0 -0
  64. data/app/assets/images/my_admin/plugins/icheck/flat/flat@2x.png +0 -0
  65. data/app/assets/images/my_admin/plugins/icheck/flat/green.png +0 -0
  66. data/app/assets/images/my_admin/plugins/icheck/flat/green@2x.png +0 -0
  67. data/app/assets/images/my_admin/plugins/icheck/flat/grey.png +0 -0
  68. data/app/assets/images/my_admin/plugins/icheck/flat/grey@2x.png +0 -0
  69. data/app/assets/images/my_admin/plugins/icheck/flat/orange.png +0 -0
  70. data/app/assets/images/my_admin/plugins/icheck/flat/orange@2x.png +0 -0
  71. data/app/assets/images/my_admin/plugins/icheck/flat/pink.png +0 -0
  72. data/app/assets/images/my_admin/plugins/icheck/flat/pink@2x.png +0 -0
  73. data/app/assets/images/my_admin/plugins/icheck/flat/purple.png +0 -0
  74. data/app/assets/images/my_admin/plugins/icheck/flat/purple@2x.png +0 -0
  75. data/app/assets/images/my_admin/plugins/icheck/flat/red.png +0 -0
  76. data/app/assets/images/my_admin/plugins/icheck/flat/red@2x.png +0 -0
  77. data/app/assets/images/my_admin/plugins/icheck/flat/yellow.png +0 -0
  78. data/app/assets/images/my_admin/plugins/icheck/flat/yellow@2x.png +0 -0
  79. data/app/assets/images/my_admin/plugins/icheck/futurico/futurico.png +0 -0
  80. data/app/assets/images/my_admin/plugins/icheck/futurico/futurico@2x.png +0 -0
  81. data/app/assets/images/my_admin/plugins/icheck/line/line.png +0 -0
  82. data/app/assets/images/my_admin/plugins/icheck/line/line@2x.png +0 -0
  83. data/app/assets/images/my_admin/plugins/icheck/minimal/aero.png +0 -0
  84. data/app/assets/images/my_admin/plugins/icheck/minimal/aero@2x.png +0 -0
  85. data/app/assets/images/my_admin/plugins/icheck/minimal/blue.png +0 -0
  86. data/app/assets/images/my_admin/plugins/icheck/minimal/blue@2x.png +0 -0
  87. data/app/assets/images/my_admin/plugins/icheck/minimal/green.png +0 -0
  88. data/app/assets/images/my_admin/plugins/icheck/minimal/green@2x.png +0 -0
  89. data/app/assets/images/my_admin/plugins/icheck/minimal/grey.png +0 -0
  90. data/app/assets/images/my_admin/plugins/icheck/minimal/grey@2x.png +0 -0
  91. data/app/assets/images/my_admin/plugins/icheck/minimal/minimal.png +0 -0
  92. data/app/assets/images/my_admin/plugins/icheck/minimal/minimal@2x.png +0 -0
  93. data/app/assets/images/my_admin/plugins/icheck/minimal/orange.png +0 -0
  94. data/app/assets/images/my_admin/plugins/icheck/minimal/orange@2x.png +0 -0
  95. data/app/assets/images/my_admin/plugins/icheck/minimal/pink.png +0 -0
  96. data/app/assets/images/my_admin/plugins/icheck/minimal/pink@2x.png +0 -0
  97. data/app/assets/images/my_admin/plugins/icheck/minimal/purple.png +0 -0
  98. data/app/assets/images/my_admin/plugins/icheck/minimal/purple@2x.png +0 -0
  99. data/app/assets/images/my_admin/plugins/icheck/minimal/red.png +0 -0
  100. data/app/assets/images/my_admin/plugins/icheck/minimal/red@2x.png +0 -0
  101. data/app/assets/images/my_admin/plugins/icheck/minimal/yellow.png +0 -0
  102. data/app/assets/images/my_admin/plugins/icheck/minimal/yellow@2x.png +0 -0
  103. data/app/assets/images/my_admin/plugins/icheck/polaris/polaris.png +0 -0
  104. data/app/assets/images/my_admin/plugins/icheck/polaris/polaris@2x.png +0 -0
  105. data/app/assets/images/my_admin/plugins/icheck/square/aero.png +0 -0
  106. data/app/assets/images/my_admin/plugins/icheck/square/aero@2x.png +0 -0
  107. data/app/assets/images/my_admin/plugins/icheck/square/blue.png +0 -0
  108. data/app/assets/images/my_admin/plugins/icheck/square/blue@2x.png +0 -0
  109. data/app/assets/images/my_admin/plugins/icheck/square/green.png +0 -0
  110. data/app/assets/images/my_admin/plugins/icheck/square/green@2x.png +0 -0
  111. data/app/assets/images/my_admin/plugins/icheck/square/grey.png +0 -0
  112. data/app/assets/images/my_admin/plugins/icheck/square/grey@2x.png +0 -0
  113. data/app/assets/images/my_admin/plugins/icheck/square/orange.png +0 -0
  114. data/app/assets/images/my_admin/plugins/icheck/square/orange@2x.png +0 -0
  115. data/app/assets/images/my_admin/plugins/icheck/square/pink.png +0 -0
  116. data/app/assets/images/my_admin/plugins/icheck/square/pink@2x.png +0 -0
  117. data/app/assets/images/my_admin/plugins/icheck/square/purple.png +0 -0
  118. data/app/assets/images/my_admin/plugins/icheck/square/purple@2x.png +0 -0
  119. data/app/assets/images/my_admin/plugins/icheck/square/red.png +0 -0
  120. data/app/assets/images/my_admin/plugins/icheck/square/red@2x.png +0 -0
  121. data/app/assets/images/my_admin/plugins/icheck/square/square.png +0 -0
  122. data/app/assets/images/my_admin/plugins/icheck/square/square@2x.png +0 -0
  123. data/app/assets/images/my_admin/plugins/icheck/square/yellow.png +0 -0
  124. data/app/assets/images/my_admin/plugins/icheck/square/yellow@2x.png +0 -0
  125. data/app/assets/images/my_admin/plugins/multiselect/switch.png +0 -0
  126. data/app/assets/images/my_admin/plugins/pageguide/pageguide_arrow.png +0 -0
  127. data/app/assets/images/my_admin/plugins/plupload/backgrounds.gif +0 -0
  128. data/app/assets/images/my_admin/plugins/plupload/buttons-disabled.png +0 -0
  129. data/app/assets/images/my_admin/plugins/plupload/buttons.png +0 -0
  130. data/app/assets/images/my_admin/plugins/plupload/delete.gif +0 -0
  131. data/app/assets/images/my_admin/plugins/plupload/done.gif +0 -0
  132. data/app/assets/images/my_admin/plugins/plupload/error.gif +0 -0
  133. data/app/assets/images/my_admin/plugins/plupload/throbber.gif +0 -0
  134. data/app/assets/images/my_admin/plugins/plupload/transp50.png +0 -0
  135. data/app/assets/images/my_admin/plugins/select2/select2-spinner.gif +0 -0
  136. data/app/assets/images/my_admin/plugins/select2/select2.png +0 -0
  137. data/app/assets/images/my_admin/plugins/select2/select2x2.png +0 -0
  138. data/app/assets/images/my_admin/plugins/xeditable/clear.png +0 -0
  139. data/app/assets/images/my_admin/plugins/xeditable/loading.gif +0 -0
  140. data/app/assets/images/my_admin/sorting-asc.png +0 -0
  141. data/app/assets/images/my_admin/sorting-desc.png +0 -0
  142. data/app/assets/images/my_admin/sorting.png +0 -0
  143. data/app/assets/images/my_admin/users/missing_mini.png +0 -0
  144. data/app/assets/images/my_admin/users/missing_my_admin.png +0 -0
  145. data/app/assets/javascripts/my_admin/application.js +62 -0
  146. data/app/assets/javascripts/my_admin/application_locked.js +20 -0
  147. data/app/assets/javascripts/my_admin/application_off.js +22 -0
  148. data/app/assets/javascripts/my_admin/bootstrap.js +2268 -0
  149. data/app/assets/javascripts/my_admin/demonstration.js +1101 -0
  150. data/app/assets/javascripts/my_admin/eakroko.js +538 -0
  151. data/app/assets/javascripts/my_admin/extensions.js +20 -0
  152. data/app/assets/javascripts/my_admin/jquery.dateFormat.js +355 -0
  153. data/app/assets/javascripts/my_admin/jquery.maskMoney.js +355 -0
  154. data/app/assets/javascripts/my_admin/locale/pt-br/validate.js +24 -0
  155. data/app/assets/javascripts/my_admin/main.js +891 -0
  156. data/app/assets/javascripts/my_admin/my_admin.js +186 -0
  157. data/app/assets/javascripts/my_admin/plugins/bootbox/jquery.bootbox.js +17 -0
  158. data/app/assets/javascripts/my_admin/plugins/chosen/chosen.jquery.min.js +10 -0
  159. data/app/assets/javascripts/my_admin/plugins/chosen/chosen.jquery.min.min.js +9 -0
  160. data/app/assets/javascripts/my_admin/plugins/ckeditor/CHANGES.md +60 -0
  161. data/app/assets/javascripts/my_admin/plugins/ckeditor/LICENSE.md +1264 -0
  162. data/app/assets/javascripts/my_admin/plugins/ckeditor/README.md +39 -0
  163. data/app/assets/javascripts/my_admin/plugins/ckeditor/build-config.js +161 -0
  164. data/app/assets/javascripts/my_admin/plugins/ckeditor/ckeditor.js +874 -0
  165. data/app/assets/javascripts/my_admin/plugins/ckeditor/config.js +11 -0
  166. data/app/assets/javascripts/my_admin/plugins/ckeditor/contents.css +99 -0
  167. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/af.js +5 -0
  168. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/ar.js +5 -0
  169. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/bg.js +5 -0
  170. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/bn.js +5 -0
  171. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/bs.js +5 -0
  172. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/ca.js +5 -0
  173. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/cs.js +5 -0
  174. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/cy.js +5 -0
  175. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/da.js +5 -0
  176. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/de.js +5 -0
  177. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/el.js +5 -0
  178. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/en-au.js +5 -0
  179. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/en-ca.js +5 -0
  180. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/en-gb.js +5 -0
  181. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/en.js +5 -0
  182. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/eo.js +5 -0
  183. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/es.js +5 -0
  184. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/et.js +5 -0
  185. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/eu.js +5 -0
  186. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/fa.js +5 -0
  187. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/fi.js +5 -0
  188. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/fo.js +5 -0
  189. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/fr-ca.js +5 -0
  190. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/fr.js +5 -0
  191. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/gl.js +5 -0
  192. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/gu.js +5 -0
  193. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/he.js +5 -0
  194. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/hi.js +5 -0
  195. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/hr.js +5 -0
  196. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/hu.js +5 -0
  197. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/is.js +5 -0
  198. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/it.js +5 -0
  199. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/ja.js +5 -0
  200. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/ka.js +5 -0
  201. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/km.js +5 -0
  202. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/ko.js +5 -0
  203. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/ku.js +5 -0
  204. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/lt.js +5 -0
  205. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/lv.js +5 -0
  206. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/mk.js +5 -0
  207. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/mn.js +5 -0
  208. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/ms.js +5 -0
  209. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/nb.js +5 -0
  210. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/nl.js +5 -0
  211. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/no.js +5 -0
  212. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/pl.js +5 -0
  213. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/pt-br.js +5 -0
  214. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/pt.js +5 -0
  215. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/ro.js +5 -0
  216. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/ru.js +5 -0
  217. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/sk.js +5 -0
  218. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/sl.js +5 -0
  219. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/sr-latn.js +5 -0
  220. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/sr.js +5 -0
  221. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/sv.js +5 -0
  222. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/th.js +5 -0
  223. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/tr.js +5 -0
  224. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/ug.js +5 -0
  225. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/uk.js +5 -0
  226. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/vi.js +5 -0
  227. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/zh-cn.js +5 -0
  228. data/app/assets/javascripts/my_admin/plugins/ckeditor/lang/zh.js +5 -0
  229. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +10 -0
  230. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/_translationstatus.txt +25 -0
  231. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/ar.js +9 -0
  232. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/bg.js +9 -0
  233. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/ca.js +9 -0
  234. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/cs.js +10 -0
  235. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/cy.js +9 -0
  236. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/da.js +9 -0
  237. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/de.js +10 -0
  238. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/el.js +10 -0
  239. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/en.js +9 -0
  240. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/eo.js +10 -0
  241. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/es.js +10 -0
  242. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/et.js +9 -0
  243. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/fa.js +9 -0
  244. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/fi.js +10 -0
  245. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/fr.js +10 -0
  246. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/gu.js +9 -0
  247. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/he.js +9 -0
  248. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/hi.js +9 -0
  249. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/hr.js +9 -0
  250. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/hu.js +9 -0
  251. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/it.js +10 -0
  252. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/ja.js +9 -0
  253. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/ku.js +10 -0
  254. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/lt.js +9 -0
  255. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/lv.js +10 -0
  256. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/mk.js +9 -0
  257. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/mn.js +9 -0
  258. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/nb.js +9 -0
  259. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/nl.js +10 -0
  260. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/no.js +9 -0
  261. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/pl.js +9 -0
  262. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/pt-br.js +9 -0
  263. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/pt.js +9 -0
  264. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/ro.js +9 -0
  265. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/ru.js +9 -0
  266. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/sk.js +10 -0
  267. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/sl.js +9 -0
  268. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/sv.js +10 -0
  269. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/tr.js +10 -0
  270. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/ug.js +9 -0
  271. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/uk.js +9 -0
  272. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/vi.js +9 -0
  273. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/a11yhelp/dialogs/lang/zh-cn.js +7 -0
  274. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/about/dialogs/about.js +6 -0
  275. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/about/dialogs/logo_ckeditor.png +0 -0
  276. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/clipboard/dialogs/paste.js +11 -0
  277. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/colordialog/dialogs/colordialog.js +13 -0
  278. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/dialog/dialogDefinition.js +4 -0
  279. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/div/dialogs/div.js +9 -0
  280. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/fakeobjects/images/spacer.gif +0 -0
  281. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/find/dialogs/find.js +24 -0
  282. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/flash/dialogs/flash.js +23 -0
  283. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/flash/images/placeholder.png +0 -0
  284. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/forms/dialogs/button.js +8 -0
  285. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/forms/dialogs/checkbox.js +8 -0
  286. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/forms/dialogs/form.js +8 -0
  287. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/forms/dialogs/hiddenfield.js +8 -0
  288. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/forms/dialogs/radio.js +8 -0
  289. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/forms/dialogs/select.js +20 -0
  290. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/forms/dialogs/textarea.js +8 -0
  291. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/forms/dialogs/textfield.js +10 -0
  292. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/forms/images/hiddenfield.gif +0 -0
  293. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/icons.png +0 -0
  294. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/iframe/dialogs/iframe.js +10 -0
  295. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/iframe/images/placeholder.png +0 -0
  296. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/image/dialogs/image.js +41 -0
  297. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/image/images/noimage.png +0 -0
  298. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/link/dialogs/anchor.js +8 -0
  299. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/link/dialogs/link.js +36 -0
  300. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/link/images/anchor.png +0 -0
  301. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/liststyle/dialogs/liststyle.js +10 -0
  302. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/magicline/images/icon.png +0 -0
  303. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/pagebreak/images/pagebreak.gif +0 -0
  304. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/pastefromword/filter/default.js +31 -0
  305. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/preview/preview.html +10 -0
  306. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/scayt/LICENSE.md +28 -0
  307. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/scayt/README.md +25 -0
  308. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/scayt/dialogs/options.js +19 -0
  309. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/scayt/dialogs/toolbar.css +71 -0
  310. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/showblocks/images/block_address.png +0 -0
  311. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/showblocks/images/block_blockquote.png +0 -0
  312. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/showblocks/images/block_div.png +0 -0
  313. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/showblocks/images/block_h1.png +0 -0
  314. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/showblocks/images/block_h2.png +0 -0
  315. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/showblocks/images/block_h3.png +0 -0
  316. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/showblocks/images/block_h4.png +0 -0
  317. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/showblocks/images/block_h5.png +0 -0
  318. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/showblocks/images/block_h6.png +0 -0
  319. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/showblocks/images/block_p.png +0 -0
  320. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/showblocks/images/block_pre.png +0 -0
  321. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/dialogs/smiley.js +10 -0
  322. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/angel_smile.gif +0 -0
  323. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/angry_smile.gif +0 -0
  324. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/broken_heart.gif +0 -0
  325. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/confused_smile.gif +0 -0
  326. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/cry_smile.gif +0 -0
  327. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/devil_smile.gif +0 -0
  328. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/embaressed_smile.gif +0 -0
  329. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/embarrassed_smile.gif +0 -0
  330. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/envelope.gif +0 -0
  331. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/heart.gif +0 -0
  332. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/kiss.gif +0 -0
  333. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/lightbulb.gif +0 -0
  334. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/omg_smile.gif +0 -0
  335. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/regular_smile.gif +0 -0
  336. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/sad_smile.gif +0 -0
  337. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/shades_smile.gif +0 -0
  338. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/teeth_smile.gif +0 -0
  339. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/thumbs_down.gif +0 -0
  340. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/thumbs_up.gif +0 -0
  341. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/tongue_smile.gif +0 -0
  342. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/tounge_smile.gif +0 -0
  343. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.gif +0 -0
  344. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/smiley/images/wink_smile.gif +0 -0
  345. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/_translationstatus.txt +20 -0
  346. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/ca.js +13 -0
  347. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/cs.js +13 -0
  348. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/cy.js +14 -0
  349. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/de.js +13 -0
  350. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/el.js +13 -0
  351. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/en.js +13 -0
  352. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/eo.js +12 -0
  353. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/et.js +13 -0
  354. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/fa.js +13 -0
  355. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/fi.js +13 -0
  356. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/fr.js +11 -0
  357. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/he.js +13 -0
  358. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/hr.js +13 -0
  359. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/it.js +14 -0
  360. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/ku.js +14 -0
  361. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/lv.js +13 -0
  362. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/nb.js +11 -0
  363. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/nl.js +13 -0
  364. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/no.js +11 -0
  365. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/pt-br.js +11 -0
  366. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/sk.js +13 -0
  367. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/sv.js +11 -0
  368. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/tr.js +12 -0
  369. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/ug.js +13 -0
  370. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/lang/zh-cn.js +9 -0
  371. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/specialchar/dialogs/specialchar.js +14 -0
  372. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/table/dialogs/table.js +20 -0
  373. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/tabletools/dialogs/tableCell.js +16 -0
  374. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/templates/dialogs/templates.css +84 -0
  375. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/templates/dialogs/templates.js +10 -0
  376. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/templates/templates/default.js +6 -0
  377. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/templates/templates/images/template1.gif +0 -0
  378. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/templates/templates/images/template2.gif +0 -0
  379. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/templates/templates/images/template3.gif +0 -0
  380. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/wsc/LICENSE.md +28 -0
  381. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/wsc/README.md +25 -0
  382. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/wsc/dialogs/ciframe.html +49 -0
  383. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/wsc/dialogs/tmpFrameset.html +52 -0
  384. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/wsc/dialogs/wsc.css +82 -0
  385. data/app/assets/javascripts/my_admin/plugins/ckeditor/plugins/wsc/dialogs/wsc.js +11 -0
  386. data/app/assets/javascripts/my_admin/plugins/ckeditor/skins/moono/dialog.css +5 -0
  387. data/app/assets/javascripts/my_admin/plugins/ckeditor/skins/moono/dialog_ie.css +5 -0
  388. data/app/assets/javascripts/my_admin/plugins/ckeditor/skins/moono/dialog_ie7.css +5 -0
  389. data/app/assets/javascripts/my_admin/plugins/ckeditor/skins/moono/dialog_ie8.css +5 -0
  390. data/app/assets/javascripts/my_admin/plugins/ckeditor/skins/moono/dialog_iequirks.css +5 -0
  391. data/app/assets/javascripts/my_admin/plugins/ckeditor/skins/moono/dialog_opera.css +5 -0
  392. data/app/assets/javascripts/my_admin/plugins/ckeditor/skins/moono/editor.css +5 -0
  393. data/app/assets/javascripts/my_admin/plugins/ckeditor/skins/moono/editor_gecko.css +5 -0
  394. data/app/assets/javascripts/my_admin/plugins/ckeditor/skins/moono/editor_ie.css +5 -0
  395. data/app/assets/javascripts/my_admin/plugins/ckeditor/skins/moono/editor_ie7.css +5 -0
  396. data/app/assets/javascripts/my_admin/plugins/ckeditor/skins/moono/editor_ie8.css +5 -0
  397. data/app/assets/javascripts/my_admin/plugins/ckeditor/skins/moono/editor_iequirks.css +5 -0
  398. data/app/assets/javascripts/my_admin/plugins/ckeditor/skins/moono/icons.png +0 -0
  399. data/app/assets/javascripts/my_admin/plugins/ckeditor/skins/moono/images/arrow.png +0 -0
  400. data/app/assets/javascripts/my_admin/plugins/ckeditor/skins/moono/images/close.png +0 -0
  401. data/app/assets/javascripts/my_admin/plugins/ckeditor/skins/moono/images/mini.png +0 -0
  402. data/app/assets/javascripts/my_admin/plugins/ckeditor/skins/moono/readme.md +51 -0
  403. data/app/assets/javascripts/my_admin/plugins/ckeditor/styles.js +112 -0
  404. data/app/assets/javascripts/my_admin/plugins/colorbox/jquery.colorbox-min.js +6 -0
  405. data/app/assets/javascripts/my_admin/plugins/colorpicker/bootstrap-colorpicker.js +540 -0
  406. data/app/assets/javascripts/my_admin/plugins/complexify/jquery.complexify-banlist.js +3 -0
  407. data/app/assets/javascripts/my_admin/plugins/complexify/jquery.complexify-banlist.min.js +3 -0
  408. data/app/assets/javascripts/my_admin/plugins/complexify/jquery.complexify.js +185 -0
  409. data/app/assets/javascripts/my_admin/plugins/complexify/jquery.complexify.min.js +5 -0
  410. data/app/assets/javascripts/my_admin/plugins/datatable/ColReorder.min.js +33 -0
  411. data/app/assets/javascripts/my_admin/plugins/datatable/ColVis.js +1133 -0
  412. data/app/assets/javascripts/my_admin/plugins/datatable/ColVis.min.js +20 -0
  413. data/app/assets/javascripts/my_admin/plugins/datatable/FixedColumns.min.js +18 -0
  414. data/app/assets/javascripts/my_admin/plugins/datatable/FixedColumns.min.min.js +18 -0
  415. data/app/assets/javascripts/my_admin/plugins/datatable/TableTools.min.js +76 -0
  416. data/app/assets/javascripts/my_admin/plugins/datatable/as3/ZeroClipboard.as +221 -0
  417. data/app/assets/javascripts/my_admin/plugins/datatable/as3/ZeroClipboardPdf.as +310 -0
  418. data/app/assets/javascripts/my_admin/plugins/datatable/as3/lib/AlivePDF.swc +0 -0
  419. data/app/assets/javascripts/my_admin/plugins/datatable/dataTables.scroller.min.js +40 -0
  420. data/app/assets/javascripts/my_admin/plugins/datatable/demo.txt +2503 -0
  421. data/app/assets/javascripts/my_admin/plugins/datatable/jquery.dataTables.columnFilter.js +764 -0
  422. data/app/assets/javascripts/my_admin/plugins/datatable/jquery.dataTables.columnFilter.min.js +22 -0
  423. data/app/assets/javascripts/my_admin/plugins/datatable/jquery.dataTables.min.js +155 -0
  424. data/app/assets/javascripts/my_admin/plugins/datatable/swf/copy_csv_xls.swf +0 -0
  425. data/app/assets/javascripts/my_admin/plugins/datatable/swf/copy_csv_xls_pdf.swf +0 -0
  426. data/app/assets/javascripts/my_admin/plugins/datepicker/bootstrap-datepicker.js +988 -0
  427. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.bg.js +14 -0
  428. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.ca.js +14 -0
  429. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.cs.js +15 -0
  430. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.da.js +14 -0
  431. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.de.js +16 -0
  432. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.el.js +13 -0
  433. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.es.js +14 -0
  434. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.fi.js +14 -0
  435. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.fr.js +16 -0
  436. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.he.js +15 -0
  437. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.hr.js +13 -0
  438. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.id.js +13 -0
  439. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.is.js +14 -0
  440. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.it.js +16 -0
  441. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.ja.js +13 -0
  442. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.kr.js +13 -0
  443. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.lt.js +16 -0
  444. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.lv.js +16 -0
  445. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.ms.js +14 -0
  446. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.nb.js +14 -0
  447. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.nl.js +14 -0
  448. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.pl.js +15 -0
  449. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.pt-BR.js +15 -0
  450. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.pt.js +14 -0
  451. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.ro.js +15 -0
  452. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.rs-latin.js +14 -0
  453. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.rs.js +14 -0
  454. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.ru.js +14 -0
  455. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.sk.js +15 -0
  456. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.sl.js +14 -0
  457. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.sv.js +14 -0
  458. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.sw.js +15 -0
  459. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.th.js +14 -0
  460. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.tr.js +15 -0
  461. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.uk.js +14 -0
  462. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js +14 -0
  463. data/app/assets/javascripts/my_admin/plugins/datepicker/locales/bootstrap-datepicker.zh-TW.js +13 -0
  464. data/app/assets/javascripts/my_admin/plugins/dynatree/jquery.dynatree.js +3432 -0
  465. data/app/assets/javascripts/my_admin/plugins/easy-pie-chart/jquery.easy-pie-chart.min.js +16 -0
  466. data/app/assets/javascripts/my_admin/plugins/elfinder/elfinder.min.js +26 -0
  467. data/app/assets/javascripts/my_admin/plugins/elfinder/files/.tmb/l1_Rm9sZGVyICMxL3Njb3R0d2lsbHNfdW5kZXJ3YXRlcjIuanBn1221239104.png +0 -0
  468. data/app/assets/javascripts/my_admin/plugins/elfinder/files/.tmb/l1_Rm9sZGVyICMxL3Njb3R0d2lsbHNfdW5kZXJ3YXRlcjUuanBn1221239108.png +0 -0
  469. data/app/assets/javascripts/my_admin/plugins/elfinder/files/.tmb/l1_Rm9sZGVyICMyL3Njb3R0d2lsbHNfY2F0LmpwZw1221239094.png +0 -0
  470. data/app/assets/javascripts/my_admin/plugins/elfinder/files/.tmb/l1_Rm9sZGVyICMyL3Njb3R0d2lsbHNfZ2FyZGVucy5qcGc1221239206.png +0 -0
  471. data/app/assets/javascripts/my_admin/plugins/elfinder/files/.tmb/l1_Rm9sZGVyICMyL3Njb3R0d2lsbHNfZmlzaC5qcGc1221239096.png +0 -0
  472. data/app/assets/javascripts/my_admin/plugins/elfinder/files/.tmb/l1_Rm9sZGVyICMyL3Njb3R0d2lsbHNfaG9yc2UuanBn1221239096.png +0 -0
  473. data/app/assets/javascripts/my_admin/plugins/elfinder/files/.tmb/l1_bWFkbmVzc19iZWFjaC5qcGc1208954324.png +0 -0
  474. data/app/assets/javascripts/my_admin/plugins/elfinder/files/.tmb/l1_bWFkbmVzc19ib2F0LmpwZw1208954324.png +0 -0
  475. data/app/assets/javascripts/my_admin/plugins/elfinder/files/.tmb/l1_c2NvdHR3aWxsc19hdXR1bW4zLmpwZw1221239274.png +0 -0
  476. data/app/assets/javascripts/my_admin/plugins/elfinder/files/.tmb/l1_c2NvdHR3aWxsc19idWZmYWxvLmpwZw1221239094.png +0 -0
  477. data/app/assets/javascripts/my_admin/plugins/elfinder/files/.tmb/l1_c2NvdHR3aWxsc19idXR0ZXJmbHkuanBn1221239286.png +0 -0
  478. data/app/assets/javascripts/my_admin/plugins/elfinder/files/Folder #1/Another_file.txt +0 -0
  479. data/app/assets/javascripts/my_admin/plugins/elfinder/files/Folder #1/file.txt +0 -0
  480. data/app/assets/javascripts/my_admin/plugins/elfinder/files/Folder #1/scottwills_underwater2.jpg +0 -0
  481. data/app/assets/javascripts/my_admin/plugins/elfinder/files/Folder #1/scottwills_underwater5.jpg +0 -0
  482. data/app/assets/javascripts/my_admin/plugins/elfinder/files/Folder #2/scottwills_cat.jpg +0 -0
  483. data/app/assets/javascripts/my_admin/plugins/elfinder/files/Folder #2/scottwills_fish.jpg +0 -0
  484. data/app/assets/javascripts/my_admin/plugins/elfinder/files/Folder #2/scottwills_gardens.jpg +0 -0
  485. data/app/assets/javascripts/my_admin/plugins/elfinder/files/Folder #2/scottwills_horse.jpg +0 -0
  486. data/app/assets/javascripts/my_admin/plugins/elfinder/files/Main-file.txt +1 -0
  487. data/app/assets/javascripts/my_admin/plugins/elfinder/files/madness_beach.jpg +0 -0
  488. data/app/assets/javascripts/my_admin/plugins/elfinder/files/madness_boat.jpg +0 -0
  489. data/app/assets/javascripts/my_admin/plugins/elfinder/files/scottwills_autumn3.jpg +0 -0
  490. data/app/assets/javascripts/my_admin/plugins/elfinder/files/scottwills_buffalo.jpg +0 -0
  491. data/app/assets/javascripts/my_admin/plugins/elfinder/files/scottwills_butterfly.jpg +0 -0
  492. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.LANG.js +355 -0
  493. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.ar.js +290 -0
  494. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.bg.js +310 -0
  495. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.ca.js +310 -0
  496. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.cs.js +340 -0
  497. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.de.js +287 -0
  498. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.el.js +355 -0
  499. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.es.js +291 -0
  500. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.fa.js +339 -0
  501. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.fr.js +325 -0
  502. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.hu.js +280 -0
  503. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.it.js +340 -0
  504. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.jp.js +335 -0
  505. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.ko.js +340 -0
  506. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.nl.js +352 -0
  507. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.no.js +280 -0
  508. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.pl.js +309 -0
  509. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.pt_BR.js +320 -0
  510. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.ru.js +355 -0
  511. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.tr.js +340 -0
  512. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.vi.js +340 -0
  513. data/app/assets/javascripts/my_admin/plugins/elfinder/i18n/elfinder.zh_CN.js +354 -0
  514. data/app/assets/javascripts/my_admin/plugins/elfinder/php/MySQLStorage.sql +23 -0
  515. data/app/assets/javascripts/my_admin/plugins/elfinder/php/connector.minimal.php +57 -0
  516. data/app/assets/javascripts/my_admin/plugins/elfinder/php/connector.php +65 -0
  517. data/app/assets/javascripts/my_admin/plugins/elfinder/php/elFinder.class.php +1500 -0
  518. data/app/assets/javascripts/my_admin/plugins/elfinder/php/elFinderConnector.class.php +133 -0
  519. data/app/assets/javascripts/my_admin/plugins/elfinder/php/elFinderVolumeDriver.class.php +3520 -0
  520. data/app/assets/javascripts/my_admin/plugins/elfinder/php/elFinderVolumeDropbox.class.php +1450 -0
  521. data/app/assets/javascripts/my_admin/plugins/elfinder/php/elFinderVolumeFTP.class.php +994 -0
  522. data/app/assets/javascripts/my_admin/plugins/elfinder/php/elFinderVolumeLocalFileSystem.class.php +837 -0
  523. data/app/assets/javascripts/my_admin/plugins/elfinder/php/elFinderVolumeMySQL.class.php +960 -0
  524. data/app/assets/javascripts/my_admin/plugins/elfinder/php/mime.types +512 -0
  525. data/app/assets/javascripts/my_admin/plugins/elfinder/proxy/elFinderSupportVer1.js +338 -0
  526. data/app/assets/javascripts/my_admin/plugins/fileupload/bootstrap-fileupload.min.js +18 -0
  527. data/app/assets/javascripts/my_admin/plugins/flot/jquery.flot.bar.order.min.js +21 -0
  528. data/app/assets/javascripts/my_admin/plugins/flot/jquery.flot.min.js +28 -0
  529. data/app/assets/javascripts/my_admin/plugins/flot/jquery.flot.pie.js +812 -0
  530. data/app/assets/javascripts/my_admin/plugins/flot/jquery.flot.pie.min.js +56 -0
  531. data/app/assets/javascripts/my_admin/plugins/flot/jquery.flot.resize.min.js +18 -0
  532. data/app/assets/javascripts/my_admin/plugins/flot/jquery.flot.stack.js +184 -0
  533. data/app/assets/javascripts/my_admin/plugins/form/jquery.form.min.js +11 -0
  534. data/app/assets/javascripts/my_admin/plugins/fullcalendar/fullcalendar.min.js +17 -0
  535. data/app/assets/javascripts/my_admin/plugins/gmap/gmap3-menu.js +99 -0
  536. data/app/assets/javascripts/my_admin/plugins/gmap/gmap3.min.js +10 -0
  537. data/app/assets/javascripts/my_admin/plugins/gritter/jquery.gritter.min.js +1 -0
  538. data/app/assets/javascripts/my_admin/plugins/icheck/jquery.icheck.min.js +9 -0
  539. data/app/assets/javascripts/my_admin/plugins/imagesLoaded/jquery.imagesloaded.min.js +3 -0
  540. data/app/assets/javascripts/my_admin/plugins/jquery-ui/jquery.ui.core.min.js +5 -0
  541. data/app/assets/javascripts/my_admin/plugins/jquery-ui/jquery.ui.datepicker.min.js +5 -0
  542. data/app/assets/javascripts/my_admin/plugins/jquery-ui/jquery.ui.draggable.min.js +15 -0
  543. data/app/assets/javascripts/my_admin/plugins/jquery-ui/jquery.ui.droppable.min.js +16 -0
  544. data/app/assets/javascripts/my_admin/plugins/jquery-ui/jquery.ui.mouse.min.js +13 -0
  545. data/app/assets/javascripts/my_admin/plugins/jquery-ui/jquery.ui.position.js +497 -0
  546. data/app/assets/javascripts/my_admin/plugins/jquery-ui/jquery.ui.resizable.min.js +5 -0
  547. data/app/assets/javascripts/my_admin/plugins/jquery-ui/jquery.ui.selectable.min.js +15 -0
  548. data/app/assets/javascripts/my_admin/plugins/jquery-ui/jquery.ui.slider.js +649 -0
  549. data/app/assets/javascripts/my_admin/plugins/jquery-ui/jquery.ui.sortable.min.js +5 -0
  550. data/app/assets/javascripts/my_admin/plugins/jquery-ui/jquery.ui.spinner.js +492 -0
  551. data/app/assets/javascripts/my_admin/plugins/jquery-ui/jquery.ui.widget.min.js +5 -0
  552. data/app/assets/javascripts/my_admin/plugins/maskedinput/jquery.maskedinput.min.js +7 -0
  553. data/app/assets/javascripts/my_admin/plugins/masonry/jquery.masonry.min.js +10 -0
  554. data/app/assets/javascripts/my_admin/plugins/mockjax/jquery.mockjax.js +25 -0
  555. data/app/assets/javascripts/my_admin/plugins/momentjs/jquery.moment.js +6 -0
  556. data/app/assets/javascripts/my_admin/plugins/multiselect/jquery.multi-select.js +464 -0
  557. data/app/assets/javascripts/my_admin/plugins/nicescroll/jquery.nicescroll.min.js +101 -0
  558. data/app/assets/javascripts/my_admin/plugins/pageguide/jquery.pageguide.js +980 -0
  559. data/app/assets/javascripts/my_admin/plugins/placeholder/jquery.placeholder.min.js +2 -0
  560. data/app/assets/javascripts/my_admin/plugins/plupload/jquery.plupload.queue.js +1 -0
  561. data/app/assets/javascripts/my_admin/plugins/plupload/plupload.flash.swf +0 -0
  562. data/app/assets/javascripts/my_admin/plugins/plupload/plupload.full.js +2 -0
  563. data/app/assets/javascripts/my_admin/plugins/plupload/plupload.silverlight.xap +0 -0
  564. data/app/assets/javascripts/my_admin/plugins/select2/select2.min.js +22 -0
  565. data/app/assets/javascripts/my_admin/plugins/slimscroll/jquery.slimscroll.js +440 -0
  566. data/app/assets/javascripts/my_admin/plugins/slimscroll/jquery.slimscroll.min.js +7 -0
  567. data/app/assets/javascripts/my_admin/plugins/sparklines/jquery.sparklines.min.js +5 -0
  568. data/app/assets/javascripts/my_admin/plugins/tagsinput/jquery.tagsinput.min.js +1 -0
  569. data/app/assets/javascripts/my_admin/plugins/timepicker/bootstrap-timepicker.min.js +6 -0
  570. data/app/assets/javascripts/my_admin/plugins/touch-punch/jquery.touch-punch.min.js +11 -0
  571. data/app/assets/javascripts/my_admin/plugins/touchwipe/touchwipe.js +82 -0
  572. data/app/assets/javascripts/my_admin/plugins/touchwipe/touchwipe.min.js +9 -0
  573. data/app/assets/javascripts/my_admin/plugins/validation/additional-methods.min.js +4 -0
  574. data/app/assets/javascripts/my_admin/plugins/validation/jquery.validate.min.js +4 -0
  575. data/app/assets/javascripts/my_admin/plugins/vmap/jquery.vmap.min.js +12 -0
  576. data/app/assets/javascripts/my_admin/plugins/vmap/jquery.vmap.sampledata.js +1 -0
  577. data/app/assets/javascripts/my_admin/plugins/vmap/jquery.vmap.world.js +2 -0
  578. data/app/assets/javascripts/my_admin/plugins/wizard/jquery.form.wizard.min.js +12 -0
  579. data/app/assets/javascripts/my_admin/plugins/xeditable/address.js +168 -0
  580. data/app/assets/javascripts/my_admin/plugins/xeditable/bootstrap-editable.min.js +5 -0
  581. data/app/assets/javascripts/my_admin/plugins/xeditable/demo.js +139 -0
  582. data/app/assets/javascripts/my_admin/plugins/xeditable/demo.min.js +1 -0
  583. data/app/assets/javascripts/my_admin/rails.js +352 -0
  584. data/app/assets/javascripts/my_admin.js +0 -0
  585. data/app/assets/stylesheets/my_admin/application.css +30 -0
  586. data/app/assets/stylesheets/my_admin/application_locked.css +17 -0
  587. data/app/assets/stylesheets/my_admin/application_off.css +18 -0
  588. data/app/assets/stylesheets/my_admin/bootstrap-responsive.css +1109 -0
  589. data/app/assets/stylesheets/my_admin/bootstrap.css.erb +6159 -0
  590. data/app/assets/stylesheets/my_admin/my_admin.css +11 -0
  591. data/app/assets/stylesheets/my_admin/plugins/chosen/chosen.css.erb +397 -0
  592. data/app/assets/stylesheets/my_admin/plugins/colorbox/colorbox.css.erb +49 -0
  593. data/app/assets/stylesheets/my_admin/plugins/colorpicker/colorpicker.css.erb +7 -0
  594. data/app/assets/stylesheets/my_admin/plugins/datatable/TableTools.css +321 -0
  595. data/app/assets/stylesheets/my_admin/plugins/datatable/jquery.dataTables.css +221 -0
  596. data/app/assets/stylesheets/my_admin/plugins/datepicker/datepicker.css +301 -0
  597. data/app/assets/stylesheets/my_admin/plugins/dynatree/icons.gif +0 -0
  598. data/app/assets/stylesheets/my_admin/plugins/dynatree/loading.gif +0 -0
  599. data/app/assets/stylesheets/my_admin/plugins/dynatree/ui.dynatree.css +452 -0
  600. data/app/assets/stylesheets/my_admin/plugins/easy-pie-chart/jquery.easy-pie-chart.css +1 -0
  601. data/app/assets/stylesheets/my_admin/plugins/elfinder/elfinder.min.css +9 -0
  602. data/app/assets/stylesheets/my_admin/plugins/elfinder/theme.css.erb +50 -0
  603. data/app/assets/stylesheets/my_admin/plugins/fullcalendar/fullcalendar.css +1 -0
  604. data/app/assets/stylesheets/my_admin/plugins/fullcalendar/fullcalendar.print.css +1 -0
  605. data/app/assets/stylesheets/my_admin/plugins/gmap/gmap3-menu.css.erb +44 -0
  606. data/app/assets/stylesheets/my_admin/plugins/gritter/jquery.gritter.css +1 -0
  607. data/app/assets/stylesheets/my_admin/plugins/icheck/all.css +61 -0
  608. data/app/assets/stylesheets/my_admin/plugins/icheck/flat/_all.css +540 -0
  609. data/app/assets/stylesheets/my_admin/plugins/icheck/flat/aero.css +54 -0
  610. data/app/assets/stylesheets/my_admin/plugins/icheck/flat/blue.css +54 -0
  611. data/app/assets/stylesheets/my_admin/plugins/icheck/flat/flat.css +54 -0
  612. data/app/assets/stylesheets/my_admin/plugins/icheck/flat/green.css +54 -0
  613. data/app/assets/stylesheets/my_admin/plugins/icheck/flat/grey.css +54 -0
  614. data/app/assets/stylesheets/my_admin/plugins/icheck/flat/orange.css +54 -0
  615. data/app/assets/stylesheets/my_admin/plugins/icheck/flat/pink.css +54 -0
  616. data/app/assets/stylesheets/my_admin/plugins/icheck/flat/purple.css +54 -0
  617. data/app/assets/stylesheets/my_admin/plugins/icheck/flat/red.css +54 -0
  618. data/app/assets/stylesheets/my_admin/plugins/icheck/flat/yellow.css +54 -0
  619. data/app/assets/stylesheets/my_admin/plugins/icheck/futurico/futurico.css +54 -0
  620. data/app/assets/stylesheets/my_admin/plugins/icheck/line/_all.css +650 -0
  621. data/app/assets/stylesheets/my_admin/plugins/icheck/line/aero.css +65 -0
  622. data/app/assets/stylesheets/my_admin/plugins/icheck/line/blue.css +65 -0
  623. data/app/assets/stylesheets/my_admin/plugins/icheck/line/green.css +65 -0
  624. data/app/assets/stylesheets/my_admin/plugins/icheck/line/grey.css +65 -0
  625. data/app/assets/stylesheets/my_admin/plugins/icheck/line/line.css +65 -0
  626. data/app/assets/stylesheets/my_admin/plugins/icheck/line/orange.css +65 -0
  627. data/app/assets/stylesheets/my_admin/plugins/icheck/line/pink.css +65 -0
  628. data/app/assets/stylesheets/my_admin/plugins/icheck/line/purple.css +65 -0
  629. data/app/assets/stylesheets/my_admin/plugins/icheck/line/red.css +65 -0
  630. data/app/assets/stylesheets/my_admin/plugins/icheck/line/yellow.css +65 -0
  631. data/app/assets/stylesheets/my_admin/plugins/icheck/minimal/_all.css +640 -0
  632. data/app/assets/stylesheets/my_admin/plugins/icheck/minimal/aero.css +64 -0
  633. data/app/assets/stylesheets/my_admin/plugins/icheck/minimal/blue.css +64 -0
  634. data/app/assets/stylesheets/my_admin/plugins/icheck/minimal/green.css +64 -0
  635. data/app/assets/stylesheets/my_admin/plugins/icheck/minimal/grey.css +64 -0
  636. data/app/assets/stylesheets/my_admin/plugins/icheck/minimal/minimal.css +64 -0
  637. data/app/assets/stylesheets/my_admin/plugins/icheck/minimal/orange.css +64 -0
  638. data/app/assets/stylesheets/my_admin/plugins/icheck/minimal/pink.css +64 -0
  639. data/app/assets/stylesheets/my_admin/plugins/icheck/minimal/purple.css +64 -0
  640. data/app/assets/stylesheets/my_admin/plugins/icheck/minimal/red.css +64 -0
  641. data/app/assets/stylesheets/my_admin/plugins/icheck/minimal/yellow.css +64 -0
  642. data/app/assets/stylesheets/my_admin/plugins/icheck/polaris/polaris.css +64 -0
  643. data/app/assets/stylesheets/my_admin/plugins/icheck/square/_all.css +640 -0
  644. data/app/assets/stylesheets/my_admin/plugins/icheck/square/aero.css +64 -0
  645. data/app/assets/stylesheets/my_admin/plugins/icheck/square/blue.css +64 -0
  646. data/app/assets/stylesheets/my_admin/plugins/icheck/square/green.css +64 -0
  647. data/app/assets/stylesheets/my_admin/plugins/icheck/square/grey.css +64 -0
  648. data/app/assets/stylesheets/my_admin/plugins/icheck/square/orange.css +64 -0
  649. data/app/assets/stylesheets/my_admin/plugins/icheck/square/pink.css +64 -0
  650. data/app/assets/stylesheets/my_admin/plugins/icheck/square/purple.css +64 -0
  651. data/app/assets/stylesheets/my_admin/plugins/icheck/square/red.css +64 -0
  652. data/app/assets/stylesheets/my_admin/plugins/icheck/square/square.css +64 -0
  653. data/app/assets/stylesheets/my_admin/plugins/icheck/square/yellow.css +64 -0
  654. data/app/assets/stylesheets/my_admin/plugins/jquery-ui/smoothness/images/animated-overlay.gif +0 -0
  655. data/app/assets/stylesheets/my_admin/plugins/jquery-ui/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  656. data/app/assets/stylesheets/my_admin/plugins/jquery-ui/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  657. data/app/assets/stylesheets/my_admin/plugins/jquery-ui/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  658. data/app/assets/stylesheets/my_admin/plugins/jquery-ui/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  659. data/app/assets/stylesheets/my_admin/plugins/jquery-ui/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  660. data/app/assets/stylesheets/my_admin/plugins/jquery-ui/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  661. data/app/assets/stylesheets/my_admin/plugins/jquery-ui/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  662. data/app/assets/stylesheets/my_admin/plugins/jquery-ui/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  663. data/app/assets/stylesheets/my_admin/plugins/jquery-ui/smoothness/images/ui-icons_222222_256x240.png +0 -0
  664. data/app/assets/stylesheets/my_admin/plugins/jquery-ui/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  665. data/app/assets/stylesheets/my_admin/plugins/jquery-ui/smoothness/images/ui-icons_454545_256x240.png +0 -0
  666. data/app/assets/stylesheets/my_admin/plugins/jquery-ui/smoothness/images/ui-icons_888888_256x240.png +0 -0
  667. data/app/assets/stylesheets/my_admin/plugins/jquery-ui/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  668. data/app/assets/stylesheets/my_admin/plugins/jquery-ui/smoothness/jquery-ui.css +1087 -0
  669. data/app/assets/stylesheets/my_admin/plugins/jquery-ui/smoothness/jquery.ui.theme.css +406 -0
  670. data/app/assets/stylesheets/my_admin/plugins/multiselect/multi-select.css.erb +93 -0
  671. data/app/assets/stylesheets/my_admin/plugins/pageguide/pageguide.css +647 -0
  672. data/app/assets/stylesheets/my_admin/plugins/plupload/jquery.plupload.queue.css.erb +176 -0
  673. data/app/assets/stylesheets/my_admin/plugins/select2/select2.css.erb +615 -0
  674. data/app/assets/stylesheets/my_admin/plugins/tagsinput/jquery.tagsinput.css +7 -0
  675. data/app/assets/stylesheets/my_admin/plugins/timepicker/bootstrap-timepicker.min.css +10 -0
  676. data/app/assets/stylesheets/my_admin/plugins/xeditable/bootstrap-editable.css +480 -0
  677. data/app/assets/stylesheets/my_admin/style.css.erb +7827 -0
  678. data/app/assets/stylesheets/my_admin/themes.css +3821 -0
  679. data/app/assets/stylesheets/my_admin.css +0 -0
  680. data/app/controllers/my_admin/configurations_controller.rb +22 -0
  681. data/app/controllers/my_admin/dashboards_controller.rb +15 -0
  682. data/app/controllers/my_admin/first_users_controller.rb +42 -0
  683. data/app/controllers/my_admin/models_controller.rb +205 -0
  684. data/app/controllers/my_admin/my_admin_controller.rb +53 -0
  685. data/app/controllers/my_admin/my_admin_groups_controller.rb +5 -0
  686. data/app/controllers/my_admin/my_admin_logs_controller.rb +3 -0
  687. data/app/controllers/my_admin/my_admin_users_controller.rb +3 -0
  688. data/app/controllers/my_admin/password_controller.rb +29 -0
  689. data/app/controllers/my_admin/recovers_controller.rb +61 -0
  690. data/app/controllers/my_admin/sessions_controller.rb +62 -0
  691. data/app/helpers/asset_package_helper.rb +37 -0
  692. data/app/helpers/my_admin_application_helper.rb +7 -0
  693. data/app/helpers/my_admin_field_helper.rb +179 -0
  694. data/app/helpers/my_admin_helper.rb +35 -0
  695. data/app/helpers/my_admin_log_helper.rb +7 -0
  696. data/app/helpers/my_admin_model_helper.rb +34 -0
  697. data/app/helpers/my_admin_session_helper.rb +50 -0
  698. data/app/mailers/my_admin/recover_mailer.rb +13 -0
  699. data/app/model/ckeditor/asset.rb +4 -0
  700. data/app/model/ckeditor/attachment_file.rb +13 -0
  701. data/app/model/ckeditor/picture.rb +14 -0
  702. data/app/model/my_admin/configuration.rb +10 -0
  703. data/app/model/my_admin/group.rb +26 -0
  704. data/app/model/my_admin/group_permission.rb +7 -0
  705. data/app/model/my_admin/locale.rb +8 -0
  706. data/app/model/my_admin/log.rb +33 -0
  707. data/app/model/my_admin/permission.rb +19 -0
  708. data/app/model/my_admin/user.rb +153 -0
  709. data/app/model/my_admin/user_group.rb +7 -0
  710. data/app/views/layouts/my_admin.html.erb +81 -0
  711. data/app/views/layouts/my_admin_locked.html.erb +44 -0
  712. data/app/views/layouts/my_admin_off.html.erb +72 -0
  713. data/app/views/my_admin/_dashboard.html.erb +0 -0
  714. data/app/views/my_admin/_header.html.erb +101 -0
  715. data/app/views/my_admin/_header.html.erb.old +42 -0
  716. data/app/views/my_admin/_left.html.erb +23 -0
  717. data/app/views/my_admin/configurations/_form.html.erb +31 -0
  718. data/app/views/my_admin/configurations/show.html.erb +17 -0
  719. data/app/views/my_admin/dashboards/index.html.erb +1 -0
  720. data/app/views/my_admin/fields/config/type/default.html.erb +18 -0
  721. data/app/views/my_admin/fields/config/type/text.html.erb +18 -0
  722. data/app/views/my_admin/fields/edit/type/belongs_to.html.erb +28 -0
  723. data/app/views/my_admin/fields/edit/type/boolean.html.erb +5 -0
  724. data/app/views/my_admin/fields/edit/type/clear_text.html.erb +8 -0
  725. data/app/views/my_admin/fields/edit/type/color.html.erb +1 -0
  726. data/app/views/my_admin/fields/edit/type/date.html.erb +3 -0
  727. data/app/views/my_admin/fields/edit/type/datetime.html.erb +11 -0
  728. data/app/views/my_admin/fields/edit/type/decimal.html.erb +3 -0
  729. data/app/views/my_admin/fields/edit/type/default.html.erb +4 -0
  730. data/app/views/my_admin/fields/edit/type/default_struct.html.erb +9 -0
  731. data/app/views/my_admin/fields/edit/type/email.html.erb +4 -0
  732. data/app/views/my_admin/fields/edit/type/file.html.erb +9 -0
  733. data/app/views/my_admin/fields/edit/type/float.html.erb +1 -0
  734. data/app/views/my_admin/fields/edit/type/has_and_belongs_to_many.html.erb +34 -0
  735. data/app/views/my_admin/fields/edit/type/has_many.html.erb +12 -0
  736. data/app/views/my_admin/fields/edit/type/has_many_edit.html.erb +79 -0
  737. data/app/views/my_admin/fields/edit/type/has_many_locale.html.erb +40 -0
  738. data/app/views/my_admin/fields/edit/type/has_many_locale_struct.html.erb +1 -0
  739. data/app/views/my_admin/fields/edit/type/integer.html.erb +3 -0
  740. data/app/views/my_admin/fields/edit/type/list.html.erb +23 -0
  741. data/app/views/my_admin/fields/edit/type/list_string.html.erb +19 -0
  742. data/app/views/my_admin/fields/edit/type/money.html.erb +7 -0
  743. data/app/views/my_admin/fields/edit/type/paperclip/attachment.html.erb +28 -0
  744. data/app/views/my_admin/fields/edit/type/password.html.erb +4 -0
  745. data/app/views/my_admin/fields/edit/type/read_only.html.erb +10 -0
  746. data/app/views/my_admin/fields/edit/type/text.html.erb +3 -0
  747. data/app/views/my_admin/fields/edit/type/time.html.erb +6 -0
  748. data/app/views/my_admin/fields/filter/type/belongs_to.html.erb +11 -0
  749. data/app/views/my_admin/fields/filter/type/boolean.html.erb +5 -0
  750. data/app/views/my_admin/fields/filter/type/date.html.erb +3 -0
  751. data/app/views/my_admin/fields/filter/type/datetime.html.erb +13 -0
  752. data/app/views/my_admin/fields/filter/type/default.html.erb +2 -0
  753. data/app/views/my_admin/fields/filter/type/default_struct.html.erb +7 -0
  754. data/app/views/my_admin/fields/filter/type/email.html.erb +5 -0
  755. data/app/views/my_admin/fields/filter/type/list.html.erb +11 -0
  756. data/app/views/my_admin/fields/filter/type/list_string.html.erb +11 -0
  757. data/app/views/my_admin/fields/type/big_decimal.html.erb +1 -0
  758. data/app/views/my_admin/fields/type/boolean.html.erb +5 -0
  759. data/app/views/my_admin/fields/type/color.html.erb +2 -0
  760. data/app/views/my_admin/fields/type/datetime.html.erb +1 -0
  761. data/app/views/my_admin/fields/type/decimal.html.erb +1 -0
  762. data/app/views/my_admin/fields/type/default.html.erb +1 -0
  763. data/app/views/my_admin/fields/type/file.html.erb +1 -0
  764. data/app/views/my_admin/fields/type/float.html.erb +1 -0
  765. data/app/views/my_admin/fields/type/has_many.html.erb +1 -0
  766. data/app/views/my_admin/fields/type/has_many_edit.html.erb +1 -0
  767. data/app/views/my_admin/fields/type/paperclip/attachment.html.erb +5 -0
  768. data/app/views/my_admin/first_users/new.html.erb +51 -0
  769. data/app/views/my_admin/models/_field.html.erb +9 -0
  770. data/app/views/my_admin/models/_filters.html.erb +43 -0
  771. data/app/views/my_admin/models/_form.html.erb +43 -0
  772. data/app/views/my_admin/models/_paginate.html.erb +9 -0
  773. data/app/views/my_admin/models/_popup_hint.html.erb +8 -0
  774. data/app/views/my_admin/models/edit.html.erb +9 -0
  775. data/app/views/my_admin/models/index.html.erb +116 -0
  776. data/app/views/my_admin/models/new.html.erb +9 -0
  777. data/app/views/my_admin/models/remote.js.erb +13 -0
  778. data/app/views/my_admin/password/edit.html.erb +58 -0
  779. data/app/views/my_admin/recover_mailer/send_recover_mail.html.erb +25 -0
  780. data/app/views/my_admin/recovers/new.html.erb +20 -0
  781. data/app/views/my_admin/recovers/show.html.erb +27 -0
  782. data/app/views/my_admin/sessions/new.html.erb +30 -0
  783. data/app/views/my_admin/sessions/unlock.html.erb +34 -0
  784. data/config/locales/en.yml +35 -0
  785. data/config/locales/es.yml +22 -0
  786. data/config/locales/pt.yml +210 -0
  787. data/config/routes.rb +52 -0
  788. data/lib/generators/my_admin/install/USAGE +8 -0
  789. data/lib/generators/my_admin/install/install_generator.rb +68 -0
  790. data/lib/generators/my_admin/install/templates/config/initializers/my_admin.rb +8 -0
  791. data/lib/generators/my_admin/install/templates/migrations/ckeditor_assets.rb +26 -0
  792. data/lib/generators/my_admin/install/templates/migrations/configurations.rb +22 -0
  793. data/lib/generators/my_admin/install/templates/migrations/group_permissions.rb +16 -0
  794. data/lib/generators/my_admin/install/templates/migrations/groups.rb +16 -0
  795. data/lib/generators/my_admin/install/templates/migrations/locales.rb +15 -0
  796. data/lib/generators/my_admin/install/templates/migrations/logs.rb +19 -0
  797. data/lib/generators/my_admin/install/templates/migrations/permissions.rb +15 -0
  798. data/lib/generators/my_admin/install/templates/migrations/user_groups.rb +16 -0
  799. data/lib/generators/my_admin/install/templates/migrations/users.rb +28 -0
  800. data/lib/generators/my_admin/install/templates/public/plugins/ckeditor/ckupload.php +35 -0
  801. data/lib/generators/my_admin/model/model_generator.rb +26 -0
  802. data/lib/generators/my_admin/model/templates/controllers/controller.rb +3 -0
  803. data/lib/generators/my_admin/permissions/permissions_generator.rb +26 -0
  804. data/lib/my_admin/active_record.rb +118 -0
  805. data/lib/my_admin/application.rb +62 -0
  806. data/lib/my_admin/breadcrumbs/my_admin.rb +44 -0
  807. data/lib/my_admin/ckeditor.rb +39 -0
  808. data/lib/my_admin/engine.rb +23 -0
  809. data/lib/my_admin/jsmin.rb +205 -0
  810. data/lib/my_admin/locales.rb +29 -0
  811. data/lib/my_admin/model_configuration.rb +53 -0
  812. data/lib/my_admin/paperclip.rb +4 -0
  813. data/lib/my_admin/paperclip_processors/cropper.rb +20 -0
  814. data/lib/my_admin/paperclip_processors/rotator.rb +25 -0
  815. data/lib/my_admin/string.rb +5 -0
  816. data/lib/my_admin/to_xls.rb +53 -0
  817. data/lib/my_admin/version.rb +3 -0
  818. data/lib/my_admin/will_paginate/bootstrap_link_renderer.rb +20 -0
  819. data/lib/my_admin/yml_manage.rb +41 -0
  820. data/lib/my_admin.rb +31 -0
  821. data/my_admin.gemspec +30 -0
  822. metadata +975 -0
@@ -0,0 +1,3432 @@
1
+ /*************************************************************************
2
+ jquery.dynatree.js
3
+ Dynamic tree view control, with support for lazy loading of branches.
4
+
5
+ Copyright (c) 2006-2013, Martin Wendt (http://wwWendt.de)
6
+ Dual licensed under the MIT or GPL Version 2 licenses.
7
+ http://code.google.com/p/dynatree/wiki/LicenseInfo
8
+
9
+ A current version and some documentation is available at
10
+ http://dynatree.googlecode.com/
11
+
12
+ $Version: 1.2.4$
13
+ $Revision: 644, 2013-02-12 21:39:36$
14
+
15
+ @depends: jquery.js
16
+ @depends: jquery.ui.core.js
17
+ @depends: jquery.cookie.js
18
+ *************************************************************************/
19
+
20
+ /* jsHint options*/
21
+ // Note: We currently allow eval() to parse the 'data' attribtes, when initializing from HTML.
22
+ // TODO: pass jsHint with the options given in grunt.js only.
23
+ // The following should not be required:
24
+ /*global alert */
25
+ /*jshint nomen:false, smarttabs:true, eqeqeq:false, evil:true, regexp:false */
26
+
27
+ /*************************************************************************
28
+ * Debug functions
29
+ */
30
+
31
+ var _canLog = true;
32
+
33
+ function _log(mode, msg) {
34
+ /**
35
+ * Usage: logMsg("%o was toggled", this);
36
+ */
37
+ if( !_canLog ){
38
+ return;
39
+ }
40
+ // Remove first argument
41
+ var args = Array.prototype.slice.apply(arguments, [1]);
42
+ // Prepend timestamp
43
+ var dt = new Date();
44
+ var tag = dt.getHours()+":"+dt.getMinutes()+":"+dt.getSeconds()+"."+dt.getMilliseconds();
45
+ args[0] = tag + " - " + args[0];
46
+
47
+ try {
48
+ switch( mode ) {
49
+ case "info":
50
+ window.console.info.apply(window.console, args);
51
+ break;
52
+ case "warn":
53
+ window.console.warn.apply(window.console, args);
54
+ break;
55
+ default:
56
+ window.console.log.apply(window.console, args);
57
+ break;
58
+ }
59
+ } catch(e) {
60
+ if( !window.console ){
61
+ _canLog = false; // Permanently disable, when logging is not supported by the browser
62
+ }else if(e.number === -2146827850){
63
+ // fix for IE8, where window.console.log() exists, but does not support .apply()
64
+ window.console.log(args.join(", "));
65
+ }
66
+ }
67
+ }
68
+
69
+ /* Check browser version, since $.browser was removed in jQuery 1.9 */
70
+ function _checkBrowser(){
71
+ var matched, browser;
72
+ function uaMatch( ua ) {
73
+ ua = ua.toLowerCase();
74
+ var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
75
+ /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
76
+ /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
77
+ /(msie) ([\w.]+)/.exec( ua ) ||
78
+ ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
79
+ [];
80
+ return {
81
+ browser: match[ 1 ] || "",
82
+ version: match[ 2 ] || "0"
83
+ };
84
+ }
85
+ matched = uaMatch( navigator.userAgent );
86
+ browser = {};
87
+ if ( matched.browser ) {
88
+ browser[ matched.browser ] = true;
89
+ browser.version = matched.version;
90
+ }
91
+ if ( browser.chrome ) {
92
+ browser.webkit = true;
93
+ } else if ( browser.webkit ) {
94
+ browser.safari = true;
95
+ }
96
+ return browser;
97
+ }
98
+ var BROWSER = jQuery.browser || _checkBrowser();
99
+
100
+ function logMsg(msg) {
101
+ Array.prototype.unshift.apply(arguments, ["debug"]);
102
+ _log.apply(this, arguments);
103
+ }
104
+
105
+
106
+ // Forward declaration
107
+ var getDynaTreePersistData = null;
108
+
109
+
110
+
111
+ /*************************************************************************
112
+ * Constants
113
+ */
114
+ var DTNodeStatus_Error = -1;
115
+ var DTNodeStatus_Loading = 1;
116
+ var DTNodeStatus_Ok = 0;
117
+
118
+
119
+ // Start of local namespace
120
+ (function($) {
121
+
122
+ /*************************************************************************
123
+ * Common tool functions.
124
+ */
125
+
126
+ var Class = {
127
+ create: function() {
128
+ return function() {
129
+ this.initialize.apply(this, arguments);
130
+ };
131
+ }
132
+ };
133
+
134
+ // Tool function to get dtnode from the event target:
135
+ function getDtNodeFromElement(el) {
136
+ alert("getDtNodeFromElement is deprecated");
137
+ return $.ui.dynatree.getNode(el);
138
+ /*
139
+ var iMax = 5;
140
+ while( el && iMax-- ) {
141
+ if(el.dtnode) { return el.dtnode; }
142
+ el = el.parentNode;
143
+ }
144
+ return null;
145
+ */
146
+ }
147
+
148
+ function noop() {
149
+ }
150
+
151
+ /** Compare two dotted version strings (like '10.2.3').
152
+ * @returns {Integer} 0: v1 == v2, -1: v1 < v2, 1: v1 > v2
153
+ */
154
+ function versionCompare(v1, v2) {
155
+ var v1parts = ("" + v1).split("."),
156
+ v2parts = ("" + v2).split("."),
157
+ minLength = Math.min(v1parts.length, v2parts.length),
158
+ p1, p2, i;
159
+ // Compare tuple pair-by-pair.
160
+ for(i = 0; i < minLength; i++) {
161
+ // Convert to integer if possible, because "8" > "10".
162
+ p1 = parseInt(v1parts[i], 10);
163
+ p2 = parseInt(v2parts[i], 10);
164
+ if (isNaN(p1)){ p1 = v1parts[i]; }
165
+ if (isNaN(p2)){ p2 = v2parts[i]; }
166
+ if (p1 == p2) {
167
+ continue;
168
+ }else if (p1 > p2) {
169
+ return 1;
170
+ }else if (p1 < p2) {
171
+ return -1;
172
+ }
173
+ // one operand is NaN
174
+ return NaN;
175
+ }
176
+ // The longer tuple is always considered 'greater'
177
+ if (v1parts.length === v2parts.length) {
178
+ return 0;
179
+ }
180
+ return (v1parts.length < v2parts.length) ? -1 : 1;
181
+ }
182
+
183
+
184
+ /*************************************************************************
185
+ * Class DynaTreeNode
186
+ */
187
+ var DynaTreeNode = Class.create();
188
+
189
+ DynaTreeNode.prototype = {
190
+ initialize: function(parent, tree, data) {
191
+ /**
192
+ * @constructor
193
+ */
194
+ this.parent = parent;
195
+ this.tree = tree;
196
+ if ( typeof data === "string" ){
197
+ data = { title: data };
198
+ }
199
+ if( !data.key ){
200
+ data.key = "_" + tree._nodeCount++;
201
+ }else{
202
+ data.key = "" + data.key; // issue 371
203
+ }
204
+ this.data = $.extend({}, $.ui.dynatree.nodedatadefaults, data);
205
+ this.li = null; // not yet created
206
+ this.span = null; // not yet created
207
+ this.ul = null; // not yet created
208
+ this.childList = null; // no subnodes yet
209
+ this._isLoading = false; // Lazy content is being loaded
210
+ this.hasSubSel = false;
211
+ this.bExpanded = false;
212
+ this.bSelected = false;
213
+
214
+ },
215
+
216
+ toString: function() {
217
+ return "DynaTreeNode<" + this.data.key + ">: '" + this.data.title + "'";
218
+ },
219
+
220
+ toDict: function(recursive, callback) {
221
+ var dict = $.extend({}, this.data);
222
+ dict.activate = ( this.tree.activeNode === this );
223
+ dict.focus = ( this.tree.focusNode === this );
224
+ dict.expand = this.bExpanded;
225
+ dict.select = this.bSelected;
226
+ if( callback ){
227
+ callback(dict);
228
+ }
229
+ if( recursive && this.childList ) {
230
+ dict.children = [];
231
+ for(var i=0, l=this.childList.length; i<l; i++ ){
232
+ dict.children.push(this.childList[i].toDict(true, callback));
233
+ }
234
+ } else {
235
+ delete dict.children;
236
+ }
237
+ return dict;
238
+ },
239
+
240
+ fromDict: function(dict) {
241
+ /**
242
+ * Update node data. If dict contains 'children', then also replace
243
+ * the hole sub tree.
244
+ */
245
+ var children = dict.children;
246
+ if(children === undefined){
247
+ this.data = $.extend(this.data, dict);
248
+ this.render();
249
+ return;
250
+ }
251
+ dict = $.extend({}, dict);
252
+ dict.children = undefined;
253
+ this.data = $.extend(this.data, dict);
254
+ this.removeChildren();
255
+ this.addChild(children);
256
+ },
257
+
258
+ _getInnerHtml: function() {
259
+ var tree = this.tree,
260
+ opts = tree.options,
261
+ cache = tree.cache,
262
+ level = this.getLevel(),
263
+ data = this.data,
264
+ res = "",
265
+ imageSrc;
266
+ // connector (expanded, expandable or simple)
267
+ if( level < opts.minExpandLevel ) {
268
+ if(level > 1){
269
+ res += cache.tagConnector;
270
+ }
271
+ // .. else (i.e. for root level) skip expander/connector altogether
272
+ } else if( this.hasChildren() !== false ) {
273
+ res += cache.tagExpander;
274
+ } else {
275
+ res += cache.tagConnector;
276
+ }
277
+ // Checkbox mode
278
+ if( opts.checkbox && data.hideCheckbox !== true && !data.isStatusNode ) {
279
+ res += cache.tagCheckbox;
280
+ }
281
+ // folder or doctype icon
282
+ if ( data.icon ) {
283
+ if (data.icon.charAt(0) === "/"){
284
+ imageSrc = data.icon;
285
+ }else{
286
+ imageSrc = opts.imagePath + data.icon;
287
+ }
288
+ res += "<img src='" + imageSrc + "' alt='' />";
289
+ } else if ( data.icon === false ) {
290
+ // icon == false means 'no icon'
291
+ // noop(); // keep JSLint happy
292
+ } else if ( data.iconClass ) {
293
+ res += "<span class='" + " " + data.iconClass + "'></span>";
294
+ } else {
295
+ // icon == null means 'default icon'
296
+ res += cache.tagNodeIcon;
297
+ }
298
+ // node title
299
+ var nodeTitle = "";
300
+ if ( opts.onCustomRender ){
301
+ nodeTitle = opts.onCustomRender.call(tree, this) || "";
302
+ }
303
+ if(!nodeTitle){
304
+ var tooltip = data.tooltip ? ' title="' + data.tooltip.replace(/\"/g, '&quot;') + '"' : '',
305
+ href = data.href || "#";
306
+ if( opts.noLink || data.noLink ) {
307
+ nodeTitle = '<span style="display:inline-block;" class="' + opts.classNames.title + '"' + tooltip + '>' + data.title + '</span>';
308
+ // this.tree.logDebug("nodeTitle: " + nodeTitle);
309
+ } else {
310
+ nodeTitle = '<a href="' + href + '" class="' + opts.classNames.title + '"' + tooltip + '>' + data.title + '</a>';
311
+ }
312
+ }
313
+ res += nodeTitle;
314
+ return res;
315
+ },
316
+
317
+
318
+ _fixOrder: function() {
319
+ /**
320
+ * Make sure, that <li> order matches childList order.
321
+ */
322
+ var cl = this.childList;
323
+ if( !cl || !this.ul ){
324
+ return;
325
+ }
326
+ var childLI = this.ul.firstChild;
327
+ for(var i=0, l=cl.length-1; i<l; i++) {
328
+ var childNode1 = cl[i];
329
+ var childNode2 = childLI.dtnode;
330
+ if( childNode1 !== childNode2 ) {
331
+ this.tree.logDebug("_fixOrder: mismatch at index " + i + ": " + childNode1 + " != " + childNode2);
332
+ this.ul.insertBefore(childNode1.li, childNode2.li);
333
+ } else {
334
+ childLI = childLI.nextSibling;
335
+ }
336
+ }
337
+ },
338
+
339
+
340
+ render: function(useEffects, includeInvisible) {
341
+ /**
342
+ * Create <li><span>..</span> .. </li> tags for this node.
343
+ *
344
+ * <li id='KEY' dtnode=NODE> // This div contains the node's span and list of child div's.
345
+ * <span class='title'>S S S A</span> // Span contains graphic spans and title <a> tag
346
+ * <ul> // only present, when node has children
347
+ * <li id='KEY' dtnode=NODE>child1</li>
348
+ * <li id='KEY' dtnode=NODE>child2</li>
349
+ * </ul>
350
+ * </li>
351
+ */
352
+ // this.tree.logDebug("%s.render(%s)", this, useEffects);
353
+ // ---
354
+ var tree = this.tree,
355
+ parent = this.parent,
356
+ data = this.data,
357
+ opts = tree.options,
358
+ cn = opts.classNames,
359
+ isLastSib = this.isLastSibling(),
360
+ firstTime = false;
361
+
362
+ if( !parent && !this.ul ) {
363
+ // Root node has only a <ul>
364
+ this.li = this.span = null;
365
+ this.ul = document.createElement("ul");
366
+ if( opts.minExpandLevel > 1 ){
367
+ this.ul.className = cn.container + " " + cn.noConnector;
368
+ }else{
369
+ this.ul.className = cn.container;
370
+ }
371
+ } else if( parent ) {
372
+ // Create <li><span /> </li>
373
+ if( ! this.li ) {
374
+ firstTime = true;
375
+ this.li = document.createElement("li");
376
+ this.li.dtnode = this;
377
+ if( data.key && opts.generateIds ){
378
+ this.li.id = opts.idPrefix + data.key;
379
+ }
380
+ this.span = document.createElement("span");
381
+ this.span.className = cn.title;
382
+ this.li.appendChild(this.span);
383
+
384
+ if( !parent.ul ) {
385
+ // This is the parent's first child: create UL tag
386
+ // (Hidden, because it will be
387
+ parent.ul = document.createElement("ul");
388
+ parent.ul.style.display = "none";
389
+ parent.li.appendChild(parent.ul);
390
+ // if( opts.minExpandLevel > this.getLevel() ){
391
+ // parent.ul.className = cn.noConnector;
392
+ // }
393
+ }
394
+ // set node connector images, links and text
395
+ // this.span.innerHTML = this._getInnerHtml();
396
+
397
+ parent.ul.appendChild(this.li);
398
+ }
399
+ // set node connector images, links and text
400
+ this.span.innerHTML = this._getInnerHtml();
401
+ // Set classes for current status
402
+ var cnList = [];
403
+ cnList.push(cn.node);
404
+ if( data.isFolder ){
405
+ cnList.push(cn.folder);
406
+ }
407
+ if( this.bExpanded ){
408
+ cnList.push(cn.expanded);
409
+ }
410
+ if( this.hasChildren() !== false ){
411
+ cnList.push(cn.hasChildren);
412
+ }
413
+ if( data.isLazy && this.childList === null ){
414
+ cnList.push(cn.lazy);
415
+ }
416
+ if( isLastSib ){
417
+ cnList.push(cn.lastsib);
418
+ }
419
+ if( this.bSelected ){
420
+ cnList.push(cn.selected);
421
+ }
422
+ if( this.hasSubSel ){
423
+ cnList.push(cn.partsel);
424
+ }
425
+ if( tree.activeNode === this ){
426
+ cnList.push(cn.active);
427
+ }
428
+ if( data.addClass ){
429
+ cnList.push(data.addClass);
430
+ }
431
+ // IE6 doesn't correctly evaluate multiple class names,
432
+ // so we create combined class names that can be used in the CSS
433
+ cnList.push(cn.combinedExpanderPrefix
434
+ + (this.bExpanded ? "e" : "c")
435
+ + (data.isLazy && this.childList === null ? "d" : "")
436
+ + (isLastSib ? "l" : "")
437
+ );
438
+ cnList.push(cn.combinedIconPrefix
439
+ + (this.bExpanded ? "e" : "c")
440
+ + (data.isFolder ? "f" : "")
441
+ );
442
+ this.span.className = cnList.join(" ");
443
+
444
+ // TODO: we should not set this in the <span> tag also, if we set it here:
445
+ this.li.className = isLastSib ? cn.lastsib : "";
446
+
447
+ // Allow tweaking, binding, after node was created for the first time
448
+ if(firstTime && opts.onCreate){
449
+ opts.onCreate.call(tree, this, this.span);
450
+ }
451
+ // Hide children, if node is collapsed
452
+ // this.ul.style.display = ( this.bExpanded || !parent ) ? "" : "none";
453
+ // Allow tweaking after node state was rendered
454
+ if(opts.onRender){
455
+ opts.onRender.call(tree, this, this.span);
456
+ }
457
+ }
458
+ // Visit child nodes
459
+ if( (this.bExpanded || includeInvisible === true) && this.childList ) {
460
+ for(var i=0, l=this.childList.length; i<l; i++) {
461
+ this.childList[i].render(false, includeInvisible);
462
+ }
463
+ // Make sure the tag order matches the child array
464
+ this._fixOrder();
465
+ }
466
+ // Hide children, if node is collapsed
467
+ if( this.ul ) {
468
+ var isHidden = (this.ul.style.display === "none");
469
+ var isExpanded = !!this.bExpanded;
470
+ // logMsg("isHidden:%s", isHidden);
471
+ if( useEffects && opts.fx && (isHidden === isExpanded) ) {
472
+ var duration = opts.fx.duration || 200;
473
+ $(this.ul).animate(opts.fx, duration);
474
+ } else {
475
+ this.ul.style.display = ( this.bExpanded || !parent ) ? "" : "none";
476
+ }
477
+ }
478
+ },
479
+ /** Return '/id1/id2/id3'. */
480
+ getKeyPath: function(excludeSelf) {
481
+ var path = [];
482
+ this.visitParents(function(node){
483
+ if(node.parent){
484
+ path.unshift(node.data.key);
485
+ }
486
+ }, !excludeSelf);
487
+ return "/" + path.join(this.tree.options.keyPathSeparator);
488
+ },
489
+
490
+ getParent: function() {
491
+ return this.parent;
492
+ },
493
+
494
+ getChildren: function() {
495
+ if(this.hasChildren() === undefined){
496
+ return undefined; // Lazy node: unloaded, currently loading, or load error
497
+ }
498
+ return this.childList;
499
+ },
500
+
501
+ /** Check if node has children (returns undefined, if not sure). */
502
+ hasChildren: function() {
503
+ if(this.data.isLazy){
504
+ if(this.childList === null || this.childList === undefined){
505
+ // Not yet loaded
506
+ return undefined;
507
+ }else if(this.childList.length === 0){
508
+ // Loaded, but response was empty
509
+ return false;
510
+ }else if(this.childList.length === 1 && this.childList[0].isStatusNode()){
511
+ // Currently loading or load error
512
+ return undefined;
513
+ }
514
+ return true;
515
+ }
516
+ return !!this.childList;
517
+ },
518
+
519
+ isFirstSibling: function() {
520
+ var p = this.parent;
521
+ return !p || p.childList[0] === this;
522
+ },
523
+
524
+ isLastSibling: function() {
525
+ var p = this.parent;
526
+ return !p || p.childList[p.childList.length-1] === this;
527
+ },
528
+
529
+ isLoading: function() {
530
+ return !!this._isLoading;
531
+ },
532
+
533
+ getPrevSibling: function() {
534
+ if( !this.parent ){
535
+ return null;
536
+ }
537
+ var ac = this.parent.childList;
538
+ for(var i=1, l=ac.length; i<l; i++){ // start with 1, so prev(first) = null
539
+ if( ac[i] === this ){
540
+ return ac[i-1];
541
+ }
542
+ }
543
+ return null;
544
+ },
545
+
546
+ getNextSibling: function() {
547
+ if( !this.parent ){
548
+ return null;
549
+ }
550
+ var ac = this.parent.childList;
551
+ for(var i=0, l=ac.length-1; i<l; i++){ // up to length-2, so next(last) = null
552
+ if( ac[i] === this ){
553
+ return ac[i+1];
554
+ }
555
+ }
556
+ return null;
557
+ },
558
+
559
+ isStatusNode: function() {
560
+ return (this.data.isStatusNode === true);
561
+ },
562
+
563
+ isChildOf: function(otherNode) {
564
+ return (this.parent && this.parent === otherNode);
565
+ },
566
+
567
+ isDescendantOf: function(otherNode) {
568
+ if(!otherNode){
569
+ return false;
570
+ }
571
+ var p = this.parent;
572
+ while( p ) {
573
+ if( p === otherNode ){
574
+ return true;
575
+ }
576
+ p = p.parent;
577
+ }
578
+ return false;
579
+ },
580
+
581
+ countChildren: function() {
582
+ var cl = this.childList;
583
+ if( !cl ){
584
+ return 0;
585
+ }
586
+ var n = cl.length;
587
+ for(var i=0, l=n; i<l; i++){
588
+ var child = cl[i];
589
+ n += child.countChildren();
590
+ }
591
+ return n;
592
+ },
593
+
594
+ /**Sort child list by title.
595
+ * cmd: optional compare function.
596
+ * deep: optional: pass true to sort all descendant nodes.
597
+ */
598
+ sortChildren: function(cmp, deep) {
599
+ var cl = this.childList;
600
+ if( !cl ){
601
+ return;
602
+ }
603
+ cmp = cmp || function(a, b) {
604
+ // return a.data.title === b.data.title ? 0 : a.data.title > b.data.title ? 1 : -1;
605
+ var x = a.data.title.toLowerCase(),
606
+ y = b.data.title.toLowerCase();
607
+ return x === y ? 0 : x > y ? 1 : -1;
608
+ };
609
+ cl.sort(cmp);
610
+ if( deep ){
611
+ for(var i=0, l=cl.length; i<l; i++){
612
+ if( cl[i].childList ){
613
+ cl[i].sortChildren(cmp, "$norender$");
614
+ }
615
+ }
616
+ }
617
+ if( deep !== "$norender$" ){
618
+ this.render();
619
+ }
620
+ },
621
+
622
+ _setStatusNode: function(data) {
623
+ // Create, modify or remove the status child node (pass 'null', to remove it).
624
+ var firstChild = ( this.childList ? this.childList[0] : null );
625
+ if( !data ) {
626
+ if ( firstChild && firstChild.isStatusNode()) {
627
+ try{
628
+ // I've seen exceptions here with loadKeyPath...
629
+ if(this.ul){
630
+ this.ul.removeChild(firstChild.li);
631
+ firstChild.li = null; // avoid leaks (issue 215)
632
+ }
633
+ }catch(e){}
634
+ if( this.childList.length === 1 ){
635
+ this.childList = [];
636
+ }else{
637
+ this.childList.shift();
638
+ }
639
+ }
640
+ } else if ( firstChild ) {
641
+ data.isStatusNode = true;
642
+ data.key = "_statusNode";
643
+ firstChild.data = data;
644
+ firstChild.render();
645
+ } else {
646
+ data.isStatusNode = true;
647
+ data.key = "_statusNode";
648
+ firstChild = this.addChild(data);
649
+ }
650
+ },
651
+
652
+ setLazyNodeStatus: function(lts, opts) {
653
+ var tooltip = (opts && opts.tooltip) ? opts.tooltip : null,
654
+ info = (opts && opts.info) ? " (" + opts.info + ")" : "";
655
+ switch( lts ) {
656
+ case DTNodeStatus_Ok:
657
+ this._setStatusNode(null);
658
+ $(this.span).removeClass(this.tree.options.classNames.nodeLoading);
659
+ this._isLoading = false;
660
+ // this.render();
661
+ if( this.tree.options.autoFocus ) {
662
+ if( this === this.tree.tnRoot && this.childList && this.childList.length > 0) {
663
+ // special case: using ajaxInit
664
+ this.childList[0].focus();
665
+ } else {
666
+ this.focus();
667
+ }
668
+ }
669
+ break;
670
+ case DTNodeStatus_Loading:
671
+ this._isLoading = true;
672
+ $(this.span).addClass(this.tree.options.classNames.nodeLoading);
673
+ // The root is hidden, so we set a temporary status child
674
+ if(!this.parent){
675
+ this._setStatusNode({
676
+ title: this.tree.options.strings.loading + info,
677
+ tooltip: tooltip,
678
+ addClass: this.tree.options.classNames.nodeWait
679
+ });
680
+ }
681
+ break;
682
+ case DTNodeStatus_Error:
683
+ this._isLoading = false;
684
+ // $(this.span).addClass(this.tree.options.classNames.nodeError);
685
+ this._setStatusNode({
686
+ title: this.tree.options.strings.loadError + info,
687
+ tooltip: tooltip,
688
+ addClass: this.tree.options.classNames.nodeError
689
+ });
690
+ break;
691
+ default:
692
+ throw "Bad LazyNodeStatus: '" + lts + "'.";
693
+ }
694
+ },
695
+
696
+ _parentList: function(includeRoot, includeSelf) {
697
+ var l = [];
698
+ var dtn = includeSelf ? this : this.parent;
699
+ while( dtn ) {
700
+ if( includeRoot || dtn.parent ){
701
+ l.unshift(dtn);
702
+ }
703
+ dtn = dtn.parent;
704
+ }
705
+ return l;
706
+ },
707
+ getLevel: function() {
708
+ /**
709
+ * Return node depth. 0: System root node, 1: visible top-level node.
710
+ */
711
+ var level = 0;
712
+ var dtn = this.parent;
713
+ while( dtn ) {
714
+ level++;
715
+ dtn = dtn.parent;
716
+ }
717
+ return level;
718
+ },
719
+
720
+ _getTypeForOuterNodeEvent: function(event) {
721
+ /** Return the inner node span (title, checkbox or expander) if
722
+ * event.target points to the outer span.
723
+ * This function should fix issue #93:
724
+ * FF2 ignores empty spans, when generating events (returning the parent instead).
725
+ */
726
+ var cns = this.tree.options.classNames;
727
+ var target = event.target;
728
+ // Only process clicks on an outer node span (probably due to a FF2 event handling bug)
729
+ if( target.className.indexOf(cns.node) < 0 ) {
730
+ return null;
731
+ }
732
+ // Event coordinates, relative to outer node span:
733
+ var eventX = event.pageX - target.offsetLeft;
734
+ var eventY = event.pageY - target.offsetTop;
735
+
736
+ for(var i=0, l=target.childNodes.length; i<l; i++) {
737
+ var cn = target.childNodes[i];
738
+ var x = cn.offsetLeft - target.offsetLeft;
739
+ var y = cn.offsetTop - target.offsetTop;
740
+ var nx = cn.clientWidth, ny = cn.clientHeight;
741
+ // alert (cn.className + ": " + x + ", " + y + ", s:" + nx + ", " + ny);
742
+ if( eventX >= x && eventX <= (x+nx) && eventY >= y && eventY <= (y+ny) ) {
743
+ // alert("HIT "+ cn.className);
744
+ if( cn.className==cns.title ){
745
+ return "title";
746
+ }else if( cn.className==cns.expander ){
747
+ return "expander";
748
+ }else if( cn.className==cns.checkbox ){
749
+ return "checkbox";
750
+ }else if( cn.className==cns.nodeIcon ){
751
+ return "icon";
752
+ }
753
+ }
754
+ }
755
+ return "prefix";
756
+ },
757
+
758
+ getEventTargetType: function(event) {
759
+ // Return the part of a node, that a click event occured on.
760
+ // Note: there is no check, if the event was fired on THIS node.
761
+ var tcn = event && event.target ? event.target.className : "",
762
+ cns = this.tree.options.classNames;
763
+
764
+ if( tcn === cns.title ){
765
+ return "title";
766
+ }else if( tcn === cns.expander ){
767
+ return "expander";
768
+ }else if( tcn === cns.checkbox ){
769
+ return "checkbox";
770
+ }else if( tcn === cns.nodeIcon ){
771
+ return "icon";
772
+ }else if( tcn === cns.empty || tcn === cns.vline || tcn === cns.connector ){
773
+ return "prefix";
774
+ }else if( tcn.indexOf(cns.node) >= 0 ){
775
+ // FIX issue #93
776
+ return this._getTypeForOuterNodeEvent(event);
777
+ }
778
+ return null;
779
+ },
780
+
781
+ isVisible: function() {
782
+ // Return true, if all parents are expanded.
783
+ var parents = this._parentList(true, false);
784
+ for(var i=0, l=parents.length; i<l; i++){
785
+ if( ! parents[i].bExpanded ){ return false; }
786
+ }
787
+ return true;
788
+ },
789
+
790
+ makeVisible: function() {
791
+ // Make sure, all parents are expanded
792
+ var parents = this._parentList(true, false);
793
+ for(var i=0, l=parents.length; i<l; i++){
794
+ parents[i]._expand(true);
795
+ }
796
+ },
797
+
798
+ focus: function() {
799
+ // TODO: check, if we already have focus
800
+ // this.tree.logDebug("dtnode.focus(): %o", this);
801
+ this.makeVisible();
802
+ try {
803
+ $(this.span).find(">a").focus();
804
+ } catch(e) { }
805
+ },
806
+
807
+ isFocused: function() {
808
+ return (this.tree.tnFocused === this);
809
+ },
810
+
811
+ _activate: function(flag, fireEvents) {
812
+ // (De)Activate - but not focus - this node.
813
+ this.tree.logDebug("dtnode._activate(%o, fireEvents=%o) - %o", flag, fireEvents, this);
814
+ var opts = this.tree.options;
815
+ if( this.data.isStatusNode ){
816
+ return;
817
+ }
818
+ if ( fireEvents && opts.onQueryActivate && opts.onQueryActivate.call(this.tree, flag, this) === false ){
819
+ return; // Callback returned false
820
+ }
821
+ if( flag ) {
822
+ // Activate
823
+ if( this.tree.activeNode ) {
824
+ if( this.tree.activeNode === this ){
825
+ return;
826
+ }
827
+ this.tree.activeNode.deactivate();
828
+ }
829
+ if( opts.activeVisible ){
830
+ this.makeVisible();
831
+ }
832
+ this.tree.activeNode = this;
833
+ if( opts.persist ){
834
+ $.cookie(opts.cookieId+"-active", this.data.key, opts.cookie);
835
+ }
836
+ this.tree.persistence.activeKey = this.data.key;
837
+ $(this.span).addClass(opts.classNames.active);
838
+ if ( fireEvents && opts.onActivate ){
839
+ opts.onActivate.call(this.tree, this);
840
+ }
841
+ } else {
842
+ // Deactivate
843
+ if( this.tree.activeNode === this ) {
844
+ if ( opts.onQueryActivate && opts.onQueryActivate.call(this.tree, false, this) === false ){
845
+ return; // Callback returned false
846
+ }
847
+ $(this.span).removeClass(opts.classNames.active);
848
+ if( opts.persist ) {
849
+ // Note: we don't pass null, but ''. So the cookie is not deleted.
850
+ // If we pass null, we also have to pass a COPY of opts, because $cookie will override opts.expires (issue 84)
851
+ $.cookie(opts.cookieId+"-active", "", opts.cookie);
852
+ }
853
+ this.tree.persistence.activeKey = null;
854
+ this.tree.activeNode = null;
855
+ if ( fireEvents && opts.onDeactivate ){
856
+ opts.onDeactivate.call(this.tree, this);
857
+ }
858
+ }
859
+ }
860
+ },
861
+
862
+ activate: function() {
863
+ // Select - but not focus - this node.
864
+ // this.tree.logDebug("dtnode.activate(): %o", this);
865
+ this._activate(true, true);
866
+ },
867
+
868
+ activateSilently: function() {
869
+ this._activate(true, false);
870
+ },
871
+
872
+ deactivate: function() {
873
+ // this.tree.logDebug("dtnode.deactivate(): %o", this);
874
+ this._activate(false, true);
875
+ },
876
+
877
+ isActive: function() {
878
+ return (this.tree.activeNode === this);
879
+ },
880
+
881
+ _userActivate: function() {
882
+ // Handle user click / [space] / [enter], according to clickFolderMode.
883
+ var activate = true;
884
+ var expand = false;
885
+ if ( this.data.isFolder ) {
886
+ switch( this.tree.options.clickFolderMode ) {
887
+ case 2:
888
+ activate = false;
889
+ expand = true;
890
+ break;
891
+ case 3:
892
+ activate = expand = true;
893
+ break;
894
+ }
895
+ }
896
+ if( this.parent === null ) {
897
+ expand = false;
898
+ }
899
+ if( expand ) {
900
+ this.toggleExpand();
901
+ this.focus();
902
+ }
903
+ if( activate ) {
904
+ this.activate();
905
+ }
906
+ },
907
+
908
+ _setSubSel: function(hasSubSel) {
909
+ if( hasSubSel ) {
910
+ this.hasSubSel = true;
911
+ $(this.span).addClass(this.tree.options.classNames.partsel);
912
+ } else {
913
+ this.hasSubSel = false;
914
+ $(this.span).removeClass(this.tree.options.classNames.partsel);
915
+ }
916
+ },
917
+ /**
918
+ * Fix selection and partsel status, of parent nodes, according to current status of
919
+ * end nodes.
920
+ */
921
+ _updatePartSelectionState: function() {
922
+ // alert("_updatePartSelectionState " + this);
923
+ // this.tree.logDebug("_updatePartSelectionState() - %o", this);
924
+ var sel;
925
+ // Return `true` or `false` for end nodes and remove part-sel flag
926
+ if( ! this.hasChildren() ){
927
+ sel = (this.bSelected && !this.data.unselectable && !this.data.isStatusNode);
928
+ this._setSubSel(false);
929
+ return sel;
930
+ }
931
+ // Return `true`, `false`, or `undefined` for parent nodes
932
+ var i, l,
933
+ cl = this.childList,
934
+ allSelected = true,
935
+ allDeselected = true;
936
+ for(i=0, l=cl.length; i<l; i++) {
937
+ var n = cl[i],
938
+ s = n._updatePartSelectionState();
939
+ if( s !== false){
940
+ allDeselected = false;
941
+ }
942
+ if( s !== true){
943
+ allSelected = false;
944
+ }
945
+ }
946
+ if( allSelected ){
947
+ sel = true;
948
+ } else if ( allDeselected ){
949
+ sel = false;
950
+ } else {
951
+ sel = undefined;
952
+ }
953
+ this._setSubSel(sel === undefined);
954
+ this.bSelected = (sel === true);
955
+ return sel;
956
+ },
957
+
958
+ /**
959
+ * Fix selection status, after this node was (de)selected in multi-hier mode.
960
+ * This includes (de)selecting all children.
961
+ */
962
+ _fixSelectionState: function() {
963
+ // alert("_fixSelectionState " + this);
964
+ // this.tree.logDebug("_fixSelectionState(%s) - %o", this.bSelected, this);
965
+ var p, i, l;
966
+ if( this.bSelected ) {
967
+ // Select all children
968
+ this.visit(function(node){
969
+ node.parent._setSubSel(true);
970
+ if(!node.data.unselectable){
971
+ node._select(true, false, false);
972
+ }
973
+ });
974
+ // Select parents, if all children are selected
975
+ p = this.parent;
976
+ while( p ) {
977
+ p._setSubSel(true);
978
+ var allChildsSelected = true;
979
+ for(i=0, l=p.childList.length; i<l; i++) {
980
+ var n = p.childList[i];
981
+ if( !n.bSelected && !n.data.isStatusNode && !n.data.unselectable) {
982
+ // issue 305 proposes this:
983
+ // if( !n.bSelected && !n.data.isStatusNode ) {
984
+ allChildsSelected = false;
985
+ break;
986
+ }
987
+ }
988
+ if( allChildsSelected ){
989
+ p._select(true, false, false);
990
+ }
991
+ p = p.parent;
992
+ }
993
+ } else {
994
+ // Deselect all children
995
+ this._setSubSel(false);
996
+ this.visit(function(node){
997
+ node._setSubSel(false);
998
+ node._select(false, false, false);
999
+ });
1000
+ // Deselect parents, and recalc hasSubSel
1001
+ p = this.parent;
1002
+ while( p ) {
1003
+ p._select(false, false, false);
1004
+ var isPartSel = false;
1005
+ for(i=0, l=p.childList.length; i<l; i++) {
1006
+ if( p.childList[i].bSelected || p.childList[i].hasSubSel ) {
1007
+ isPartSel = true;
1008
+ break;
1009
+ }
1010
+ }
1011
+ p._setSubSel(isPartSel);
1012
+ p = p.parent;
1013
+ }
1014
+ }
1015
+ },
1016
+
1017
+ _select: function(sel, fireEvents, deep) {
1018
+ // Select - but not focus - this node.
1019
+ // this.tree.logDebug("dtnode._select(%o) - %o", sel, this);
1020
+ var opts = this.tree.options;
1021
+ if( this.data.isStatusNode ){
1022
+ return;
1023
+ }
1024
+ //
1025
+ if( this.bSelected === sel ) {
1026
+ // this.tree.logDebug("dtnode._select(%o) IGNORED - %o", sel, this);
1027
+ return;
1028
+ }
1029
+ // Allow event listener to abort selection
1030
+ if ( fireEvents && opts.onQuerySelect && opts.onQuerySelect.call(this.tree, sel, this) === false ){
1031
+ return; // Callback returned false
1032
+ }
1033
+ // Force single-selection
1034
+ if( opts.selectMode==1 && sel ) {
1035
+ this.tree.visit(function(node){
1036
+ if( node.bSelected ) {
1037
+ // Deselect; assuming that in selectMode:1 there's max. one other selected node
1038
+ node._select(false, false, false);
1039
+ return false;
1040
+ }
1041
+ });
1042
+ }
1043
+
1044
+ this.bSelected = sel;
1045
+ // this.tree._changeNodeList("select", this, sel);
1046
+
1047
+ if( sel ) {
1048
+ if( opts.persist ){
1049
+ this.tree.persistence.addSelect(this.data.key);
1050
+ }
1051
+ $(this.span).addClass(opts.classNames.selected);
1052
+
1053
+ if( deep && opts.selectMode === 3 ){
1054
+ this._fixSelectionState();
1055
+ }
1056
+ if ( fireEvents && opts.onSelect ){
1057
+ opts.onSelect.call(this.tree, true, this);
1058
+ }
1059
+ } else {
1060
+ if( opts.persist ){
1061
+ this.tree.persistence.clearSelect(this.data.key);
1062
+ }
1063
+ $(this.span).removeClass(opts.classNames.selected);
1064
+
1065
+ if( deep && opts.selectMode === 3 ){
1066
+ this._fixSelectionState();
1067
+ }
1068
+ if ( fireEvents && opts.onSelect ){
1069
+ opts.onSelect.call(this.tree, false, this);
1070
+ }
1071
+ }
1072
+ },
1073
+
1074
+ select: function(sel) {
1075
+ // Select - but not focus - this node.
1076
+ // this.tree.logDebug("dtnode.select(%o) - %o", sel, this);
1077
+ if( this.data.unselectable ){
1078
+ return this.bSelected;
1079
+ }
1080
+ return this._select(sel!==false, true, true);
1081
+ },
1082
+
1083
+ toggleSelect: function() {
1084
+ // this.tree.logDebug("dtnode.toggleSelect() - %o", this);
1085
+ return this.select(!this.bSelected);
1086
+ },
1087
+
1088
+ isSelected: function() {
1089
+ return this.bSelected;
1090
+ },
1091
+
1092
+ isLazy: function() {
1093
+ return !!this.data.isLazy;
1094
+ },
1095
+
1096
+ _loadContent: function() {
1097
+ try {
1098
+ var opts = this.tree.options;
1099
+ this.tree.logDebug("_loadContent: start - %o", this);
1100
+ this.setLazyNodeStatus(DTNodeStatus_Loading);
1101
+ if( true === opts.onLazyRead.call(this.tree, this) ) {
1102
+ // If function returns 'true', we assume that the loading is done:
1103
+ this.setLazyNodeStatus(DTNodeStatus_Ok);
1104
+ // Otherwise (i.e. if the loading was started as an asynchronous process)
1105
+ // the onLazyRead(dtnode) handler is expected to call dtnode.setLazyNodeStatus(DTNodeStatus_Ok/_Error) when done.
1106
+ this.tree.logDebug("_loadContent: succeeded - %o", this);
1107
+ }
1108
+ } catch(e) {
1109
+ this.tree.logWarning("_loadContent: failed - %o", e);
1110
+ this.setLazyNodeStatus(DTNodeStatus_Error, {tooltip: ""+e});
1111
+ }
1112
+ },
1113
+
1114
+ _expand: function(bExpand, forceSync) {
1115
+ if( this.bExpanded === bExpand ) {
1116
+ this.tree.logDebug("dtnode._expand(%o) IGNORED - %o", bExpand, this);
1117
+ return;
1118
+ }
1119
+ this.tree.logDebug("dtnode._expand(%o) - %o", bExpand, this);
1120
+ var opts = this.tree.options;
1121
+ if( !bExpand && this.getLevel() < opts.minExpandLevel ) {
1122
+ this.tree.logDebug("dtnode._expand(%o) prevented collapse - %o", bExpand, this);
1123
+ return;
1124
+ }
1125
+ if ( opts.onQueryExpand && opts.onQueryExpand.call(this.tree, bExpand, this) === false ){
1126
+ return; // Callback returned false
1127
+ }
1128
+ this.bExpanded = bExpand;
1129
+
1130
+ // Persist expand state
1131
+ if( opts.persist ) {
1132
+ if( bExpand ){
1133
+ this.tree.persistence.addExpand(this.data.key);
1134
+ }else{
1135
+ this.tree.persistence.clearExpand(this.data.key);
1136
+ }
1137
+ }
1138
+ // Do not apply animations in init phase, or before lazy-loading
1139
+ var allowEffects = !(this.data.isLazy && this.childList === null)
1140
+ && !this._isLoading
1141
+ && !forceSync;
1142
+ this.render(allowEffects);
1143
+
1144
+ // Auto-collapse mode: collapse all siblings
1145
+ if( this.bExpanded && this.parent && opts.autoCollapse ) {
1146
+ var parents = this._parentList(false, true);
1147
+ for(var i=0, l=parents.length; i<l; i++){
1148
+ parents[i].collapseSiblings();
1149
+ }
1150
+ }
1151
+ // If the currently active node is now hidden, deactivate it
1152
+ if( opts.activeVisible && this.tree.activeNode && ! this.tree.activeNode.isVisible() ) {
1153
+ this.tree.activeNode.deactivate();
1154
+ }
1155
+ // Expanding a lazy node: set 'loading...' and call callback
1156
+ if( bExpand && this.data.isLazy && this.childList === null && !this._isLoading ) {
1157
+ this._loadContent();
1158
+ return;
1159
+ }
1160
+ if ( opts.onExpand ){
1161
+ opts.onExpand.call(this.tree, bExpand, this);
1162
+ }
1163
+ },
1164
+
1165
+ isExpanded: function() {
1166
+ return this.bExpanded;
1167
+ },
1168
+
1169
+ expand: function(flag) {
1170
+ flag = (flag !== false);
1171
+ if( !this.childList && !this.data.isLazy && flag ){
1172
+ return; // Prevent expanding empty nodes
1173
+ } else if( this.parent === null && !flag ){
1174
+ return; // Prevent collapsing the root
1175
+ }
1176
+ this._expand(flag);
1177
+ },
1178
+
1179
+ scheduleAction: function(mode, ms) {
1180
+ /** Schedule activity for delayed execution (cancel any pending request).
1181
+ * scheduleAction('cancel') will cancel the request.
1182
+ */
1183
+ if( this.tree.timer ) {
1184
+ clearTimeout(this.tree.timer);
1185
+ this.tree.logDebug("clearTimeout(%o)", this.tree.timer);
1186
+ }
1187
+ var self = this; // required for closures
1188
+ switch (mode) {
1189
+ case "cancel":
1190
+ // Simply made sure that timer was cleared
1191
+ break;
1192
+ case "expand":
1193
+ this.tree.timer = setTimeout(function(){
1194
+ self.tree.logDebug("setTimeout: trigger expand");
1195
+ self.expand(true);
1196
+ }, ms);
1197
+ break;
1198
+ case "activate":
1199
+ this.tree.timer = setTimeout(function(){
1200
+ self.tree.logDebug("setTimeout: trigger activate");
1201
+ self.activate();
1202
+ }, ms);
1203
+ break;
1204
+ default:
1205
+ throw "Invalid mode " + mode;
1206
+ }
1207
+ this.tree.logDebug("setTimeout(%s, %s): %s", mode, ms, this.tree.timer);
1208
+ },
1209
+
1210
+ toggleExpand: function() {
1211
+ this.expand(!this.bExpanded);
1212
+ },
1213
+
1214
+ collapseSiblings: function() {
1215
+ if( this.parent === null ){
1216
+ return;
1217
+ }
1218
+ var ac = this.parent.childList;
1219
+ for (var i=0, l=ac.length; i<l; i++) {
1220
+ if ( ac[i] !== this && ac[i].bExpanded ){
1221
+ ac[i]._expand(false);
1222
+ }
1223
+ }
1224
+ },
1225
+
1226
+ _onClick: function(event) {
1227
+ // this.tree.logDebug("dtnode.onClick(" + event.type + "): dtnode:" + this + ", button:" + event.button + ", which: " + event.which);
1228
+ var targetType = this.getEventTargetType(event);
1229
+ if( targetType === "expander" ) {
1230
+ // Clicking the expander icon always expands/collapses
1231
+ this.toggleExpand();
1232
+ this.focus(); // issue 95
1233
+ } else if( targetType === "checkbox" ) {
1234
+ // Clicking the checkbox always (de)selects
1235
+ this.toggleSelect();
1236
+ this.focus(); // issue 95
1237
+ } else {
1238
+ this._userActivate();
1239
+ var aTag = this.span.getElementsByTagName("a");
1240
+ if(aTag[0]){
1241
+ // issue 154, 313
1242
+ // if(!($.browser.msie && parseInt($.browser.version, 10) < 9)){
1243
+ if(!(BROWSER.msie && parseInt(BROWSER.version, 10) < 9)){
1244
+ aTag[0].focus();
1245
+ }
1246
+ }else{
1247
+ // 'noLink' option was set
1248
+ return true;
1249
+ }
1250
+ }
1251
+ // Make sure that clicks stop, otherwise <a href='#'> jumps to the top
1252
+ event.preventDefault();
1253
+ },
1254
+
1255
+ _onDblClick: function(event) {
1256
+ // this.tree.logDebug("dtnode.onDblClick(" + event.type + "): dtnode:" + this + ", button:" + event.button + ", which: " + event.which);
1257
+ },
1258
+
1259
+ _onKeydown: function(event) {
1260
+ // this.tree.logDebug("dtnode.onKeydown(" + event.type + "): dtnode:" + this + ", charCode:" + event.charCode + ", keyCode: " + event.keyCode + ", which: " + event.which);
1261
+ var handled = true,
1262
+ sib;
1263
+ // alert("keyDown" + event.which);
1264
+
1265
+ switch( event.which ) {
1266
+ // charCodes:
1267
+ // case 43: // '+'
1268
+ case 107: // '+'
1269
+ case 187: // '+' @ Chrome, Safari
1270
+ if( !this.bExpanded ){ this.toggleExpand(); }
1271
+ break;
1272
+ // case 45: // '-'
1273
+ case 109: // '-'
1274
+ case 189: // '+' @ Chrome, Safari
1275
+ if( this.bExpanded ){ this.toggleExpand(); }
1276
+ break;
1277
+ //~ case 42: // '*'
1278
+ //~ break;
1279
+ //~ case 47: // '/'
1280
+ //~ break;
1281
+ // case 13: // <enter>
1282
+ // <enter> on a focused <a> tag seems to generate a click-event.
1283
+ // this._userActivate();
1284
+ // break;
1285
+ case 32: // <space>
1286
+ this._userActivate();
1287
+ break;
1288
+ case 8: // <backspace>
1289
+ if( this.parent ){
1290
+ this.parent.focus();
1291
+ }
1292
+ break;
1293
+ case 37: // <left>
1294
+ if( this.bExpanded ) {
1295
+ this.toggleExpand();
1296
+ this.focus();
1297
+ // } else if( this.parent && (this.tree.options.rootVisible || this.parent.parent) ) {
1298
+ } else if( this.parent && this.parent.parent ) {
1299
+ this.parent.focus();
1300
+ }
1301
+ break;
1302
+ case 39: // <right>
1303
+ if( !this.bExpanded && (this.childList || this.data.isLazy) ) {
1304
+ this.toggleExpand();
1305
+ this.focus();
1306
+ } else if( this.childList ) {
1307
+ this.childList[0].focus();
1308
+ }
1309
+ break;
1310
+ case 38: // <up>
1311
+ sib = this.getPrevSibling();
1312
+ while( sib && sib.bExpanded && sib.childList ){
1313
+ sib = sib.childList[sib.childList.length-1];
1314
+ }
1315
+ // if( !sib && this.parent && (this.tree.options.rootVisible || this.parent.parent) )
1316
+ if( !sib && this.parent && this.parent.parent ){
1317
+ sib = this.parent;
1318
+ }
1319
+ if( sib ){
1320
+ sib.focus();
1321
+ }
1322
+ break;
1323
+ case 40: // <down>
1324
+ if( this.bExpanded && this.childList ) {
1325
+ sib = this.childList[0];
1326
+ } else {
1327
+ var parents = this._parentList(false, true);
1328
+ for(var i=parents.length-1; i>=0; i--) {
1329
+ sib = parents[i].getNextSibling();
1330
+ if( sib ){ break; }
1331
+ }
1332
+ }
1333
+ if( sib ){
1334
+ sib.focus();
1335
+ }
1336
+ break;
1337
+ default:
1338
+ handled = false;
1339
+ }
1340
+ // Return false, if handled, to prevent default processing
1341
+ // return !handled;
1342
+ if(handled){
1343
+ event.preventDefault();
1344
+ }
1345
+ },
1346
+
1347
+ _onKeypress: function(event) {
1348
+ // onKeypress is only hooked to allow user callbacks.
1349
+ // We don't process it, because IE and Safari don't fire keypress for cursor keys.
1350
+ // this.tree.logDebug("dtnode.onKeypress(" + event.type + "): dtnode:" + this + ", charCode:" + event.charCode + ", keyCode: " + event.keyCode + ", which: " + event.which);
1351
+ },
1352
+
1353
+ _onFocus: function(event) {
1354
+ // Handles blur and focus events.
1355
+ // this.tree.logDebug("dtnode._onFocus(%o): %o", event, this);
1356
+ var opts = this.tree.options;
1357
+ if ( event.type == "blur" || event.type == "focusout" ) {
1358
+ if ( opts.onBlur ){
1359
+ opts.onBlur.call(this.tree, this);
1360
+ }
1361
+ if( this.tree.tnFocused ){
1362
+ $(this.tree.tnFocused.span).removeClass(opts.classNames.focused);
1363
+ }
1364
+ this.tree.tnFocused = null;
1365
+ if( opts.persist ){
1366
+ $.cookie(opts.cookieId+"-focus", "", opts.cookie);
1367
+ }
1368
+ } else if ( event.type=="focus" || event.type=="focusin") {
1369
+ // Fix: sometimes the blur event is not generated
1370
+ if( this.tree.tnFocused && this.tree.tnFocused !== this ) {
1371
+ this.tree.logDebug("dtnode.onFocus: out of sync: curFocus: %o", this.tree.tnFocused);
1372
+ $(this.tree.tnFocused.span).removeClass(opts.classNames.focused);
1373
+ }
1374
+ this.tree.tnFocused = this;
1375
+ if ( opts.onFocus ){
1376
+ opts.onFocus.call(this.tree, this);
1377
+ }
1378
+ $(this.tree.tnFocused.span).addClass(opts.classNames.focused);
1379
+ if( opts.persist ){
1380
+ $.cookie(opts.cookieId+"-focus", this.data.key, opts.cookie);
1381
+ }
1382
+ }
1383
+ // TODO: return anything?
1384
+ // return false;
1385
+ },
1386
+
1387
+ visit: function(fn, includeSelf) {
1388
+ // Call fn(node) for all child nodes. Stop iteration, if fn() returns false.
1389
+ var res = true;
1390
+ if( includeSelf === true ) {
1391
+ res = fn(this);
1392
+ if( res === false || res == "skip" ){
1393
+ return res;
1394
+ }
1395
+ }
1396
+ if(this.childList){
1397
+ for(var i=0, l=this.childList.length; i<l; i++){
1398
+ res = this.childList[i].visit(fn, true);
1399
+ if( res === false ){
1400
+ break;
1401
+ }
1402
+ }
1403
+ }
1404
+ return res;
1405
+ },
1406
+
1407
+ visitParents: function(fn, includeSelf) {
1408
+ // Visit parent nodes (bottom up)
1409
+ if(includeSelf && fn(this) === false){
1410
+ return false;
1411
+ }
1412
+ var p = this.parent;
1413
+ while( p ) {
1414
+ if(fn(p) === false){
1415
+ return false;
1416
+ }
1417
+ p = p.parent;
1418
+ }
1419
+ return true;
1420
+ },
1421
+
1422
+ remove: function() {
1423
+ // Remove this node
1424
+ // this.tree.logDebug ("%s.remove()", this);
1425
+ if ( this === this.tree.root ){
1426
+ throw "Cannot remove system root";
1427
+ }
1428
+ return this.parent.removeChild(this);
1429
+ },
1430
+
1431
+ removeChild: function(tn) {
1432
+ // Remove tn from list of direct children.
1433
+ var ac = this.childList;
1434
+ if( ac.length == 1 ) {
1435
+ if( tn !== ac[0] ){
1436
+ throw "removeChild: invalid child";
1437
+ }
1438
+ return this.removeChildren();
1439
+ }
1440
+ if( tn === this.tree.activeNode ){
1441
+ tn.deactivate();
1442
+ }
1443
+ if( this.tree.options.persist ) {
1444
+ if( tn.bSelected ){
1445
+ this.tree.persistence.clearSelect(tn.data.key);
1446
+ }
1447
+ if ( tn.bExpanded ){
1448
+ this.tree.persistence.clearExpand(tn.data.key);
1449
+ }
1450
+ }
1451
+ tn.removeChildren(true);
1452
+ if(this.ul){
1453
+ // $("li", $(this.ul)).remove(); // issue 399
1454
+ this.ul.removeChild(tn.li); // issue 402
1455
+ }
1456
+ for(var i=0, l=ac.length; i<l; i++) {
1457
+ if( ac[i] === tn ) {
1458
+ this.childList.splice(i, 1);
1459
+ // delete tn; // JSLint complained
1460
+ break;
1461
+ }
1462
+ }
1463
+ },
1464
+
1465
+ removeChildren: function(isRecursiveCall, retainPersistence) {
1466
+ // Remove all child nodes (more efficiently than recursive remove())
1467
+ this.tree.logDebug("%s.removeChildren(%o)", this, isRecursiveCall);
1468
+ var tree = this.tree;
1469
+ var ac = this.childList;
1470
+ if( ac ) {
1471
+ for(var i=0, l=ac.length; i<l; i++) {
1472
+ var tn = ac[i];
1473
+ if ( tn === tree.activeNode && !retainPersistence ){
1474
+ tn.deactivate();
1475
+ }
1476
+ if( this.tree.options.persist && !retainPersistence ) {
1477
+ if( tn.bSelected ){
1478
+ this.tree.persistence.clearSelect(tn.data.key);
1479
+ }
1480
+ if ( tn.bExpanded ){
1481
+ this.tree.persistence.clearExpand(tn.data.key);
1482
+ }
1483
+ }
1484
+ tn.removeChildren(true, retainPersistence);
1485
+ if(this.ul){
1486
+ // this.ul.removeChild(tn.li);
1487
+ $("li", $(this.ul)).remove(); // issue 231
1488
+ }
1489
+ // delete tn; JSLint complained
1490
+ }
1491
+ // Set to 'null' which is interpreted as 'not yet loaded' for lazy
1492
+ // nodes
1493
+ this.childList = null;
1494
+ }
1495
+ if( ! isRecursiveCall ) {
1496
+ // this._expand(false);
1497
+ // this.isRead = false;
1498
+ this._isLoading = false;
1499
+ this.render();
1500
+ }
1501
+ },
1502
+
1503
+ setTitle: function(title) {
1504
+ this.fromDict({title: title});
1505
+ },
1506
+
1507
+ reload: function(force) {
1508
+ throw "Use reloadChildren() instead";
1509
+ },
1510
+
1511
+ reloadChildren: function(callback) {
1512
+ // Reload lazy content (expansion state is maintained).
1513
+ if( this.parent === null ){
1514
+ throw "Use tree.reload() instead";
1515
+ }else if( ! this.data.isLazy ){
1516
+ throw "node.reloadChildren() requires lazy nodes.";
1517
+ }
1518
+ // appendAjax triggers 'nodeLoaded' event.
1519
+ // We listen to this, if a callback was passed to reloadChildren
1520
+ if(callback){
1521
+ var self = this;
1522
+ var eventType = "nodeLoaded.dynatree." + this.tree.$tree.attr("id")
1523
+ + "." + this.data.key;
1524
+ this.tree.$tree.bind(eventType, function(e, node, isOk){
1525
+ self.tree.$tree.unbind(eventType);
1526
+ self.tree.logDebug("loaded %o, %o, %o", e, node, isOk);
1527
+ if(node !== self){
1528
+ throw "got invalid load event";
1529
+ }
1530
+ callback.call(self.tree, node, isOk);
1531
+ });
1532
+ }
1533
+ // The expansion state is maintained
1534
+ this.removeChildren();
1535
+ this._loadContent();
1536
+ // if( this.bExpanded ) {
1537
+ // // Remove children first, to prevent effects being applied
1538
+ // this.removeChildren();
1539
+ // // then force re-expand to trigger lazy loading
1540
+ //// this.expand(false);
1541
+ //// this.expand(true);
1542
+ // this._loadContent();
1543
+ // } else {
1544
+ // this.removeChildren();
1545
+ // this._loadContent();
1546
+ // }
1547
+ },
1548
+
1549
+ /**
1550
+ * Make sure the node with a given key path is available in the tree.
1551
+ */
1552
+ _loadKeyPath: function(keyPath, callback) {
1553
+ var tree = this.tree;
1554
+ tree.logDebug("%s._loadKeyPath(%s)", this, keyPath);
1555
+ if(keyPath === ""){
1556
+ throw "Key path must not be empty";
1557
+ }
1558
+ var segList = keyPath.split(tree.options.keyPathSeparator);
1559
+ if(segList[0] === ""){
1560
+ throw "Key path must be relative (don't start with '/')";
1561
+ }
1562
+ var seg = segList.shift();
1563
+ if(this.childList){
1564
+ for(var i=0, l=this.childList.length; i < l; i++){
1565
+ var child = this.childList[i];
1566
+ if( child.data.key === seg ){
1567
+ if(segList.length === 0) {
1568
+ // Found the end node
1569
+ callback.call(tree, child, "ok");
1570
+
1571
+ }else if(child.data.isLazy && (child.childList === null || child.childList === undefined)){
1572
+ tree.logDebug("%s._loadKeyPath(%s) -> reloading %s...", this, keyPath, child);
1573
+ var self = this;
1574
+ // Note: this line gives a JSLint warning (Don't make functions within a loop)
1575
+ /*jshint loopfunc:true */
1576
+ child.reloadChildren(function(node, isOk){
1577
+ // After loading, look for direct child with that key
1578
+ if(isOk){
1579
+ tree.logDebug("%s._loadKeyPath(%s) -> reloaded %s.", node, keyPath, node);
1580
+ callback.call(tree, child, "loaded");
1581
+ node._loadKeyPath(segList.join(tree.options.keyPathSeparator), callback);
1582
+ }else{
1583
+ tree.logWarning("%s._loadKeyPath(%s) -> reloadChildren() failed.", self, keyPath);
1584
+ callback.call(tree, child, "error");
1585
+ }
1586
+ });
1587
+ // we can ignore it, since it will only be exectuted once, the the loop is ended
1588
+ // See also http://stackoverflow.com/questions/3037598/how-to-get-around-the-jslint-error-dont-make-functions-within-a-loop
1589
+ } else {
1590
+ callback.call(tree, child, "loaded");
1591
+ // Look for direct child with that key
1592
+ child._loadKeyPath(segList.join(tree.options.keyPathSeparator), callback);
1593
+ }
1594
+ return;
1595
+ }
1596
+ }
1597
+ }
1598
+ // Could not find key
1599
+ // Callback params: child: undefined, the segment, isEndNode (segList.length === 0)
1600
+ callback.call(tree, undefined, "notfound", seg, segList.length === 0);
1601
+ tree.logWarning("Node not found: " + seg);
1602
+ return;
1603
+ },
1604
+
1605
+ resetLazy: function() {
1606
+ // Discard lazy content.
1607
+ if( this.parent === null ){
1608
+ throw "Use tree.reload() instead";
1609
+ }else if( ! this.data.isLazy ){
1610
+ throw "node.resetLazy() requires lazy nodes.";
1611
+ }
1612
+ this.expand(false);
1613
+ this.removeChildren();
1614
+ },
1615
+
1616
+ _addChildNode: function(dtnode, beforeNode) {
1617
+ /**
1618
+ * Internal function to add one single DynatreeNode as a child.
1619
+ *
1620
+ */
1621
+ var tree = this.tree,
1622
+ opts = tree.options,
1623
+ pers = tree.persistence;
1624
+
1625
+ // tree.logDebug("%s._addChildNode(%o)", this, dtnode);
1626
+
1627
+ // --- Update and fix dtnode attributes if necessary
1628
+ dtnode.parent = this;
1629
+ // if( beforeNode && (beforeNode.parent !== this || beforeNode === dtnode ) )
1630
+ // throw "<beforeNode> must be another child of <this>";
1631
+
1632
+ // --- Add dtnode as a child
1633
+ if ( this.childList === null ) {
1634
+ this.childList = [];
1635
+ } else if( ! beforeNode ) {
1636
+ // Fix 'lastsib'
1637
+ if(this.childList.length > 0) {
1638
+ $(this.childList[this.childList.length-1].span).removeClass(opts.classNames.lastsib);
1639
+ }
1640
+ }
1641
+ if( beforeNode ) {
1642
+ var iBefore = $.inArray(beforeNode, this.childList);
1643
+ if( iBefore < 0 ){
1644
+ throw "<beforeNode> must be a child of <this>";
1645
+ }
1646
+ this.childList.splice(iBefore, 0, dtnode);
1647
+ } else {
1648
+ // Append node
1649
+ this.childList.push(dtnode);
1650
+ }
1651
+
1652
+ // --- Handle persistence
1653
+ // Initial status is read from cookies, if persistence is active and
1654
+ // cookies are already present.
1655
+ // Otherwise the status is read from the data attributes and then persisted.
1656
+ var isInitializing = tree.isInitializing();
1657
+ if( opts.persist && pers.cookiesFound && isInitializing ) {
1658
+ // Init status from cookies
1659
+ // tree.logDebug("init from cookie, pa=%o, dk=%o", pers.activeKey, dtnode.data.key);
1660
+ if( pers.activeKey === dtnode.data.key ){
1661
+ tree.activeNode = dtnode;
1662
+ }
1663
+ if( pers.focusedKey === dtnode.data.key ){
1664
+ tree.focusNode = dtnode;
1665
+ }
1666
+ dtnode.bExpanded = ($.inArray(dtnode.data.key, pers.expandedKeyList) >= 0);
1667
+ dtnode.bSelected = ($.inArray(dtnode.data.key, pers.selectedKeyList) >= 0);
1668
+ // tree.logDebug(" key=%o, bSelected=%o", dtnode.data.key, dtnode.bSelected);
1669
+ } else {
1670
+ // Init status from data (Note: we write the cookies after the init phase)
1671
+ // tree.logDebug("init from data");
1672
+ if( dtnode.data.activate ) {
1673
+ tree.activeNode = dtnode;
1674
+ if( opts.persist ){
1675
+ pers.activeKey = dtnode.data.key;
1676
+ }
1677
+ }
1678
+ if( dtnode.data.focus ) {
1679
+ tree.focusNode = dtnode;
1680
+ if( opts.persist ){
1681
+ pers.focusedKey = dtnode.data.key;
1682
+ }
1683
+ }
1684
+ dtnode.bExpanded = ( dtnode.data.expand === true ); // Collapsed by default
1685
+ if( dtnode.bExpanded && opts.persist ){
1686
+ pers.addExpand(dtnode.data.key);
1687
+ }
1688
+ dtnode.bSelected = ( dtnode.data.select === true ); // Deselected by default
1689
+ /*
1690
+ Doesn't work, cause pers.selectedKeyList may be null
1691
+ if( dtnode.bSelected && opts.selectMode==1
1692
+ && pers.selectedKeyList && pers.selectedKeyList.length>0 ) {
1693
+ tree.logWarning("Ignored multi-selection in single-mode for %o", dtnode);
1694
+ dtnode.bSelected = false; // Fixing bad input data (multi selection for mode:1)
1695
+ }
1696
+ */
1697
+ if( dtnode.bSelected && opts.persist ){
1698
+ pers.addSelect(dtnode.data.key);
1699
+ }
1700
+ }
1701
+
1702
+ // Always expand, if it's below minExpandLevel
1703
+ // tree.logDebug ("%s._addChildNode(%o), l=%o", this, dtnode, dtnode.getLevel());
1704
+ if ( opts.minExpandLevel >= dtnode.getLevel() ) {
1705
+ // tree.logDebug ("Force expand for %o", dtnode);
1706
+ this.bExpanded = true;
1707
+ }
1708
+
1709
+ // In multi-hier mode, update the parents selection state
1710
+ // issue #82: only if not initializing, because the children may not exist yet
1711
+ // if( !dtnode.data.isStatusNode && opts.selectMode==3 && !isInitializing )
1712
+ // dtnode._fixSelectionState();
1713
+
1714
+ // In multi-hier mode, update the parents selection state
1715
+ if( dtnode.bSelected && opts.selectMode==3 ) {
1716
+ var p = this;
1717
+ while( p ) {
1718
+ if( !p.hasSubSel ){
1719
+ p._setSubSel(true);
1720
+ }
1721
+ p = p.parent;
1722
+ }
1723
+ }
1724
+ // render this node and the new child
1725
+ if ( tree.bEnableUpdate ){
1726
+ this.render();
1727
+ }
1728
+ return dtnode;
1729
+ },
1730
+
1731
+ addChild: function(obj, beforeNode) {
1732
+ /**
1733
+ * Add a node object as child.
1734
+ *
1735
+ * This should be the only place, where a DynaTreeNode is constructed!
1736
+ * (Except for the root node creation in the tree constructor)
1737
+ *
1738
+ * @param obj A JS object (may be recursive) or an array of those.
1739
+ * @param {DynaTreeNode} beforeNode (optional) sibling node.
1740
+ *
1741
+ * Data format: array of node objects, with optional 'children' attributes.
1742
+ * [
1743
+ * { title: "t1", isFolder: true, ... }
1744
+ * { title: "t2", isFolder: true, ...,
1745
+ * children: [
1746
+ * {title: "t2.1", ..},
1747
+ * {..}
1748
+ * ]
1749
+ * }
1750
+ * ]
1751
+ * A simple object is also accepted instead of an array.
1752
+ *
1753
+ */
1754
+ // this.tree.logDebug("%s.addChild(%o, %o)", this, obj, beforeNode);
1755
+ if(typeof(obj) == "string"){
1756
+ throw "Invalid data type for " + obj;
1757
+ }else if( !obj || obj.length === 0 ){ // Passed null or undefined or empty array
1758
+ return;
1759
+ }else if( obj instanceof DynaTreeNode ){
1760
+ return this._addChildNode(obj, beforeNode);
1761
+ }
1762
+
1763
+ if( !obj.length ){ // Passed a single data object
1764
+ obj = [ obj ];
1765
+ }
1766
+ var prevFlag = this.tree.enableUpdate(false);
1767
+
1768
+ var tnFirst = null;
1769
+ for (var i=0, l=obj.length; i<l; i++) {
1770
+ var data = obj[i];
1771
+ var dtnode = this._addChildNode(new DynaTreeNode(this, this.tree, data), beforeNode);
1772
+ if( !tnFirst ){
1773
+ tnFirst = dtnode;
1774
+ }
1775
+ // Add child nodes recursively
1776
+ if( data.children ){
1777
+ dtnode.addChild(data.children, null);
1778
+ }
1779
+ }
1780
+ this.tree.enableUpdate(prevFlag);
1781
+ return tnFirst;
1782
+ },
1783
+
1784
+ append: function(obj) {
1785
+ this.tree.logWarning("node.append() is deprecated (use node.addChild() instead).");
1786
+ return this.addChild(obj, null);
1787
+ },
1788
+
1789
+ appendAjax: function(ajaxOptions) {
1790
+ var self = this;
1791
+ this.removeChildren(false, true);
1792
+ this.setLazyNodeStatus(DTNodeStatus_Loading);
1793
+ // Debug feature: force a delay, to simulate slow loading...
1794
+ if(ajaxOptions.debugLazyDelay){
1795
+ var ms = ajaxOptions.debugLazyDelay;
1796
+ ajaxOptions.debugLazyDelay = 0;
1797
+ this.tree.logInfo("appendAjax: waiting for debugLazyDelay " + ms);
1798
+ setTimeout(function(){self.appendAjax(ajaxOptions);}, ms);
1799
+ return;
1800
+ }
1801
+ // Ajax option inheritance: $.ajaxSetup < $.ui.dynatree.prototype.options.ajaxDefaults < tree.options.ajaxDefaults < ajaxOptions
1802
+ var orgSuccess = ajaxOptions.success,
1803
+ orgError = ajaxOptions.error,
1804
+ eventType = "nodeLoaded.dynatree." + this.tree.$tree.attr("id") + "." + this.data.key;
1805
+ var options = $.extend({}, this.tree.options.ajaxDefaults, ajaxOptions, {
1806
+ success: function(data, textStatus, jqXHR){
1807
+ // <this> is the request options
1808
+ // self.tree.logDebug("appendAjax().success");
1809
+ var prevPhase = self.tree.phase;
1810
+ self.tree.phase = "init";
1811
+ // postProcess is similar to the standard dataFilter hook,
1812
+ // but it is also called for JSONP
1813
+ if( options.postProcess ){
1814
+ data = options.postProcess.call(this, data, this.dataType);
1815
+ }
1816
+ // Process ASPX WebMethod JSON object inside "d" property
1817
+ // http://code.google.com/p/dynatree/issues/detail?id=202
1818
+ else if (data && data.hasOwnProperty("d")) {
1819
+ data = (typeof data.d) == "string" ? $.parseJSON(data.d) : data.d;
1820
+ }
1821
+ if(!$.isArray(data) || data.length !== 0){
1822
+ self.addChild(data, null);
1823
+ }
1824
+ self.tree.phase = "postInit";
1825
+ if( orgSuccess ){
1826
+ orgSuccess.call(options, self, data, textStatus);
1827
+ }
1828
+ self.tree.logDebug("trigger " + eventType);
1829
+ self.tree.$tree.trigger(eventType, [self, true]);
1830
+ self.tree.phase = prevPhase;
1831
+ // This should be the last command, so node._isLoading is true
1832
+ // while the callbacks run
1833
+ self.setLazyNodeStatus(DTNodeStatus_Ok);
1834
+ if($.isArray(data) && data.length === 0){
1835
+ // Set to [] which is interpreted as 'no children' for lazy
1836
+ // nodes
1837
+ self.childList = [];
1838
+ self.render();
1839
+ }
1840
+ },
1841
+ error: function(jqXHR, textStatus, errorThrown){
1842
+ // <this> is the request options
1843
+ self.tree.logWarning("appendAjax failed:", textStatus, ":\n", jqXHR, "\n", errorThrown);
1844
+ if( orgError ){
1845
+ orgError.call(options, self, jqXHR, textStatus, errorThrown);
1846
+ }
1847
+ self.tree.$tree.trigger(eventType, [self, false]);
1848
+ self.setLazyNodeStatus(DTNodeStatus_Error, {info: textStatus, tooltip: "" + errorThrown});
1849
+ }
1850
+ });
1851
+ $.ajax(options);
1852
+ },
1853
+
1854
+ move: function(targetNode, mode) {
1855
+ /**Move this node to targetNode.
1856
+ * mode 'child': append this node as last child of targetNode.
1857
+ * This is the default. To be compatble with the D'n'd
1858
+ * hitMode, we also accept 'over'.
1859
+ * mode 'before': add this node as sibling before targetNode.
1860
+ * mode 'after': add this node as sibling after targetNode.
1861
+ */
1862
+ var pos;
1863
+ if(this === targetNode){
1864
+ return;
1865
+ }
1866
+ if( !this.parent ){
1867
+ throw "Cannot move system root";
1868
+ }
1869
+ if(mode === undefined || mode == "over"){
1870
+ mode = "child";
1871
+ }
1872
+ var prevParent = this.parent;
1873
+ var targetParent = (mode === "child") ? targetNode : targetNode.parent;
1874
+ if( targetParent.isDescendantOf(this) ){
1875
+ throw "Cannot move a node to it's own descendant";
1876
+ }
1877
+ // Unlink this node from current parent
1878
+ if( this.parent.childList.length == 1 ) {
1879
+ this.parent.childList = this.parent.data.isLazy ? [] : null;
1880
+ this.parent.bExpanded = false;
1881
+ } else {
1882
+ pos = $.inArray(this, this.parent.childList);
1883
+ if( pos < 0 ){
1884
+ throw "Internal error";
1885
+ }
1886
+ this.parent.childList.splice(pos, 1);
1887
+ }
1888
+ // Remove from source DOM parent
1889
+ if(this.parent.ul){
1890
+ this.parent.ul.removeChild(this.li);
1891
+ }
1892
+
1893
+ // Insert this node to target parent's child list
1894
+ this.parent = targetParent;
1895
+ if( targetParent.hasChildren() ) {
1896
+ switch(mode) {
1897
+ case "child":
1898
+ // Append to existing target children
1899
+ targetParent.childList.push(this);
1900
+ break;
1901
+ case "before":
1902
+ // Insert this node before target node
1903
+ pos = $.inArray(targetNode, targetParent.childList);
1904
+ if( pos < 0 ){
1905
+ throw "Internal error";
1906
+ }
1907
+ targetParent.childList.splice(pos, 0, this);
1908
+ break;
1909
+ case "after":
1910
+ // Insert this node after target node
1911
+ pos = $.inArray(targetNode, targetParent.childList);
1912
+ if( pos < 0 ){
1913
+ throw "Internal error";
1914
+ }
1915
+ targetParent.childList.splice(pos+1, 0, this);
1916
+ break;
1917
+ default:
1918
+ throw "Invalid mode " + mode;
1919
+ }
1920
+ } else {
1921
+ targetParent.childList = [ this ];
1922
+ }
1923
+ // Parent has no <ul> tag yet:
1924
+ if( !targetParent.ul ) {
1925
+ // This is the parent's first child: create UL tag
1926
+ // (Hidden, because it will be
1927
+ targetParent.ul = document.createElement("ul");
1928
+ targetParent.ul.style.display = "none";
1929
+ targetParent.li.appendChild(targetParent.ul);
1930
+ }
1931
+ // Issue 319: Add to target DOM parent (only if node was already rendered(expanded))
1932
+ if(this.li){
1933
+ targetParent.ul.appendChild(this.li);
1934
+ }
1935
+
1936
+ if( this.tree !== targetNode.tree ) {
1937
+ // Fix node.tree for all source nodes
1938
+ this.visit(function(node){
1939
+ node.tree = targetNode.tree;
1940
+ }, null, true);
1941
+ throw "Not yet implemented.";
1942
+ }
1943
+ // TODO: fix selection state
1944
+ // TODO: fix active state
1945
+ if( !prevParent.isDescendantOf(targetParent)) {
1946
+ prevParent.render();
1947
+ }
1948
+ if( !targetParent.isDescendantOf(prevParent) ) {
1949
+ targetParent.render();
1950
+ }
1951
+ // this.tree.redraw();
1952
+ /*
1953
+ var tree = this.tree;
1954
+ var opts = tree.options;
1955
+ var pers = tree.persistence;
1956
+
1957
+
1958
+ // Always expand, if it's below minExpandLevel
1959
+ // tree.logDebug ("%s._addChildNode(%o), l=%o", this, dtnode, dtnode.getLevel());
1960
+ if ( opts.minExpandLevel >= dtnode.getLevel() ) {
1961
+ // tree.logDebug ("Force expand for %o", dtnode);
1962
+ this.bExpanded = true;
1963
+ }
1964
+
1965
+ // In multi-hier mode, update the parents selection state
1966
+ // issue #82: only if not initializing, because the children may not exist yet
1967
+ // if( !dtnode.data.isStatusNode && opts.selectMode==3 && !isInitializing )
1968
+ // dtnode._fixSelectionState();
1969
+
1970
+ // In multi-hier mode, update the parents selection state
1971
+ if( dtnode.bSelected && opts.selectMode==3 ) {
1972
+ var p = this;
1973
+ while( p ) {
1974
+ if( !p.hasSubSel )
1975
+ p._setSubSel(true);
1976
+ p = p.parent;
1977
+ }
1978
+ }
1979
+ // render this node and the new child
1980
+ if ( tree.bEnableUpdate )
1981
+ this.render();
1982
+
1983
+ return dtnode;
1984
+
1985
+ */
1986
+ },
1987
+
1988
+ // --- end of class
1989
+ lastentry: undefined
1990
+ };
1991
+
1992
+ /*************************************************************************
1993
+ * class DynaTreeStatus
1994
+ */
1995
+
1996
+ var DynaTreeStatus = Class.create();
1997
+
1998
+
1999
+ DynaTreeStatus._getTreePersistData = function(cookieId, cookieOpts) {
2000
+ // Static member: Return persistence information from cookies
2001
+ var ts = new DynaTreeStatus(cookieId, cookieOpts);
2002
+ ts.read();
2003
+ return ts.toDict();
2004
+ };
2005
+ // Make available in global scope
2006
+ getDynaTreePersistData = DynaTreeStatus._getTreePersistData; // TODO: deprecated
2007
+
2008
+
2009
+ DynaTreeStatus.prototype = {
2010
+ // Constructor
2011
+ initialize: function(cookieId, cookieOpts) {
2012
+ // this._log("DynaTreeStatus: initialize");
2013
+ if( cookieId === undefined ){
2014
+ cookieId = $.ui.dynatree.prototype.options.cookieId;
2015
+ }
2016
+ cookieOpts = $.extend({}, $.ui.dynatree.prototype.options.cookie, cookieOpts);
2017
+
2018
+ this.cookieId = cookieId;
2019
+ this.cookieOpts = cookieOpts;
2020
+ this.cookiesFound = undefined;
2021
+ this.activeKey = null;
2022
+ this.focusedKey = null;
2023
+ this.expandedKeyList = null;
2024
+ this.selectedKeyList = null;
2025
+ },
2026
+ // member functions
2027
+ _log: function(msg) {
2028
+ // this.logDebug("_changeNodeList(%o): nodeList:%o, idx:%o", mode, nodeList, idx);
2029
+ Array.prototype.unshift.apply(arguments, ["debug"]);
2030
+ _log.apply(this, arguments);
2031
+ },
2032
+ read: function() {
2033
+ // this._log("DynaTreeStatus: read");
2034
+ // Read or init cookies.
2035
+ this.cookiesFound = false;
2036
+
2037
+ var cookie = $.cookie(this.cookieId + "-active");
2038
+ this.activeKey = ( cookie === null ) ? "" : cookie;
2039
+ if( cookie !== null ){
2040
+ this.cookiesFound = true;
2041
+ }
2042
+ cookie = $.cookie(this.cookieId + "-focus");
2043
+ this.focusedKey = ( cookie === null ) ? "" : cookie;
2044
+ if( cookie !== null ){
2045
+ this.cookiesFound = true;
2046
+ }
2047
+ cookie = $.cookie(this.cookieId + "-expand");
2048
+ this.expandedKeyList = ( cookie === null ) ? [] : cookie.split(",");
2049
+ if( cookie !== null ){
2050
+ this.cookiesFound = true;
2051
+ }
2052
+ cookie = $.cookie(this.cookieId + "-select");
2053
+ this.selectedKeyList = ( cookie === null ) ? [] : cookie.split(",");
2054
+ if( cookie !== null ){
2055
+ this.cookiesFound = true;
2056
+ }
2057
+ },
2058
+ write: function() {
2059
+ // this._log("DynaTreeStatus: write");
2060
+ $.cookie(this.cookieId + "-active", ( this.activeKey === null ) ? "" : this.activeKey, this.cookieOpts);
2061
+ $.cookie(this.cookieId + "-focus", ( this.focusedKey === null ) ? "" : this.focusedKey, this.cookieOpts);
2062
+ $.cookie(this.cookieId + "-expand", ( this.expandedKeyList === null ) ? "" : this.expandedKeyList.join(","), this.cookieOpts);
2063
+ $.cookie(this.cookieId + "-select", ( this.selectedKeyList === null ) ? "" : this.selectedKeyList.join(","), this.cookieOpts);
2064
+ },
2065
+ addExpand: function(key) {
2066
+ // this._log("addExpand(%o)", key);
2067
+ if( $.inArray(key, this.expandedKeyList) < 0 ) {
2068
+ this.expandedKeyList.push(key);
2069
+ $.cookie(this.cookieId + "-expand", this.expandedKeyList.join(","), this.cookieOpts);
2070
+ }
2071
+ },
2072
+ clearExpand: function(key) {
2073
+ // this._log("clearExpand(%o)", key);
2074
+ var idx = $.inArray(key, this.expandedKeyList);
2075
+ if( idx >= 0 ) {
2076
+ this.expandedKeyList.splice(idx, 1);
2077
+ $.cookie(this.cookieId + "-expand", this.expandedKeyList.join(","), this.cookieOpts);
2078
+ }
2079
+ },
2080
+ addSelect: function(key) {
2081
+ // this._log("addSelect(%o)", key);
2082
+ if( $.inArray(key, this.selectedKeyList) < 0 ) {
2083
+ this.selectedKeyList.push(key);
2084
+ $.cookie(this.cookieId + "-select", this.selectedKeyList.join(","), this.cookieOpts);
2085
+ }
2086
+ },
2087
+ clearSelect: function(key) {
2088
+ // this._log("clearSelect(%o)", key);
2089
+ var idx = $.inArray(key, this.selectedKeyList);
2090
+ if( idx >= 0 ) {
2091
+ this.selectedKeyList.splice(idx, 1);
2092
+ $.cookie(this.cookieId + "-select", this.selectedKeyList.join(","), this.cookieOpts);
2093
+ }
2094
+ },
2095
+ isReloading: function() {
2096
+ return this.cookiesFound === true;
2097
+ },
2098
+ toDict: function() {
2099
+ return {
2100
+ cookiesFound: this.cookiesFound,
2101
+ activeKey: this.activeKey,
2102
+ focusedKey: this.activeKey,
2103
+ expandedKeyList: this.expandedKeyList,
2104
+ selectedKeyList: this.selectedKeyList
2105
+ };
2106
+ },
2107
+ // --- end of class
2108
+ lastentry: undefined
2109
+ };
2110
+
2111
+
2112
+ /*************************************************************************
2113
+ * class DynaTree
2114
+ */
2115
+
2116
+ var DynaTree = Class.create();
2117
+
2118
+ // --- Static members ----------------------------------------------------------
2119
+
2120
+ DynaTree.version = "$Version: 1.2.4$";
2121
+
2122
+ /*
2123
+ DynaTree._initTree = function() {
2124
+ };
2125
+
2126
+ DynaTree._bind = function() {
2127
+ };
2128
+ */
2129
+ //--- Class members ------------------------------------------------------------
2130
+
2131
+ DynaTree.prototype = {
2132
+ // Constructor
2133
+ // initialize: function(divContainer, options) {
2134
+ initialize: function($widget) {
2135
+ // instance members
2136
+ this.phase = "init";
2137
+ this.$widget = $widget;
2138
+ this.options = $widget.options;
2139
+ this.$tree = $widget.element;
2140
+ this.timer = null;
2141
+ // find container element
2142
+ this.divTree = this.$tree.get(0);
2143
+
2144
+ // var parentPos = $(this.divTree).parent().offset();
2145
+ // this.parentTop = parentPos.top;
2146
+ // this.parentLeft = parentPos.left;
2147
+
2148
+ _initDragAndDrop(this);
2149
+ },
2150
+
2151
+ // member functions
2152
+
2153
+ _load: function(callback) {
2154
+ var $widget = this.$widget;
2155
+ var opts = this.options,
2156
+ self = this;
2157
+ this.bEnableUpdate = true;
2158
+ this._nodeCount = 1;
2159
+ this.activeNode = null;
2160
+ this.focusNode = null;
2161
+
2162
+ // Some deprecation warnings to help with migration
2163
+ if( opts.rootVisible !== undefined ){
2164
+ this.logWarning("Option 'rootVisible' is no longer supported.");
2165
+ }
2166
+ if( opts.minExpandLevel < 1 ) {
2167
+ this.logWarning("Option 'minExpandLevel' must be >= 1.");
2168
+ opts.minExpandLevel = 1;
2169
+ }
2170
+ // _log("warn", "jQuery.support.boxModel " + jQuery.support.boxModel);
2171
+
2172
+ // If a 'options.classNames' dictionary was passed, still use defaults
2173
+ // for undefined classes:
2174
+ if( opts.classNames !== $.ui.dynatree.prototype.options.classNames ) {
2175
+ opts.classNames = $.extend({}, $.ui.dynatree.prototype.options.classNames, opts.classNames);
2176
+ }
2177
+ if( opts.ajaxDefaults !== $.ui.dynatree.prototype.options.ajaxDefaults ) {
2178
+ opts.ajaxDefaults = $.extend({}, $.ui.dynatree.prototype.options.ajaxDefaults, opts.ajaxDefaults);
2179
+ }
2180
+ if( opts.dnd !== $.ui.dynatree.prototype.options.dnd ) {
2181
+ opts.dnd = $.extend({}, $.ui.dynatree.prototype.options.dnd, opts.dnd);
2182
+ }
2183
+ // Guess skin path, if not specified
2184
+ if(!opts.imagePath) {
2185
+ $("script").each( function () {
2186
+ var _rexDtLibName = /.*dynatree[^\/]*\.js$/i;
2187
+ if( this.src.search(_rexDtLibName) >= 0 ) {
2188
+ if( this.src.indexOf("/")>=0 ){ // issue #47
2189
+ opts.imagePath = this.src.slice(0, this.src.lastIndexOf("/")) + "/skin/";
2190
+ }else{
2191
+ opts.imagePath = "skin/";
2192
+ }
2193
+ self.logDebug("Guessing imagePath from '%s': '%s'", this.src, opts.imagePath);
2194
+ return false; // first match
2195
+ }
2196
+ });
2197
+ }
2198
+
2199
+ this.persistence = new DynaTreeStatus(opts.cookieId, opts.cookie);
2200
+ if( opts.persist ) {
2201
+ if( !$.cookie ){
2202
+ _log("warn", "Please include jquery.cookie.js to use persistence.");
2203
+ }
2204
+ this.persistence.read();
2205
+ }
2206
+ this.logDebug("DynaTree.persistence: %o", this.persistence.toDict());
2207
+
2208
+ // Cached tag strings
2209
+ this.cache = {
2210
+ tagEmpty: "<span class='" + opts.classNames.empty + "'></span>",
2211
+ tagVline: "<span class='" + opts.classNames.vline + "'></span>",
2212
+ tagExpander: "<span class='" + opts.classNames.expander + "'></span>",
2213
+ tagConnector: "<span class='" + opts.classNames.connector + "'></span>",
2214
+ tagNodeIcon: "<span class='" + opts.classNames.nodeIcon + "'></span>",
2215
+ tagCheckbox: "<span class='" + opts.classNames.checkbox + "'></span>",
2216
+ lastentry: undefined
2217
+ };
2218
+
2219
+ // Clear container, in case it contained some 'waiting' or 'error' text
2220
+ // for clients that don't support JS.
2221
+ // We don't do this however, if we try to load from an embedded UL element.
2222
+ if( opts.children || (opts.initAjax && opts.initAjax.url) || opts.initId ){
2223
+ $(this.divTree).empty();
2224
+ }
2225
+ var $ulInitialize = this.$tree.find(">ul:first").hide();
2226
+
2227
+ // Create the root element
2228
+ this.tnRoot = new DynaTreeNode(null, this, {});
2229
+ this.tnRoot.bExpanded = true;
2230
+ this.tnRoot.render();
2231
+ this.divTree.appendChild(this.tnRoot.ul);
2232
+
2233
+ var root = this.tnRoot,
2234
+ isReloading = ( opts.persist && this.persistence.isReloading() ),
2235
+ isLazy = false,
2236
+ prevFlag = this.enableUpdate(false);
2237
+
2238
+ this.logDebug("Dynatree._load(): read tree structure...");
2239
+
2240
+ // Init tree structure
2241
+ if( opts.children ) {
2242
+ // Read structure from node array
2243
+ root.addChild(opts.children);
2244
+
2245
+ } else if( opts.initAjax && opts.initAjax.url ) {
2246
+ // Init tree from AJAX request
2247
+ isLazy = true;
2248
+ root.data.isLazy = true;
2249
+ this._reloadAjax(callback);
2250
+
2251
+ } else if( opts.initId ) {
2252
+ // Init tree from another UL element
2253
+ this._createFromTag(root, $("#"+opts.initId));
2254
+
2255
+ } else {
2256
+ // Init tree from the first UL element inside the container <div>
2257
+ // var $ul = this.$tree.find(">ul:first").hide();
2258
+ this._createFromTag(root, $ulInitialize);
2259
+ $ulInitialize.remove();
2260
+ }
2261
+
2262
+ this._checkConsistency();
2263
+ // Fix part-sel flags
2264
+ if(!isLazy && opts.selectMode == 3){
2265
+ root._updatePartSelectionState();
2266
+ }
2267
+ // Render html markup
2268
+ this.logDebug("Dynatree._load(): render nodes...");
2269
+ this.enableUpdate(prevFlag);
2270
+
2271
+ // bind event handlers
2272
+ this.logDebug("Dynatree._load(): bind events...");
2273
+ this.$widget.bind();
2274
+
2275
+ // --- Post-load processing
2276
+ this.logDebug("Dynatree._load(): postInit...");
2277
+ this.phase = "postInit";
2278
+
2279
+ // In persist mode, make sure that cookies are written, even if they are empty
2280
+ if( opts.persist ) {
2281
+ this.persistence.write();
2282
+ }
2283
+ // Set focus, if possible (this will also fire an event and write a cookie)
2284
+ if( this.focusNode && this.focusNode.isVisible() ) {
2285
+ this.logDebug("Focus on init: %o", this.focusNode);
2286
+ this.focusNode.focus();
2287
+ }
2288
+ if( !isLazy ) {
2289
+ if( opts.onPostInit ) {
2290
+ opts.onPostInit.call(this, isReloading, false);
2291
+ }
2292
+ if( callback ){
2293
+ callback.call(this, "ok");
2294
+ }
2295
+ }
2296
+ this.phase = "idle";
2297
+ },
2298
+
2299
+ _reloadAjax: function(callback) {
2300
+ // Reload
2301
+ var opts = this.options;
2302
+ if( ! opts.initAjax || ! opts.initAjax.url ){
2303
+ throw "tree.reload() requires 'initAjax' mode.";
2304
+ }
2305
+ var pers = this.persistence;
2306
+ var ajaxOpts = $.extend({}, opts.initAjax);
2307
+ // Append cookie info to the request
2308
+ // this.logDebug("reloadAjax: key=%o, an.key:%o", pers.activeKey, this.activeNode?this.activeNode.data.key:"?");
2309
+ if( ajaxOpts.addActiveKey ){
2310
+ ajaxOpts.data.activeKey = pers.activeKey;
2311
+ }
2312
+ if( ajaxOpts.addFocusedKey ){
2313
+ ajaxOpts.data.focusedKey = pers.focusedKey;
2314
+ }
2315
+ if( ajaxOpts.addExpandedKeyList ){
2316
+ ajaxOpts.data.expandedKeyList = pers.expandedKeyList.join(",");
2317
+ }
2318
+ if( ajaxOpts.addSelectedKeyList ){
2319
+ ajaxOpts.data.selectedKeyList = pers.selectedKeyList.join(",");
2320
+ }
2321
+ // Set up onPostInit callback to be called when Ajax returns
2322
+ if( ajaxOpts.success ){
2323
+ this.logWarning("initAjax: success callback is ignored; use onPostInit instead.");
2324
+ }
2325
+ if( ajaxOpts.error ){
2326
+ this.logWarning("initAjax: error callback is ignored; use onPostInit instead.");
2327
+ }
2328
+ var isReloading = pers.isReloading();
2329
+ ajaxOpts.success = function(dtnode, data, textStatus) {
2330
+ if(opts.selectMode == 3){
2331
+ dtnode.tree.tnRoot._updatePartSelectionState();
2332
+ }
2333
+ if(opts.onPostInit){
2334
+ opts.onPostInit.call(dtnode.tree, isReloading, false);
2335
+ }
2336
+ if(callback){
2337
+ callback.call(dtnode.tree, "ok");
2338
+ }
2339
+ };
2340
+ ajaxOpts.error = function(dtnode, XMLHttpRequest, textStatus, errorThrown) {
2341
+ if(opts.onPostInit){
2342
+ opts.onPostInit.call(dtnode.tree, isReloading, true, XMLHttpRequest, textStatus, errorThrown);
2343
+ }
2344
+ if(callback){
2345
+ callback.call(dtnode.tree, "error", XMLHttpRequest, textStatus, errorThrown);
2346
+ }
2347
+ };
2348
+ // }
2349
+ this.logDebug("Dynatree._init(): send Ajax request...");
2350
+ this.tnRoot.appendAjax(ajaxOpts);
2351
+ },
2352
+
2353
+ toString: function() {
2354
+ // return "DynaTree '" + this.options.title + "'";
2355
+ return "Dynatree '" + this.$tree.attr("id") + "'";
2356
+ },
2357
+
2358
+ toDict: function() {
2359
+ return this.tnRoot.toDict(true);
2360
+ },
2361
+
2362
+ serializeArray: function(stopOnParents) {
2363
+ // Return a JavaScript array of objects, ready to be encoded as a JSON
2364
+ // string for selected nodes
2365
+ var nodeList = this.getSelectedNodes(stopOnParents),
2366
+ name = this.$tree.attr("name") || this.$tree.attr("id"),
2367
+ arr = [];
2368
+ for(var i=0, l=nodeList.length; i<l; i++){
2369
+ arr.push({name: name, value: nodeList[i].data.key});
2370
+ }
2371
+ return arr;
2372
+ },
2373
+
2374
+ getPersistData: function() {
2375
+ return this.persistence.toDict();
2376
+ },
2377
+
2378
+ logDebug: function(msg) {
2379
+ if( this.options.debugLevel >= 2 ) {
2380
+ Array.prototype.unshift.apply(arguments, ["debug"]);
2381
+ _log.apply(this, arguments);
2382
+ }
2383
+ },
2384
+
2385
+ logInfo: function(msg) {
2386
+ if( this.options.debugLevel >= 1 ) {
2387
+ Array.prototype.unshift.apply(arguments, ["info"]);
2388
+ _log.apply(this, arguments);
2389
+ }
2390
+ },
2391
+
2392
+ logWarning: function(msg) {
2393
+ Array.prototype.unshift.apply(arguments, ["warn"]);
2394
+ _log.apply(this, arguments);
2395
+ },
2396
+
2397
+ isInitializing: function() {
2398
+ return ( this.phase=="init" || this.phase=="postInit" );
2399
+ },
2400
+ isReloading: function() {
2401
+ return ( this.phase=="init" || this.phase=="postInit" ) && this.options.persist && this.persistence.cookiesFound;
2402
+ },
2403
+ isUserEvent: function() {
2404
+ return ( this.phase=="userEvent" );
2405
+ },
2406
+
2407
+ redraw: function() {
2408
+ // this.logDebug("dynatree.redraw()...");
2409
+ this.tnRoot.render(false, false);
2410
+ // this.logDebug("dynatree.redraw() done.");
2411
+ },
2412
+ renderInvisibleNodes: function() {
2413
+ this.tnRoot.render(false, true);
2414
+ },
2415
+ reload: function(callback) {
2416
+ this._load(callback);
2417
+ },
2418
+
2419
+ getRoot: function() {
2420
+ return this.tnRoot;
2421
+ },
2422
+
2423
+ enable: function() {
2424
+ this.$widget.enable();
2425
+ },
2426
+
2427
+ disable: function() {
2428
+ this.$widget.disable();
2429
+ },
2430
+
2431
+ getNodeByKey: function(key) {
2432
+ // Search the DOM by element ID (assuming this is faster than traversing all nodes).
2433
+ // $("#...") has problems, if the key contains '.', so we use getElementById()
2434
+ var el = document.getElementById(this.options.idPrefix + key);
2435
+ if( el ){
2436
+ return el.dtnode ? el.dtnode : null;
2437
+ }
2438
+ // Not found in the DOM, but still may be in an unrendered part of tree
2439
+ var match = null;
2440
+ this.visit(function(node){
2441
+ // window.console.log("%s", node);
2442
+ if(node.data.key === key) {
2443
+ match = node;
2444
+ return false;
2445
+ }
2446
+ }, true);
2447
+ return match;
2448
+ },
2449
+
2450
+ getActiveNode: function() {
2451
+ return this.activeNode;
2452
+ },
2453
+
2454
+ reactivate: function(setFocus) {
2455
+ // Re-fire onQueryActivate and onActivate events.
2456
+ var node = this.activeNode;
2457
+ // this.logDebug("reactivate %o", node);
2458
+ if( node ) {
2459
+ this.activeNode = null; // Force re-activating
2460
+ node.activate();
2461
+ if( setFocus ){
2462
+ node.focus();
2463
+ }
2464
+ }
2465
+ },
2466
+
2467
+ getSelectedNodes: function(stopOnParents) {
2468
+ var nodeList = [];
2469
+ this.tnRoot.visit(function(node){
2470
+ if( node.bSelected ) {
2471
+ nodeList.push(node);
2472
+ if( stopOnParents === true ){
2473
+ return "skip"; // stop processing this branch
2474
+ }
2475
+ }
2476
+ });
2477
+ return nodeList;
2478
+ },
2479
+
2480
+ activateKey: function(key) {
2481
+ var dtnode = (key === null) ? null : this.getNodeByKey(key);
2482
+ if( !dtnode ) {
2483
+ if( this.activeNode ){
2484
+ this.activeNode.deactivate();
2485
+ }
2486
+ this.activeNode = null;
2487
+ return null;
2488
+ }
2489
+ dtnode.focus();
2490
+ dtnode.activate();
2491
+ return dtnode;
2492
+ },
2493
+
2494
+ loadKeyPath: function(keyPath, callback) {
2495
+ var segList = keyPath.split(this.options.keyPathSeparator);
2496
+ // Remove leading '/'
2497
+ if(segList[0] === ""){
2498
+ segList.shift();
2499
+ }
2500
+ // Remove leading system root key
2501
+ if(segList[0] == this.tnRoot.data.key){
2502
+ this.logDebug("Removed leading root key.");
2503
+ segList.shift();
2504
+ }
2505
+ keyPath = segList.join(this.options.keyPathSeparator);
2506
+ return this.tnRoot._loadKeyPath(keyPath, callback);
2507
+ },
2508
+
2509
+ selectKey: function(key, select) {
2510
+ var dtnode = this.getNodeByKey(key);
2511
+ if( !dtnode ){
2512
+ return null;
2513
+ }
2514
+ dtnode.select(select);
2515
+ return dtnode;
2516
+ },
2517
+
2518
+ enableUpdate: function(bEnable) {
2519
+ if ( this.bEnableUpdate==bEnable ){
2520
+ return bEnable;
2521
+ }
2522
+ this.bEnableUpdate = bEnable;
2523
+ if ( bEnable ){
2524
+ this.redraw();
2525
+ }
2526
+ return !bEnable; // return previous value
2527
+ },
2528
+
2529
+ count: function() {
2530
+ return this.tnRoot.countChildren();
2531
+ },
2532
+
2533
+ visit: function(fn, includeRoot) {
2534
+ return this.tnRoot.visit(fn, includeRoot);
2535
+ },
2536
+
2537
+ _createFromTag: function(parentTreeNode, $ulParent) {
2538
+ // Convert a <UL>...</UL> list into children of the parent tree node.
2539
+ var self = this;
2540
+ /*
2541
+ TODO: better?
2542
+ this.$lis = $("li:has(a[href])", this.element);
2543
+ this.$tabs = this.$lis.map(function() { return $("a", this)[0]; });
2544
+ */
2545
+ $ulParent.find(">li").each(function() {
2546
+ var $li = $(this),
2547
+ $liSpan = $li.find(">span:first"),
2548
+ $liA = $li.find(">a:first"),
2549
+ title,
2550
+ href = null,
2551
+ target = null,
2552
+ tooltip;
2553
+ if( $liSpan.length ) {
2554
+ // If a <li><span> tag is specified, use it literally.
2555
+ title = $liSpan.html();
2556
+ } else if( $liA.length ) {
2557
+ title = $liA.html();
2558
+ href = $liA.attr("href");
2559
+ target = $liA.attr("target");
2560
+ tooltip = $liA.attr("title");
2561
+ } else {
2562
+ // If only a <li> tag is specified, use the trimmed string up to
2563
+ // the next child <ul> tag.
2564
+ title = $li.html();
2565
+ var iPos = title.search(/<ul/i);
2566
+ if( iPos >= 0 ){
2567
+ title = $.trim(title.substring(0, iPos));
2568
+ }else{
2569
+ title = $.trim(title);
2570
+ }
2571
+ // self.logDebug("%o", title);
2572
+ }
2573
+ // Parse node options from ID, title and class attributes
2574
+ var data = {
2575
+ title: title,
2576
+ tooltip: tooltip,
2577
+ isFolder: $li.hasClass("folder"),
2578
+ isLazy: $li.hasClass("lazy"),
2579
+ expand: $li.hasClass("expanded"),
2580
+ select: $li.hasClass("selected"),
2581
+ activate: $li.hasClass("active"),
2582
+ focus: $li.hasClass("focused"),
2583
+ noLink: $li.hasClass("noLink")
2584
+ };
2585
+ if( href ){
2586
+ data.href = href;
2587
+ data.target = target;
2588
+ }
2589
+ if( $li.attr("title") ){
2590
+ data.tooltip = $li.attr("title"); // overrides <a title='...'>
2591
+ }
2592
+ if( $li.attr("id") ){
2593
+ data.key = "" + $li.attr("id");
2594
+ }
2595
+ // If a data attribute is present, evaluate as a JavaScript object
2596
+ if( $li.attr("data") ) {
2597
+ var dataAttr = $.trim($li.attr("data"));
2598
+ if( dataAttr ) {
2599
+ if( dataAttr.charAt(0) != "{" ){
2600
+ dataAttr = "{" + dataAttr + "}";
2601
+ }
2602
+ try {
2603
+ $.extend(data, eval("(" + dataAttr + ")"));
2604
+ } catch(e) {
2605
+ throw ("Error parsing node data: " + e + "\ndata:\n'" + dataAttr + "'");
2606
+ }
2607
+ }
2608
+ }
2609
+ var childNode = parentTreeNode.addChild(data);
2610
+ // Recursive reading of child nodes, if LI tag contains an UL tag
2611
+ var $ul = $li.find(">ul:first");
2612
+ if( $ul.length ) {
2613
+ self._createFromTag(childNode, $ul); // must use 'self', because 'this' is the each() context
2614
+ }
2615
+ });
2616
+ },
2617
+
2618
+ _checkConsistency: function() {
2619
+ // this.logDebug("tree._checkConsistency() NOT IMPLEMENTED - %o", this);
2620
+ },
2621
+
2622
+ _setDndStatus: function(sourceNode, targetNode, helper, hitMode, accept) {
2623
+ // hitMode: 'after', 'before', 'over', 'out', 'start', 'stop'
2624
+ var $source = sourceNode ? $(sourceNode.span) : null,
2625
+ $target = $(targetNode.span);
2626
+ if( !this.$dndMarker ) {
2627
+ this.$dndMarker = $("<div id='dynatree-drop-marker'></div>")
2628
+ .hide()
2629
+ .css({"z-index": 1000})
2630
+ .prependTo($(this.divTree).parent());
2631
+
2632
+ // logMsg("Creating marker: %o", this.$dndMarker);
2633
+ }
2634
+ /*
2635
+ if(hitMode === "start"){
2636
+ }
2637
+ if(hitMode === "stop"){
2638
+ // sourceNode.removeClass("dynatree-drop-target");
2639
+ }
2640
+ */
2641
+ if(hitMode === "after" || hitMode === "before" || hitMode === "over"){
2642
+ // $source && $source.addClass("dynatree-drag-source");
2643
+ // $target.addClass("dynatree-drop-target");
2644
+
2645
+ var markerOffset = "0 0";
2646
+
2647
+ switch(hitMode){
2648
+ case "before":
2649
+ this.$dndMarker.removeClass("dynatree-drop-after dynatree-drop-over");
2650
+ this.$dndMarker.addClass("dynatree-drop-before");
2651
+ markerOffset = "0 -8";
2652
+ break;
2653
+ case "after":
2654
+ this.$dndMarker.removeClass("dynatree-drop-before dynatree-drop-over");
2655
+ this.$dndMarker.addClass("dynatree-drop-after");
2656
+ markerOffset = "0 8";
2657
+ break;
2658
+ default:
2659
+ this.$dndMarker.removeClass("dynatree-drop-after dynatree-drop-before");
2660
+ this.$dndMarker.addClass("dynatree-drop-over");
2661
+ $target.addClass("dynatree-drop-target");
2662
+ markerOffset = "8 0";
2663
+ }
2664
+ // logMsg("Creating marker: %o", this.$dndMarker);
2665
+ // logMsg(" $target.offset=%o", $target);
2666
+ // logMsg(" pos/$target.offset=%o", pos);
2667
+ // logMsg(" $target.position=%o", $target.position());
2668
+ // logMsg(" $target.offsetParent=%o, ot:%o", $target.offsetParent(), $target.offsetParent().offset());
2669
+ // logMsg(" $(this.divTree).offset=%o", $(this.divTree).offset());
2670
+ // logMsg(" $(this.divTree).parent=%o", $(this.divTree).parent());
2671
+ // var pos = $target.offset();
2672
+ // var parentPos = $target.offsetParent().offset();
2673
+ // var bodyPos = $target.offsetParent().offset();
2674
+
2675
+ this.$dndMarker
2676
+ .show()
2677
+ .position({
2678
+ my: "left top",
2679
+ at: "left top",
2680
+ of: $target,
2681
+ offset: markerOffset
2682
+ });
2683
+
2684
+ // helper.addClass("dynatree-drop-hover");
2685
+ } else {
2686
+ // $source && $source.removeClass("dynatree-drag-source");
2687
+ $target.removeClass("dynatree-drop-target");
2688
+ this.$dndMarker.hide();
2689
+ // helper.removeClass("dynatree-drop-hover");
2690
+ }
2691
+ if(hitMode === "after"){
2692
+ $target.addClass("dynatree-drop-after");
2693
+ } else {
2694
+ $target.removeClass("dynatree-drop-after");
2695
+ }
2696
+ if(hitMode === "before"){
2697
+ $target.addClass("dynatree-drop-before");
2698
+ } else {
2699
+ $target.removeClass("dynatree-drop-before");
2700
+ }
2701
+ if(accept === true){
2702
+ if($source){
2703
+ $source.addClass("dynatree-drop-accept");
2704
+ }
2705
+ $target.addClass("dynatree-drop-accept");
2706
+ helper.addClass("dynatree-drop-accept");
2707
+ }else{
2708
+ if($source){
2709
+ $source.removeClass("dynatree-drop-accept");
2710
+ }
2711
+ $target.removeClass("dynatree-drop-accept");
2712
+ helper.removeClass("dynatree-drop-accept");
2713
+ }
2714
+ if(accept === false){
2715
+ if($source){
2716
+ $source.addClass("dynatree-drop-reject");
2717
+ }
2718
+ $target.addClass("dynatree-drop-reject");
2719
+ helper.addClass("dynatree-drop-reject");
2720
+ }else{
2721
+ if($source){
2722
+ $source.removeClass("dynatree-drop-reject");
2723
+ }
2724
+ $target.removeClass("dynatree-drop-reject");
2725
+ helper.removeClass("dynatree-drop-reject");
2726
+ }
2727
+ },
2728
+
2729
+ _onDragEvent: function(eventName, node, otherNode, event, ui, draggable) {
2730
+ /**
2731
+ * Handles drag'n'drop functionality.
2732
+ *
2733
+ * A standard jQuery drag-and-drop process may generate these calls:
2734
+ *
2735
+ * draggable helper():
2736
+ * _onDragEvent("helper", sourceNode, null, event, null, null);
2737
+ * start:
2738
+ * _onDragEvent("start", sourceNode, null, event, ui, draggable);
2739
+ * drag:
2740
+ * _onDragEvent("leave", prevTargetNode, sourceNode, event, ui, draggable);
2741
+ * _onDragEvent("over", targetNode, sourceNode, event, ui, draggable);
2742
+ * _onDragEvent("enter", targetNode, sourceNode, event, ui, draggable);
2743
+ * stop:
2744
+ * _onDragEvent("drop", targetNode, sourceNode, event, ui, draggable);
2745
+ * _onDragEvent("leave", targetNode, sourceNode, event, ui, draggable);
2746
+ * _onDragEvent("stop", sourceNode, null, event, ui, draggable);
2747
+ */
2748
+ // if(eventName !== "over"){
2749
+ // this.logDebug("tree._onDragEvent(%s, %o, %o) - %o", eventName, node, otherNode, this);
2750
+ // }
2751
+ var opts = this.options,
2752
+ dnd = this.options.dnd,
2753
+ res = null,
2754
+ nodeTag = $(node.span),
2755
+ hitMode,
2756
+ enterResponse;
2757
+
2758
+ switch (eventName) {
2759
+ case "helper":
2760
+ // Only event and node argument is available
2761
+ var $helper = $("<div class='dynatree-drag-helper'><span class='dynatree-drag-helper-img' /></div>")
2762
+ .append($(event.target).closest(".dynatree-title").clone());
2763
+ // .append($(event.target).closest('a').clone());
2764
+ // issue 244: helper should be child of scrollParent
2765
+ $("ul.dynatree-container", node.tree.divTree).append($helper);
2766
+ // $(node.tree.divTree).append($helper);
2767
+ // Attach node reference to helper object
2768
+ $helper.data("dtSourceNode", node);
2769
+ // this.logDebug("helper=%o", $helper);
2770
+ // this.logDebug("helper.sourceNode=%o", $helper.data("dtSourceNode"));
2771
+ res = $helper;
2772
+ break;
2773
+ case "start":
2774
+ if(node.isStatusNode()) {
2775
+ res = false;
2776
+ } else if(dnd.onDragStart) {
2777
+ res = dnd.onDragStart(node);
2778
+ }
2779
+ if(res === false) {
2780
+ this.logDebug("tree.onDragStart() cancelled");
2781
+ //draggable._clear();
2782
+ // NOTE: the return value seems to be ignored (drag is not canceled, when false is returned)
2783
+ ui.helper.trigger("mouseup");
2784
+ ui.helper.hide();
2785
+ } else {
2786
+ nodeTag.addClass("dynatree-drag-source");
2787
+ }
2788
+ break;
2789
+ case "enter":
2790
+ res = dnd.onDragEnter ? dnd.onDragEnter(node, otherNode) : null;
2791
+ if(!res){
2792
+ // convert null, undefined, false to false
2793
+ res = false;
2794
+ }else{
2795
+ res = {
2796
+ over: ((res === true) || (res === "over") || $.inArray("over", res) >= 0),
2797
+ before: ((res === true) || (res === "before") || $.inArray("before", res) >= 0),
2798
+ after: ((res === true) || (res === "after") || $.inArray("after", res) >= 0)
2799
+ };
2800
+ }
2801
+ ui.helper.data("enterResponse", res);
2802
+ // this.logDebug("helper.enterResponse: %o", res);
2803
+ break;
2804
+ case "over":
2805
+ enterResponse = ui.helper.data("enterResponse");
2806
+ hitMode = null;
2807
+ if(enterResponse === false){
2808
+ // Don't call onDragOver if onEnter returned false.
2809
+ // issue 332
2810
+ // break;
2811
+ } else if(typeof enterResponse === "string") {
2812
+ // Use hitMode from onEnter if provided.
2813
+ hitMode = enterResponse;
2814
+ } else {
2815
+ // Calculate hitMode from relative cursor position.
2816
+ var nodeOfs = nodeTag.offset();
2817
+ // var relPos = { x: event.clientX - nodeOfs.left,
2818
+ // y: event.clientY - nodeOfs.top };
2819
+ // nodeOfs.top += this.parentTop;
2820
+ // nodeOfs.left += this.parentLeft;
2821
+ var relPos = { x: event.pageX - nodeOfs.left,
2822
+ y: event.pageY - nodeOfs.top };
2823
+ var relPos2 = { x: relPos.x / nodeTag.width(),
2824
+ y: relPos.y / nodeTag.height() };
2825
+ // this.logDebug("event.page: %s/%s", event.pageX, event.pageY);
2826
+ // this.logDebug("event.client: %s/%s", event.clientX, event.clientY);
2827
+ // this.logDebug("nodeOfs: %s/%s", nodeOfs.left, nodeOfs.top);
2828
+ //// this.logDebug("parent: %s/%s", this.parentLeft, this.parentTop);
2829
+ // this.logDebug("relPos: %s/%s", relPos.x, relPos.y);
2830
+ // this.logDebug("relPos2: %s/%s", relPos2.x, relPos2.y);
2831
+ if( enterResponse.after && relPos2.y > 0.75 ){
2832
+ hitMode = "after";
2833
+ } else if(!enterResponse.over && enterResponse.after && relPos2.y > 0.5 ){
2834
+ hitMode = "after";
2835
+ } else if(enterResponse.before && relPos2.y <= 0.25) {
2836
+ hitMode = "before";
2837
+ } else if(!enterResponse.over && enterResponse.before && relPos2.y <= 0.5) {
2838
+ hitMode = "before";
2839
+ } else if(enterResponse.over) {
2840
+ hitMode = "over";
2841
+ }
2842
+ // Prevent no-ops like 'before source node'
2843
+ // TODO: these are no-ops when moving nodes, but not in copy mode
2844
+ if( dnd.preventVoidMoves ){
2845
+ if(node === otherNode){
2846
+ // this.logDebug(" drop over source node prevented");
2847
+ hitMode = null;
2848
+ }else if(hitMode === "before" && otherNode && node === otherNode.getNextSibling()){
2849
+ // this.logDebug(" drop after source node prevented");
2850
+ hitMode = null;
2851
+ }else if(hitMode === "after" && otherNode && node === otherNode.getPrevSibling()){
2852
+ // this.logDebug(" drop before source node prevented");
2853
+ hitMode = null;
2854
+ }else if(hitMode === "over" && otherNode
2855
+ && otherNode.parent === node && otherNode.isLastSibling() ){
2856
+ // this.logDebug(" drop last child over own parent prevented");
2857
+ hitMode = null;
2858
+ }
2859
+ }
2860
+ // this.logDebug("hitMode: %s - %s - %s", hitMode, (node.parent === otherNode), node.isLastSibling());
2861
+ ui.helper.data("hitMode", hitMode);
2862
+ }
2863
+ // Auto-expand node (only when 'over' the node, not 'before', or 'after')
2864
+ if(hitMode === "over"
2865
+ && dnd.autoExpandMS && node.hasChildren() !== false && !node.bExpanded) {
2866
+ node.scheduleAction("expand", dnd.autoExpandMS);
2867
+ }
2868
+ if(hitMode && dnd.onDragOver){
2869
+ res = dnd.onDragOver(node, otherNode, hitMode);
2870
+ if(res === "over" || res === "before" || res === "after") {
2871
+ hitMode = res;
2872
+ }
2873
+ }
2874
+ // issue 332
2875
+ // this._setDndStatus(otherNode, node, ui.helper, hitMode, res!==false);
2876
+ this._setDndStatus(otherNode, node, ui.helper, hitMode, res!==false && hitMode !== null);
2877
+ break;
2878
+ case "drop":
2879
+ // issue 286: don't trigger onDrop, if DnD status is 'reject'
2880
+ var isForbidden = ui.helper.hasClass("dynatree-drop-reject");
2881
+ hitMode = ui.helper.data("hitMode");
2882
+ if(hitMode && dnd.onDrop && !isForbidden){
2883
+ dnd.onDrop(node, otherNode, hitMode, ui, draggable);
2884
+ }
2885
+ break;
2886
+ case "leave":
2887
+ // Cancel pending expand request
2888
+ node.scheduleAction("cancel");
2889
+ ui.helper.data("enterResponse", null);
2890
+ ui.helper.data("hitMode", null);
2891
+ this._setDndStatus(otherNode, node, ui.helper, "out", undefined);
2892
+ if(dnd.onDragLeave){
2893
+ dnd.onDragLeave(node, otherNode);
2894
+ }
2895
+ break;
2896
+ case "stop":
2897
+ nodeTag.removeClass("dynatree-drag-source");
2898
+ if(dnd.onDragStop){
2899
+ dnd.onDragStop(node);
2900
+ }
2901
+ break;
2902
+ default:
2903
+ throw "Unsupported drag event: " + eventName;
2904
+ }
2905
+ return res;
2906
+ },
2907
+
2908
+ cancelDrag: function() {
2909
+ var dd = $.ui.ddmanager.current;
2910
+ if(dd){
2911
+ dd.cancel();
2912
+ }
2913
+ },
2914
+
2915
+ // --- end of class
2916
+ lastentry: undefined
2917
+ };
2918
+
2919
+ /*************************************************************************
2920
+ * Widget $(..).dynatree
2921
+ */
2922
+
2923
+ $.widget("ui.dynatree", {
2924
+ /*
2925
+ init: function() {
2926
+ // ui.core 1.6 renamed init() to _init(): this stub assures backward compatibility
2927
+ _log("warn", "ui.dynatree.init() was called; you should upgrade to jquery.ui.core.js v1.8 or higher.");
2928
+ return this._init();
2929
+ },
2930
+ */
2931
+ _init: function() {
2932
+ // if( parseFloat($.ui.version) < 1.8 ) {
2933
+ if(versionCompare($.ui.version, "1.8") < 0){
2934
+ // jquery.ui.core 1.8 renamed _init() to _create(): this stub assures backward compatibility
2935
+ if(this.options.debugLevel >= 0){
2936
+ _log("warn", "ui.dynatree._init() was called; you should upgrade to jquery.ui.core.js v1.8 or higher.");
2937
+ }
2938
+ return this._create();
2939
+ }
2940
+ // jquery.ui.core 1.8 still uses _init() to perform "default functionality"
2941
+ if(this.options.debugLevel >= 2){
2942
+ _log("debug", "ui.dynatree._init() was called; no current default functionality.");
2943
+ }
2944
+ },
2945
+
2946
+ _create: function() {
2947
+ var opts = this.options;
2948
+ if(opts.debugLevel >= 1){
2949
+ logMsg("Dynatree._create(): version='%s', debugLevel=%o.", $.ui.dynatree.version, this.options.debugLevel);
2950
+ }
2951
+ // The widget framework supplies this.element and this.options.
2952
+ this.options.event += ".dynatree"; // namespace event
2953
+
2954
+ var divTree = this.element.get(0);
2955
+ /* // Clear container, in case it contained some 'waiting' or 'error' text
2956
+ // for clients that don't support JS
2957
+ if( opts.children || (opts.initAjax && opts.initAjax.url) || opts.initId )
2958
+ $(divTree).empty();
2959
+ */
2960
+ // Create the DynaTree object
2961
+ this.tree = new DynaTree(this);
2962
+ this.tree._load();
2963
+ this.tree.logDebug("Dynatree._init(): done.");
2964
+ },
2965
+
2966
+ bind: function() {
2967
+ // Prevent duplicate binding
2968
+ this.unbind();
2969
+
2970
+ var eventNames = "click.dynatree dblclick.dynatree";
2971
+ if( this.options.keyboard ){
2972
+ // Note: leading ' '!
2973
+ eventNames += " keypress.dynatree keydown.dynatree";
2974
+ }
2975
+ this.element.bind(eventNames, function(event){
2976
+ var dtnode = $.ui.dynatree.getNode(event.target);
2977
+ if( !dtnode ){
2978
+ return true; // Allow bubbling of other events
2979
+ }
2980
+ var tree = dtnode.tree;
2981
+ var o = tree.options;
2982
+ tree.logDebug("event(%s): dtnode: %s", event.type, dtnode);
2983
+ var prevPhase = tree.phase;
2984
+ tree.phase = "userEvent";
2985
+ try {
2986
+ switch(event.type) {
2987
+ case "click":
2988
+ return ( o.onClick && o.onClick.call(tree, dtnode, event)===false ) ? false : dtnode._onClick(event);
2989
+ case "dblclick":
2990
+ return ( o.onDblClick && o.onDblClick.call(tree, dtnode, event)===false ) ? false : dtnode._onDblClick(event);
2991
+ case "keydown":
2992
+ return ( o.onKeydown && o.onKeydown.call(tree, dtnode, event)===false ) ? false : dtnode._onKeydown(event);
2993
+ case "keypress":
2994
+ return ( o.onKeypress && o.onKeypress.call(tree, dtnode, event)===false ) ? false : dtnode._onKeypress(event);
2995
+ }
2996
+ } catch(e) {
2997
+ var _ = null; // issue 117
2998
+ tree.logWarning("bind(%o): dtnode: %o, error: %o", event, dtnode, e);
2999
+ } finally {
3000
+ tree.phase = prevPhase;
3001
+ }
3002
+ });
3003
+
3004
+ // focus/blur don't bubble, i.e. are not delegated to parent <div> tags,
3005
+ // so we use the addEventListener capturing phase.
3006
+ // See http://www.howtocreate.co.uk/tutorials/javascript/domevents
3007
+ function __focusHandler(event) {
3008
+ // Handles blur and focus.
3009
+ // Fix event for IE:
3010
+ // doesn't pass JSLint:
3011
+ // event = arguments[0] = $.event.fix( event || window.event );
3012
+ // what jQuery does:
3013
+ // var args = jQuery.makeArray( arguments );
3014
+ // event = args[0] = jQuery.event.fix( event || window.event );
3015
+ event = $.event.fix( event || window.event );
3016
+ var dtnode = $.ui.dynatree.getNode(event.target);
3017
+ return dtnode ? dtnode._onFocus(event) : false;
3018
+ }
3019
+ var div = this.tree.divTree;
3020
+
3021
+ if( div.addEventListener ) {
3022
+ div.addEventListener("focus", __focusHandler, true);
3023
+ div.addEventListener("blur", __focusHandler, true);
3024
+ } else {
3025
+ div.onfocusin = div.onfocusout = __focusHandler;
3026
+ }
3027
+ // EVENTS
3028
+ // disable click if event is configured to something else
3029
+ // if (!(/^click/).test(o.event))
3030
+ // this.$tabs.bind("click.tabs", function() { return false; });
3031
+
3032
+ },
3033
+
3034
+ unbind: function() {
3035
+ this.element.unbind(".dynatree");
3036
+ },
3037
+
3038
+ /* TODO: we could handle option changes during runtime here (maybe to re-render, ...)
3039
+ setData: function(key, value) {
3040
+ this.tree.logDebug("dynatree.setData('" + key + "', '" + value + "')");
3041
+ },
3042
+ */
3043
+ enable: function() {
3044
+ this.bind();
3045
+ // Call default disable(): remove -disabled from css:
3046
+ $.Widget.prototype.enable.apply(this, arguments);
3047
+ },
3048
+
3049
+ disable: function() {
3050
+ this.unbind();
3051
+ // Call default disable(): add -disabled to css:
3052
+ $.Widget.prototype.disable.apply(this, arguments);
3053
+ },
3054
+
3055
+ // --- getter methods (i.e. NOT returning a reference to $)
3056
+ getTree: function() {
3057
+ return this.tree;
3058
+ },
3059
+
3060
+ getRoot: function() {
3061
+ return this.tree.getRoot();
3062
+ },
3063
+
3064
+ getActiveNode: function() {
3065
+ return this.tree.getActiveNode();
3066
+ },
3067
+
3068
+ getSelectedNodes: function() {
3069
+ return this.tree.getSelectedNodes();
3070
+ },
3071
+
3072
+ // ------------------------------------------------------------------------
3073
+ lastentry: undefined
3074
+ });
3075
+
3076
+
3077
+ // The following methods return a value (thus breaking the jQuery call chain):
3078
+ if(versionCompare($.ui.version, "1.8") < 0){
3079
+ //if( parseFloat($.ui.version) < 1.8 ) {
3080
+ $.ui.dynatree.getter = "getTree getRoot getActiveNode getSelectedNodes";
3081
+ }
3082
+
3083
+ /*******************************************************************************
3084
+ * Tools in ui.dynatree namespace
3085
+ */
3086
+ $.ui.dynatree.version = "$Version: 1.2.4$";
3087
+
3088
+ /**
3089
+ * Return a DynaTreeNode object for a given DOM element
3090
+ */
3091
+ $.ui.dynatree.getNode = function(el) {
3092
+ if(el instanceof DynaTreeNode){
3093
+ return el; // el already was a DynaTreeNode
3094
+ }
3095
+ if(el.selector !== undefined){
3096
+ el = el[0]; // el was a jQuery object: use the DOM element
3097
+ }
3098
+ // TODO: for some reason $el.parents("[dtnode]") does not work (jQuery 1.6.1)
3099
+ // maybe, because dtnode is a property, not an attribute
3100
+ while( el ) {
3101
+ if(el.dtnode) {
3102
+ return el.dtnode;
3103
+ }
3104
+ el = el.parentNode;
3105
+ }
3106
+ return null;
3107
+ /*
3108
+ var $el = el.selector === undefined ? $(el) : el,
3109
+ // parent = $el.closest("[dtnode]"),
3110
+ // parent = $el.parents("[dtnode]").first(),
3111
+ useProp = (typeof $el.prop == "function"),
3112
+ node;
3113
+ $el.parents().each(function(){
3114
+ node = useProp ? $(this).prop("dtnode") : $(this).attr("dtnode");
3115
+ if(node){
3116
+ return false;
3117
+ }
3118
+ });
3119
+ return node;
3120
+ */
3121
+ };
3122
+
3123
+ /**Return persistence information from cookies.*/
3124
+ $.ui.dynatree.getPersistData = DynaTreeStatus._getTreePersistData;
3125
+
3126
+ /*******************************************************************************
3127
+ * Plugin default options:
3128
+ */
3129
+ $.ui.dynatree.prototype.options = {
3130
+ title: "Dynatree", // Tree's name (only used for debug output)
3131
+ minExpandLevel: 1, // 1: root node is not collapsible
3132
+ imagePath: null, // Path to a folder containing icons. Defaults to 'skin/' subdirectory.
3133
+ children: null, // Init tree structure from this object array.
3134
+ initId: null, // Init tree structure from a <ul> element with this ID.
3135
+ initAjax: null, // Ajax options used to initialize the tree strucuture.
3136
+ autoFocus: true, // Set focus to first child, when expanding or lazy-loading.
3137
+ keyboard: true, // Support keyboard navigation.
3138
+ persist: false, // Persist expand-status to a cookie
3139
+ autoCollapse: false, // Automatically collapse all siblings, when a node is expanded.
3140
+ clickFolderMode: 3, // 1:activate, 2:expand, 3:activate and expand
3141
+ activeVisible: true, // Make sure, active nodes are visible (expanded).
3142
+ checkbox: false, // Show checkboxes.
3143
+ selectMode: 2, // 1:single, 2:multi, 3:multi-hier
3144
+ fx: null, // Animations, e.g. null or { height: "toggle", duration: 200 }
3145
+ noLink: false, // Use <span> instead of <a> tags for all nodes
3146
+ // Low level event handlers: onEvent(dtnode, event): return false, to stop default processing
3147
+ onClick: null, // null: generate focus, expand, activate, select events.
3148
+ onDblClick: null, // (No default actions.)
3149
+ onKeydown: null, // null: generate keyboard navigation (focus, expand, activate).
3150
+ onKeypress: null, // (No default actions.)
3151
+ onFocus: null, // null: set focus to node.
3152
+ onBlur: null, // null: remove focus from node.
3153
+
3154
+ // Pre-event handlers onQueryEvent(flag, dtnode): return false, to stop processing
3155
+ onQueryActivate: null, // Callback(flag, dtnode) before a node is (de)activated.
3156
+ onQuerySelect: null, // Callback(flag, dtnode) before a node is (de)selected.
3157
+ onQueryExpand: null, // Callback(flag, dtnode) before a node is expanded/collpsed.
3158
+
3159
+ // High level event handlers
3160
+ onPostInit: null, // Callback(isReloading, isError) when tree was (re)loaded.
3161
+ onActivate: null, // Callback(dtnode) when a node is activated.
3162
+ onDeactivate: null, // Callback(dtnode) when a node is deactivated.
3163
+ onSelect: null, // Callback(flag, dtnode) when a node is (de)selected.
3164
+ onExpand: null, // Callback(flag, dtnode) when a node is expanded/collapsed.
3165
+ onLazyRead: null, // Callback(dtnode) when a lazy node is expanded for the first time.
3166
+ onCustomRender: null, // Callback(dtnode) before a node is rendered. Return a HTML string to override.
3167
+ onCreate: null, // Callback(dtnode, nodeSpan) after a node was rendered for the first time.
3168
+ onRender: null, // Callback(dtnode, nodeSpan) after a node was rendered.
3169
+ // postProcess is similar to the standard dataFilter hook,
3170
+ // but it is also called for JSONP
3171
+ postProcess: null, // Callback(data, dataType) before an Ajax result is passed to dynatree
3172
+
3173
+ // Drag'n'drop support
3174
+ dnd: {
3175
+ // Make tree nodes draggable:
3176
+ onDragStart: null, // Callback(sourceNode), return true, to enable dnd
3177
+ onDragStop: null, // Callback(sourceNode)
3178
+ // helper: null,
3179
+ // Make tree nodes accept draggables
3180
+ autoExpandMS: 1000, // Expand nodes after n milliseconds of hovering.
3181
+ preventVoidMoves: true, // Prevent dropping nodes 'before self', etc.
3182
+ onDragEnter: null, // Callback(targetNode, sourceNode)
3183
+ onDragOver: null, // Callback(targetNode, sourceNode, hitMode)
3184
+ onDrop: null, // Callback(targetNode, sourceNode, hitMode)
3185
+ onDragLeave: null // Callback(targetNode, sourceNode)
3186
+ },
3187
+ ajaxDefaults: { // Used by initAjax option
3188
+ cache: false, // false: Append random '_' argument to the request url to prevent caching.
3189
+ timeout: 0, // >0: Make sure we get an ajax error for invalid URLs
3190
+ dataType: "json" // Expect json format and pass json object to callbacks.
3191
+ },
3192
+ strings: {
3193
+ loading: "Loading&#8230;",
3194
+ loadError: "Load error!"
3195
+ },
3196
+ generateIds: false, // Generate id attributes like <span id='dynatree-id-KEY'>
3197
+ idPrefix: "dynatree-id-", // Used to generate node id's like <span id="dynatree-id-<key>">.
3198
+ keyPathSeparator: "/", // Used by node.getKeyPath() and tree.loadKeyPath().
3199
+ // cookieId: "dynatree-cookie", // Choose a more unique name, to allow multiple trees.
3200
+ cookieId: "dynatree", // Choose a more unique name, to allow multiple trees.
3201
+ cookie: {
3202
+ expires: null //7, // Days or Date; null: session cookie
3203
+ // path: "/", // Defaults to current page
3204
+ // domain: "jquery.com",
3205
+ // secure: true
3206
+ },
3207
+ // Class names used, when rendering the HTML markup.
3208
+ // Note: if only single entries are passed for options.classNames, all other
3209
+ // values are still set to default.
3210
+ classNames: {
3211
+ container: "dynatree-container",
3212
+ node: "dynatree-node",
3213
+ folder: "dynatree-folder",
3214
+ // document: "dynatree-document",
3215
+
3216
+ empty: "dynatree-empty",
3217
+ vline: "dynatree-vline",
3218
+ expander: "dynatree-expander",
3219
+ connector: "dynatree-connector",
3220
+ checkbox: "dynatree-checkbox",
3221
+ nodeIcon: "dynatree-icon",
3222
+ title: "dynatree-title",
3223
+ noConnector: "dynatree-no-connector",
3224
+
3225
+ nodeError: "dynatree-statusnode-error",
3226
+ nodeWait: "dynatree-statusnode-wait",
3227
+ hidden: "dynatree-hidden",
3228
+ combinedExpanderPrefix: "dynatree-exp-",
3229
+ combinedIconPrefix: "dynatree-ico-",
3230
+ nodeLoading: "dynatree-loading",
3231
+ // disabled: "dynatree-disabled",
3232
+ hasChildren: "dynatree-has-children",
3233
+ active: "dynatree-active",
3234
+ selected: "dynatree-selected",
3235
+ expanded: "dynatree-expanded",
3236
+ lazy: "dynatree-lazy",
3237
+ focused: "dynatree-focused",
3238
+ partsel: "dynatree-partsel",
3239
+ lastsib: "dynatree-lastsib"
3240
+ },
3241
+ debugLevel: 1,
3242
+
3243
+ // ------------------------------------------------------------------------
3244
+ lastentry: undefined
3245
+ };
3246
+ //
3247
+ if(versionCompare($.ui.version, "1.8") < 0){
3248
+ //if( parseFloat($.ui.version) < 1.8 ) {
3249
+ $.ui.dynatree.defaults = $.ui.dynatree.prototype.options;
3250
+ }
3251
+
3252
+ /*******************************************************************************
3253
+ * Reserved data attributes for a tree node.
3254
+ */
3255
+ $.ui.dynatree.nodedatadefaults = {
3256
+ title: null, // (required) Displayed name of the node (html is allowed here)
3257
+ key: null, // May be used with activate(), select(), find(), ...
3258
+ isFolder: false, // Use a folder icon. Also the node is expandable but not selectable.
3259
+ isLazy: false, // Call onLazyRead(), when the node is expanded for the first time to allow for delayed creation of children.
3260
+ tooltip: null, // Show this popup text.
3261
+ href: null, // Added to the generated <a> tag.
3262
+ icon: null, // Use a custom image (filename relative to tree.options.imagePath). 'null' for default icon, 'false' for no icon.
3263
+ addClass: null, // Class name added to the node's span tag.
3264
+ noLink: false, // Use <span> instead of <a> tag for this node
3265
+ activate: false, // Initial active status.
3266
+ focus: false, // Initial focused status.
3267
+ expand: false, // Initial expanded status.
3268
+ select: false, // Initial selected status.
3269
+ hideCheckbox: false, // Suppress checkbox display for this node.
3270
+ unselectable: false, // Prevent selection.
3271
+ // disabled: false,
3272
+ // The following attributes are only valid if passed to some functions:
3273
+ children: null, // Array of child nodes.
3274
+ // NOTE: we can also add custom attributes here.
3275
+ // This may then also be used in the onActivate(), onSelect() or onLazyTree() callbacks.
3276
+ // ------------------------------------------------------------------------
3277
+ lastentry: undefined
3278
+ };
3279
+
3280
+ /*******************************************************************************
3281
+ * Drag and drop support
3282
+ */
3283
+ function _initDragAndDrop(tree) {
3284
+ var dnd = tree.options.dnd || null;
3285
+ // Register 'connectToDynatree' option with ui.draggable
3286
+ if(dnd && (dnd.onDragStart || dnd.onDrop)) {
3287
+ _registerDnd();
3288
+ }
3289
+ // Attach ui.draggable to this Dynatree instance
3290
+ if(dnd && dnd.onDragStart ) {
3291
+ tree.$tree.draggable({
3292
+ addClasses: false,
3293
+ appendTo: "body",
3294
+ containment: false,
3295
+ delay: 0,
3296
+ distance: 4,
3297
+ revert: false,
3298
+ scroll: true, // issue 244: enable scrolling (if ul.dynatree-container)
3299
+ scrollSpeed: 7,
3300
+ scrollSensitivity: 10,
3301
+ // Delegate draggable.start, drag, and stop events to our handler
3302
+ connectToDynatree: true,
3303
+ // Let source tree create the helper element
3304
+ helper: function(event) {
3305
+ var sourceNode = $.ui.dynatree.getNode(event.target);
3306
+ if(!sourceNode){ // issue 211
3307
+ return "<div></div>";
3308
+ }
3309
+ return sourceNode.tree._onDragEvent("helper", sourceNode, null, event, null, null);
3310
+ },
3311
+ start: function(event, ui) {
3312
+ // See issues 211, 268, 278
3313
+ // var sourceNode = $.ui.dynatree.getNode(event.target);
3314
+ var sourceNode = ui.helper.data("dtSourceNode");
3315
+ return !!sourceNode; // Abort dragging if no Node could be found
3316
+ },
3317
+ _last: null
3318
+ });
3319
+ }
3320
+ // Attach ui.droppable to this Dynatree instance
3321
+ if(dnd && dnd.onDrop) {
3322
+ tree.$tree.droppable({
3323
+ addClasses: false,
3324
+ tolerance: "intersect",
3325
+ greedy: false,
3326
+ _last: null
3327
+ });
3328
+ }
3329
+ }
3330
+
3331
+ //--- Extend ui.draggable event handling --------------------------------------
3332
+ var didRegisterDnd = false;
3333
+ var _registerDnd = function() {
3334
+ if(didRegisterDnd){
3335
+ return;
3336
+ }
3337
+ // Register proxy-functions for draggable.start/drag/stop
3338
+ $.ui.plugin.add("draggable", "connectToDynatree", {
3339
+ start: function(event, ui) {
3340
+ // issue 386
3341
+ var draggable = $(this).data("ui-draggable") || $(this).data("draggable"),
3342
+ sourceNode = ui.helper.data("dtSourceNode") || null;
3343
+ // logMsg("draggable-connectToDynatree.start, %s", sourceNode);
3344
+ // logMsg(" this: %o", this);
3345
+ // logMsg(" event: %o", event);
3346
+ // logMsg(" draggable: %o", draggable);
3347
+ // logMsg(" ui: %o", ui);
3348
+
3349
+ if(sourceNode) {
3350
+ // Adjust helper offset, so cursor is slightly outside top/left corner
3351
+ // draggable.offset.click.top -= event.target.offsetTop;
3352
+ // draggable.offset.click.left -= event.target.offsetLeft;
3353
+ draggable.offset.click.top = -2;
3354
+ draggable.offset.click.left = + 16;
3355
+ // logMsg(" draggable2: %o", draggable);
3356
+ // logMsg(" draggable.offset.click FIXED: %s/%s", draggable.offset.click.left, draggable.offset.click.top);
3357
+ // Trigger onDragStart event
3358
+ // TODO: when called as connectTo..., the return value is ignored(?)
3359
+ return sourceNode.tree._onDragEvent("start", sourceNode, null, event, ui, draggable);
3360
+ }
3361
+ },
3362
+ drag: function(event, ui) {
3363
+ // issue 386
3364
+ var draggable = $(this).data("ui-draggable") || $(this).data("draggable"),
3365
+ sourceNode = ui.helper.data("dtSourceNode") || null,
3366
+ prevTargetNode = ui.helper.data("dtTargetNode") || null,
3367
+ targetNode = $.ui.dynatree.getNode(event.target);
3368
+ // logMsg("$.ui.dynatree.getNode(%o): %s", event.target, targetNode);
3369
+ // logMsg("connectToDynatree.drag: helper: %o", ui.helper[0]);
3370
+ if(event.target && !targetNode){
3371
+ // We got a drag event, but the targetNode could not be found
3372
+ // at the event location. This may happen,
3373
+ // 1. if the mouse jumped over the drag helper,
3374
+ // 2. or if non-dynatree element is dragged
3375
+ // We ignore it:
3376
+ var isHelper = $(event.target).closest("div.dynatree-drag-helper,#dynatree-drop-marker").length > 0;
3377
+ if(isHelper){
3378
+ // logMsg("Drag event over helper: ignored.");
3379
+ return;
3380
+ }
3381
+ }
3382
+ // logMsg("draggable-connectToDynatree.drag: targetNode(from event): %s, dtTargetNode: %s", targetNode, ui.helper.data("dtTargetNode"));
3383
+ ui.helper.data("dtTargetNode", targetNode);
3384
+ // Leaving a tree node
3385
+ if(prevTargetNode && prevTargetNode !== targetNode ) {
3386
+ prevTargetNode.tree._onDragEvent("leave", prevTargetNode, sourceNode, event, ui, draggable);
3387
+ }
3388
+ if(targetNode){
3389
+ if(!targetNode.tree.options.dnd.onDrop) {
3390
+ // not enabled as drop target
3391
+ // noop(); // Keep JSLint happy
3392
+ } else if(targetNode === prevTargetNode) {
3393
+ // Moving over same node
3394
+ targetNode.tree._onDragEvent("over", targetNode, sourceNode, event, ui, draggable);
3395
+ }else{
3396
+ // Entering this node first time
3397
+ targetNode.tree._onDragEvent("enter", targetNode, sourceNode, event, ui, draggable);
3398
+ }
3399
+ }
3400
+ // else go ahead with standard event handling
3401
+ },
3402
+ stop: function(event, ui) {
3403
+ // issue 386
3404
+ var draggable = $(this).data("ui-draggable") || $(this).data("draggable"),
3405
+ sourceNode = ui.helper.data("dtSourceNode") || null,
3406
+ targetNode = ui.helper.data("dtTargetNode") || null,
3407
+ mouseDownEvent = draggable._mouseDownEvent,
3408
+ eventType = event.type,
3409
+ dropped = (eventType == "mouseup" && event.which == 1);
3410
+ logMsg("draggable-connectToDynatree.stop: targetNode(from event): %s, dtTargetNode: %s", targetNode, ui.helper.data("dtTargetNode"));
3411
+ // logMsg("draggable-connectToDynatree.stop, %s", sourceNode);
3412
+ // logMsg(" type: %o, downEvent: %o, upEvent: %o", eventType, mouseDownEvent, event);
3413
+ // logMsg(" targetNode: %o", targetNode);
3414
+ if(!dropped){
3415
+ logMsg("Drag was cancelled");
3416
+ }
3417
+ if(targetNode) {
3418
+ if(dropped){
3419
+ targetNode.tree._onDragEvent("drop", targetNode, sourceNode, event, ui, draggable);
3420
+ }
3421
+ targetNode.tree._onDragEvent("leave", targetNode, sourceNode, event, ui, draggable);
3422
+ }
3423
+ if(sourceNode){
3424
+ sourceNode.tree._onDragEvent("stop", sourceNode, null, event, ui, draggable);
3425
+ }
3426
+ }
3427
+ });
3428
+ didRegisterDnd = true;
3429
+ };
3430
+
3431
+ // ---------------------------------------------------------------------------
3432
+ }(jQuery));