yui-rails-asset 2.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (398) hide show
  1. data/LICENSE +21 -0
  2. data/README +17 -0
  3. data/lib/yui/rails.rb +29 -0
  4. data/lib/yui/rails/engine.rb +10 -0
  5. data/lib/yui/rails/version.rb +6 -0
  6. data/vendor/assets/javascripts/yui-2.8.1/build/animation/animation-debug.js +1396 -0
  7. data/vendor/assets/javascripts/yui-2.8.1/build/animation/animation-min.js +23 -0
  8. data/vendor/assets/javascripts/yui-2.8.1/build/animation/animation.js +1392 -0
  9. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/ajax-loader.gif +0 -0
  10. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/asc.gif +0 -0
  11. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/autocomplete.css +7 -0
  12. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/back-h.png +0 -0
  13. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/back-v.png +0 -0
  14. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/bar-h.png +0 -0
  15. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/bar-v.png +0 -0
  16. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/bg-h.gif +0 -0
  17. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/bg-v.gif +0 -0
  18. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/blankimage.png +0 -0
  19. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/button.css +7 -0
  20. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/calendar.css +8 -0
  21. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/carousel.css +7 -0
  22. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/check0.gif +0 -0
  23. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/check1.gif +0 -0
  24. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/check2.gif +0 -0
  25. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/colorpicker.css +7 -0
  26. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/container.css +7 -0
  27. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/datatable.css +8 -0
  28. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/desc.gif +0 -0
  29. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/dt-arrow-dn.png +0 -0
  30. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/dt-arrow-up.png +0 -0
  31. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/editor-knob.gif +0 -0
  32. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/editor-sprite-active.gif +0 -0
  33. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/editor-sprite.gif +0 -0
  34. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/editor.css +10 -0
  35. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/header_background.png +0 -0
  36. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/hue_bg.png +0 -0
  37. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/imagecropper.css +7 -0
  38. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/layout.css +7 -0
  39. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/layout_sprite.png +0 -0
  40. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/loading.gif +0 -0
  41. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/logger.css +7 -0
  42. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menu-button-arrow-disabled.png +0 -0
  43. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menu-button-arrow.png +0 -0
  44. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menu.css +7 -0
  45. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menubaritem_submenuindicator.png +0 -0
  46. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menubaritem_submenuindicator_disabled.png +0 -0
  47. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menuitem_checkbox.png +0 -0
  48. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menuitem_checkbox_disabled.png +0 -0
  49. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menuitem_submenuindicator.png +0 -0
  50. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menuitem_submenuindicator_disabled.png +0 -0
  51. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/paginator.css +7 -0
  52. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/picker_mask.png +0 -0
  53. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/profilerviewer.css +7 -0
  54. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/progressbar.css +7 -0
  55. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/resize.css +7 -0
  56. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/simpleeditor.css +10 -0
  57. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/skin.css +36 -0
  58. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/slider.css +7 -0
  59. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/split-button-arrow-active.png +0 -0
  60. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/split-button-arrow-disabled.png +0 -0
  61. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/split-button-arrow-focus.png +0 -0
  62. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/split-button-arrow-hover.png +0 -0
  63. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/split-button-arrow.png +0 -0
  64. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/sprite.png +0 -0
  65. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/sprite.psd +0 -0
  66. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/tabview.css +8 -0
  67. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/treeview-loading.gif +0 -0
  68. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/treeview-sprite.gif +0 -0
  69. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/treeview.css +7 -0
  70. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/wait.gif +0 -0
  71. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/yuitest.css +7 -0
  72. data/vendor/assets/javascripts/yui-2.8.1/build/autocomplete/assets/autocomplete-core.css +7 -0
  73. data/vendor/assets/javascripts/yui-2.8.1/build/autocomplete/assets/skins/sam/autocomplete-skin.css +57 -0
  74. data/vendor/assets/javascripts/yui-2.8.1/build/autocomplete/assets/skins/sam/autocomplete.css +7 -0
  75. data/vendor/assets/javascripts/yui-2.8.1/build/autocomplete/autocomplete-debug.js +3009 -0
  76. data/vendor/assets/javascripts/yui-2.8.1/build/autocomplete/autocomplete-min.js +12 -0
  77. data/vendor/assets/javascripts/yui-2.8.1/build/autocomplete/autocomplete.js +2966 -0
  78. data/vendor/assets/javascripts/yui-2.8.1/build/base/base-min.css +7 -0
  79. data/vendor/assets/javascripts/yui-2.8.1/build/base/base.css +131 -0
  80. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/button-core.css +44 -0
  81. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/button-skin.css +219 -0
  82. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/button.css +7 -0
  83. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/menu-button-arrow-disabled.png +0 -0
  84. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/menu-button-arrow.png +0 -0
  85. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/split-button-arrow-active.png +0 -0
  86. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/split-button-arrow-disabled.png +0 -0
  87. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/split-button-arrow-focus.png +0 -0
  88. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/split-button-arrow-hover.png +0 -0
  89. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/split-button-arrow.png +0 -0
  90. data/vendor/assets/javascripts/yui-2.8.1/build/button/button-debug.js +4694 -0
  91. data/vendor/assets/javascripts/yui-2.8.1/build/button/button-min.js +11 -0
  92. data/vendor/assets/javascripts/yui-2.8.1/build/button/button.js +4633 -0
  93. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/calendar-core.css +132 -0
  94. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/calendar.css +320 -0
  95. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/calgrad.png +0 -0
  96. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/callt.gif +0 -0
  97. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/calrt.gif +0 -0
  98. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/calx.gif +0 -0
  99. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/skins/sam/calendar-skin.css +361 -0
  100. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/skins/sam/calendar.css +8 -0
  101. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/calendar-debug.js +7324 -0
  102. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/calendar-min.js +18 -0
  103. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/calendar.js +7294 -0
  104. data/vendor/assets/javascripts/yui-2.8.1/build/carousel/assets/ajax-loader.gif +0 -0
  105. data/vendor/assets/javascripts/yui-2.8.1/build/carousel/assets/carousel-core.css +88 -0
  106. data/vendor/assets/javascripts/yui-2.8.1/build/carousel/assets/skins/sam/ajax-loader.gif +0 -0
  107. data/vendor/assets/javascripts/yui-2.8.1/build/carousel/assets/skins/sam/carousel-skin.css +142 -0
  108. data/vendor/assets/javascripts/yui-2.8.1/build/carousel/assets/skins/sam/carousel.css +7 -0
  109. data/vendor/assets/javascripts/yui-2.8.1/build/carousel/carousel-debug.js +4390 -0
  110. data/vendor/assets/javascripts/yui-2.8.1/build/carousel/carousel-min.js +12 -0
  111. data/vendor/assets/javascripts/yui-2.8.1/build/carousel/carousel.js +4349 -0
  112. data/vendor/assets/javascripts/yui-2.8.1/build/charts/assets/charts.swf +0 -0
  113. data/vendor/assets/javascripts/yui-2.8.1/build/charts/charts-debug.js +2061 -0
  114. data/vendor/assets/javascripts/yui-2.8.1/build/charts/charts-min.js +9 -0
  115. data/vendor/assets/javascripts/yui-2.8.1/build/charts/charts.js +2060 -0
  116. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/colorpicker-core.css +6 -0
  117. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/hue_thumb.png +0 -0
  118. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/picker_mask.png +0 -0
  119. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/picker_thumb.png +0 -0
  120. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/skins/sam/colorpicker-skin.css +105 -0
  121. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/skins/sam/colorpicker.css +7 -0
  122. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/skins/sam/hue_bg.png +0 -0
  123. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/skins/sam/picker_mask.png +0 -0
  124. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/colorpicker-debug.js +1783 -0
  125. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/colorpicker-min.js +9 -0
  126. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/colorpicker.js +1763 -0
  127. data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection-debug.js +1576 -0
  128. data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection-min.js +9 -0
  129. data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection.js +1546 -0
  130. data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection.swf +0 -0
  131. data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection_core-debug.js +980 -0
  132. data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection_core-min.js +8 -0
  133. data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection_core.js +957 -0
  134. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/alrt16_1.gif +0 -0
  135. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/blck16_1.gif +0 -0
  136. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/close12_1.gif +0 -0
  137. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/container-core.css +176 -0
  138. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/container.css +324 -0
  139. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/hlp16_1.gif +0 -0
  140. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/info16_1.gif +0 -0
  141. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/skins/sam/container-skin.css +242 -0
  142. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/skins/sam/container.css +7 -0
  143. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/tip16_1.gif +0 -0
  144. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/warn16_1.gif +0 -0
  145. data/vendor/assets/javascripts/yui-2.8.1/build/container/container-debug.js +9076 -0
  146. data/vendor/assets/javascripts/yui-2.8.1/build/container/container-min.js +19 -0
  147. data/vendor/assets/javascripts/yui-2.8.1/build/container/container.js +9052 -0
  148. data/vendor/assets/javascripts/yui-2.8.1/build/container/container_core-debug.js +5136 -0
  149. data/vendor/assets/javascripts/yui-2.8.1/build/container/container_core-min.js +14 -0
  150. data/vendor/assets/javascripts/yui-2.8.1/build/container/container_core.js +5126 -0
  151. data/vendor/assets/javascripts/yui-2.8.1/build/cookie/cookie-debug.js +482 -0
  152. data/vendor/assets/javascripts/yui-2.8.1/build/cookie/cookie-min.js +7 -0
  153. data/vendor/assets/javascripts/yui-2.8.1/build/cookie/cookie.js +482 -0
  154. data/vendor/assets/javascripts/yui-2.8.1/build/datasource/datasource-debug.js +3067 -0
  155. data/vendor/assets/javascripts/yui-2.8.1/build/datasource/datasource-min.js +12 -0
  156. data/vendor/assets/javascripts/yui-2.8.1/build/datasource/datasource.js +2996 -0
  157. data/vendor/assets/javascripts/yui-2.8.1/build/datatable/assets/datatable-core.css +93 -0
  158. data/vendor/assets/javascripts/yui-2.8.1/build/datatable/assets/datatable.css +49 -0
  159. data/vendor/assets/javascripts/yui-2.8.1/build/datatable/assets/skins/sam/datatable-skin.css +240 -0
  160. data/vendor/assets/javascripts/yui-2.8.1/build/datatable/assets/skins/sam/datatable.css +8 -0
  161. data/vendor/assets/javascripts/yui-2.8.1/build/datatable/assets/skins/sam/dt-arrow-dn.png +0 -0
  162. data/vendor/assets/javascripts/yui-2.8.1/build/datatable/assets/skins/sam/dt-arrow-up.png +0 -0
  163. data/vendor/assets/javascripts/yui-2.8.1/build/datatable/datatable-debug.js +17360 -0
  164. data/vendor/assets/javascripts/yui-2.8.1/build/datatable/datatable-min.js +29 -0
  165. data/vendor/assets/javascripts/yui-2.8.1/build/datatable/datatable.js +17122 -0
  166. data/vendor/assets/javascripts/yui-2.8.1/build/datemath/datemath-debug.js +408 -0
  167. data/vendor/assets/javascripts/yui-2.8.1/build/datemath/datemath-min.js +7 -0
  168. data/vendor/assets/javascripts/yui-2.8.1/build/datemath/datemath.js +408 -0
  169. data/vendor/assets/javascripts/yui-2.8.1/build/dom/dom-debug.js +1872 -0
  170. data/vendor/assets/javascripts/yui-2.8.1/build/dom/dom-min.js +9 -0
  171. data/vendor/assets/javascripts/yui-2.8.1/build/dom/dom.js +1832 -0
  172. data/vendor/assets/javascripts/yui-2.8.1/build/dragdrop/dragdrop-debug.js +3710 -0
  173. data/vendor/assets/javascripts/yui-2.8.1/build/dragdrop/dragdrop-min.js +10 -0
  174. data/vendor/assets/javascripts/yui-2.8.1/build/dragdrop/dragdrop.js +3601 -0
  175. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/editor-core.css +602 -0
  176. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/simpleeditor-core.css +602 -0
  177. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/blankimage.png +0 -0
  178. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/editor-knob.gif +0 -0
  179. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/editor-skin.css +711 -0
  180. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/editor-sprite-active.gif +0 -0
  181. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/editor-sprite.gif +0 -0
  182. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/editor.css +10 -0
  183. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/simpleeditor-skin.css +711 -0
  184. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/simpleeditor.css +10 -0
  185. data/vendor/assets/javascripts/yui-2.8.1/build/editor/editor-debug.js +9557 -0
  186. data/vendor/assets/javascripts/yui-2.8.1/build/editor/editor-min.js +30 -0
  187. data/vendor/assets/javascripts/yui-2.8.1/build/editor/editor.js +9447 -0
  188. data/vendor/assets/javascripts/yui-2.8.1/build/editor/simpleeditor-debug.js +7493 -0
  189. data/vendor/assets/javascripts/yui-2.8.1/build/editor/simpleeditor-min.js +24 -0
  190. data/vendor/assets/javascripts/yui-2.8.1/build/editor/simpleeditor.js +7406 -0
  191. data/vendor/assets/javascripts/yui-2.8.1/build/element-delegate/element-delegate-debug.js +141 -0
  192. data/vendor/assets/javascripts/yui-2.8.1/build/element-delegate/element-delegate-min.js +7 -0
  193. data/vendor/assets/javascripts/yui-2.8.1/build/element-delegate/element-delegate.js +138 -0
  194. data/vendor/assets/javascripts/yui-2.8.1/build/element/element-debug.js +1106 -0
  195. data/vendor/assets/javascripts/yui-2.8.1/build/element/element-min.js +8 -0
  196. data/vendor/assets/javascripts/yui-2.8.1/build/element/element.js +1090 -0
  197. data/vendor/assets/javascripts/yui-2.8.1/build/event-delegate/event-delegate-debug.js +283 -0
  198. data/vendor/assets/javascripts/yui-2.8.1/build/event-delegate/event-delegate-min.js +7 -0
  199. data/vendor/assets/javascripts/yui-2.8.1/build/event-delegate/event-delegate.js +281 -0
  200. data/vendor/assets/javascripts/yui-2.8.1/build/event-mouseenter/event-mouseenter-debug.js +219 -0
  201. data/vendor/assets/javascripts/yui-2.8.1/build/event-mouseenter/event-mouseenter-min.js +7 -0
  202. data/vendor/assets/javascripts/yui-2.8.1/build/event-mouseenter/event-mouseenter.js +219 -0
  203. data/vendor/assets/javascripts/yui-2.8.1/build/event-simulate/event-simulate-debug.js +622 -0
  204. data/vendor/assets/javascripts/yui-2.8.1/build/event-simulate/event-simulate-min.js +7 -0
  205. data/vendor/assets/javascripts/yui-2.8.1/build/event-simulate/event-simulate.js +622 -0
  206. data/vendor/assets/javascripts/yui-2.8.1/build/event/event-debug.js +2524 -0
  207. data/vendor/assets/javascripts/yui-2.8.1/build/event/event-min.js +11 -0
  208. data/vendor/assets/javascripts/yui-2.8.1/build/event/event.js +2500 -0
  209. data/vendor/assets/javascripts/yui-2.8.1/build/fonts/fonts-min.css +7 -0
  210. data/vendor/assets/javascripts/yui-2.8.1/build/fonts/fonts.css +56 -0
  211. data/vendor/assets/javascripts/yui-2.8.1/build/get/get-debug.js +773 -0
  212. data/vendor/assets/javascripts/yui-2.8.1/build/get/get-min.js +7 -0
  213. data/vendor/assets/javascripts/yui-2.8.1/build/get/get.js +755 -0
  214. data/vendor/assets/javascripts/yui-2.8.1/build/grids/grids-min.css +7 -0
  215. data/vendor/assets/javascripts/yui-2.8.1/build/grids/grids.css +467 -0
  216. data/vendor/assets/javascripts/yui-2.8.1/build/history/assets/blank.html +1 -0
  217. data/vendor/assets/javascripts/yui-2.8.1/build/history/history-debug.js +808 -0
  218. data/vendor/assets/javascripts/yui-2.8.1/build/history/history-min.js +7 -0
  219. data/vendor/assets/javascripts/yui-2.8.1/build/history/history.js +808 -0
  220. data/vendor/assets/javascripts/yui-2.8.1/build/imagecropper/assets/imagecropper-core.css +33 -0
  221. data/vendor/assets/javascripts/yui-2.8.1/build/imagecropper/assets/skins/sam/imagecropper-skin.css +16 -0
  222. data/vendor/assets/javascripts/yui-2.8.1/build/imagecropper/assets/skins/sam/imagecropper.css +7 -0
  223. data/vendor/assets/javascripts/yui-2.8.1/build/imagecropper/imagecropper-debug.js +907 -0
  224. data/vendor/assets/javascripts/yui-2.8.1/build/imagecropper/imagecropper-min.js +8 -0
  225. data/vendor/assets/javascripts/yui-2.8.1/build/imagecropper/imagecropper.js +889 -0
  226. data/vendor/assets/javascripts/yui-2.8.1/build/imageloader/imageloader-debug.js +487 -0
  227. data/vendor/assets/javascripts/yui-2.8.1/build/imageloader/imageloader-min.js +7 -0
  228. data/vendor/assets/javascripts/yui-2.8.1/build/imageloader/imageloader.js +481 -0
  229. data/vendor/assets/javascripts/yui-2.8.1/build/json/json-debug.js +538 -0
  230. data/vendor/assets/javascripts/yui-2.8.1/build/json/json-min.js +7 -0
  231. data/vendor/assets/javascripts/yui-2.8.1/build/json/json.js +538 -0
  232. data/vendor/assets/javascripts/yui-2.8.1/build/layout/assets/layout-core.css +158 -0
  233. data/vendor/assets/javascripts/yui-2.8.1/build/layout/assets/skins/sam/layout-skin.css +207 -0
  234. data/vendor/assets/javascripts/yui-2.8.1/build/layout/assets/skins/sam/layout.css +7 -0
  235. data/vendor/assets/javascripts/yui-2.8.1/build/layout/assets/skins/sam/layout_sprite.png +0 -0
  236. data/vendor/assets/javascripts/yui-2.8.1/build/layout/layout-debug.js +2305 -0
  237. data/vendor/assets/javascripts/yui-2.8.1/build/layout/layout-min.js +11 -0
  238. data/vendor/assets/javascripts/yui-2.8.1/build/layout/layout.js +2290 -0
  239. data/vendor/assets/javascripts/yui-2.8.1/build/logger/assets/logger-core.css +7 -0
  240. data/vendor/assets/javascripts/yui-2.8.1/build/logger/assets/logger.css +57 -0
  241. data/vendor/assets/javascripts/yui-2.8.1/build/logger/assets/skins/sam/logger-skin.css +55 -0
  242. data/vendor/assets/javascripts/yui-2.8.1/build/logger/assets/skins/sam/logger.css +7 -0
  243. data/vendor/assets/javascripts/yui-2.8.1/build/logger/logger-debug.js +2104 -0
  244. data/vendor/assets/javascripts/yui-2.8.1/build/logger/logger-min.js +9 -0
  245. data/vendor/assets/javascripts/yui-2.8.1/build/logger/logger.js +2104 -0
  246. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menu-core.css +242 -0
  247. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menu.css +503 -0
  248. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menu_down_arrow.png +0 -0
  249. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menu_down_arrow_disabled.png +0 -0
  250. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menu_up_arrow.png +0 -0
  251. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menu_up_arrow_disabled.png +0 -0
  252. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menubaritem_submenuindicator.png +0 -0
  253. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menubaritem_submenuindicator_disabled.png +0 -0
  254. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menubaritem_submenuindicator_selected.png +0 -0
  255. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menuitem_checkbox.png +0 -0
  256. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menuitem_checkbox_disabled.png +0 -0
  257. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menuitem_checkbox_selected.png +0 -0
  258. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menuitem_submenuindicator.png +0 -0
  259. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menuitem_submenuindicator_disabled.png +0 -0
  260. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menuitem_submenuindicator_selected.png +0 -0
  261. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menu-skin.css +339 -0
  262. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menu.css +7 -0
  263. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menubaritem_submenuindicator.png +0 -0
  264. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menubaritem_submenuindicator_disabled.png +0 -0
  265. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menuitem_checkbox.png +0 -0
  266. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menuitem_checkbox_disabled.png +0 -0
  267. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menuitem_submenuindicator.png +0 -0
  268. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menuitem_submenuindicator_disabled.png +0 -0
  269. data/vendor/assets/javascripts/yui-2.8.1/build/menu/menu-debug.js +9870 -0
  270. data/vendor/assets/javascripts/yui-2.8.1/build/menu/menu-min.js +16 -0
  271. data/vendor/assets/javascripts/yui-2.8.1/build/menu/menu.js +9823 -0
  272. data/vendor/assets/javascripts/yui-2.8.1/build/paginator/assets/paginator-core.css +6 -0
  273. data/vendor/assets/javascripts/yui-2.8.1/build/paginator/assets/skins/sam/paginator-skin.css +78 -0
  274. data/vendor/assets/javascripts/yui-2.8.1/build/paginator/assets/skins/sam/paginator.css +7 -0
  275. data/vendor/assets/javascripts/yui-2.8.1/build/paginator/paginator-debug.js +2393 -0
  276. data/vendor/assets/javascripts/yui-2.8.1/build/paginator/paginator-min.js +10 -0
  277. data/vendor/assets/javascripts/yui-2.8.1/build/paginator/paginator.js +2393 -0
  278. data/vendor/assets/javascripts/yui-2.8.1/build/profiler/profiler-debug.js +557 -0
  279. data/vendor/assets/javascripts/yui-2.8.1/build/profiler/profiler-min.js +7 -0
  280. data/vendor/assets/javascripts/yui-2.8.1/build/profiler/profiler.js +557 -0
  281. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/profilerviewer-core.css +6 -0
  282. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/skins/sam/asc.gif +0 -0
  283. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/skins/sam/desc.gif +0 -0
  284. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/skins/sam/header_background.png +0 -0
  285. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/skins/sam/profilerviewer-skin.css +167 -0
  286. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/skins/sam/profilerviewer.css +7 -0
  287. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/skins/sam/wait.gif +0 -0
  288. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/profilerviewer-debug.js +1229 -0
  289. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/profilerviewer-min.js +9 -0
  290. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/profilerviewer.js +1192 -0
  291. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/progressbar-core.css +85 -0
  292. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/skins/sam/back-h.png +0 -0
  293. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/skins/sam/back-v.png +0 -0
  294. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/skins/sam/bar-h.png +0 -0
  295. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/skins/sam/bar-v.png +0 -0
  296. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/skins/sam/progressbar-skin.css +56 -0
  297. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/skins/sam/progressbar.css +7 -0
  298. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/progressbar-debug.js +691 -0
  299. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/progressbar-min.js +8 -0
  300. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/progressbar.js +677 -0
  301. data/vendor/assets/javascripts/yui-2.8.1/build/reset-fonts-grids/reset-fonts-grids.css +7 -0
  302. data/vendor/assets/javascripts/yui-2.8.1/build/reset-fonts/reset-fonts.css +7 -0
  303. data/vendor/assets/javascripts/yui-2.8.1/build/reset/reset-min.css +7 -0
  304. data/vendor/assets/javascripts/yui-2.8.1/build/reset/reset.css +142 -0
  305. data/vendor/assets/javascripts/yui-2.8.1/build/resize/assets/resize-core.css +173 -0
  306. data/vendor/assets/javascripts/yui-2.8.1/build/resize/assets/skins/sam/layout_sprite.png +0 -0
  307. data/vendor/assets/javascripts/yui-2.8.1/build/resize/assets/skins/sam/resize-skin.css +142 -0
  308. data/vendor/assets/javascripts/yui-2.8.1/build/resize/assets/skins/sam/resize.css +7 -0
  309. data/vendor/assets/javascripts/yui-2.8.1/build/resize/resize-debug.js +1749 -0
  310. data/vendor/assets/javascripts/yui-2.8.1/build/resize/resize-min.js +10 -0
  311. data/vendor/assets/javascripts/yui-2.8.1/build/resize/resize.js +1689 -0
  312. data/vendor/assets/javascripts/yui-2.8.1/build/selector/selector-debug.js +651 -0
  313. data/vendor/assets/javascripts/yui-2.8.1/build/selector/selector-min.js +8 -0
  314. data/vendor/assets/javascripts/yui-2.8.1/build/selector/selector.js +644 -0
  315. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/bg-fader.gif +0 -0
  316. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/bg-h.gif +0 -0
  317. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/bg-v-e.gif +0 -0
  318. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/bg-v.gif +0 -0
  319. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/left-thumb.png +0 -0
  320. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/right-thumb.png +0 -0
  321. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/skins/sam/bg-h.gif +0 -0
  322. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/skins/sam/bg-v.gif +0 -0
  323. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/skins/sam/slider-skin.css +24 -0
  324. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/skins/sam/slider.css +7 -0
  325. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/slider-core.css +17 -0
  326. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/slider-skin.css +20 -0
  327. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/thumb-bar.gif +0 -0
  328. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/thumb-e.gif +0 -0
  329. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/thumb-fader.gif +0 -0
  330. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/thumb-n.gif +0 -0
  331. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/thumb-s.gif +0 -0
  332. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/thumb-w.gif +0 -0
  333. data/vendor/assets/javascripts/yui-2.8.1/build/slider/slider-debug.js +2114 -0
  334. data/vendor/assets/javascripts/yui-2.8.1/build/slider/slider-min.js +9 -0
  335. data/vendor/assets/javascripts/yui-2.8.1/build/slider/slider.js +2068 -0
  336. data/vendor/assets/javascripts/yui-2.8.1/build/storage/storage-debug.js +1185 -0
  337. data/vendor/assets/javascripts/yui-2.8.1/build/storage/storage-min.js +8 -0
  338. data/vendor/assets/javascripts/yui-2.8.1/build/storage/storage.js +1183 -0
  339. data/vendor/assets/javascripts/yui-2.8.1/build/stylesheet/stylesheet-debug.js +648 -0
  340. data/vendor/assets/javascripts/yui-2.8.1/build/stylesheet/stylesheet-min.js +7 -0
  341. data/vendor/assets/javascripts/yui-2.8.1/build/stylesheet/stylesheet.js +645 -0
  342. data/vendor/assets/javascripts/yui-2.8.1/build/swf/swf-debug.js +269 -0
  343. data/vendor/assets/javascripts/yui-2.8.1/build/swf/swf-min.js +7 -0
  344. data/vendor/assets/javascripts/yui-2.8.1/build/swf/swf.js +268 -0
  345. data/vendor/assets/javascripts/yui-2.8.1/build/swfdetect/swfdetect-debug.js +93 -0
  346. data/vendor/assets/javascripts/yui-2.8.1/build/swfdetect/swfdetect-min.js +7 -0
  347. data/vendor/assets/javascripts/yui-2.8.1/build/swfdetect/swfdetect.js +93 -0
  348. data/vendor/assets/javascripts/yui-2.8.1/build/swfstore/swf.js +238 -0
  349. data/vendor/assets/javascripts/yui-2.8.1/build/swfstore/swfstore-debug.js +470 -0
  350. data/vendor/assets/javascripts/yui-2.8.1/build/swfstore/swfstore-min.js +7 -0
  351. data/vendor/assets/javascripts/yui-2.8.1/build/swfstore/swfstore.js +453 -0
  352. data/vendor/assets/javascripts/yui-2.8.1/build/swfstore/swfstore.swf +0 -0
  353. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/border_tabs.css +54 -0
  354. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/loading.gif +0 -0
  355. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/skin-sam.css +77 -0
  356. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/skins/sam/tabview-skin.css +186 -0
  357. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/skins/sam/tabview.css +8 -0
  358. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/tabview-core.css +133 -0
  359. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/tabview.css +77 -0
  360. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/tabview-debug.js +995 -0
  361. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/tabview-min.js +8 -0
  362. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/tabview.js +987 -0
  363. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/check0.gif +0 -0
  364. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/check1.gif +0 -0
  365. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/check2.gif +0 -0
  366. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/loading.gif +0 -0
  367. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/treeview-loading.gif +0 -0
  368. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/treeview-skin.css +249 -0
  369. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/treeview-sprite.gif +0 -0
  370. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/treeview.css +7 -0
  371. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/treeview-core.css +6 -0
  372. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/treeview-debug.js +4058 -0
  373. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/treeview-min.js +12 -0
  374. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/treeview.js +3989 -0
  375. data/vendor/assets/javascripts/yui-2.8.1/build/uploader/assets/uploader.swf +0 -0
  376. data/vendor/assets/javascripts/yui-2.8.1/build/uploader/uploader-debug.js +1072 -0
  377. data/vendor/assets/javascripts/yui-2.8.1/build/uploader/uploader-min.js +15 -0
  378. data/vendor/assets/javascripts/yui-2.8.1/build/uploader/uploader.js +1069 -0
  379. data/vendor/assets/javascripts/yui-2.8.1/build/utilities/utilities.js +39 -0
  380. data/vendor/assets/javascripts/yui-2.8.1/build/yahoo-dom-event/yahoo-dom-event.js +14 -0
  381. data/vendor/assets/javascripts/yui-2.8.1/build/yahoo/yahoo-debug.js +1075 -0
  382. data/vendor/assets/javascripts/yui-2.8.1/build/yahoo/yahoo-min.js +7 -0
  383. data/vendor/assets/javascripts/yui-2.8.1/build/yahoo/yahoo.js +1075 -0
  384. data/vendor/assets/javascripts/yui-2.8.1/build/yuiloader-dom-event/yuiloader-dom-event.js +17 -0
  385. data/vendor/assets/javascripts/yui-2.8.1/build/yuiloader/yuiloader-debug.js +3879 -0
  386. data/vendor/assets/javascripts/yui-2.8.1/build/yuiloader/yuiloader-min.js +10 -0
  387. data/vendor/assets/javascripts/yui-2.8.1/build/yuiloader/yuiloader.js +3879 -0
  388. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/assets/skins/sam/yuitest-skin.css +7 -0
  389. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/assets/skins/sam/yuitest.css +7 -0
  390. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/assets/testlogger.css +7 -0
  391. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/assets/yuitest-core.css +7 -0
  392. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/yuitest-debug.js +2741 -0
  393. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/yuitest-min.js +10 -0
  394. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/yuitest.js +2741 -0
  395. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/yuitest_core-debug.js +1976 -0
  396. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/yuitest_core-min.js +9 -0
  397. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/yuitest_core.js +1976 -0
  398. metadata +470 -0
@@ -0,0 +1,249 @@
1
+ /*
2
+ Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3
+ Code licensed under the BSD License:
4
+ http://developer.yahoo.com/yui/license.html
5
+ version: 2.8.1
6
+ */
7
+ /*
8
+ Copyright (c) 2008, Yahoo! Inc. All rights reserved.
9
+ Code licensed under the BSD License:
10
+ http://developer.yahoo.net/yui/license.txt
11
+ version: 2.5.2
12
+ */
13
+
14
+ /* the style of the div around each node */
15
+ .ygtvitem { }
16
+
17
+ table.ygtvtable {
18
+ margin-bottom:0;
19
+ border:none;
20
+ border-collapse:collapse;
21
+ }
22
+
23
+ /*.ygtvitem td {*/
24
+ td.ygtvcell {
25
+ border: none;
26
+ padding: 0;
27
+ }
28
+ a.ygtvspacer {
29
+ text-decoration:none;
30
+ outline-style:none;
31
+ display:block;
32
+ }
33
+
34
+
35
+ /* first or middle sibling, no children */
36
+ .ygtvtn {
37
+ width:18px; height:22px;
38
+ background: url(treeview-sprite.gif) 0 -5600px no-repeat;
39
+ cursor:pointer ;
40
+ }
41
+
42
+ /* first or middle sibling, collapsable */
43
+ .ygtvtm {
44
+ width:18px; height:22px;
45
+ cursor:pointer ;
46
+ background: url(treeview-sprite.gif) 0 -4000px no-repeat;
47
+ }
48
+
49
+ /* first or middle sibling, collapsable, hover */
50
+ .ygtvtmh,.ygtvtmhh {
51
+ width:18px; height:22px;
52
+ cursor:pointer ;
53
+ background: url(treeview-sprite.gif) 0 -4800px no-repeat;
54
+ }
55
+
56
+ /* first or middle sibling, expandable */
57
+ .ygtvtp {
58
+ width:18px; height:22px;
59
+ cursor:pointer ;
60
+ background: url(treeview-sprite.gif) 0 -6400px no-repeat;
61
+ }
62
+
63
+ /* first or middle sibling, expandable, hover */
64
+ .ygtvtph ,.ygtvtphh {
65
+ width:18px; height:22px;
66
+ cursor:pointer ;
67
+ background: url(treeview-sprite.gif) 0 -7200px no-repeat;
68
+ }
69
+
70
+ /* last sibling, no children */
71
+ .ygtvln {
72
+ width:18px; height:22px;
73
+ background: url(treeview-sprite.gif) 0 -1600px no-repeat;
74
+ cursor:pointer ;
75
+ }
76
+
77
+ /* Last sibling, collapsable */
78
+ .ygtvlm {
79
+ width:18px; height:22px;
80
+ cursor:pointer ;
81
+ background: url(treeview-sprite.gif) 0 0px no-repeat;
82
+ }
83
+
84
+ /* Last sibling, collapsable, hover */
85
+ .ygtvlmh,.ygtvlmhh {
86
+ width:18px; height:22px;
87
+ cursor:pointer ;
88
+ background: url(treeview-sprite.gif) 0 -800px no-repeat;
89
+ }
90
+
91
+ /* Last sibling, expandable */
92
+ .ygtvlp {
93
+ width:18px; height:22px;
94
+ cursor:pointer ;
95
+ background: url(treeview-sprite.gif) 0 -2400px no-repeat;
96
+ }
97
+
98
+ /* Last sibling, expandable, hover */
99
+ .ygtvlph,.ygtvlphh {
100
+ width:18px; height:22px; cursor:pointer ;
101
+ background: url(treeview-sprite.gif) 0 -3200px no-repeat;
102
+ cursor:pointer ;
103
+ }
104
+
105
+ /* Loading icon */
106
+ .ygtvloading {
107
+ width:18px; height:22px;
108
+ background: url(treeview-loading.gif) 0 0 no-repeat;
109
+ }
110
+
111
+ /* the style for the empty cells that are used for rendering the depth
112
+ * of the node */
113
+ .ygtvdepthcell {
114
+ width:18px; height:22px;
115
+ background: url(treeview-sprite.gif) 0 -8000px no-repeat;
116
+ }
117
+
118
+ .ygtvblankdepthcell { width:18px; height:22px; }
119
+
120
+
121
+ /* the style of the div around each node's collection of children */
122
+ .ygtvchildren { }
123
+ * html .ygtvchildren { height:2%; }
124
+
125
+ /* the style of the text label in ygTextNode */
126
+ .ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover {
127
+ margin-left:2px;
128
+ text-decoration: none;
129
+ background-color: white; /* workaround for IE font smoothing bug */
130
+ cursor:pointer;
131
+ }
132
+
133
+ .ygtvcontent {
134
+ cursor:default;
135
+ }
136
+
137
+ .ygtvspacer { height: 22px; width: 18px; }
138
+
139
+ .ygtvfocus {
140
+ background-color: #c0e0e0;
141
+ border: none;
142
+ }
143
+ .ygtvfocus .ygtvlabel, .ygtvfocus .ygtvlabel:link, .ygtvfocus .ygtvlabel:visited, .ygtvfocus .ygtvlabel:hover {
144
+ background-color: #c0e0e0;
145
+ }
146
+
147
+ .ygtvfocus a {
148
+ outline-style:none;
149
+ }
150
+
151
+
152
+ .ygtvok {
153
+ width:18px; height:22px;
154
+ background: url(treeview-sprite.gif) 0 -8800px no-repeat;
155
+ }
156
+
157
+ .ygtvok:hover {
158
+ background: url(treeview-sprite.gif) 0 -8844px no-repeat;
159
+ }
160
+
161
+ .ygtvcancel {
162
+ width:18px; height:22px;
163
+ background: url(treeview-sprite.gif) 0 -8822px no-repeat;
164
+ }
165
+
166
+ .ygtvcancel:hover {
167
+ background: url(treeview-sprite.gif) 0 -8866px no-repeat;
168
+ }
169
+
170
+ .ygtv-label-editor {
171
+ background-color:#f2f2f2;
172
+ border: 1px solid silver;
173
+ position:absolute;
174
+ display:none;
175
+ overflow:hidden;
176
+ margin:auto;
177
+ z-index:9000;
178
+ }
179
+
180
+ .ygtv-edit-TextNode {
181
+ width: 190px;
182
+ }
183
+
184
+ .ygtv-edit-TextNode .ygtvcancel, .ygtv-edit-TextNode .ygtvok {
185
+ border:none;
186
+ }
187
+
188
+ .ygtv-edit-TextNode .ygtv-button-container {
189
+ float: right;
190
+ }
191
+
192
+ .ygtv-edit-TextNode .ygtv-input input{
193
+ width: 140px;
194
+ }
195
+
196
+ .ygtv-edit-DateNode .ygtvcancel {
197
+ border:none;
198
+ }
199
+ .ygtv-edit-DateNode .ygtvok {
200
+ display:none;
201
+ }
202
+
203
+ .ygtv-edit-DateNode .ygtv-button-container {
204
+ text-align:right;
205
+ margin:auto;
206
+ }
207
+
208
+ .ygtv-highlight .ygtv-highlight0 , .ygtv-highlight .ygtv-highlight0 .ygtvlabel{
209
+ }
210
+
211
+ .ygtv-highlight .ygtv-highlight1 , .ygtv-highlight .ygtv-highlight1 .ygtvlabel{
212
+ background-color:blue;
213
+ color:white;
214
+ }
215
+
216
+ .ygtv-highlight .ygtv-highlight2 , .ygtv-highlight .ygtv-highlight2 .ygtvlabel {
217
+ background-color:silver;
218
+ }
219
+
220
+ .ygtv-highlight .ygtv-highlight0 .ygtvfocus .ygtvlabel,
221
+ .ygtv-highlight .ygtv-highlight1 .ygtvfocus .ygtvlabel,
222
+ .ygtv-highlight .ygtv-highlight2 .ygtvfocus .ygtvlabel {
223
+ background-color: #c0e0e0;
224
+ }
225
+
226
+ .ygtv-highlight .ygtvcontent {
227
+ padding-right: 1em;
228
+ }
229
+
230
+ .ygtv-checkbox .ygtv-highlight0 .ygtvcontent {
231
+ padding-left:1em;
232
+ background:url(check0.gif) no-repeat;
233
+ }
234
+
235
+ .ygtv-checkbox .ygtv-highlight0 .ygtvfocus.ygtvcontent,
236
+ .ygtv-checkbox .ygtv-highlight1 .ygtvfocus.ygtvcontent ,
237
+ .ygtv-checkbox .ygtv-highlight2 .ygtvfocus.ygtvcontent {
238
+ background-color:#c0e0e0;
239
+ }
240
+
241
+ .ygtv-checkbox .ygtv-highlight1 .ygtvcontent {
242
+ padding-left:1em;
243
+ background:url(check1.gif) no-repeat;
244
+ }
245
+
246
+ .ygtv-checkbox .ygtv-highlight2 .ygtvcontent{
247
+ padding-left:1em;
248
+ background:url(check2.gif) no-repeat;
249
+ }
@@ -0,0 +1,7 @@
1
+ /*
2
+ Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3
+ Code licensed under the BSD License:
4
+ http://developer.yahoo.com/yui/license.html
5
+ version: 2.8.1
6
+ */
7
+ table.ygtvtable{margin-bottom:0;border:none;border-collapse:collapse;}td.ygtvcell{border:none;padding:0;}a.ygtvspacer{text-decoration:none;outline-style:none;display:block;}.ygtvtn{width:18px;height:22px;background:url(treeview-sprite.gif) 0 -5600px no-repeat;cursor:pointer;}.ygtvtm{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -4000px no-repeat;}.ygtvtmh,.ygtvtmhh{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -4800px no-repeat;}.ygtvtp{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -6400px no-repeat;}.ygtvtph,.ygtvtphh{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -7200px no-repeat;}.ygtvln{width:18px;height:22px;background:url(treeview-sprite.gif) 0 -1600px no-repeat;cursor:pointer;}.ygtvlm{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 0 no-repeat;}.ygtvlmh,.ygtvlmhh{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -800px no-repeat;}.ygtvlp{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -2400px no-repeat;}.ygtvlph,.ygtvlphh{width:18px;height:22px;cursor:pointer;background:url(treeview-sprite.gif) 0 -3200px no-repeat;cursor:pointer;}.ygtvloading{width:18px;height:22px;background:url(treeview-loading.gif) 0 0 no-repeat;}.ygtvdepthcell{width:18px;height:22px;background:url(treeview-sprite.gif) 0 -8000px no-repeat;}.ygtvblankdepthcell{width:18px;height:22px;}* html .ygtvchildren{height:2%;}.ygtvlabel,.ygtvlabel:link,.ygtvlabel:visited,.ygtvlabel:hover{margin-left:2px;text-decoration:none;background-color:white;cursor:pointer;}.ygtvcontent{cursor:default;}.ygtvspacer{height:22px;width:18px;}.ygtvfocus{background-color:#c0e0e0;border:none;}.ygtvfocus .ygtvlabel,.ygtvfocus .ygtvlabel:link,.ygtvfocus .ygtvlabel:visited,.ygtvfocus .ygtvlabel:hover{background-color:#c0e0e0;}.ygtvfocus a{outline-style:none;}.ygtvok{width:18px;height:22px;background:url(treeview-sprite.gif) 0 -8800px no-repeat;}.ygtvok:hover{background:url(treeview-sprite.gif) 0 -8844px no-repeat;}.ygtvcancel{width:18px;height:22px;background:url(treeview-sprite.gif) 0 -8822px no-repeat;}.ygtvcancel:hover{background:url(treeview-sprite.gif) 0 -8866px no-repeat;}.ygtv-label-editor{background-color:#f2f2f2;border:1px solid silver;position:absolute;display:none;overflow:hidden;margin:auto;z-index:9000;}.ygtv-edit-TextNode{width:190px;}.ygtv-edit-TextNode .ygtvcancel,.ygtv-edit-TextNode .ygtvok{border:none;}.ygtv-edit-TextNode .ygtv-button-container{float:right;}.ygtv-edit-TextNode .ygtv-input input{width:140px;}.ygtv-edit-DateNode .ygtvcancel{border:none;}.ygtv-edit-DateNode .ygtvok{display:none;}.ygtv-edit-DateNode .ygtv-button-container{text-align:right;margin:auto;}.ygtv-highlight .ygtv-highlight1,.ygtv-highlight .ygtv-highlight1 .ygtvlabel{background-color:blue;color:white;}.ygtv-highlight .ygtv-highlight2,.ygtv-highlight .ygtv-highlight2 .ygtvlabel{background-color:silver;}.ygtv-highlight .ygtv-highlight0 .ygtvfocus .ygtvlabel,.ygtv-highlight .ygtv-highlight1 .ygtvfocus .ygtvlabel,.ygtv-highlight .ygtv-highlight2 .ygtvfocus .ygtvlabel{background-color:#c0e0e0;}.ygtv-highlight .ygtvcontent{padding-right:1em;}.ygtv-checkbox .ygtv-highlight0 .ygtvcontent{padding-left:1em;background:url(check0.gif) no-repeat;}.ygtv-checkbox .ygtv-highlight0 .ygtvfocus.ygtvcontent,.ygtv-checkbox .ygtv-highlight1 .ygtvfocus.ygtvcontent,.ygtv-checkbox .ygtv-highlight2 .ygtvfocus.ygtvcontent{background-color:#c0e0e0;}.ygtv-checkbox .ygtv-highlight1 .ygtvcontent{padding-left:1em;background:url(check1.gif) no-repeat;}.ygtv-checkbox .ygtv-highlight2 .ygtvcontent{padding-left:1em;background:url(check2.gif) no-repeat;}
@@ -0,0 +1,6 @@
1
+ /*
2
+ Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3
+ Code licensed under the BSD License:
4
+ http://developer.yahoo.com/yui/license.html
5
+ version: 2.8.1
6
+ */
@@ -0,0 +1,4058 @@
1
+ /*
2
+ Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3
+ Code licensed under the BSD License:
4
+ http://developer.yahoo.com/yui/license.html
5
+ version: 2.8.1
6
+ */
7
+ (function () {
8
+ var Dom = YAHOO.util.Dom,
9
+ Event = YAHOO.util.Event,
10
+ Lang = YAHOO.lang,
11
+ Widget = YAHOO.widget;
12
+
13
+
14
+
15
+ /**
16
+ * The treeview widget is a generic tree building tool.
17
+ * @module treeview
18
+ * @title TreeView Widget
19
+ * @requires yahoo, dom, event
20
+ * @optional animation, json, calendar
21
+ * @namespace YAHOO.widget
22
+ */
23
+
24
+ /**
25
+ * Contains the tree view state data and the root node.
26
+ *
27
+ * @class TreeView
28
+ * @uses YAHOO.util.EventProvider
29
+ * @constructor
30
+ * @param {string|HTMLElement} id The id of the element, or the element itself that the tree will be inserted into.
31
+ * Existing markup in this element, if valid, will be used to build the tree
32
+ * @param {Array|Object|String} oConfig (optional) If present, it will be used to build the tree via method <a href="#method_buildTreeFromObject">buildTreeFromObject</a>
33
+ *
34
+ */
35
+ YAHOO.widget.TreeView = function(id, oConfig) {
36
+ if (id) { this.init(id); }
37
+ if (oConfig) {
38
+ this.buildTreeFromObject(oConfig);
39
+ } else if (Lang.trim(this._el.innerHTML)) {
40
+ this.buildTreeFromMarkup(id);
41
+ }
42
+ };
43
+
44
+ var TV = Widget.TreeView;
45
+
46
+ TV.prototype = {
47
+
48
+ /**
49
+ * The id of tree container element
50
+ * @property id
51
+ * @type String
52
+ */
53
+ id: null,
54
+
55
+ /**
56
+ * The host element for this tree
57
+ * @property _el
58
+ * @private
59
+ * @type HTMLelement
60
+ */
61
+ _el: null,
62
+
63
+ /**
64
+ * Flat collection of all nodes in this tree. This is a sparse
65
+ * array, so the length property can't be relied upon for a
66
+ * node count for the tree.
67
+ * @property _nodes
68
+ * @type Node[]
69
+ * @private
70
+ */
71
+ _nodes: null,
72
+
73
+ /**
74
+ * We lock the tree control while waiting for the dynamic loader to return
75
+ * @property locked
76
+ * @type boolean
77
+ */
78
+ locked: false,
79
+
80
+ /**
81
+ * The animation to use for expanding children, if any
82
+ * @property _expandAnim
83
+ * @type string
84
+ * @private
85
+ */
86
+ _expandAnim: null,
87
+
88
+ /**
89
+ * The animation to use for collapsing children, if any
90
+ * @property _collapseAnim
91
+ * @type string
92
+ * @private
93
+ */
94
+ _collapseAnim: null,
95
+
96
+ /**
97
+ * The current number of animations that are executing
98
+ * @property _animCount
99
+ * @type int
100
+ * @private
101
+ */
102
+ _animCount: 0,
103
+
104
+ /**
105
+ * The maximum number of animations to run at one time.
106
+ * @property maxAnim
107
+ * @type int
108
+ */
109
+ maxAnim: 2,
110
+
111
+ /**
112
+ * Whether there is any subscriber to dblClickEvent
113
+ * @property _hasDblClickSubscriber
114
+ * @type boolean
115
+ * @private
116
+ */
117
+ _hasDblClickSubscriber: false,
118
+
119
+ /**
120
+ * Stores the timer used to check for double clicks
121
+ * @property _dblClickTimer
122
+ * @type window.timer object
123
+ * @private
124
+ */
125
+ _dblClickTimer: null,
126
+
127
+ /**
128
+ * A reference to the Node currently having the focus or null if none.
129
+ * @property currentFocus
130
+ * @type YAHOO.widget.Node
131
+ */
132
+ currentFocus: null,
133
+
134
+ /**
135
+ * If true, only one Node can be highlighted at a time
136
+ * @property singleNodeHighlight
137
+ * @type boolean
138
+ * @default false
139
+ */
140
+
141
+ singleNodeHighlight: false,
142
+
143
+ /**
144
+ * A reference to the Node that is currently highlighted.
145
+ * It is only meaningful if singleNodeHighlight is enabled
146
+ * @property _currentlyHighlighted
147
+ * @type YAHOO.widget.Node
148
+ * @default null
149
+ * @private
150
+ */
151
+
152
+ _currentlyHighlighted: null,
153
+
154
+ /**
155
+ * Sets up the animation for expanding children
156
+ * @method setExpandAnim
157
+ * @param {string} type the type of animation (acceptable values defined
158
+ * in YAHOO.widget.TVAnim)
159
+ */
160
+ setExpandAnim: function(type) {
161
+ this._expandAnim = (Widget.TVAnim.isValid(type)) ? type : null;
162
+ },
163
+
164
+ /**
165
+ * Sets up the animation for collapsing children
166
+ * @method setCollapseAnim
167
+ * @param {string} type of animation (acceptable values defined in
168
+ * YAHOO.widget.TVAnim)
169
+ */
170
+ setCollapseAnim: function(type) {
171
+ this._collapseAnim = (Widget.TVAnim.isValid(type)) ? type : null;
172
+ },
173
+
174
+ /**
175
+ * Perform the expand animation if configured, or just show the
176
+ * element if not configured or too many animations are in progress
177
+ * @method animateExpand
178
+ * @param el {HTMLElement} the element to animate
179
+ * @param node {YAHOO.util.Node} the node that was expanded
180
+ * @return {boolean} true if animation could be invoked, false otherwise
181
+ */
182
+ animateExpand: function(el, node) {
183
+ this.logger.log("animating expand");
184
+
185
+ if (this._expandAnim && this._animCount < this.maxAnim) {
186
+ // this.locked = true;
187
+ var tree = this;
188
+ var a = Widget.TVAnim.getAnim(this._expandAnim, el,
189
+ function() { tree.expandComplete(node); });
190
+ if (a) {
191
+ ++this._animCount;
192
+ this.fireEvent("animStart", {
193
+ "node": node,
194
+ "type": "expand"
195
+ });
196
+ a.animate();
197
+ }
198
+
199
+ return true;
200
+ }
201
+
202
+ return false;
203
+ },
204
+
205
+ /**
206
+ * Perform the collapse animation if configured, or just show the
207
+ * element if not configured or too many animations are in progress
208
+ * @method animateCollapse
209
+ * @param el {HTMLElement} the element to animate
210
+ * @param node {YAHOO.util.Node} the node that was expanded
211
+ * @return {boolean} true if animation could be invoked, false otherwise
212
+ */
213
+ animateCollapse: function(el, node) {
214
+ this.logger.log("animating collapse");
215
+
216
+ if (this._collapseAnim && this._animCount < this.maxAnim) {
217
+ // this.locked = true;
218
+ var tree = this;
219
+ var a = Widget.TVAnim.getAnim(this._collapseAnim, el,
220
+ function() { tree.collapseComplete(node); });
221
+ if (a) {
222
+ ++this._animCount;
223
+ this.fireEvent("animStart", {
224
+ "node": node,
225
+ "type": "collapse"
226
+ });
227
+ a.animate();
228
+ }
229
+
230
+ return true;
231
+ }
232
+
233
+ return false;
234
+ },
235
+
236
+ /**
237
+ * Function executed when the expand animation completes
238
+ * @method expandComplete
239
+ */
240
+ expandComplete: function(node) {
241
+ this.logger.log("expand complete: " + this.id);
242
+ --this._animCount;
243
+ this.fireEvent("animComplete", {
244
+ "node": node,
245
+ "type": "expand"
246
+ });
247
+ // this.locked = false;
248
+ },
249
+
250
+ /**
251
+ * Function executed when the collapse animation completes
252
+ * @method collapseComplete
253
+ */
254
+ collapseComplete: function(node) {
255
+ this.logger.log("collapse complete: " + this.id);
256
+ --this._animCount;
257
+ this.fireEvent("animComplete", {
258
+ "node": node,
259
+ "type": "collapse"
260
+ });
261
+ // this.locked = false;
262
+ },
263
+
264
+ /**
265
+ * Initializes the tree
266
+ * @method init
267
+ * @parm {string|HTMLElement} id the id of the element that will hold the tree
268
+ * @private
269
+ */
270
+ init: function(id) {
271
+ this._el = Dom.get(id);
272
+ this.id = Dom.generateId(this._el,"yui-tv-auto-id-");
273
+
274
+ /**
275
+ * When animation is enabled, this event fires when the animation
276
+ * starts
277
+ * @event animStart
278
+ * @type CustomEvent
279
+ * @param {YAHOO.widget.Node} oArgs.node the node that is expanding/collapsing
280
+ * @param {String} oArgs.type the type of animation ("expand" or "collapse")
281
+ */
282
+ this.createEvent("animStart", this);
283
+
284
+ /**
285
+ * When animation is enabled, this event fires when the animation
286
+ * completes
287
+ * @event animComplete
288
+ * @type CustomEvent
289
+ * @param {YAHOO.widget.Node} oArgs.node the node that is expanding/collapsing
290
+ * @param {String} oArgs.type the type of animation ("expand" or "collapse")
291
+ */
292
+ this.createEvent("animComplete", this);
293
+
294
+ /**
295
+ * Fires when a node is going to be collapsed. Return false to stop
296
+ * the collapse.
297
+ * @event collapse
298
+ * @type CustomEvent
299
+ * @param {YAHOO.widget.Node} node the node that is collapsing
300
+ */
301
+ this.createEvent("collapse", this);
302
+
303
+ /**
304
+ * Fires after a node is successfully collapsed. This event will not fire
305
+ * if the "collapse" event was cancelled.
306
+ * @event collapseComplete
307
+ * @type CustomEvent
308
+ * @param {YAHOO.widget.Node} node the node that was collapsed
309
+ */
310
+ this.createEvent("collapseComplete", this);
311
+
312
+ /**
313
+ * Fires when a node is going to be expanded. Return false to stop
314
+ * the collapse.
315
+ * @event expand
316
+ * @type CustomEvent
317
+ * @param {YAHOO.widget.Node} node the node that is expanding
318
+ */
319
+ this.createEvent("expand", this);
320
+
321
+ /**
322
+ * Fires after a node is successfully expanded. This event will not fire
323
+ * if the "expand" event was cancelled.
324
+ * @event expandComplete
325
+ * @type CustomEvent
326
+ * @param {YAHOO.widget.Node} node the node that was expanded
327
+ */
328
+ this.createEvent("expandComplete", this);
329
+
330
+ /**
331
+ * Fires when the Enter key is pressed on a node that has the focus
332
+ * @event enterKeyPressed
333
+ * @type CustomEvent
334
+ * @param {YAHOO.widget.Node} node the node that has the focus
335
+ */
336
+ this.createEvent("enterKeyPressed", this);
337
+
338
+ /**
339
+ * Fires when the label in a TextNode or MenuNode or content in an HTMLNode receives a Click.
340
+ * The listener may return false to cancel toggling and focusing on the node.
341
+ * @event clickEvent
342
+ * @type CustomEvent
343
+ * @param oArgs.event {HTMLEvent} The event object
344
+ * @param oArgs.node {YAHOO.widget.Node} node the node that was clicked
345
+ */
346
+ this.createEvent("clickEvent", this);
347
+
348
+ /**
349
+ * Fires when the focus receives the focus, when it changes from a Node
350
+ * to another Node or when it is completely lost (blurred)
351
+ * @event focusChanged
352
+ * @type CustomEvent
353
+ * @param oArgs.oldNode {YAHOO.widget.Node} Node that had the focus or null if none
354
+ * @param oArgs.newNode {YAHOO.widget.Node} Node that receives the focus or null if none
355
+ */
356
+
357
+ this.createEvent('focusChanged',this);
358
+
359
+ /**
360
+ * Fires when the label in a TextNode or MenuNode or content in an HTMLNode receives a double Click
361
+ * @event dblClickEvent
362
+ * @type CustomEvent
363
+ * @param oArgs.event {HTMLEvent} The event object
364
+ * @param oArgs.node {YAHOO.widget.Node} node the node that was clicked
365
+ */
366
+ var self = this;
367
+ this.createEvent("dblClickEvent", {
368
+ scope:this,
369
+ onSubscribeCallback: function() {
370
+ self._hasDblClickSubscriber = true;
371
+ }
372
+ });
373
+
374
+ /**
375
+ * Custom event that is fired when the text node label is clicked.
376
+ * The node clicked is provided as an argument
377
+ *
378
+ * @event labelClick
379
+ * @type CustomEvent
380
+ * @param {YAHOO.widget.Node} node the node clicked
381
+ * @deprecated use clickEvent or dblClickEvent
382
+ */
383
+ this.createEvent("labelClick", this);
384
+
385
+ /**
386
+ * Custom event fired when the highlight of a node changes.
387
+ * The node that triggered the change is provided as an argument:
388
+ * The status of the highlight can be checked in
389
+ * <a href="YAHOO.widget.Node.html#property_highlightState">nodeRef.highlightState</a>.
390
+ * Depending on <a href="YAHOO.widget.Node.html#property_propagateHighlight">nodeRef.propagateHighlight</a>, other nodes might have changed
391
+ * @event highlightEvent
392
+ * @type CustomEvent
393
+ * @param node {YAHOO.widget.Node} the node that started the change in highlighting state
394
+ */
395
+ this.createEvent("highlightEvent",this);
396
+
397
+
398
+
399
+ this._nodes = [];
400
+
401
+ // store a global reference
402
+ TV.trees[this.id] = this;
403
+
404
+ // Set up the root node
405
+ this.root = new Widget.RootNode(this);
406
+
407
+ var LW = Widget.LogWriter;
408
+
409
+ this.logger = (LW) ? new LW(this.toString()) : YAHOO;
410
+
411
+ this.logger.log("tree init: " + this.id);
412
+
413
+ if (this._initEditor) {
414
+ this._initEditor();
415
+ }
416
+
417
+ // YAHOO.util.Event.onContentReady(this.id, this.handleAvailable, this, true);
418
+ // YAHOO.util.Event.on(this.id, "click", this.handleClick, this, true);
419
+ },
420
+
421
+ //handleAvailable: function() {
422
+ //var Event = YAHOO.util.Event;
423
+ //Event.on(this.id,
424
+ //},
425
+ /**
426
+ * Builds the TreeView from an object.
427
+ * This is the method called by the constructor to build the tree when it has a second argument.
428
+ * A tree can be described by an array of objects, each object corresponding to a node.
429
+ * Node descriptions may contain values for any property of a node plus the following extra properties: <ul>
430
+ * <li>type: can be one of the following:<ul>
431
+ * <li> A shortname for a node type (<code>'text','menu','html'</code>) </li>
432
+ * <li>The name of a Node class under YAHOO.widget (<code>'TextNode', 'MenuNode', 'DateNode'</code>, etc) </li>
433
+ * <li>a reference to an actual class: <code>YAHOO.widget.DateNode</code></li>
434
+ * </ul></li>
435
+ * <li>children: an array containing further node definitions</li></ul>
436
+ * A string instead of an object will produce a node of type 'text' with the given string as its label.
437
+ * @method buildTreeFromObject
438
+ * @param oConfig {Array|Object|String} array containing a full description of the tree.
439
+ * An object or a string will be turned into an array with the given object or string as its only element.
440
+ *
441
+ */
442
+ buildTreeFromObject: function (oConfig) {
443
+ var logger = this.logger;
444
+ logger.log('Building tree from object');
445
+ var build = function (parent, oConfig) {
446
+ var i, item, node, children, type, NodeType, ThisType;
447
+ for (i = 0; i < oConfig.length; i++) {
448
+ item = oConfig[i];
449
+ if (Lang.isString(item)) {
450
+ node = new Widget.TextNode(item, parent);
451
+ } else if (Lang.isObject(item)) {
452
+ children = item.children;
453
+ delete item.children;
454
+ type = item.type || 'text';
455
+ delete item.type;
456
+ switch (Lang.isString(type) && type.toLowerCase()) {
457
+ case 'text':
458
+ node = new Widget.TextNode(item, parent);
459
+ break;
460
+ case 'menu':
461
+ node = new Widget.MenuNode(item, parent);
462
+ break;
463
+ case 'html':
464
+ node = new Widget.HTMLNode(item, parent);
465
+ break;
466
+ default:
467
+ if (Lang.isString(type)) {
468
+ NodeType = Widget[type];
469
+ } else {
470
+ NodeType = type;
471
+ }
472
+ if (Lang.isObject(NodeType)) {
473
+ for (ThisType = NodeType; ThisType && ThisType !== Widget.Node; ThisType = ThisType.superclass.constructor) {}
474
+ if (ThisType) {
475
+ node = new NodeType(item, parent);
476
+ } else {
477
+ logger.log('Invalid type in node definition: ' + type,'error');
478
+ }
479
+ } else {
480
+ logger.log('Invalid type in node definition: ' + type,'error');
481
+ }
482
+ }
483
+ if (children) {
484
+ build(node,children);
485
+ }
486
+ } else {
487
+ logger.log('Invalid node definition','error');
488
+ }
489
+ }
490
+ };
491
+ if (!Lang.isArray(oConfig)) {
492
+ oConfig = [oConfig];
493
+ }
494
+
495
+
496
+ build(this.root,oConfig);
497
+ },
498
+ /**
499
+ * Builds the TreeView from existing markup. Markup should consist of &lt;UL&gt; or &lt;OL&gt; elements containing &lt;LI&gt; elements.
500
+ * Each &lt;LI&gt; can have one element used as label and a second optional element which is to be a &lt;UL&gt; or &lt;OL&gt;
501
+ * containing nested nodes.
502
+ * Depending on what the first element of the &lt;LI&gt; element is, the following Nodes will be created: <ul>
503
+ * <li>plain text: a regular TextNode</li>
504
+ * <li>anchor &lt;A&gt;: a TextNode with its <code>href</code> and <code>target</code> taken from the anchor</li>
505
+ * <li>anything else: an HTMLNode</li></ul>
506
+ * Only the first outermost (un-)ordered list in the markup and its children will be parsed.
507
+ * Nodes will be collapsed unless an &lt;LI&gt; tag has a className called 'expanded'.
508
+ * All other className attributes will be copied over to the Node className property.
509
+ * If the &lt;LI&gt; element contains an attribute called <code>yuiConfig</code>, its contents should be a JSON-encoded object
510
+ * as the one used in method <a href="#method_buildTreeFromObject">buildTreeFromObject</a>.
511
+ * @method buildTreeFromMarkup
512
+ * @param id {string|HTMLElement} The id of the element that contains the markup or a reference to it.
513
+ */
514
+ buildTreeFromMarkup: function (id) {
515
+ this.logger.log('Building tree from existing markup');
516
+ var build = function (markup) {
517
+ var el, child, branch = [], config = {}, label, yuiConfig;
518
+ // Dom's getFirstChild and getNextSibling skip over text elements
519
+ for (el = Dom.getFirstChild(markup); el; el = Dom.getNextSibling(el)) {
520
+ switch (el.tagName.toUpperCase()) {
521
+ case 'LI':
522
+ label = '';
523
+ config = {
524
+ expanded: Dom.hasClass(el,'expanded'),
525
+ title: el.title || el.alt || null,
526
+ className: Lang.trim(el.className.replace(/\bexpanded\b/,'')) || null
527
+ };
528
+ // I cannot skip over text elements here because I want them for labels
529
+ child = el.firstChild;
530
+ if (child.nodeType == 3) {
531
+ // nodes with only whitespace, tabs and new lines don't count, they are probably just formatting.
532
+ label = Lang.trim(child.nodeValue.replace(/[\n\t\r]*/g,''));
533
+ if (label) {
534
+ config.type = 'text';
535
+ config.label = label;
536
+ } else {
537
+ child = Dom.getNextSibling(child);
538
+ }
539
+ }
540
+ if (!label) {
541
+ if (child.tagName.toUpperCase() == 'A') {
542
+ config.type = 'text';
543
+ config.label = child.innerHTML;
544
+ config.href = child.href;
545
+ config.target = child.target;
546
+ config.title = child.title || child.alt || config.title;
547
+ } else {
548
+ config.type = 'html';
549
+ var d = document.createElement('div');
550
+ d.appendChild(child.cloneNode(true));
551
+ config.html = d.innerHTML;
552
+ config.hasIcon = true;
553
+ }
554
+ }
555
+ // see if after the label it has a further list which will become children of this node.
556
+ child = Dom.getNextSibling(child);
557
+ switch (child && child.tagName.toUpperCase()) {
558
+ case 'UL':
559
+ case 'OL':
560
+ config.children = build(child);
561
+ break;
562
+ }
563
+ // if there are further elements or text, it will be ignored.
564
+
565
+ if (YAHOO.lang.JSON) {
566
+ yuiConfig = el.getAttribute('yuiConfig');
567
+ if (yuiConfig) {
568
+ yuiConfig = YAHOO.lang.JSON.parse(yuiConfig);
569
+ config = YAHOO.lang.merge(config,yuiConfig);
570
+ }
571
+ }
572
+
573
+ branch.push(config);
574
+ break;
575
+ case 'UL':
576
+ case 'OL':
577
+ this.logger.log('ULs or OLs can only contain LI elements, not other UL or OL. This will not work in some browsers','error');
578
+ config = {
579
+ type: 'text',
580
+ label: '',
581
+ children: build(child)
582
+ };
583
+ branch.push(config);
584
+ break;
585
+ }
586
+ }
587
+ return branch;
588
+ };
589
+
590
+ var markup = Dom.getChildrenBy(Dom.get(id),function (el) {
591
+ var tag = el.tagName.toUpperCase();
592
+ return tag == 'UL' || tag == 'OL';
593
+ });
594
+ if (markup.length) {
595
+ this.buildTreeFromObject(build(markup[0]));
596
+ } else {
597
+ this.logger.log('Markup contains no UL or OL elements','warn');
598
+ }
599
+ },
600
+ /**
601
+ * Returns the TD element where the event has occurred
602
+ * @method _getEventTargetTdEl
603
+ * @private
604
+ */
605
+ _getEventTargetTdEl: function (ev) {
606
+ var target = Event.getTarget(ev);
607
+ // go up looking for a TD with a className with a ygtv prefix
608
+ while (target && !(target.tagName.toUpperCase() == 'TD' && Dom.hasClass(target.parentNode,'ygtvrow'))) {
609
+ target = Dom.getAncestorByTagName(target,'td');
610
+ }
611
+ if (Lang.isNull(target)) { return null; }
612
+ // If it is a spacer cell, do nothing
613
+ if (/\bygtv(blank)?depthcell/.test(target.className)) { return null;}
614
+ // If it has an id, search for the node number and see if it belongs to a node in this tree.
615
+ if (target.id) {
616
+ var m = target.id.match(/\bygtv([^\d]*)(.*)/);
617
+ if (m && m[2] && this._nodes[m[2]]) {
618
+ return target;
619
+ }
620
+ }
621
+ return null;
622
+ },
623
+ /**
624
+ * Event listener for click events
625
+ * @method _onClickEvent
626
+ * @private
627
+ */
628
+ _onClickEvent: function (ev) {
629
+ var self = this,
630
+ td = this._getEventTargetTdEl(ev),
631
+ node,
632
+ target,
633
+ toggle = function (force) {
634
+ node.focus();
635
+ if (force || !node.href) {
636
+ node.toggle();
637
+ try {
638
+ Event.preventDefault(ev);
639
+ } catch (e) {
640
+ // @TODO
641
+ // For some reason IE8 is providing an event object with
642
+ // most of the fields missing, but only when clicking on
643
+ // the node's label, and only when working with inline
644
+ // editing. This generates a "Member not found" error
645
+ // in that browser. Determine if this is a browser
646
+ // bug, or a problem with this code. Already checked to
647
+ // see if the problem has to do with access the event
648
+ // in the outer scope, and that isn't the problem.
649
+ // Maybe the markup for inline editing is broken.
650
+ }
651
+ }
652
+ };
653
+
654
+ if (!td) {
655
+ return;
656
+ }
657
+
658
+ node = this.getNodeByElement(td);
659
+ if (!node) {
660
+ return;
661
+ }
662
+
663
+ // exception to handle deprecated event labelClick
664
+ // @TODO take another look at this deprecation. It is common for people to
665
+ // only be interested in the label click, so why make them have to test
666
+ // the node type to figure out whether the click was on the label?
667
+ target = Event.getTarget(ev);
668
+ if (Dom.hasClass(target, node.labelStyle) || Dom.getAncestorByClassName(target,node.labelStyle)) {
669
+ this.logger.log("onLabelClick " + node.label);
670
+ this.fireEvent('labelClick',node);
671
+ }
672
+
673
+ // If it is a toggle cell, toggle
674
+ if (/\bygtv[tl][mp]h?h?/.test(td.className)) {
675
+ toggle(true);
676
+ } else {
677
+ if (this._dblClickTimer) {
678
+ window.clearTimeout(this._dblClickTimer);
679
+ this._dblClickTimer = null;
680
+ } else {
681
+ if (this._hasDblClickSubscriber) {
682
+ this._dblClickTimer = window.setTimeout(function () {
683
+ self._dblClickTimer = null;
684
+ if (self.fireEvent('clickEvent', {event:ev,node:node}) !== false) {
685
+ toggle();
686
+ }
687
+ }, 200);
688
+ } else {
689
+ if (self.fireEvent('clickEvent', {event:ev,node:node}) !== false) {
690
+ toggle();
691
+ }
692
+ }
693
+ }
694
+ }
695
+ },
696
+
697
+ /**
698
+ * Event listener for double-click events
699
+ * @method _onDblClickEvent
700
+ * @private
701
+ */
702
+ _onDblClickEvent: function (ev) {
703
+ if (!this._hasDblClickSubscriber) { return; }
704
+ var td = this._getEventTargetTdEl(ev);
705
+ if (!td) {return;}
706
+
707
+ if (!(/\bygtv[tl][mp]h?h?/.test(td.className))) {
708
+ this.fireEvent('dblClickEvent', {event:ev, node:this.getNodeByElement(td)});
709
+ if (this._dblClickTimer) {
710
+ window.clearTimeout(this._dblClickTimer);
711
+ this._dblClickTimer = null;
712
+ }
713
+ }
714
+ },
715
+ /**
716
+ * Event listener for mouse over events
717
+ * @method _onMouseOverEvent
718
+ * @private
719
+ */
720
+ _onMouseOverEvent:function (ev) {
721
+ var target;
722
+ if ((target = this._getEventTargetTdEl(ev)) && (target = this.getNodeByElement(target)) && (target = target.getToggleEl())) {
723
+ target.className = target.className.replace(/\bygtv([lt])([mp])\b/gi,'ygtv$1$2h');
724
+ }
725
+ },
726
+ /**
727
+ * Event listener for mouse out events
728
+ * @method _onMouseOutEvent
729
+ * @private
730
+ */
731
+ _onMouseOutEvent: function (ev) {
732
+ var target;
733
+ if ((target = this._getEventTargetTdEl(ev)) && (target = this.getNodeByElement(target)) && (target = target.getToggleEl())) {
734
+ target.className = target.className.replace(/\bygtv([lt])([mp])h\b/gi,'ygtv$1$2');
735
+ }
736
+ },
737
+ /**
738
+ * Event listener for key down events
739
+ * @method _onKeyDownEvent
740
+ * @private
741
+ */
742
+ _onKeyDownEvent: function (ev) {
743
+ var target = Event.getTarget(ev),
744
+ node = this.getNodeByElement(target),
745
+ newNode = node,
746
+ KEY = YAHOO.util.KeyListener.KEY;
747
+
748
+ switch(ev.keyCode) {
749
+ case KEY.UP:
750
+ this.logger.log('UP');
751
+ do {
752
+ if (newNode.previousSibling) {
753
+ newNode = newNode.previousSibling;
754
+ } else {
755
+ newNode = newNode.parent;
756
+ }
757
+ } while (newNode && !newNode._canHaveFocus());
758
+ if (newNode) { newNode.focus(); }
759
+ Event.preventDefault(ev);
760
+ break;
761
+ case KEY.DOWN:
762
+ this.logger.log('DOWN');
763
+ do {
764
+ if (newNode.nextSibling) {
765
+ newNode = newNode.nextSibling;
766
+ } else {
767
+ newNode.expand();
768
+ newNode = (newNode.children.length || null) && newNode.children[0];
769
+ }
770
+ } while (newNode && !newNode._canHaveFocus);
771
+ if (newNode) { newNode.focus();}
772
+ Event.preventDefault(ev);
773
+ break;
774
+ case KEY.LEFT:
775
+ this.logger.log('LEFT');
776
+ do {
777
+ if (newNode.parent) {
778
+ newNode = newNode.parent;
779
+ } else {
780
+ newNode = newNode.previousSibling;
781
+ }
782
+ } while (newNode && !newNode._canHaveFocus());
783
+ if (newNode) { newNode.focus();}
784
+ Event.preventDefault(ev);
785
+ break;
786
+ case KEY.RIGHT:
787
+ this.logger.log('RIGHT');
788
+ var self = this,
789
+ moveFocusRight,
790
+ focusOnExpand = function (newNode) {
791
+ self.unsubscribe('expandComplete',focusOnExpand);
792
+ moveFocusRight(newNode);
793
+ };
794
+ moveFocusRight = function (newNode) {
795
+ do {
796
+ if (newNode.isDynamic() && !newNode.childrenRendered) {
797
+ self.subscribe('expandComplete',focusOnExpand);
798
+ newNode.expand();
799
+ newNode = null;
800
+ break;
801
+ } else {
802
+ newNode.expand();
803
+ if (newNode.children.length) {
804
+ newNode = newNode.children[0];
805
+ } else {
806
+ newNode = newNode.nextSibling;
807
+ }
808
+ }
809
+ } while (newNode && !newNode._canHaveFocus());
810
+ if (newNode) { newNode.focus();}
811
+ };
812
+
813
+ moveFocusRight(newNode);
814
+ Event.preventDefault(ev);
815
+ break;
816
+ case KEY.ENTER:
817
+ this.logger.log('ENTER: ' + newNode.href);
818
+ if (node.href) {
819
+ if (node.target) {
820
+ window.open(node.href,node.target);
821
+ } else {
822
+ window.location(node.href);
823
+ }
824
+ } else {
825
+ node.toggle();
826
+ }
827
+ this.fireEvent('enterKeyPressed',node);
828
+ Event.preventDefault(ev);
829
+ break;
830
+ case KEY.HOME:
831
+ this.logger.log('HOME');
832
+ newNode = this.getRoot();
833
+ if (newNode.children.length) {newNode = newNode.children[0];}
834
+ if (newNode._canHaveFocus()) { newNode.focus(); }
835
+ Event.preventDefault(ev);
836
+ break;
837
+ case KEY.END:
838
+ this.logger.log('END');
839
+ newNode = newNode.parent.children;
840
+ newNode = newNode[newNode.length -1];
841
+ if (newNode._canHaveFocus()) { newNode.focus(); }
842
+ Event.preventDefault(ev);
843
+ break;
844
+ // case KEY.PAGE_UP:
845
+ // this.logger.log('PAGE_UP');
846
+ // break;
847
+ // case KEY.PAGE_DOWN:
848
+ // this.logger.log('PAGE_DOWN');
849
+ // break;
850
+ case 107: // plus key
851
+ if (ev.shiftKey) {
852
+ this.logger.log('Shift-PLUS');
853
+ node.parent.expandAll();
854
+ } else {
855
+ this.logger.log('PLUS');
856
+ node.expand();
857
+ }
858
+ break;
859
+ case 109: // minus key
860
+ if (ev.shiftKey) {
861
+ this.logger.log('Shift-MINUS');
862
+ node.parent.collapseAll();
863
+ } else {
864
+ this.logger.log('MINUS');
865
+ node.collapse();
866
+ }
867
+ break;
868
+ default:
869
+ break;
870
+ }
871
+ },
872
+ /**
873
+ * Renders the tree boilerplate and visible nodes
874
+ * @method render
875
+ */
876
+ render: function() {
877
+ var html = this.root.getHtml(),
878
+ el = this.getEl();
879
+ el.innerHTML = html;
880
+ if (!this._hasEvents) {
881
+ Event.on(el, 'click', this._onClickEvent, this, true);
882
+ Event.on(el, 'dblclick', this._onDblClickEvent, this, true);
883
+ Event.on(el, 'mouseover', this._onMouseOverEvent, this, true);
884
+ Event.on(el, 'mouseout', this._onMouseOutEvent, this, true);
885
+ Event.on(el, 'keydown', this._onKeyDownEvent, this, true);
886
+ }
887
+ this._hasEvents = true;
888
+ },
889
+
890
+ /**
891
+ * Returns the tree's host element
892
+ * @method getEl
893
+ * @return {HTMLElement} the host element
894
+ */
895
+ getEl: function() {
896
+ if (! this._el) {
897
+ this._el = Dom.get(this.id);
898
+ }
899
+ return this._el;
900
+ },
901
+
902
+ /**
903
+ * Nodes register themselves with the tree instance when they are created.
904
+ * @method regNode
905
+ * @param node {Node} the node to register
906
+ * @private
907
+ */
908
+ regNode: function(node) {
909
+ this._nodes[node.index] = node;
910
+ },
911
+
912
+ /**
913
+ * Returns the root node of this tree
914
+ * @method getRoot
915
+ * @return {Node} the root node
916
+ */
917
+ getRoot: function() {
918
+ return this.root;
919
+ },
920
+
921
+ /**
922
+ * Configures this tree to dynamically load all child data
923
+ * @method setDynamicLoad
924
+ * @param {function} fnDataLoader the function that will be called to get the data
925
+ * @param iconMode {int} configures the icon that is displayed when a dynamic
926
+ * load node is expanded the first time without children. By default, the
927
+ * "collapse" icon will be used. If set to 1, the leaf node icon will be
928
+ * displayed.
929
+ */
930
+ setDynamicLoad: function(fnDataLoader, iconMode) {
931
+ this.root.setDynamicLoad(fnDataLoader, iconMode);
932
+ },
933
+
934
+ /**
935
+ * Expands all child nodes. Note: this conflicts with the "multiExpand"
936
+ * node property. If expand all is called in a tree with nodes that
937
+ * do not allow multiple siblings to be displayed, only the last sibling
938
+ * will be expanded.
939
+ * @method expandAll
940
+ */
941
+ expandAll: function() {
942
+ if (!this.locked) {
943
+ this.root.expandAll();
944
+ }
945
+ },
946
+
947
+ /**
948
+ * Collapses all expanded child nodes in the entire tree.
949
+ * @method collapseAll
950
+ */
951
+ collapseAll: function() {
952
+ if (!this.locked) {
953
+ this.root.collapseAll();
954
+ }
955
+ },
956
+
957
+ /**
958
+ * Returns a node in the tree that has the specified index (this index
959
+ * is created internally, so this function probably will only be used
960
+ * in html generated for a given node.)
961
+ * @method getNodeByIndex
962
+ * @param {int} nodeIndex the index of the node wanted
963
+ * @return {Node} the node with index=nodeIndex, null if no match
964
+ */
965
+ getNodeByIndex: function(nodeIndex) {
966
+ var n = this._nodes[nodeIndex];
967
+ return (n) ? n : null;
968
+ },
969
+
970
+ /**
971
+ * Returns a node that has a matching property and value in the data
972
+ * object that was passed into its constructor.
973
+ * @method getNodeByProperty
974
+ * @param {object} property the property to search (usually a string)
975
+ * @param {object} value the value we want to find (usuall an int or string)
976
+ * @return {Node} the matching node, null if no match
977
+ */
978
+ getNodeByProperty: function(property, value) {
979
+ for (var i in this._nodes) {
980
+ if (this._nodes.hasOwnProperty(i)) {
981
+ var n = this._nodes[i];
982
+ if ((property in n && n[property] == value) || (n.data && value == n.data[property])) {
983
+ return n;
984
+ }
985
+ }
986
+ }
987
+
988
+ return null;
989
+ },
990
+
991
+ /**
992
+ * Returns a collection of nodes that have a matching property
993
+ * and value in the data object that was passed into its constructor.
994
+ * @method getNodesByProperty
995
+ * @param {object} property the property to search (usually a string)
996
+ * @param {object} value the value we want to find (usuall an int or string)
997
+ * @return {Array} the matching collection of nodes, null if no match
998
+ */
999
+ getNodesByProperty: function(property, value) {
1000
+ var values = [];
1001
+ for (var i in this._nodes) {
1002
+ if (this._nodes.hasOwnProperty(i)) {
1003
+ var n = this._nodes[i];
1004
+ if ((property in n && n[property] == value) || (n.data && value == n.data[property])) {
1005
+ values.push(n);
1006
+ }
1007
+ }
1008
+ }
1009
+
1010
+ return (values.length) ? values : null;
1011
+ },
1012
+
1013
+
1014
+ /**
1015
+ * Returns a collection of nodes that have passed the test function
1016
+ * passed as its only argument.
1017
+ * The function will receive a reference to each node to be tested.
1018
+ * @method getNodesBy
1019
+ * @param {function} a boolean function that receives a Node instance and returns true to add the node to the results list
1020
+ * @return {Array} the matching collection of nodes, null if no match
1021
+ */
1022
+ getNodesBy: function(fn) {
1023
+ var values = [];
1024
+ for (var i in this._nodes) {
1025
+ if (this._nodes.hasOwnProperty(i)) {
1026
+ var n = this._nodes[i];
1027
+ if (fn(n)) {
1028
+ values.push(n);
1029
+ }
1030
+ }
1031
+ }
1032
+ return (values.length) ? values : null;
1033
+ },
1034
+ /**
1035
+ * Returns the treeview node reference for an ancestor element
1036
+ * of the node, or null if it is not contained within any node
1037
+ * in this tree.
1038
+ * @method getNodeByElement
1039
+ * @param el {HTMLElement} the element to test
1040
+ * @return {YAHOO.widget.Node} a node reference or null
1041
+ */
1042
+ getNodeByElement: function(el) {
1043
+
1044
+ var p=el, m, re=/ygtv([^\d]*)(.*)/;
1045
+
1046
+ do {
1047
+
1048
+ if (p && p.id) {
1049
+ m = p.id.match(re);
1050
+ if (m && m[2]) {
1051
+ return this.getNodeByIndex(m[2]);
1052
+ }
1053
+ }
1054
+
1055
+ p = p.parentNode;
1056
+
1057
+ if (!p || !p.tagName) {
1058
+ break;
1059
+ }
1060
+
1061
+ }
1062
+ while (p.id !== this.id && p.tagName.toLowerCase() !== "body");
1063
+
1064
+ return null;
1065
+ },
1066
+
1067
+ /**
1068
+ * When in singleNodeHighlight it returns the node highlighted
1069
+ * or null if none. Returns null if singleNodeHighlight is false.
1070
+ * @method getHighlightedNode
1071
+ * @return {YAHOO.widget.Node} a node reference or null
1072
+ */
1073
+ getHighlightedNode: function() {
1074
+ return this._currentlyHighlighted;
1075
+ },
1076
+
1077
+
1078
+ /**
1079
+ * Removes the node and its children, and optionally refreshes the
1080
+ * branch of the tree that was affected.
1081
+ * @method removeNode
1082
+ * @param {Node} node to remove
1083
+ * @param {boolean} autoRefresh automatically refreshes branch if true
1084
+ * @return {boolean} False is there was a problem, true otherwise.
1085
+ */
1086
+ removeNode: function(node, autoRefresh) {
1087
+
1088
+ // Don't delete the root node
1089
+ if (node.isRoot()) {
1090
+ return false;
1091
+ }
1092
+
1093
+ // Get the branch that we may need to refresh
1094
+ var p = node.parent;
1095
+ if (p.parent) {
1096
+ p = p.parent;
1097
+ }
1098
+
1099
+ // Delete the node and its children
1100
+ this._deleteNode(node);
1101
+
1102
+ // Refresh the parent of the parent
1103
+ if (autoRefresh && p && p.childrenRendered) {
1104
+ p.refresh();
1105
+ }
1106
+
1107
+ return true;
1108
+ },
1109
+
1110
+ /**
1111
+ * wait until the animation is complete before deleting
1112
+ * to avoid javascript errors
1113
+ * @method _removeChildren_animComplete
1114
+ * @param o the custom event payload
1115
+ * @private
1116
+ */
1117
+ _removeChildren_animComplete: function(o) {
1118
+ this.unsubscribe(this._removeChildren_animComplete);
1119
+ this.removeChildren(o.node);
1120
+ },
1121
+
1122
+ /**
1123
+ * Deletes this nodes child collection, recursively. Also collapses
1124
+ * the node, and resets the dynamic load flag. The primary use for
1125
+ * this method is to purge a node and allow it to fetch its data
1126
+ * dynamically again.
1127
+ * @method removeChildren
1128
+ * @param {Node} node the node to purge
1129
+ */
1130
+ removeChildren: function(node) {
1131
+
1132
+ if (node.expanded) {
1133
+ // wait until the animation is complete before deleting to
1134
+ // avoid javascript errors
1135
+ if (this._collapseAnim) {
1136
+ this.subscribe("animComplete",
1137
+ this._removeChildren_animComplete, this, true);
1138
+ Widget.Node.prototype.collapse.call(node);
1139
+ return;
1140
+ }
1141
+
1142
+ node.collapse();
1143
+ }
1144
+
1145
+ this.logger.log("Removing children for " + node);
1146
+ while (node.children.length) {
1147
+ this._deleteNode(node.children[0]);
1148
+ }
1149
+
1150
+ if (node.isRoot()) {
1151
+ Widget.Node.prototype.expand.call(node);
1152
+ }
1153
+
1154
+ node.childrenRendered = false;
1155
+ node.dynamicLoadComplete = false;
1156
+
1157
+ node.updateIcon();
1158
+ },
1159
+
1160
+ /**
1161
+ * Deletes the node and recurses children
1162
+ * @method _deleteNode
1163
+ * @private
1164
+ */
1165
+ _deleteNode: function(node) {
1166
+ // Remove all the child nodes first
1167
+ this.removeChildren(node);
1168
+
1169
+ // Remove the node from the tree
1170
+ this.popNode(node);
1171
+ },
1172
+
1173
+ /**
1174
+ * Removes the node from the tree, preserving the child collection
1175
+ * to make it possible to insert the branch into another part of the
1176
+ * tree, or another tree.
1177
+ * @method popNode
1178
+ * @param {Node} node to remove
1179
+ */
1180
+ popNode: function(node) {
1181
+ var p = node.parent;
1182
+
1183
+ // Update the parent's collection of children
1184
+ var a = [];
1185
+
1186
+ for (var i=0, len=p.children.length;i<len;++i) {
1187
+ if (p.children[i] != node) {
1188
+ a[a.length] = p.children[i];
1189
+ }
1190
+ }
1191
+
1192
+ p.children = a;
1193
+
1194
+ // reset the childrenRendered flag for the parent
1195
+ p.childrenRendered = false;
1196
+
1197
+ // Update the sibling relationship
1198
+ if (node.previousSibling) {
1199
+ node.previousSibling.nextSibling = node.nextSibling;
1200
+ }
1201
+
1202
+ if (node.nextSibling) {
1203
+ node.nextSibling.previousSibling = node.previousSibling;
1204
+ }
1205
+
1206
+ if (this.currentFocus == node) {
1207
+ this.currentFocus = null;
1208
+ }
1209
+ if (this._currentlyHighlighted == node) {
1210
+ this._currentlyHighlighted = null;
1211
+ }
1212
+
1213
+ node.parent = null;
1214
+ node.previousSibling = null;
1215
+ node.nextSibling = null;
1216
+ node.tree = null;
1217
+
1218
+ // Update the tree's node collection
1219
+ delete this._nodes[node.index];
1220
+ },
1221
+
1222
+ /**
1223
+ * Nulls out the entire TreeView instance and related objects, removes attached
1224
+ * event listeners, and clears out DOM elements inside the container. After
1225
+ * calling this method, the instance reference should be expliclitly nulled by
1226
+ * implementer, as in myDataTable = null. Use with caution!
1227
+ *
1228
+ * @method destroy
1229
+ */
1230
+ destroy : function() {
1231
+ // Since the label editor can be separated from the main TreeView control
1232
+ // the destroy method for it might not be there.
1233
+ if (this._destroyEditor) { this._destroyEditor(); }
1234
+ var el = this.getEl();
1235
+ Event.removeListener(el,'click');
1236
+ Event.removeListener(el,'dblclick');
1237
+ Event.removeListener(el,'mouseover');
1238
+ Event.removeListener(el,'mouseout');
1239
+ Event.removeListener(el,'keydown');
1240
+ for (var i = 0 ; i < this._nodes.length; i++) {
1241
+ var node = this._nodes[i];
1242
+ if (node && node.destroy) {node.destroy(); }
1243
+ }
1244
+ el.innerHTML = '';
1245
+ this._hasEvents = false;
1246
+ },
1247
+
1248
+
1249
+
1250
+
1251
+ /**
1252
+ * TreeView instance toString
1253
+ * @method toString
1254
+ * @return {string} string representation of the tree
1255
+ */
1256
+ toString: function() {
1257
+ return "TreeView " + this.id;
1258
+ },
1259
+
1260
+ /**
1261
+ * Count of nodes in tree
1262
+ * @method getNodeCount
1263
+ * @return {int} number of nodes in the tree
1264
+ */
1265
+ getNodeCount: function() {
1266
+ return this.getRoot().getNodeCount();
1267
+ },
1268
+
1269
+ /**
1270
+ * Returns an object which could be used to rebuild the tree.
1271
+ * It can be passed to the tree constructor to reproduce the same tree.
1272
+ * It will return false if any node loads dynamically, regardless of whether it is loaded or not.
1273
+ * @method getTreeDefinition
1274
+ * @return {Object | false} definition of the tree or false if any node is defined as dynamic
1275
+ */
1276
+ getTreeDefinition: function() {
1277
+ return this.getRoot().getNodeDefinition();
1278
+ },
1279
+
1280
+ /**
1281
+ * Abstract method that is executed when a node is expanded
1282
+ * @method onExpand
1283
+ * @param node {Node} the node that was expanded
1284
+ * @deprecated use treeobj.subscribe("expand") instead
1285
+ */
1286
+ onExpand: function(node) { },
1287
+
1288
+ /**
1289
+ * Abstract method that is executed when a node is collapsed.
1290
+ * @method onCollapse
1291
+ * @param node {Node} the node that was collapsed.
1292
+ * @deprecated use treeobj.subscribe("collapse") instead
1293
+ */
1294
+ onCollapse: function(node) { },
1295
+
1296
+ /**
1297
+ * Sets the value of a property for all loaded nodes in the tree.
1298
+ * @method setNodesProperty
1299
+ * @param name {string} Name of the property to be set
1300
+ * @param value {any} value to be set
1301
+ * @param refresh {boolean} if present and true, it does a refresh
1302
+ */
1303
+ setNodesProperty: function(name, value, refresh) {
1304
+ this.root.setNodesProperty(name,value);
1305
+ if (refresh) {
1306
+ this.root.refresh();
1307
+ }
1308
+ },
1309
+ /**
1310
+ * Event listener to toggle node highlight.
1311
+ * Can be assigned as listener to clickEvent, dblClickEvent and enterKeyPressed.
1312
+ * It returns false to prevent the default action.
1313
+ * @method onEventToggleHighlight
1314
+ * @param oArgs {any} it takes the arguments of any of the events mentioned above
1315
+ * @return {false} Always cancels the default action for the event
1316
+ */
1317
+ onEventToggleHighlight: function (oArgs) {
1318
+ var node;
1319
+ if ('node' in oArgs && oArgs.node instanceof Widget.Node) {
1320
+ node = oArgs.node;
1321
+ } else if (oArgs instanceof Widget.Node) {
1322
+ node = oArgs;
1323
+ } else {
1324
+ return false;
1325
+ }
1326
+ node.toggleHighlight();
1327
+ return false;
1328
+ }
1329
+
1330
+
1331
+ };
1332
+
1333
+ /* Backwards compatibility aliases */
1334
+ var PROT = TV.prototype;
1335
+ /**
1336
+ * Renders the tree boilerplate and visible nodes.
1337
+ * Alias for render
1338
+ * @method draw
1339
+ * @deprecated Use render instead
1340
+ */
1341
+ PROT.draw = PROT.render;
1342
+
1343
+ /* end backwards compatibility aliases */
1344
+
1345
+ YAHOO.augment(TV, YAHOO.util.EventProvider);
1346
+
1347
+ /**
1348
+ * Running count of all nodes created in all trees. This is
1349
+ * used to provide unique identifies for all nodes. Deleting
1350
+ * nodes does not change the nodeCount.
1351
+ * @property YAHOO.widget.TreeView.nodeCount
1352
+ * @type int
1353
+ * @static
1354
+ */
1355
+ TV.nodeCount = 0;
1356
+
1357
+ /**
1358
+ * Global cache of tree instances
1359
+ * @property YAHOO.widget.TreeView.trees
1360
+ * @type Array
1361
+ * @static
1362
+ * @private
1363
+ */
1364
+ TV.trees = [];
1365
+
1366
+ /**
1367
+ * Global method for getting a tree by its id. Used in the generated
1368
+ * tree html.
1369
+ * @method YAHOO.widget.TreeView.getTree
1370
+ * @param treeId {String} the id of the tree instance
1371
+ * @return {TreeView} the tree instance requested, null if not found.
1372
+ * @static
1373
+ */
1374
+ TV.getTree = function(treeId) {
1375
+ var t = TV.trees[treeId];
1376
+ return (t) ? t : null;
1377
+ };
1378
+
1379
+
1380
+ /**
1381
+ * Global method for getting a node by its id. Used in the generated
1382
+ * tree html.
1383
+ * @method YAHOO.widget.TreeView.getNode
1384
+ * @param treeId {String} the id of the tree instance
1385
+ * @param nodeIndex {String} the index of the node to return
1386
+ * @return {Node} the node instance requested, null if not found
1387
+ * @static
1388
+ */
1389
+ TV.getNode = function(treeId, nodeIndex) {
1390
+ var t = TV.getTree(treeId);
1391
+ return (t) ? t.getNodeByIndex(nodeIndex) : null;
1392
+ };
1393
+
1394
+
1395
+ /**
1396
+ * Class name assigned to elements that have the focus
1397
+ *
1398
+ * @property TreeView.FOCUS_CLASS_NAME
1399
+ * @type String
1400
+ * @static
1401
+ * @final
1402
+ * @default "ygtvfocus"
1403
+
1404
+ */
1405
+ TV.FOCUS_CLASS_NAME = 'ygtvfocus';
1406
+
1407
+
1408
+
1409
+ })();
1410
+
1411
+ (function () {
1412
+ var Dom = YAHOO.util.Dom,
1413
+ Lang = YAHOO.lang,
1414
+ Event = YAHOO.util.Event;
1415
+ /**
1416
+ * The base class for all tree nodes. The node's presentation and behavior in
1417
+ * response to mouse events is handled in Node subclasses.
1418
+ * @namespace YAHOO.widget
1419
+ * @class Node
1420
+ * @uses YAHOO.util.EventProvider
1421
+ * @param oData {object} a string or object containing the data that will
1422
+ * be used to render this node, and any custom attributes that should be
1423
+ * stored with the node (which is available in noderef.data).
1424
+ * All values in oData will be used to set equally named properties in the node
1425
+ * as long as the node does have such properties, they are not undefined, private or functions,
1426
+ * the rest of the values will be stored in noderef.data
1427
+ * @param oParent {Node} this node's parent node
1428
+ * @param expanded {boolean} the initial expanded/collapsed state (deprecated, use oData.expanded)
1429
+ * @constructor
1430
+ */
1431
+ YAHOO.widget.Node = function(oData, oParent, expanded) {
1432
+ if (oData) { this.init(oData, oParent, expanded); }
1433
+ };
1434
+
1435
+ YAHOO.widget.Node.prototype = {
1436
+
1437
+ /**
1438
+ * The index for this instance obtained from global counter in YAHOO.widget.TreeView.
1439
+ * @property index
1440
+ * @type int
1441
+ */
1442
+ index: 0,
1443
+
1444
+ /**
1445
+ * This node's child node collection.
1446
+ * @property children
1447
+ * @type Node[]
1448
+ */
1449
+ children: null,
1450
+
1451
+ /**
1452
+ * Tree instance this node is part of
1453
+ * @property tree
1454
+ * @type TreeView
1455
+ */
1456
+ tree: null,
1457
+
1458
+ /**
1459
+ * The data linked to this node. This can be any object or primitive
1460
+ * value, and the data can be used in getNodeHtml().
1461
+ * @property data
1462
+ * @type object
1463
+ */
1464
+ data: null,
1465
+
1466
+ /**
1467
+ * Parent node
1468
+ * @property parent
1469
+ * @type Node
1470
+ */
1471
+ parent: null,
1472
+
1473
+ /**
1474
+ * The depth of this node. We start at -1 for the root node.
1475
+ * @property depth
1476
+ * @type int
1477
+ */
1478
+ depth: -1,
1479
+
1480
+ /**
1481
+ * The node's expanded/collapsed state
1482
+ * @property expanded
1483
+ * @type boolean
1484
+ */
1485
+ expanded: false,
1486
+
1487
+ /**
1488
+ * Can multiple children be expanded at once?
1489
+ * @property multiExpand
1490
+ * @type boolean
1491
+ */
1492
+ multiExpand: true,
1493
+
1494
+ /**
1495
+ * Should we render children for a collapsed node? It is possible that the
1496
+ * implementer will want to render the hidden data... @todo verify that we
1497
+ * need this, and implement it if we do.
1498
+ * @property renderHidden
1499
+ * @type boolean
1500
+ */
1501
+ renderHidden: false,
1502
+
1503
+ /**
1504
+ * This flag is set to true when the html is generated for this node's
1505
+ * children, and set to false when new children are added.
1506
+ * @property childrenRendered
1507
+ * @type boolean
1508
+ */
1509
+ childrenRendered: false,
1510
+
1511
+ /**
1512
+ * Dynamically loaded nodes only fetch the data the first time they are
1513
+ * expanded. This flag is set to true once the data has been fetched.
1514
+ * @property dynamicLoadComplete
1515
+ * @type boolean
1516
+ */
1517
+ dynamicLoadComplete: false,
1518
+
1519
+ /**
1520
+ * This node's previous sibling
1521
+ * @property previousSibling
1522
+ * @type Node
1523
+ */
1524
+ previousSibling: null,
1525
+
1526
+ /**
1527
+ * This node's next sibling
1528
+ * @property nextSibling
1529
+ * @type Node
1530
+ */
1531
+ nextSibling: null,
1532
+
1533
+ /**
1534
+ * We can set the node up to call an external method to get the child
1535
+ * data dynamically.
1536
+ * @property _dynLoad
1537
+ * @type boolean
1538
+ * @private
1539
+ */
1540
+ _dynLoad: false,
1541
+
1542
+ /**
1543
+ * Function to execute when we need to get this node's child data.
1544
+ * @property dataLoader
1545
+ * @type function
1546
+ */
1547
+ dataLoader: null,
1548
+
1549
+ /**
1550
+ * This is true for dynamically loading nodes while waiting for the
1551
+ * callback to return.
1552
+ * @property isLoading
1553
+ * @type boolean
1554
+ */
1555
+ isLoading: false,
1556
+
1557
+ /**
1558
+ * The toggle/branch icon will not show if this is set to false. This
1559
+ * could be useful if the implementer wants to have the child contain
1560
+ * extra info about the parent, rather than an actual node.
1561
+ * @property hasIcon
1562
+ * @type boolean
1563
+ */
1564
+ hasIcon: true,
1565
+
1566
+ /**
1567
+ * Used to configure what happens when a dynamic load node is expanded
1568
+ * and we discover that it does not have children. By default, it is
1569
+ * treated as if it still could have children (plus/minus icon). Set
1570
+ * iconMode to have it display like a leaf node instead.
1571
+ * @property iconMode
1572
+ * @type int
1573
+ */
1574
+ iconMode: 0,
1575
+
1576
+ /**
1577
+ * Specifies whether or not the content area of the node should be allowed
1578
+ * to wrap.
1579
+ * @property nowrap
1580
+ * @type boolean
1581
+ * @default false
1582
+ */
1583
+ nowrap: false,
1584
+
1585
+ /**
1586
+ * If true, the node will alway be rendered as a leaf node. This can be
1587
+ * used to override the presentation when dynamically loading the entire
1588
+ * tree. Setting this to true also disables the dynamic load call for the
1589
+ * node.
1590
+ * @property isLeaf
1591
+ * @type boolean
1592
+ * @default false
1593
+ */
1594
+ isLeaf: false,
1595
+
1596
+ /**
1597
+ * The CSS class for the html content container. Defaults to ygtvhtml, but
1598
+ * can be overridden to provide a custom presentation for a specific node.
1599
+ * @property contentStyle
1600
+ * @type string
1601
+ */
1602
+ contentStyle: "",
1603
+
1604
+
1605
+ /**
1606
+ * The generated id that will contain the data passed in by the implementer.
1607
+ * @property contentElId
1608
+ * @type string
1609
+ */
1610
+ contentElId: null,
1611
+
1612
+ /**
1613
+ * Enables node highlighting. If true, the node can be highlighted and/or propagate highlighting
1614
+ * @property enableHighlight
1615
+ * @type boolean
1616
+ * @default true
1617
+ */
1618
+ enableHighlight: true,
1619
+
1620
+ /**
1621
+ * Stores the highlight state. Can be any of:
1622
+ * <ul>
1623
+ * <li>0 - not highlighted</li>
1624
+ * <li>1 - highlighted</li>
1625
+ * <li>2 - some children highlighted</li>
1626
+ * </ul>
1627
+ * @property highlightState
1628
+ * @type integer
1629
+ * @default 0
1630
+ */
1631
+
1632
+ highlightState: 0,
1633
+
1634
+ /**
1635
+ * Tells whether highlighting will be propagated up to the parents of the clicked node
1636
+ * @property propagateHighlightUp
1637
+ * @type boolean
1638
+ * @default false
1639
+ */
1640
+
1641
+ propagateHighlightUp: false,
1642
+
1643
+ /**
1644
+ * Tells whether highlighting will be propagated down to the children of the clicked node
1645
+ * @property propagateHighlightDown
1646
+ * @type boolean
1647
+ * @default false
1648
+ */
1649
+
1650
+ propagateHighlightDown: false,
1651
+
1652
+ /**
1653
+ * User-defined className to be added to the Node
1654
+ * @property className
1655
+ * @type string
1656
+ * @default null
1657
+ */
1658
+
1659
+ className: null,
1660
+
1661
+ /**
1662
+ * The node type
1663
+ * @property _type
1664
+ * @private
1665
+ * @type string
1666
+ * @default "Node"
1667
+ */
1668
+ _type: "Node",
1669
+
1670
+ /*
1671
+ spacerPath: "http://l.yimg.com/a/i/space.gif",
1672
+ expandedText: "Expanded",
1673
+ collapsedText: "Collapsed",
1674
+ loadingText: "Loading",
1675
+ */
1676
+
1677
+ /**
1678
+ * Initializes this node, gets some of the properties from the parent
1679
+ * @method init
1680
+ * @param oData {object} a string or object containing the data that will
1681
+ * be used to render this node
1682
+ * @param oParent {Node} this node's parent node
1683
+ * @param expanded {boolean} the initial expanded/collapsed state
1684
+ */
1685
+ init: function(oData, oParent, expanded) {
1686
+
1687
+ this.data = {};
1688
+ this.children = [];
1689
+ this.index = YAHOO.widget.TreeView.nodeCount;
1690
+ ++YAHOO.widget.TreeView.nodeCount;
1691
+ this.contentElId = "ygtvcontentel" + this.index;
1692
+
1693
+ if (Lang.isObject(oData)) {
1694
+ for (var property in oData) {
1695
+ if (oData.hasOwnProperty(property)) {
1696
+ if (property.charAt(0) != '_' && !Lang.isUndefined(this[property]) && !Lang.isFunction(this[property]) ) {
1697
+ this[property] = oData[property];
1698
+ } else {
1699
+ this.data[property] = oData[property];
1700
+ }
1701
+ }
1702
+ }
1703
+ }
1704
+ if (!Lang.isUndefined(expanded) ) { this.expanded = expanded; }
1705
+
1706
+ this.logger = new YAHOO.widget.LogWriter(this.toString());
1707
+
1708
+ /**
1709
+ * The parentChange event is fired when a parent element is applied
1710
+ * to the node. This is useful if you need to apply tree-level
1711
+ * properties to a tree that need to happen if a node is moved from
1712
+ * one tree to another.
1713
+ *
1714
+ * @event parentChange
1715
+ * @type CustomEvent
1716
+ */
1717
+ this.createEvent("parentChange", this);
1718
+
1719
+ // oParent should never be null except when we create the root node.
1720
+ if (oParent) {
1721
+ oParent.appendChild(this);
1722
+ }
1723
+ },
1724
+
1725
+ /**
1726
+ * Certain properties for the node cannot be set until the parent
1727
+ * is known. This is called after the node is inserted into a tree.
1728
+ * the parent is also applied to this node's children in order to
1729
+ * make it possible to move a branch from one tree to another.
1730
+ * @method applyParent
1731
+ * @param {Node} parentNode this node's parent node
1732
+ * @return {boolean} true if the application was successful
1733
+ */
1734
+ applyParent: function(parentNode) {
1735
+ if (!parentNode) {
1736
+ return false;
1737
+ }
1738
+
1739
+ this.tree = parentNode.tree;
1740
+ this.parent = parentNode;
1741
+ this.depth = parentNode.depth + 1;
1742
+
1743
+ // @todo why was this put here. This causes new nodes added at the
1744
+ // root level to lose the menu behavior.
1745
+ // if (! this.multiExpand) {
1746
+ // this.multiExpand = parentNode.multiExpand;
1747
+ // }
1748
+
1749
+ this.tree.regNode(this);
1750
+ parentNode.childrenRendered = false;
1751
+
1752
+ // cascade update existing children
1753
+ for (var i=0, len=this.children.length;i<len;++i) {
1754
+ this.children[i].applyParent(this);
1755
+ }
1756
+
1757
+ this.fireEvent("parentChange");
1758
+
1759
+ return true;
1760
+ },
1761
+
1762
+ /**
1763
+ * Appends a node to the child collection.
1764
+ * @method appendChild
1765
+ * @param childNode {Node} the new node
1766
+ * @return {Node} the child node
1767
+ * @private
1768
+ */
1769
+ appendChild: function(childNode) {
1770
+ if (this.hasChildren()) {
1771
+ var sib = this.children[this.children.length - 1];
1772
+ sib.nextSibling = childNode;
1773
+ childNode.previousSibling = sib;
1774
+ }
1775
+ this.children[this.children.length] = childNode;
1776
+ childNode.applyParent(this);
1777
+
1778
+ // part of the IE display issue workaround. If child nodes
1779
+ // are added after the initial render, and the node was
1780
+ // instantiated with expanded = true, we need to show the
1781
+ // children div now that the node has a child.
1782
+ if (this.childrenRendered && this.expanded) {
1783
+ this.getChildrenEl().style.display = "";
1784
+ }
1785
+
1786
+ return childNode;
1787
+ },
1788
+
1789
+ /**
1790
+ * Appends this node to the supplied node's child collection
1791
+ * @method appendTo
1792
+ * @param parentNode {Node} the node to append to.
1793
+ * @return {Node} The appended node
1794
+ */
1795
+ appendTo: function(parentNode) {
1796
+ return parentNode.appendChild(this);
1797
+ },
1798
+
1799
+ /**
1800
+ * Inserts this node before this supplied node
1801
+ * @method insertBefore
1802
+ * @param node {Node} the node to insert this node before
1803
+ * @return {Node} the inserted node
1804
+ */
1805
+ insertBefore: function(node) {
1806
+ this.logger.log("insertBefore: " + node);
1807
+ var p = node.parent;
1808
+ if (p) {
1809
+
1810
+ if (this.tree) {
1811
+ this.tree.popNode(this);
1812
+ }
1813
+
1814
+ var refIndex = node.isChildOf(p);
1815
+ //this.logger.log(refIndex);
1816
+ p.children.splice(refIndex, 0, this);
1817
+ if (node.previousSibling) {
1818
+ node.previousSibling.nextSibling = this;
1819
+ }
1820
+ this.previousSibling = node.previousSibling;
1821
+ this.nextSibling = node;
1822
+ node.previousSibling = this;
1823
+
1824
+ this.applyParent(p);
1825
+ }
1826
+
1827
+ return this;
1828
+ },
1829
+
1830
+ /**
1831
+ * Inserts this node after the supplied node
1832
+ * @method insertAfter
1833
+ * @param node {Node} the node to insert after
1834
+ * @return {Node} the inserted node
1835
+ */
1836
+ insertAfter: function(node) {
1837
+ this.logger.log("insertAfter: " + node);
1838
+ var p = node.parent;
1839
+ if (p) {
1840
+
1841
+ if (this.tree) {
1842
+ this.tree.popNode(this);
1843
+ }
1844
+
1845
+ var refIndex = node.isChildOf(p);
1846
+ this.logger.log(refIndex);
1847
+
1848
+ if (!node.nextSibling) {
1849
+ this.nextSibling = null;
1850
+ return this.appendTo(p);
1851
+ }
1852
+
1853
+ p.children.splice(refIndex + 1, 0, this);
1854
+
1855
+ node.nextSibling.previousSibling = this;
1856
+ this.previousSibling = node;
1857
+ this.nextSibling = node.nextSibling;
1858
+ node.nextSibling = this;
1859
+
1860
+ this.applyParent(p);
1861
+ }
1862
+
1863
+ return this;
1864
+ },
1865
+
1866
+ /**
1867
+ * Returns true if the Node is a child of supplied Node
1868
+ * @method isChildOf
1869
+ * @param parentNode {Node} the Node to check
1870
+ * @return {boolean} The node index if this Node is a child of
1871
+ * supplied Node, else -1.
1872
+ * @private
1873
+ */
1874
+ isChildOf: function(parentNode) {
1875
+ if (parentNode && parentNode.children) {
1876
+ for (var i=0, len=parentNode.children.length; i<len ; ++i) {
1877
+ if (parentNode.children[i] === this) {
1878
+ return i;
1879
+ }
1880
+ }
1881
+ }
1882
+
1883
+ return -1;
1884
+ },
1885
+
1886
+ /**
1887
+ * Returns a node array of this node's siblings, null if none.
1888
+ * @method getSiblings
1889
+ * @return Node[]
1890
+ */
1891
+ getSiblings: function() {
1892
+ var sib = this.parent.children.slice(0);
1893
+ for (var i=0;i < sib.length && sib[i] != this;i++) {}
1894
+ sib.splice(i,1);
1895
+ if (sib.length) { return sib; }
1896
+ return null;
1897
+ },
1898
+
1899
+ /**
1900
+ * Shows this node's children
1901
+ * @method showChildren
1902
+ */
1903
+ showChildren: function() {
1904
+ if (!this.tree.animateExpand(this.getChildrenEl(), this)) {
1905
+ if (this.hasChildren()) {
1906
+ this.getChildrenEl().style.display = "";
1907
+ }
1908
+ }
1909
+ },
1910
+
1911
+ /**
1912
+ * Hides this node's children
1913
+ * @method hideChildren
1914
+ */
1915
+ hideChildren: function() {
1916
+ this.logger.log("hiding " + this.index);
1917
+
1918
+ if (!this.tree.animateCollapse(this.getChildrenEl(), this)) {
1919
+ this.getChildrenEl().style.display = "none";
1920
+ }
1921
+ },
1922
+
1923
+ /**
1924
+ * Returns the id for this node's container div
1925
+ * @method getElId
1926
+ * @return {string} the element id
1927
+ */
1928
+ getElId: function() {
1929
+ return "ygtv" + this.index;
1930
+ },
1931
+
1932
+ /**
1933
+ * Returns the id for this node's children div
1934
+ * @method getChildrenElId
1935
+ * @return {string} the element id for this node's children div
1936
+ */
1937
+ getChildrenElId: function() {
1938
+ return "ygtvc" + this.index;
1939
+ },
1940
+
1941
+ /**
1942
+ * Returns the id for this node's toggle element
1943
+ * @method getToggleElId
1944
+ * @return {string} the toggel element id
1945
+ */
1946
+ getToggleElId: function() {
1947
+ return "ygtvt" + this.index;
1948
+ },
1949
+
1950
+
1951
+ /*
1952
+ * Returns the id for this node's spacer image. The spacer is positioned
1953
+ * over the toggle and provides feedback for screen readers.
1954
+ * @method getSpacerId
1955
+ * @return {string} the id for the spacer image
1956
+ */
1957
+ /*
1958
+ getSpacerId: function() {
1959
+ return "ygtvspacer" + this.index;
1960
+ },
1961
+ */
1962
+
1963
+ /**
1964
+ * Returns this node's container html element
1965
+ * @method getEl
1966
+ * @return {HTMLElement} the container html element
1967
+ */
1968
+ getEl: function() {
1969
+ return Dom.get(this.getElId());
1970
+ },
1971
+
1972
+ /**
1973
+ * Returns the div that was generated for this node's children
1974
+ * @method getChildrenEl
1975
+ * @return {HTMLElement} this node's children div
1976
+ */
1977
+ getChildrenEl: function() {
1978
+ return Dom.get(this.getChildrenElId());
1979
+ },
1980
+
1981
+ /**
1982
+ * Returns the element that is being used for this node's toggle.
1983
+ * @method getToggleEl
1984
+ * @return {HTMLElement} this node's toggle html element
1985
+ */
1986
+ getToggleEl: function() {
1987
+ return Dom.get(this.getToggleElId());
1988
+ },
1989
+ /**
1990
+ * Returns the outer html element for this node's content
1991
+ * @method getContentEl
1992
+ * @return {HTMLElement} the element
1993
+ */
1994
+ getContentEl: function() {
1995
+ return Dom.get(this.contentElId);
1996
+ },
1997
+
1998
+
1999
+ /*
2000
+ * Returns the element that is being used for this node's spacer.
2001
+ * @method getSpacer
2002
+ * @return {HTMLElement} this node's spacer html element
2003
+ */
2004
+ /*
2005
+ getSpacer: function() {
2006
+ return document.getElementById( this.getSpacerId() ) || {};
2007
+ },
2008
+ */
2009
+
2010
+ /*
2011
+ getStateText: function() {
2012
+ if (this.isLoading) {
2013
+ return this.loadingText;
2014
+ } else if (this.hasChildren(true)) {
2015
+ if (this.expanded) {
2016
+ return this.expandedText;
2017
+ } else {
2018
+ return this.collapsedText;
2019
+ }
2020
+ } else {
2021
+ return "";
2022
+ }
2023
+ },
2024
+ */
2025
+
2026
+ /**
2027
+ * Hides this nodes children (creating them if necessary), changes the toggle style.
2028
+ * @method collapse
2029
+ */
2030
+ collapse: function() {
2031
+ // Only collapse if currently expanded
2032
+ if (!this.expanded) { return; }
2033
+
2034
+ // fire the collapse event handler
2035
+ var ret = this.tree.onCollapse(this);
2036
+
2037
+ if (false === ret) {
2038
+ this.logger.log("Collapse was stopped by the abstract onCollapse");
2039
+ return;
2040
+ }
2041
+
2042
+ ret = this.tree.fireEvent("collapse", this);
2043
+
2044
+ if (false === ret) {
2045
+ this.logger.log("Collapse was stopped by a custom event handler");
2046
+ return;
2047
+ }
2048
+
2049
+
2050
+ if (!this.getEl()) {
2051
+ this.expanded = false;
2052
+ } else {
2053
+ // hide the child div
2054
+ this.hideChildren();
2055
+ this.expanded = false;
2056
+
2057
+ this.updateIcon();
2058
+ }
2059
+
2060
+ // this.getSpacer().title = this.getStateText();
2061
+
2062
+ ret = this.tree.fireEvent("collapseComplete", this);
2063
+
2064
+ },
2065
+
2066
+ /**
2067
+ * Shows this nodes children (creating them if necessary), changes the
2068
+ * toggle style, and collapses its siblings if multiExpand is not set.
2069
+ * @method expand
2070
+ */
2071
+ expand: function(lazySource) {
2072
+ // Only expand if currently collapsed.
2073
+ if (this.isLoading || (this.expanded && !lazySource)) {
2074
+ return;
2075
+ }
2076
+
2077
+ var ret = true;
2078
+
2079
+ // When returning from the lazy load handler, expand is called again
2080
+ // in order to render the new children. The "expand" event already
2081
+ // fired before fething the new data, so we need to skip it now.
2082
+ if (!lazySource) {
2083
+ // fire the expand event handler
2084
+ ret = this.tree.onExpand(this);
2085
+
2086
+ if (false === ret) {
2087
+ this.logger.log("Expand was stopped by the abstract onExpand");
2088
+ return;
2089
+ }
2090
+
2091
+ ret = this.tree.fireEvent("expand", this);
2092
+ }
2093
+
2094
+ if (false === ret) {
2095
+ this.logger.log("Expand was stopped by the custom event handler");
2096
+ return;
2097
+ }
2098
+
2099
+ if (!this.getEl()) {
2100
+ this.expanded = true;
2101
+ return;
2102
+ }
2103
+
2104
+ if (!this.childrenRendered) {
2105
+ this.logger.log("children not rendered yet");
2106
+ this.getChildrenEl().innerHTML = this.renderChildren();
2107
+ } else {
2108
+ this.logger.log("children already rendered");
2109
+ }
2110
+
2111
+ this.expanded = true;
2112
+
2113
+ this.updateIcon();
2114
+
2115
+ // this.getSpacer().title = this.getStateText();
2116
+
2117
+ // We do an extra check for children here because the lazy
2118
+ // load feature can expose nodes that have no children.
2119
+
2120
+ // if (!this.hasChildren()) {
2121
+ if (this.isLoading) {
2122
+ this.expanded = false;
2123
+ return;
2124
+ }
2125
+
2126
+ if (! this.multiExpand) {
2127
+ var sibs = this.getSiblings();
2128
+ for (var i=0; sibs && i<sibs.length; ++i) {
2129
+ if (sibs[i] != this && sibs[i].expanded) {
2130
+ sibs[i].collapse();
2131
+ }
2132
+ }
2133
+ }
2134
+
2135
+ this.showChildren();
2136
+
2137
+ ret = this.tree.fireEvent("expandComplete", this);
2138
+ },
2139
+
2140
+ updateIcon: function() {
2141
+ if (this.hasIcon) {
2142
+ var el = this.getToggleEl();
2143
+ if (el) {
2144
+ el.className = el.className.replace(/\bygtv(([tl][pmn]h?)|(loading))\b/gi,this.getStyle());
2145
+ }
2146
+ }
2147
+ },
2148
+
2149
+ /**
2150
+ * Returns the css style name for the toggle
2151
+ * @method getStyle
2152
+ * @return {string} the css class for this node's toggle
2153
+ */
2154
+ getStyle: function() {
2155
+ // this.logger.log("No children, " + " isDyanmic: " + this.isDynamic() + " expanded: " + this.expanded);
2156
+ if (this.isLoading) {
2157
+ this.logger.log("returning the loading icon");
2158
+ return "ygtvloading";
2159
+ } else {
2160
+ // location top or bottom, middle nodes also get the top style
2161
+ var loc = (this.nextSibling) ? "t" : "l";
2162
+
2163
+ // type p=plus(expand), m=minus(collapase), n=none(no children)
2164
+ var type = "n";
2165
+ if (this.hasChildren(true) || (this.isDynamic() && !this.getIconMode())) {
2166
+ // if (this.hasChildren(true)) {
2167
+ type = (this.expanded) ? "m" : "p";
2168
+ }
2169
+
2170
+ // this.logger.log("ygtv" + loc + type);
2171
+ return "ygtv" + loc + type;
2172
+ }
2173
+ },
2174
+
2175
+ /**
2176
+ * Returns the hover style for the icon
2177
+ * @return {string} the css class hover state
2178
+ * @method getHoverStyle
2179
+ */
2180
+ getHoverStyle: function() {
2181
+ var s = this.getStyle();
2182
+ if (this.hasChildren(true) && !this.isLoading) {
2183
+ s += "h";
2184
+ }
2185
+ return s;
2186
+ },
2187
+
2188
+ /**
2189
+ * Recursively expands all of this node's children.
2190
+ * @method expandAll
2191
+ */
2192
+ expandAll: function() {
2193
+ var l = this.children.length;
2194
+ for (var i=0;i<l;++i) {
2195
+ var c = this.children[i];
2196
+ if (c.isDynamic()) {
2197
+ this.logger.log("Not supported (lazy load + expand all)");
2198
+ break;
2199
+ } else if (! c.multiExpand) {
2200
+ this.logger.log("Not supported (no multi-expand + expand all)");
2201
+ break;
2202
+ } else {
2203
+ c.expand();
2204
+ c.expandAll();
2205
+ }
2206
+ }
2207
+ },
2208
+
2209
+ /**
2210
+ * Recursively collapses all of this node's children.
2211
+ * @method collapseAll
2212
+ */
2213
+ collapseAll: function() {
2214
+ for (var i=0;i<this.children.length;++i) {
2215
+ this.children[i].collapse();
2216
+ this.children[i].collapseAll();
2217
+ }
2218
+ },
2219
+
2220
+ /**
2221
+ * Configures this node for dynamically obtaining the child data
2222
+ * when the node is first expanded. Calling it without the callback
2223
+ * will turn off dynamic load for the node.
2224
+ * @method setDynamicLoad
2225
+ * @param fmDataLoader {function} the function that will be used to get the data.
2226
+ * @param iconMode {int} configures the icon that is displayed when a dynamic
2227
+ * load node is expanded the first time without children. By default, the
2228
+ * "collapse" icon will be used. If set to 1, the leaf node icon will be
2229
+ * displayed.
2230
+ */
2231
+ setDynamicLoad: function(fnDataLoader, iconMode) {
2232
+ if (fnDataLoader) {
2233
+ this.dataLoader = fnDataLoader;
2234
+ this._dynLoad = true;
2235
+ } else {
2236
+ this.dataLoader = null;
2237
+ this._dynLoad = false;
2238
+ }
2239
+
2240
+ if (iconMode) {
2241
+ this.iconMode = iconMode;
2242
+ }
2243
+ },
2244
+
2245
+ /**
2246
+ * Evaluates if this node is the root node of the tree
2247
+ * @method isRoot
2248
+ * @return {boolean} true if this is the root node
2249
+ */
2250
+ isRoot: function() {
2251
+ return (this == this.tree.root);
2252
+ },
2253
+
2254
+ /**
2255
+ * Evaluates if this node's children should be loaded dynamically. Looks for
2256
+ * the property both in this instance and the root node. If the tree is
2257
+ * defined to load all children dynamically, the data callback function is
2258
+ * defined in the root node
2259
+ * @method isDynamic
2260
+ * @return {boolean} true if this node's children are to be loaded dynamically
2261
+ */
2262
+ isDynamic: function() {
2263
+ if (this.isLeaf) {
2264
+ return false;
2265
+ } else {
2266
+ return (!this.isRoot() && (this._dynLoad || this.tree.root._dynLoad));
2267
+ // this.logger.log("isDynamic: " + lazy);
2268
+ // return lazy;
2269
+ }
2270
+ },
2271
+
2272
+ /**
2273
+ * Returns the current icon mode. This refers to the way childless dynamic
2274
+ * load nodes appear (this comes into play only after the initial dynamic
2275
+ * load request produced no children).
2276
+ * @method getIconMode
2277
+ * @return {int} 0 for collapse style, 1 for leaf node style
2278
+ */
2279
+ getIconMode: function() {
2280
+ return (this.iconMode || this.tree.root.iconMode);
2281
+ },
2282
+
2283
+ /**
2284
+ * Checks if this node has children. If this node is lazy-loading and the
2285
+ * children have not been rendered, we do not know whether or not there
2286
+ * are actual children. In most cases, we need to assume that there are
2287
+ * children (for instance, the toggle needs to show the expandable
2288
+ * presentation state). In other times we want to know if there are rendered
2289
+ * children. For the latter, "checkForLazyLoad" should be false.
2290
+ * @method hasChildren
2291
+ * @param checkForLazyLoad {boolean} should we check for unloaded children?
2292
+ * @return {boolean} true if this has children or if it might and we are
2293
+ * checking for this condition.
2294
+ */
2295
+ hasChildren: function(checkForLazyLoad) {
2296
+ if (this.isLeaf) {
2297
+ return false;
2298
+ } else {
2299
+ return ( this.children.length > 0 ||
2300
+ (checkForLazyLoad && this.isDynamic() && !this.dynamicLoadComplete)
2301
+ );
2302
+ }
2303
+ },
2304
+
2305
+ /**
2306
+ * Expands if node is collapsed, collapses otherwise.
2307
+ * @method toggle
2308
+ */
2309
+ toggle: function() {
2310
+ if (!this.tree.locked && ( this.hasChildren(true) || this.isDynamic()) ) {
2311
+ if (this.expanded) { this.collapse(); } else { this.expand(); }
2312
+ }
2313
+ },
2314
+
2315
+ /**
2316
+ * Returns the markup for this node and its children.
2317
+ * @method getHtml
2318
+ * @return {string} the markup for this node and its expanded children.
2319
+ */
2320
+ getHtml: function() {
2321
+
2322
+ this.childrenRendered = false;
2323
+
2324
+ return ['<div class="ygtvitem" id="' , this.getElId() , '">' ,this.getNodeHtml() , this.getChildrenHtml() ,'</div>'].join("");
2325
+ },
2326
+
2327
+ /**
2328
+ * Called when first rendering the tree. We always build the div that will
2329
+ * contain this nodes children, but we don't render the children themselves
2330
+ * unless this node is expanded.
2331
+ * @method getChildrenHtml
2332
+ * @return {string} the children container div html and any expanded children
2333
+ * @private
2334
+ */
2335
+ getChildrenHtml: function() {
2336
+
2337
+
2338
+ var sb = [];
2339
+ sb[sb.length] = '<div class="ygtvchildren" id="' + this.getChildrenElId() + '"';
2340
+
2341
+ // This is a workaround for an IE rendering issue, the child div has layout
2342
+ // in IE, creating extra space if a leaf node is created with the expanded
2343
+ // property set to true.
2344
+ if (!this.expanded || !this.hasChildren()) {
2345
+ sb[sb.length] = ' style="display:none;"';
2346
+ }
2347
+ sb[sb.length] = '>';
2348
+
2349
+ // this.logger.log(["index", this.index,
2350
+ // "hasChildren", this.hasChildren(true),
2351
+ // "expanded", this.expanded,
2352
+ // "renderHidden", this.renderHidden,
2353
+ // "isDynamic", this.isDynamic()]);
2354
+
2355
+ // Don't render the actual child node HTML unless this node is expanded.
2356
+ if ( (this.hasChildren(true) && this.expanded) ||
2357
+ (this.renderHidden && !this.isDynamic()) ) {
2358
+ sb[sb.length] = this.renderChildren();
2359
+ }
2360
+
2361
+ sb[sb.length] = '</div>';
2362
+
2363
+ return sb.join("");
2364
+ },
2365
+
2366
+ /**
2367
+ * Generates the markup for the child nodes. This is not done until the node
2368
+ * is expanded.
2369
+ * @method renderChildren
2370
+ * @return {string} the html for this node's children
2371
+ * @private
2372
+ */
2373
+ renderChildren: function() {
2374
+
2375
+ this.logger.log("rendering children for " + this.index);
2376
+
2377
+ var node = this;
2378
+
2379
+ if (this.isDynamic() && !this.dynamicLoadComplete) {
2380
+ this.isLoading = true;
2381
+ this.tree.locked = true;
2382
+
2383
+ if (this.dataLoader) {
2384
+ this.logger.log("Using dynamic loader defined for this node");
2385
+
2386
+ setTimeout(
2387
+ function() {
2388
+ node.dataLoader(node,
2389
+ function() {
2390
+ node.loadComplete();
2391
+ });
2392
+ }, 10);
2393
+
2394
+ } else if (this.tree.root.dataLoader) {
2395
+ this.logger.log("Using the tree-level dynamic loader");
2396
+
2397
+ setTimeout(
2398
+ function() {
2399
+ node.tree.root.dataLoader(node,
2400
+ function() {
2401
+ node.loadComplete();
2402
+ });
2403
+ }, 10);
2404
+
2405
+ } else {
2406
+ this.logger.log("no loader found");
2407
+ return "Error: data loader not found or not specified.";
2408
+ }
2409
+
2410
+ return "";
2411
+
2412
+ } else {
2413
+ return this.completeRender();
2414
+ }
2415
+ },
2416
+
2417
+ /**
2418
+ * Called when we know we have all the child data.
2419
+ * @method completeRender
2420
+ * @return {string} children html
2421
+ */
2422
+ completeRender: function() {
2423
+ this.logger.log("completeRender: " + this.index + ", # of children: " + this.children.length);
2424
+ var sb = [];
2425
+
2426
+ for (var i=0; i < this.children.length; ++i) {
2427
+ // this.children[i].childrenRendered = false;
2428
+ sb[sb.length] = this.children[i].getHtml();
2429
+ }
2430
+
2431
+ this.childrenRendered = true;
2432
+
2433
+ return sb.join("");
2434
+ },
2435
+
2436
+ /**
2437
+ * Load complete is the callback function we pass to the data provider
2438
+ * in dynamic load situations.
2439
+ * @method loadComplete
2440
+ */
2441
+ loadComplete: function() {
2442
+ this.logger.log(this.index + " loadComplete, children: " + this.children.length);
2443
+ this.getChildrenEl().innerHTML = this.completeRender();
2444
+ if (this.propagateHighlightDown) {
2445
+ if (this.highlightState === 1 && !this.tree.singleNodeHighlight) {
2446
+ for (var i = 0; i < this.children.length; i++) {
2447
+ this.children[i].highlight(true);
2448
+ }
2449
+ } else if (this.highlightState === 0 || this.tree.singleNodeHighlight) {
2450
+ for (i = 0; i < this.children.length; i++) {
2451
+ this.children[i].unhighlight(true);
2452
+ }
2453
+ } // if (highlighState == 2) leave child nodes with whichever highlight state they are set
2454
+ }
2455
+
2456
+ this.dynamicLoadComplete = true;
2457
+ this.isLoading = false;
2458
+ this.expand(true);
2459
+ this.tree.locked = false;
2460
+ },
2461
+
2462
+ /**
2463
+ * Returns this node's ancestor at the specified depth.
2464
+ * @method getAncestor
2465
+ * @param {int} depth the depth of the ancestor.
2466
+ * @return {Node} the ancestor
2467
+ */
2468
+ getAncestor: function(depth) {
2469
+ if (depth >= this.depth || depth < 0) {
2470
+ this.logger.log("illegal getAncestor depth: " + depth);
2471
+ return null;
2472
+ }
2473
+
2474
+ var p = this.parent;
2475
+
2476
+ while (p.depth > depth) {
2477
+ p = p.parent;
2478
+ }
2479
+
2480
+ return p;
2481
+ },
2482
+
2483
+ /**
2484
+ * Returns the css class for the spacer at the specified depth for
2485
+ * this node. If this node's ancestor at the specified depth
2486
+ * has a next sibling the presentation is different than if it
2487
+ * does not have a next sibling
2488
+ * @method getDepthStyle
2489
+ * @param {int} depth the depth of the ancestor.
2490
+ * @return {string} the css class for the spacer
2491
+ */
2492
+ getDepthStyle: function(depth) {
2493
+ return (this.getAncestor(depth).nextSibling) ?
2494
+ "ygtvdepthcell" : "ygtvblankdepthcell";
2495
+ },
2496
+
2497
+ /**
2498
+ * Get the markup for the node. This may be overrided so that we can
2499
+ * support different types of nodes.
2500
+ * @method getNodeHtml
2501
+ * @return {string} The HTML that will render this node.
2502
+ */
2503
+ getNodeHtml: function() {
2504
+ this.logger.log("Generating html");
2505
+ var sb = [];
2506
+
2507
+ sb[sb.length] = '<table id="ygtvtableel' + this.index + '" border="0" cellpadding="0" cellspacing="0" class="ygtvtable ygtvdepth' + this.depth;
2508
+ if (this.enableHighlight) {
2509
+ sb[sb.length] = ' ygtv-highlight' + this.highlightState;
2510
+ }
2511
+ if (this.className) {
2512
+ sb[sb.length] = ' ' + this.className;
2513
+ }
2514
+ sb[sb.length] = '"><tr class="ygtvrow">';
2515
+
2516
+ for (var i=0;i<this.depth;++i) {
2517
+ sb[sb.length] = '<td class="ygtvcell ' + this.getDepthStyle(i) + '"><div class="ygtvspacer"></div></td>';
2518
+ }
2519
+
2520
+ if (this.hasIcon) {
2521
+ sb[sb.length] = '<td id="' + this.getToggleElId();
2522
+ sb[sb.length] = '" class="ygtvcell ';
2523
+ sb[sb.length] = this.getStyle() ;
2524
+ sb[sb.length] = '"><a href="#" class="ygtvspacer">&#160;</a></td>';
2525
+ }
2526
+
2527
+ sb[sb.length] = '<td id="' + this.contentElId;
2528
+ sb[sb.length] = '" class="ygtvcell ';
2529
+ sb[sb.length] = this.contentStyle + ' ygtvcontent" ';
2530
+ sb[sb.length] = (this.nowrap) ? ' nowrap="nowrap" ' : '';
2531
+ sb[sb.length] = ' >';
2532
+ sb[sb.length] = this.getContentHtml();
2533
+ sb[sb.length] = '</td></tr></table>';
2534
+
2535
+ return sb.join("");
2536
+
2537
+ },
2538
+ /**
2539
+ * Get the markup for the contents of the node. This is designed to be overrided so that we can
2540
+ * support different types of nodes.
2541
+ * @method getContentHtml
2542
+ * @return {string} The HTML that will render the content of this node.
2543
+ */
2544
+ getContentHtml: function () {
2545
+ return "";
2546
+ },
2547
+
2548
+ /**
2549
+ * Regenerates the html for this node and its children. To be used when the
2550
+ * node is expanded and new children have been added.
2551
+ * @method refresh
2552
+ */
2553
+ refresh: function() {
2554
+ // this.loadComplete();
2555
+ this.getChildrenEl().innerHTML = this.completeRender();
2556
+
2557
+ if (this.hasIcon) {
2558
+ var el = this.getToggleEl();
2559
+ if (el) {
2560
+ el.className = el.className.replace(/\bygtv[lt][nmp]h*\b/gi,this.getStyle());
2561
+ }
2562
+ }
2563
+ },
2564
+
2565
+ /**
2566
+ * Node toString
2567
+ * @method toString
2568
+ * @return {string} string representation of the node
2569
+ */
2570
+ toString: function() {
2571
+ return this._type + " (" + this.index + ")";
2572
+ },
2573
+ /**
2574
+ * array of items that had the focus set on them
2575
+ * so that they can be cleaned when focus is lost
2576
+ * @property _focusHighlightedItems
2577
+ * @type Array of DOM elements
2578
+ * @private
2579
+ */
2580
+ _focusHighlightedItems: [],
2581
+ /**
2582
+ * DOM element that actually got the browser focus
2583
+ * @property _focusedItem
2584
+ * @type DOM element
2585
+ * @private
2586
+ */
2587
+ _focusedItem: null,
2588
+
2589
+ /**
2590
+ * Returns true if there are any elements in the node that can
2591
+ * accept the real actual browser focus
2592
+ * @method _canHaveFocus
2593
+ * @return {boolean} success
2594
+ * @private
2595
+ */
2596
+ _canHaveFocus: function() {
2597
+ return this.getEl().getElementsByTagName('a').length > 0;
2598
+ },
2599
+ /**
2600
+ * Removes the focus of previously selected Node
2601
+ * @method _removeFocus
2602
+ * @private
2603
+ */
2604
+ _removeFocus:function () {
2605
+ if (this._focusedItem) {
2606
+ Event.removeListener(this._focusedItem,'blur');
2607
+ this._focusedItem = null;
2608
+ }
2609
+ var el;
2610
+ while ((el = this._focusHighlightedItems.shift())) { // yes, it is meant as an assignment, really
2611
+ Dom.removeClass(el,YAHOO.widget.TreeView.FOCUS_CLASS_NAME );
2612
+ }
2613
+ },
2614
+ /**
2615
+ * Sets the focus on the node element.
2616
+ * It will only be able to set the focus on nodes that have anchor elements in it.
2617
+ * Toggle or branch icons have anchors and can be focused on.
2618
+ * If will fail in nodes that have no anchor
2619
+ * @method focus
2620
+ * @return {boolean} success
2621
+ */
2622
+ focus: function () {
2623
+ var focused = false, self = this;
2624
+
2625
+ if (this.tree.currentFocus) {
2626
+ this.tree.currentFocus._removeFocus();
2627
+ }
2628
+
2629
+ var expandParent = function (node) {
2630
+ if (node.parent) {
2631
+ expandParent(node.parent);
2632
+ node.parent.expand();
2633
+ }
2634
+ };
2635
+ expandParent(this);
2636
+
2637
+ Dom.getElementsBy (
2638
+ function (el) {
2639
+ return (/ygtv(([tl][pmn]h?)|(content))/).test(el.className);
2640
+ } ,
2641
+ 'td' ,
2642
+ self.getEl().firstChild ,
2643
+ function (el) {
2644
+ Dom.addClass(el, YAHOO.widget.TreeView.FOCUS_CLASS_NAME );
2645
+ if (!focused) {
2646
+ var aEl = el.getElementsByTagName('a');
2647
+ if (aEl.length) {
2648
+ aEl = aEl[0];
2649
+ aEl.focus();
2650
+ self._focusedItem = aEl;
2651
+ Event.on(aEl,'blur',function () {
2652
+ //console.log('f1');
2653
+ self.tree.fireEvent('focusChanged',{oldNode:self.tree.currentFocus,newNode:null});
2654
+ self.tree.currentFocus = null;
2655
+ self._removeFocus();
2656
+ });
2657
+ focused = true;
2658
+ }
2659
+ }
2660
+ self._focusHighlightedItems.push(el);
2661
+ }
2662
+ );
2663
+ if (focused) {
2664
+ //console.log('f2');
2665
+ this.tree.fireEvent('focusChanged',{oldNode:this.tree.currentFocus,newNode:this});
2666
+ this.tree.currentFocus = this;
2667
+ } else {
2668
+ //console.log('f3');
2669
+ this.tree.fireEvent('focusChanged',{oldNode:self.tree.currentFocus,newNode:null});
2670
+ this.tree.currentFocus = null;
2671
+ this._removeFocus();
2672
+ }
2673
+ return focused;
2674
+ },
2675
+
2676
+ /**
2677
+ * Count of nodes in a branch
2678
+ * @method getNodeCount
2679
+ * @return {int} number of nodes in the branch
2680
+ */
2681
+ getNodeCount: function() {
2682
+ for (var i = 0, count = 0;i< this.children.length;i++) {
2683
+ count += this.children[i].getNodeCount();
2684
+ }
2685
+ return count + 1;
2686
+ },
2687
+
2688
+ /**
2689
+ * Returns an object which could be used to build a tree out of this node and its children.
2690
+ * It can be passed to the tree constructor to reproduce this node as a tree.
2691
+ * It will return false if the node or any children loads dynamically, regardless of whether it is loaded or not.
2692
+ * @method getNodeDefinition
2693
+ * @return {Object | false} definition of the tree or false if the node or any children is defined as dynamic
2694
+ */
2695
+ getNodeDefinition: function() {
2696
+
2697
+ if (this.isDynamic()) { return false; }
2698
+
2699
+ var def, defs = Lang.merge(this.data), children = [];
2700
+
2701
+
2702
+
2703
+ if (this.expanded) {defs.expanded = this.expanded; }
2704
+ if (!this.multiExpand) { defs.multiExpand = this.multiExpand; }
2705
+ if (!this.renderHidden) { defs.renderHidden = this.renderHidden; }
2706
+ if (!this.hasIcon) { defs.hasIcon = this.hasIcon; }
2707
+ if (this.nowrap) { defs.nowrap = this.nowrap; }
2708
+ if (this.className) { defs.className = this.className; }
2709
+ if (this.editable) { defs.editable = this.editable; }
2710
+ if (this.enableHighlight) { defs.enableHighlight = this.enableHighlight; }
2711
+ if (this.highlightState) { defs.highlightState = this.highlightState; }
2712
+ if (this.propagateHighlightUp) { defs.propagateHighlightUp = this.propagateHighlightUp; }
2713
+ if (this.propagateHighlightDown) { defs.propagateHighlightDown = this.propagateHighlightDown; }
2714
+ defs.type = this._type;
2715
+
2716
+
2717
+
2718
+ for (var i = 0; i < this.children.length;i++) {
2719
+ def = this.children[i].getNodeDefinition();
2720
+ if (def === false) { return false;}
2721
+ children.push(def);
2722
+ }
2723
+ if (children.length) { defs.children = children; }
2724
+ return defs;
2725
+ },
2726
+
2727
+
2728
+ /**
2729
+ * Generates the link that will invoke this node's toggle method
2730
+ * @method getToggleLink
2731
+ * @return {string} the javascript url for toggling this node
2732
+ */
2733
+ getToggleLink: function() {
2734
+ return 'return false;';
2735
+ },
2736
+
2737
+ /**
2738
+ * Sets the value of property for this node and all loaded descendants.
2739
+ * Only public and defined properties can be set, not methods.
2740
+ * Values for unknown properties will be assigned to the refNode.data object
2741
+ * @method setNodesProperty
2742
+ * @param name {string} Name of the property to be set
2743
+ * @param value {any} value to be set
2744
+ * @param refresh {boolean} if present and true, it does a refresh
2745
+ */
2746
+ setNodesProperty: function(name, value, refresh) {
2747
+ if (name.charAt(0) != '_' && !Lang.isUndefined(this[name]) && !Lang.isFunction(this[name]) ) {
2748
+ this[name] = value;
2749
+ } else {
2750
+ this.data[name] = value;
2751
+ }
2752
+ for (var i = 0; i < this.children.length;i++) {
2753
+ this.children[i].setNodesProperty(name,value);
2754
+ }
2755
+ if (refresh) {
2756
+ this.refresh();
2757
+ }
2758
+ },
2759
+ /**
2760
+ * Toggles the highlighted state of a Node
2761
+ * @method toggleHighlight
2762
+ */
2763
+ toggleHighlight: function() {
2764
+ if (this.enableHighlight) {
2765
+ // unhighlights only if fully highligthed. For not or partially highlighted it will highlight
2766
+ if (this.highlightState == 1) {
2767
+ this.unhighlight();
2768
+ } else {
2769
+ this.highlight();
2770
+ }
2771
+ }
2772
+ },
2773
+
2774
+ /**
2775
+ * Turns highlighting on node.
2776
+ * @method highlight
2777
+ * @param _silent {boolean} optional, don't fire the highlightEvent
2778
+ */
2779
+ highlight: function(_silent) {
2780
+ if (this.enableHighlight) {
2781
+ if (this.tree.singleNodeHighlight) {
2782
+ if (this.tree._currentlyHighlighted) {
2783
+ this.tree._currentlyHighlighted.unhighlight(_silent);
2784
+ }
2785
+ this.tree._currentlyHighlighted = this;
2786
+ }
2787
+ this.highlightState = 1;
2788
+ this._setHighlightClassName();
2789
+ if (!this.tree.singleNodeHighlight) {
2790
+ if (this.propagateHighlightDown) {
2791
+ for (var i = 0;i < this.children.length;i++) {
2792
+ this.children[i].highlight(true);
2793
+ }
2794
+ }
2795
+ if (this.propagateHighlightUp) {
2796
+ if (this.parent) {
2797
+ this.parent._childrenHighlighted();
2798
+ }
2799
+ }
2800
+ }
2801
+ if (!_silent) {
2802
+ this.tree.fireEvent('highlightEvent',this);
2803
+ }
2804
+ }
2805
+ },
2806
+ /**
2807
+ * Turns highlighting off a node.
2808
+ * @method unhighlight
2809
+ * @param _silent {boolean} optional, don't fire the highlightEvent
2810
+ */
2811
+ unhighlight: function(_silent) {
2812
+ if (this.enableHighlight) {
2813
+ // might have checked singleNodeHighlight but it wouldn't really matter either way
2814
+ this.tree._currentlyHighlighted = null;
2815
+ this.highlightState = 0;
2816
+ this._setHighlightClassName();
2817
+ if (!this.tree.singleNodeHighlight) {
2818
+ if (this.propagateHighlightDown) {
2819
+ for (var i = 0;i < this.children.length;i++) {
2820
+ this.children[i].unhighlight(true);
2821
+ }
2822
+ }
2823
+ if (this.propagateHighlightUp) {
2824
+ if (this.parent) {
2825
+ this.parent._childrenHighlighted();
2826
+ }
2827
+ }
2828
+ }
2829
+ if (!_silent) {
2830
+ this.tree.fireEvent('highlightEvent',this);
2831
+ }
2832
+ }
2833
+ },
2834
+ /**
2835
+ * Checks whether all or part of the children of a node are highlighted and
2836
+ * sets the node highlight to full, none or partial highlight.
2837
+ * If set to propagate it will further call the parent
2838
+ * @method _childrenHighlighted
2839
+ * @private
2840
+ */
2841
+ _childrenHighlighted: function() {
2842
+ var yes = false, no = false;
2843
+ if (this.enableHighlight) {
2844
+ for (var i = 0;i < this.children.length;i++) {
2845
+ switch(this.children[i].highlightState) {
2846
+ case 0:
2847
+ no = true;
2848
+ break;
2849
+ case 1:
2850
+ yes = true;
2851
+ break;
2852
+ case 2:
2853
+ yes = no = true;
2854
+ break;
2855
+ }
2856
+ }
2857
+ if (yes && no) {
2858
+ this.highlightState = 2;
2859
+ } else if (yes) {
2860
+ this.highlightState = 1;
2861
+ } else {
2862
+ this.highlightState = 0;
2863
+ }
2864
+ this._setHighlightClassName();
2865
+ if (this.propagateHighlightUp) {
2866
+ if (this.parent) {
2867
+ this.parent._childrenHighlighted();
2868
+ }
2869
+ }
2870
+ }
2871
+ },
2872
+
2873
+ /**
2874
+ * Changes the classNames on the toggle and content containers to reflect the current highlighting
2875
+ * @method _setHighlightClassName
2876
+ * @private
2877
+ */
2878
+ _setHighlightClassName: function() {
2879
+ var el = Dom.get('ygtvtableel' + this.index);
2880
+ if (el) {
2881
+ el.className = el.className.replace(/\bygtv-highlight\d\b/gi,'ygtv-highlight' + this.highlightState);
2882
+ }
2883
+ }
2884
+
2885
+ };
2886
+
2887
+ YAHOO.augment(YAHOO.widget.Node, YAHOO.util.EventProvider);
2888
+ })();
2889
+
2890
+ /**
2891
+ * A custom YAHOO.widget.Node that handles the unique nature of
2892
+ * the virtual, presentationless root node.
2893
+ * @namespace YAHOO.widget
2894
+ * @class RootNode
2895
+ * @extends YAHOO.widget.Node
2896
+ * @param oTree {YAHOO.widget.TreeView} The tree instance this node belongs to
2897
+ * @constructor
2898
+ */
2899
+ YAHOO.widget.RootNode = function(oTree) {
2900
+ // Initialize the node with null params. The root node is a
2901
+ // special case where the node has no presentation. So we have
2902
+ // to alter the standard properties a bit.
2903
+ this.init(null, null, true);
2904
+
2905
+ /*
2906
+ * For the root node, we get the tree reference from as a param
2907
+ * to the constructor instead of from the parent element.
2908
+ */
2909
+ this.tree = oTree;
2910
+ };
2911
+
2912
+ YAHOO.extend(YAHOO.widget.RootNode, YAHOO.widget.Node, {
2913
+
2914
+ /**
2915
+ * The node type
2916
+ * @property _type
2917
+ * @type string
2918
+ * @private
2919
+ * @default "RootNode"
2920
+ */
2921
+ _type: "RootNode",
2922
+
2923
+ // overrides YAHOO.widget.Node
2924
+ getNodeHtml: function() {
2925
+ return "";
2926
+ },
2927
+
2928
+ toString: function() {
2929
+ return this._type;
2930
+ },
2931
+
2932
+ loadComplete: function() {
2933
+ this.tree.draw();
2934
+ },
2935
+
2936
+ /**
2937
+ * Count of nodes in tree.
2938
+ * It overrides Nodes.getNodeCount because the root node should not be counted.
2939
+ * @method getNodeCount
2940
+ * @return {int} number of nodes in the tree
2941
+ */
2942
+ getNodeCount: function() {
2943
+ for (var i = 0, count = 0;i< this.children.length;i++) {
2944
+ count += this.children[i].getNodeCount();
2945
+ }
2946
+ return count;
2947
+ },
2948
+
2949
+ /**
2950
+ * Returns an object which could be used to build a tree out of this node and its children.
2951
+ * It can be passed to the tree constructor to reproduce this node as a tree.
2952
+ * Since the RootNode is automatically created by treeView,
2953
+ * its own definition is excluded from the returned node definition
2954
+ * which only contains its children.
2955
+ * @method getNodeDefinition
2956
+ * @return {Object | false} definition of the tree or false if any child node is defined as dynamic
2957
+ */
2958
+ getNodeDefinition: function() {
2959
+
2960
+ for (var def, defs = [], i = 0; i < this.children.length;i++) {
2961
+ def = this.children[i].getNodeDefinition();
2962
+ if (def === false) { return false;}
2963
+ defs.push(def);
2964
+ }
2965
+ return defs;
2966
+ },
2967
+
2968
+ collapse: function() {},
2969
+ expand: function() {},
2970
+ getSiblings: function() { return null; },
2971
+ focus: function () {}
2972
+
2973
+ });
2974
+
2975
+ (function () {
2976
+ var Dom = YAHOO.util.Dom,
2977
+ Lang = YAHOO.lang,
2978
+ Event = YAHOO.util.Event;
2979
+ /**
2980
+ * The default node presentation. The first parameter should be
2981
+ * either a string that will be used as the node's label, or an object
2982
+ * that has at least a string property called label. By default, clicking the
2983
+ * label will toggle the expanded/collapsed state of the node. By
2984
+ * setting the href property of the instance, this behavior can be
2985
+ * changed so that the label will go to the specified href.
2986
+ * @namespace YAHOO.widget
2987
+ * @class TextNode
2988
+ * @extends YAHOO.widget.Node
2989
+ * @constructor
2990
+ * @param oData {object} a string or object containing the data that will
2991
+ * be used to render this node.
2992
+ * Providing a string is the same as providing an object with a single property named label.
2993
+ * All values in the oData will be used to set equally named properties in the node
2994
+ * as long as the node does have such properties, they are not undefined, private or functions.
2995
+ * All attributes are made available in noderef.data, which
2996
+ * can be used to store custom attributes. TreeView.getNode(s)ByProperty
2997
+ * can be used to retrieve a node by one of the attributes.
2998
+ * @param oParent {YAHOO.widget.Node} this node's parent node
2999
+ * @param expanded {boolean} the initial expanded/collapsed state (deprecated; use oData.expanded)
3000
+ */
3001
+ YAHOO.widget.TextNode = function(oData, oParent, expanded) {
3002
+
3003
+ if (oData) {
3004
+ if (Lang.isString(oData)) {
3005
+ oData = { label: oData };
3006
+ }
3007
+ this.init(oData, oParent, expanded);
3008
+ this.setUpLabel(oData);
3009
+ }
3010
+
3011
+ this.logger = new YAHOO.widget.LogWriter(this.toString());
3012
+ };
3013
+
3014
+ YAHOO.extend(YAHOO.widget.TextNode, YAHOO.widget.Node, {
3015
+
3016
+ /**
3017
+ * The CSS class for the label href. Defaults to ygtvlabel, but can be
3018
+ * overridden to provide a custom presentation for a specific node.
3019
+ * @property labelStyle
3020
+ * @type string
3021
+ */
3022
+ labelStyle: "ygtvlabel",
3023
+
3024
+ /**
3025
+ * The derived element id of the label for this node
3026
+ * @property labelElId
3027
+ * @type string
3028
+ */
3029
+ labelElId: null,
3030
+
3031
+ /**
3032
+ * The text for the label. It is assumed that the oData parameter will
3033
+ * either be a string that will be used as the label, or an object that
3034
+ * has a property called "label" that we will use.
3035
+ * @property label
3036
+ * @type string
3037
+ */
3038
+ label: null,
3039
+
3040
+ /**
3041
+ * The text for the title (tooltip) for the label element
3042
+ * @property title
3043
+ * @type string
3044
+ */
3045
+ title: null,
3046
+
3047
+ /**
3048
+ * The href for the node's label. If one is not specified, the href will
3049
+ * be set so that it toggles the node.
3050
+ * @property href
3051
+ * @type string
3052
+ */
3053
+ href: null,
3054
+
3055
+ /**
3056
+ * The label href target, defaults to current window
3057
+ * @property target
3058
+ * @type string
3059
+ */
3060
+ target: "_self",
3061
+
3062
+ /**
3063
+ * The node type
3064
+ * @property _type
3065
+ * @private
3066
+ * @type string
3067
+ * @default "TextNode"
3068
+ */
3069
+ _type: "TextNode",
3070
+
3071
+
3072
+ /**
3073
+ * Sets up the node label
3074
+ * @method setUpLabel
3075
+ * @param oData string containing the label, or an object with a label property
3076
+ */
3077
+ setUpLabel: function(oData) {
3078
+
3079
+ if (Lang.isString(oData)) {
3080
+ oData = {
3081
+ label: oData
3082
+ };
3083
+ } else {
3084
+ if (oData.style) {
3085
+ this.labelStyle = oData.style;
3086
+ }
3087
+ }
3088
+
3089
+ this.label = oData.label;
3090
+
3091
+ this.labelElId = "ygtvlabelel" + this.index;
3092
+
3093
+ },
3094
+
3095
+ /**
3096
+ * Returns the label element
3097
+ * @for YAHOO.widget.TextNode
3098
+ * @method getLabelEl
3099
+ * @return {object} the element
3100
+ */
3101
+ getLabelEl: function() {
3102
+ return Dom.get(this.labelElId);
3103
+ },
3104
+
3105
+ // overrides YAHOO.widget.Node
3106
+ getContentHtml: function() {
3107
+ var sb = [];
3108
+ sb[sb.length] = this.href?'<a':'<span';
3109
+ sb[sb.length] = ' id="' + this.labelElId + '"';
3110
+ sb[sb.length] = ' class="' + this.labelStyle + '"';
3111
+ if (this.href) {
3112
+ sb[sb.length] = ' href="' + this.href + '"';
3113
+ sb[sb.length] = ' target="' + this.target + '"';
3114
+ }
3115
+ if (this.title) {
3116
+ sb[sb.length] = ' title="' + this.title + '"';
3117
+ }
3118
+ sb[sb.length] = ' >';
3119
+ sb[sb.length] = this.label;
3120
+ sb[sb.length] = this.href?'</a>':'</span>';
3121
+ return sb.join("");
3122
+ },
3123
+
3124
+
3125
+
3126
+ /**
3127
+ * Returns an object which could be used to build a tree out of this node and its children.
3128
+ * It can be passed to the tree constructor to reproduce this node as a tree.
3129
+ * It will return false if the node or any descendant loads dynamically, regardless of whether it is loaded or not.
3130
+ * @method getNodeDefinition
3131
+ * @return {Object | false} definition of the tree or false if this node or any descendant is defined as dynamic
3132
+ */
3133
+ getNodeDefinition: function() {
3134
+ var def = YAHOO.widget.TextNode.superclass.getNodeDefinition.call(this);
3135
+ if (def === false) { return false; }
3136
+
3137
+ // Node specific properties
3138
+ def.label = this.label;
3139
+ if (this.labelStyle != 'ygtvlabel') { def.style = this.labelStyle; }
3140
+ if (this.title) { def.title = this.title; }
3141
+ if (this.href) { def.href = this.href; }
3142
+ if (this.target != '_self') { def.target = this.target; }
3143
+
3144
+ return def;
3145
+
3146
+ },
3147
+
3148
+ toString: function() {
3149
+ return YAHOO.widget.TextNode.superclass.toString.call(this) + ": " + this.label;
3150
+ },
3151
+
3152
+ // deprecated
3153
+ onLabelClick: function() {
3154
+ return false;
3155
+ },
3156
+ refresh: function() {
3157
+ YAHOO.widget.TextNode.superclass.refresh.call(this);
3158
+ var label = this.getLabelEl();
3159
+ label.innerHTML = this.label;
3160
+ if (label.tagName.toUpperCase() == 'A') {
3161
+ label.href = this.href;
3162
+ label.target = this.target;
3163
+ }
3164
+ }
3165
+
3166
+
3167
+
3168
+
3169
+ });
3170
+ })();
3171
+
3172
+ /**
3173
+ * A menu-specific implementation that differs from TextNode in that only
3174
+ * one sibling can be expanded at a time.
3175
+ * @namespace YAHOO.widget
3176
+ * @class MenuNode
3177
+ * @extends YAHOO.widget.TextNode
3178
+ * @param oData {object} a string or object containing the data that will
3179
+ * be used to render this node.
3180
+ * Providing a string is the same as providing an object with a single property named label.
3181
+ * All values in the oData will be used to set equally named properties in the node
3182
+ * as long as the node does have such properties, they are not undefined, private or functions.
3183
+ * All attributes are made available in noderef.data, which
3184
+ * can be used to store custom attributes. TreeView.getNode(s)ByProperty
3185
+ * can be used to retrieve a node by one of the attributes.
3186
+ * @param oParent {YAHOO.widget.Node} this node's parent node
3187
+ * @param expanded {boolean} the initial expanded/collapsed state (deprecated; use oData.expanded)
3188
+ * @constructor
3189
+ */
3190
+ YAHOO.widget.MenuNode = function(oData, oParent, expanded) {
3191
+ YAHOO.widget.MenuNode.superclass.constructor.call(this,oData,oParent,expanded);
3192
+
3193
+ /*
3194
+ * Menus usually allow only one branch to be open at a time.
3195
+ */
3196
+ this.multiExpand = false;
3197
+
3198
+ };
3199
+
3200
+ YAHOO.extend(YAHOO.widget.MenuNode, YAHOO.widget.TextNode, {
3201
+
3202
+ /**
3203
+ * The node type
3204
+ * @property _type
3205
+ * @private
3206
+ * @default "MenuNode"
3207
+ */
3208
+ _type: "MenuNode"
3209
+
3210
+ });
3211
+
3212
+ (function () {
3213
+ var Dom = YAHOO.util.Dom,
3214
+ Lang = YAHOO.lang,
3215
+ Event = YAHOO.util.Event;
3216
+
3217
+ /**
3218
+ * This implementation takes either a string or object for the
3219
+ * oData argument. If is it a string, it will use it for the display
3220
+ * of this node (and it can contain any html code). If the parameter
3221
+ * is an object,it looks for a parameter called "html" that will be
3222
+ * used for this node's display.
3223
+ * @namespace YAHOO.widget
3224
+ * @class HTMLNode
3225
+ * @extends YAHOO.widget.Node
3226
+ * @constructor
3227
+ * @param oData {object} a string or object containing the data that will
3228
+ * be used to render this node.
3229
+ * Providing a string is the same as providing an object with a single property named html.
3230
+ * All values in the oData will be used to set equally named properties in the node
3231
+ * as long as the node does have such properties, they are not undefined, private or functions.
3232
+ * All other attributes are made available in noderef.data, which
3233
+ * can be used to store custom attributes. TreeView.getNode(s)ByProperty
3234
+ * can be used to retrieve a node by one of the attributes.
3235
+ * @param oParent {YAHOO.widget.Node} this node's parent node
3236
+ * @param expanded {boolean} the initial expanded/collapsed state (deprecated; use oData.expanded)
3237
+ * @param hasIcon {boolean} specifies whether or not leaf nodes should
3238
+ * be rendered with or without a horizontal line line and/or toggle icon. If the icon
3239
+ * is not displayed, the content fills the space it would have occupied.
3240
+ * This option operates independently of the leaf node presentation logic
3241
+ * for dynamic nodes.
3242
+ * (deprecated; use oData.hasIcon)
3243
+ */
3244
+ YAHOO.widget.HTMLNode = function(oData, oParent, expanded, hasIcon) {
3245
+ if (oData) {
3246
+ this.init(oData, oParent, expanded);
3247
+ this.initContent(oData, hasIcon);
3248
+ }
3249
+ };
3250
+
3251
+ YAHOO.extend(YAHOO.widget.HTMLNode, YAHOO.widget.Node, {
3252
+
3253
+ /**
3254
+ * The CSS class for the html content container. Defaults to ygtvhtml, but
3255
+ * can be overridden to provide a custom presentation for a specific node.
3256
+ * @property contentStyle
3257
+ * @type string
3258
+ */
3259
+ contentStyle: "ygtvhtml",
3260
+
3261
+
3262
+ /**
3263
+ * The HTML content to use for this node's display
3264
+ * @property html
3265
+ * @type string
3266
+ */
3267
+ html: null,
3268
+
3269
+ /**
3270
+ * The node type
3271
+ * @property _type
3272
+ * @private
3273
+ * @type string
3274
+ * @default "HTMLNode"
3275
+ */
3276
+ _type: "HTMLNode",
3277
+
3278
+ /**
3279
+ * Sets up the node label
3280
+ * @property initContent
3281
+ * @param oData {object} An html string or object containing an html property
3282
+ * @param hasIcon {boolean} determines if the node will be rendered with an
3283
+ * icon or not
3284
+ */
3285
+ initContent: function(oData, hasIcon) {
3286
+ this.setHtml(oData);
3287
+ this.contentElId = "ygtvcontentel" + this.index;
3288
+ if (!Lang.isUndefined(hasIcon)) { this.hasIcon = hasIcon; }
3289
+
3290
+ this.logger = new YAHOO.widget.LogWriter(this.toString());
3291
+ },
3292
+
3293
+ /**
3294
+ * Synchronizes the node.html, and the node's content
3295
+ * @property setHtml
3296
+ * @param o {object} An html string or object containing an html property
3297
+ */
3298
+ setHtml: function(o) {
3299
+
3300
+ this.html = (typeof o === "string") ? o : o.html;
3301
+
3302
+ var el = this.getContentEl();
3303
+ if (el) {
3304
+ el.innerHTML = this.html;
3305
+ }
3306
+
3307
+ },
3308
+
3309
+ // overrides YAHOO.widget.Node
3310
+ getContentHtml: function() {
3311
+ return this.html;
3312
+ },
3313
+
3314
+ /**
3315
+ * Returns an object which could be used to build a tree out of this node and its children.
3316
+ * It can be passed to the tree constructor to reproduce this node as a tree.
3317
+ * It will return false if any node loads dynamically, regardless of whether it is loaded or not.
3318
+ * @method getNodeDefinition
3319
+ * @return {Object | false} definition of the tree or false if any node is defined as dynamic
3320
+ */
3321
+ getNodeDefinition: function() {
3322
+ var def = YAHOO.widget.HTMLNode.superclass.getNodeDefinition.call(this);
3323
+ if (def === false) { return false; }
3324
+ def.html = this.html;
3325
+ return def;
3326
+
3327
+ }
3328
+ });
3329
+ })();
3330
+
3331
+ (function () {
3332
+ var Dom = YAHOO.util.Dom,
3333
+ Lang = YAHOO.lang,
3334
+ Event = YAHOO.util.Event,
3335
+ Calendar = YAHOO.widget.Calendar;
3336
+
3337
+ /**
3338
+ * A Date-specific implementation that differs from TextNode in that it uses
3339
+ * YAHOO.widget.Calendar as an in-line editor, if available
3340
+ * If Calendar is not available, it behaves as a plain TextNode.
3341
+ * @namespace YAHOO.widget
3342
+ * @class DateNode
3343
+ * @extends YAHOO.widget.TextNode
3344
+ * @param oData {object} a string or object containing the data that will
3345
+ * be used to render this node.
3346
+ * Providing a string is the same as providing an object with a single property named label.
3347
+ * All values in the oData will be used to set equally named properties in the node
3348
+ * as long as the node does have such properties, they are not undefined, private nor functions.
3349
+ * All attributes are made available in noderef.data, which
3350
+ * can be used to store custom attributes. TreeView.getNode(s)ByProperty
3351
+ * can be used to retrieve a node by one of the attributes.
3352
+ * @param oParent {YAHOO.widget.Node} this node's parent node
3353
+ * @param expanded {boolean} the initial expanded/collapsed state (deprecated; use oData.expanded)
3354
+ * @constructor
3355
+ */
3356
+ YAHOO.widget.DateNode = function(oData, oParent, expanded) {
3357
+ YAHOO.widget.DateNode.superclass.constructor.call(this,oData, oParent, expanded);
3358
+ };
3359
+
3360
+ YAHOO.extend(YAHOO.widget.DateNode, YAHOO.widget.TextNode, {
3361
+
3362
+ /**
3363
+ * The node type
3364
+ * @property _type
3365
+ * @type string
3366
+ * @private
3367
+ * @default "DateNode"
3368
+ */
3369
+ _type: "DateNode",
3370
+
3371
+ /**
3372
+ * Configuration object for the Calendar editor, if used.
3373
+ * See <a href="http://developer.yahoo.com/yui/calendar/#internationalization">http://developer.yahoo.com/yui/calendar/#internationalization</a>
3374
+ * @property calendarConfig
3375
+ */
3376
+ calendarConfig: null,
3377
+
3378
+
3379
+
3380
+ /**
3381
+ * If YAHOO.widget.Calendar is available, it will pop up a Calendar to enter a new date. Otherwise, it falls back to a plain &lt;input&gt; textbox
3382
+ * @method fillEditorContainer
3383
+ * @param editorData {YAHOO.widget.TreeView.editorData} a shortcut to the static object holding editing information
3384
+ * @return void
3385
+ */
3386
+ fillEditorContainer: function (editorData) {
3387
+
3388
+ var cal, container = editorData.inputContainer;
3389
+
3390
+ if (Lang.isUndefined(Calendar)) {
3391
+ Dom.replaceClass(editorData.editorPanel,'ygtv-edit-DateNode','ygtv-edit-TextNode');
3392
+ YAHOO.widget.DateNode.superclass.fillEditorContainer.call(this, editorData);
3393
+ return;
3394
+ }
3395
+
3396
+ if (editorData.nodeType != this._type) {
3397
+ editorData.nodeType = this._type;
3398
+ editorData.saveOnEnter = false;
3399
+
3400
+ editorData.node.destroyEditorContents(editorData);
3401
+
3402
+ editorData.inputObject = cal = new Calendar(container.appendChild(document.createElement('div')));
3403
+ if (this.calendarConfig) {
3404
+ cal.cfg.applyConfig(this.calendarConfig,true);
3405
+ cal.cfg.fireQueue();
3406
+ }
3407
+ cal.selectEvent.subscribe(function () {
3408
+ this.tree._closeEditor(true);
3409
+ },this,true);
3410
+ } else {
3411
+ cal = editorData.inputObject;
3412
+ }
3413
+
3414
+ editorData.oldValue = this.label;
3415
+ cal.cfg.setProperty("selected",this.label, false);
3416
+
3417
+ var delim = cal.cfg.getProperty('DATE_FIELD_DELIMITER');
3418
+ var pageDate = this.label.split(delim);
3419
+ cal.cfg.setProperty('pagedate',pageDate[cal.cfg.getProperty('MDY_MONTH_POSITION') -1] + delim + pageDate[cal.cfg.getProperty('MDY_YEAR_POSITION') -1]);
3420
+ cal.cfg.fireQueue();
3421
+
3422
+ cal.render();
3423
+ cal.oDomContainer.focus();
3424
+ },
3425
+ /**
3426
+ * Returns the value from the input element.
3427
+ * Overrides Node.getEditorValue.
3428
+ * @method getEditorValue
3429
+ * @param editorData {YAHOO.widget.TreeView.editorData} a shortcut to the static object holding editing information
3430
+ * @return {string} date entered
3431
+ */
3432
+
3433
+ getEditorValue: function (editorData) {
3434
+ if (Lang.isUndefined(Calendar)) {
3435
+ return editorData.inputElement.value;
3436
+ } else {
3437
+ var cal = editorData.inputObject,
3438
+ date = cal.getSelectedDates()[0],
3439
+ dd = [];
3440
+
3441
+ dd[cal.cfg.getProperty('MDY_DAY_POSITION') -1] = date.getDate();
3442
+ dd[cal.cfg.getProperty('MDY_MONTH_POSITION') -1] = date.getMonth() + 1;
3443
+ dd[cal.cfg.getProperty('MDY_YEAR_POSITION') -1] = date.getFullYear();
3444
+ return dd.join(cal.cfg.getProperty('DATE_FIELD_DELIMITER'));
3445
+ }
3446
+ },
3447
+
3448
+ /**
3449
+ * Finally displays the newly entered date in the tree.
3450
+ * Overrides Node.displayEditedValue.
3451
+ * @method displayEditedValue
3452
+ * @param value {string} date to be displayed and stored in the node
3453
+ * @param editorData {YAHOO.widget.TreeView.editorData} a shortcut to the static object holding editing information
3454
+ */
3455
+ displayEditedValue: function (value,editorData) {
3456
+ var node = editorData.node;
3457
+ node.label = value;
3458
+ node.getLabelEl().innerHTML = value;
3459
+ },
3460
+ /**
3461
+ * Returns an object which could be used to build a tree out of this node and its children.
3462
+ * It can be passed to the tree constructor to reproduce this node as a tree.
3463
+ * It will return false if the node or any descendant loads dynamically, regardless of whether it is loaded or not.
3464
+ * @method getNodeDefinition
3465
+ * @return {Object | false} definition of the node or false if this node or any descendant is defined as dynamic
3466
+ */
3467
+ getNodeDefinition: function() {
3468
+ var def = YAHOO.widget.DateNode.superclass.getNodeDefinition.call(this);
3469
+ if (def === false) { return false; }
3470
+ if (this.calendarConfig) { def.calendarConfig = this.calendarConfig; }
3471
+ return def;
3472
+ }
3473
+
3474
+
3475
+ });
3476
+ })();
3477
+
3478
+ (function () {
3479
+ var Dom = YAHOO.util.Dom,
3480
+ Lang = YAHOO.lang,
3481
+ Event = YAHOO.util.Event,
3482
+ TV = YAHOO.widget.TreeView,
3483
+ TVproto = TV.prototype;
3484
+
3485
+ /**
3486
+ * An object to store information used for in-line editing
3487
+ * for all Nodes of all TreeViews. It contains:
3488
+ * <ul>
3489
+ * <li>active {boolean}, whether there is an active cell editor </li>
3490
+ * <li>whoHasIt {YAHOO.widget.TreeView} TreeView instance that is currently using the editor</li>
3491
+ * <li>nodeType {string} value of static Node._type property, allows reuse of input element if node is of the same type.</li>
3492
+ * <li>editorPanel {HTMLelement (&lt;div&gt;)} element holding the in-line editor</li>
3493
+ * <li>inputContainer {HTMLelement (&lt;div&gt;)} element which will hold the type-specific input element(s) to be filled by the fillEditorContainer method</li>
3494
+ * <li>buttonsContainer {HTMLelement (&lt;div&gt;)} element which holds the &lt;button&gt; elements for Ok/Cancel. If you don't want any of the buttons, hide it via CSS styles, don't destroy it</li>
3495
+ * <li>node {YAHOO.widget.Node} reference to the Node being edited</li>
3496
+ * <li>saveOnEnter {boolean}, whether the Enter key should be accepted as a Save command (Esc. is always taken as Cancel), disable for multi-line input elements </li>
3497
+ * <li>oldValue {any} value before editing</li>
3498
+ * </ul>
3499
+ * Editors are free to use this object to store additional data.
3500
+ * @property editorData
3501
+ * @static
3502
+ * @for YAHOO.widget.TreeView
3503
+ */
3504
+ TV.editorData = {
3505
+ active:false,
3506
+ whoHasIt:null, // which TreeView has it
3507
+ nodeType:null,
3508
+ editorPanel:null,
3509
+ inputContainer:null,
3510
+ buttonsContainer:null,
3511
+ node:null, // which Node is being edited
3512
+ saveOnEnter:true,
3513
+ oldValue:undefined
3514
+ // Each node type is free to add its own properties to this as it sees fit.
3515
+ };
3516
+
3517
+ /**
3518
+ * Validator function for edited data, called from the TreeView instance scope,
3519
+ * receives the arguments (newValue, oldValue, nodeInstance)
3520
+ * and returns either the validated (or type-converted) value or undefined.
3521
+ * An undefined return will prevent the editor from closing
3522
+ * @property validator
3523
+ * @type function
3524
+ * @default null
3525
+ * @for YAHOO.widget.TreeView
3526
+ */
3527
+ TVproto.validator = null;
3528
+
3529
+ /**
3530
+ * Entry point for initializing the editing plug-in.
3531
+ * TreeView will call this method on initializing if it exists
3532
+ * @method _initEditor
3533
+ * @for YAHOO.widget.TreeView
3534
+ * @private
3535
+ */
3536
+
3537
+ TVproto._initEditor = function () {
3538
+ /**
3539
+ * Fires when the user clicks on the ok button of a node editor
3540
+ * @event editorSaveEvent
3541
+ * @type CustomEvent
3542
+ * @param oArgs.newValue {mixed} the new value just entered
3543
+ * @param oArgs.oldValue {mixed} the value originally in the tree
3544
+ * @param oArgs.node {YAHOO.widget.Node} the node that has the focus
3545
+ * @for YAHOO.widget.TreeView
3546
+ */
3547
+ this.createEvent("editorSaveEvent", this);
3548
+
3549
+ /**
3550
+ * Fires when the user clicks on the cancel button of a node editor
3551
+ * @event editorCancelEvent
3552
+ * @type CustomEvent
3553
+ * @param {YAHOO.widget.Node} node the node that has the focus
3554
+ * @for YAHOO.widget.TreeView
3555
+ */
3556
+ this.createEvent("editorCancelEvent", this);
3557
+
3558
+ };
3559
+
3560
+ /**
3561
+ * Entry point of the editing plug-in.
3562
+ * TreeView will call this method if it exists when a node label is clicked
3563
+ * @method _nodeEditing
3564
+ * @param node {YAHOO.widget.Node} the node to be edited
3565
+ * @return {Boolean} true to indicate that the node is editable and prevent any further bubbling of the click.
3566
+ * @for YAHOO.widget.TreeView
3567
+ * @private
3568
+ */
3569
+
3570
+
3571
+
3572
+ TVproto._nodeEditing = function (node) {
3573
+ if (node.fillEditorContainer && node.editable) {
3574
+ var ed, topLeft, buttons, button, editorData = TV.editorData;
3575
+ editorData.active = true;
3576
+ editorData.whoHasIt = this;
3577
+ if (!editorData.nodeType) {
3578
+ editorData.editorPanel = ed = document.body.appendChild(document.createElement('div'));
3579
+ Dom.addClass(ed,'ygtv-label-editor');
3580
+
3581
+ buttons = editorData.buttonsContainer = ed.appendChild(document.createElement('div'));
3582
+ Dom.addClass(buttons,'ygtv-button-container');
3583
+ button = buttons.appendChild(document.createElement('button'));
3584
+ Dom.addClass(button,'ygtvok');
3585
+ button.innerHTML = ' ';
3586
+ button = buttons.appendChild(document.createElement('button'));
3587
+ Dom.addClass(button,'ygtvcancel');
3588
+ button.innerHTML = ' ';
3589
+ Event.on(buttons, 'click', function (ev) {
3590
+ this.logger.log('click on editor');
3591
+ var target = Event.getTarget(ev);
3592
+ var node = TV.editorData.node;
3593
+ if (Dom.hasClass(target,'ygtvok')) {
3594
+ node.logger.log('ygtvok');
3595
+ Event.stopEvent(ev);
3596
+ this._closeEditor(true);
3597
+ }
3598
+ if (Dom.hasClass(target,'ygtvcancel')) {
3599
+ node.logger.log('ygtvcancel');
3600
+ Event.stopEvent(ev);
3601
+ this._closeEditor(false);
3602
+ }
3603
+ }, this, true);
3604
+
3605
+ editorData.inputContainer = ed.appendChild(document.createElement('div'));
3606
+ Dom.addClass(editorData.inputContainer,'ygtv-input');
3607
+
3608
+ Event.on(ed,'keydown',function (ev) {
3609
+ var editorData = TV.editorData,
3610
+ KEY = YAHOO.util.KeyListener.KEY;
3611
+ switch (ev.keyCode) {
3612
+ case KEY.ENTER:
3613
+ this.logger.log('ENTER');
3614
+ Event.stopEvent(ev);
3615
+ if (editorData.saveOnEnter) {
3616
+ this._closeEditor(true);
3617
+ }
3618
+ break;
3619
+ case KEY.ESCAPE:
3620
+ this.logger.log('ESC');
3621
+ Event.stopEvent(ev);
3622
+ this._closeEditor(false);
3623
+ break;
3624
+ }
3625
+ },this,true);
3626
+
3627
+
3628
+
3629
+ } else {
3630
+ ed = editorData.editorPanel;
3631
+ }
3632
+ editorData.node = node;
3633
+ if (editorData.nodeType) {
3634
+ Dom.removeClass(ed,'ygtv-edit-' + editorData.nodeType);
3635
+ }
3636
+ Dom.addClass(ed,' ygtv-edit-' + node._type);
3637
+ topLeft = Dom.getXY(node.getContentEl());
3638
+ Dom.setStyle(ed,'left',topLeft[0] + 'px');
3639
+ Dom.setStyle(ed,'top',topLeft[1] + 'px');
3640
+ Dom.setStyle(ed,'display','block');
3641
+ ed.focus();
3642
+ node.fillEditorContainer(editorData);
3643
+
3644
+ return true; // If inline editor available, don't do anything else.
3645
+ }
3646
+ };
3647
+
3648
+ /**
3649
+ * Method to be associated with an event (clickEvent, dblClickEvent or enterKeyPressed) to pop up the contents editor
3650
+ * It calls the corresponding node editNode method.
3651
+ * @method onEventEditNode
3652
+ * @param oArgs {object} Object passed as arguments to TreeView event listeners
3653
+ * @for YAHOO.widget.TreeView
3654
+ */
3655
+
3656
+ TVproto.onEventEditNode = function (oArgs) {
3657
+ if (oArgs instanceof YAHOO.widget.Node) {
3658
+ oArgs.editNode();
3659
+ } else if (oArgs.node instanceof YAHOO.widget.Node) {
3660
+ oArgs.node.editNode();
3661
+ }
3662
+ };
3663
+
3664
+ /**
3665
+ * Method to be called when the inline editing is finished and the editor is to be closed
3666
+ * @method _closeEditor
3667
+ * @param save {Boolean} true if the edited value is to be saved, false if discarded
3668
+ * @private
3669
+ * @for YAHOO.widget.TreeView
3670
+ */
3671
+
3672
+ TVproto._closeEditor = function (save) {
3673
+ var ed = TV.editorData,
3674
+ node = ed.node,
3675
+ close = true;
3676
+ if (save) {
3677
+ close = ed.node.saveEditorValue(ed) !== false;
3678
+ } else {
3679
+ this.fireEvent( 'editorCancelEvent', node);
3680
+ }
3681
+
3682
+ if (close) {
3683
+ Dom.setStyle(ed.editorPanel,'display','none');
3684
+ ed.active = false;
3685
+ node.focus();
3686
+ }
3687
+ };
3688
+
3689
+ /**
3690
+ * Entry point for TreeView's destroy method to destroy whatever the editing plug-in has created
3691
+ * @method _destroyEditor
3692
+ * @private
3693
+ * @for YAHOO.widget.TreeView
3694
+ */
3695
+ TVproto._destroyEditor = function() {
3696
+ var ed = TV.editorData;
3697
+ if (ed && ed.nodeType && (!ed.active || ed.whoHasIt === this)) {
3698
+ Event.removeListener(ed.editorPanel,'keydown');
3699
+ Event.removeListener(ed.buttonContainer,'click');
3700
+ ed.node.destroyEditorContents(ed);
3701
+ document.body.removeChild(ed.editorPanel);
3702
+ ed.nodeType = ed.editorPanel = ed.inputContainer = ed.buttonsContainer = ed.whoHasIt = ed.node = null;
3703
+ ed.active = false;
3704
+ }
3705
+ };
3706
+
3707
+ var Nproto = YAHOO.widget.Node.prototype;
3708
+
3709
+ /**
3710
+ * Signals if the label is editable. (Ignored on TextNodes with href set.)
3711
+ * @property editable
3712
+ * @type boolean
3713
+ * @for YAHOO.widget.Node
3714
+ */
3715
+ Nproto.editable = false;
3716
+
3717
+ /**
3718
+ * pops up the contents editor, if there is one and the node is declared editable
3719
+ * @method editNode
3720
+ * @for YAHOO.widget.Node
3721
+ */
3722
+
3723
+ Nproto.editNode = function () {
3724
+ this.tree._nodeEditing(this);
3725
+ };
3726
+
3727
+
3728
+
3729
+
3730
+ /** Placeholder for a function that should provide the inline node label editor.
3731
+ * Leaving it set to null will indicate that this node type is not editable.
3732
+ * It should be overridden by nodes that provide inline editing.
3733
+ * The Node-specific editing element (input box, textarea or whatever) should be inserted into editorData.inputContainer.
3734
+ * @method fillEditorContainer
3735
+ * @param editorData {YAHOO.widget.TreeView.editorData} a shortcut to the static object holding editing information
3736
+ * @return void
3737
+ * @for YAHOO.widget.Node
3738
+ */
3739
+ Nproto.fillEditorContainer = null;
3740
+
3741
+
3742
+ /**
3743
+ * Node-specific destroy function to empty the contents of the inline editor panel.
3744
+ * This function is the worst case alternative that will purge all possible events and remove the editor contents.
3745
+ * Method Event.purgeElement is somewhat costly so if it can be replaced by specifc Event.removeListeners, it is better to do so.
3746
+ * @method destroyEditorContents
3747
+ * @param editorData {YAHOO.widget.TreeView.editorData} a shortcut to the static object holding editing information
3748
+ * @for YAHOO.widget.Node
3749
+ */
3750
+ Nproto.destroyEditorContents = function (editorData) {
3751
+ // In the worst case, if the input editor (such as the Calendar) has no destroy method
3752
+ // we can only try to remove all possible events on it.
3753
+ Event.purgeElement(editorData.inputContainer,true);
3754
+ editorData.inputContainer.innerHTML = '';
3755
+ };
3756
+
3757
+ /**
3758
+ * Saves the value entered into the editor.
3759
+ * @method saveEditorValue
3760
+ * @param editorData {YAHOO.widget.TreeView.editorData} a shortcut to the static object holding editing information
3761
+ * @return {false or none} a return of exactly false will prevent the editor from closing
3762
+ * @for YAHOO.widget.Node
3763
+ */
3764
+ Nproto.saveEditorValue = function (editorData) {
3765
+ var node = editorData.node,
3766
+ value,
3767
+ validator = node.tree.validator;
3768
+
3769
+ value = this.getEditorValue(editorData);
3770
+
3771
+ if (Lang.isFunction(validator)) {
3772
+ value = validator(value,editorData.oldValue,node);
3773
+ if (Lang.isUndefined(value)) {
3774
+ return false;
3775
+ }
3776
+ }
3777
+
3778
+ if (this.tree.fireEvent( 'editorSaveEvent', {
3779
+ newValue:value,
3780
+ oldValue:editorData.oldValue,
3781
+ node:node
3782
+ }) !== false) {
3783
+ this.displayEditedValue(value,editorData);
3784
+ }
3785
+ };
3786
+
3787
+
3788
+ /**
3789
+ * Returns the value(s) from the input element(s) .
3790
+ * Should be overridden by each node type.
3791
+ * @method getEditorValue
3792
+ * @param editorData {YAHOO.widget.TreeView.editorData} a shortcut to the static object holding editing information
3793
+ * @return {any} value entered
3794
+ * @for YAHOO.widget.Node
3795
+ */
3796
+
3797
+ Nproto.getEditorValue = function (editorData) {
3798
+ };
3799
+
3800
+ /**
3801
+ * Finally displays the newly edited value(s) in the tree.
3802
+ * Should be overridden by each node type.
3803
+ * @method displayEditedValue
3804
+ * @param value {any} value to be displayed and stored in the node
3805
+ * @param editorData {YAHOO.widget.TreeView.editorData} a shortcut to the static object holding editing information
3806
+ * @for YAHOO.widget.Node
3807
+ */
3808
+ Nproto.displayEditedValue = function (value,editorData) {
3809
+ };
3810
+
3811
+ var TNproto = YAHOO.widget.TextNode.prototype;
3812
+
3813
+
3814
+
3815
+ /**
3816
+ * Places an &lt;input&gt; textbox in the input container and loads the label text into it.
3817
+ * @method fillEditorContainer
3818
+ * @param editorData {YAHOO.widget.TreeView.editorData} a shortcut to the static object holding editing information
3819
+ * @return void
3820
+ * @for YAHOO.widget.TextNode
3821
+ */
3822
+ TNproto.fillEditorContainer = function (editorData) {
3823
+
3824
+ var input;
3825
+ // If last node edited is not of the same type as this one, delete it and fill it with our editor
3826
+ if (editorData.nodeType != this._type) {
3827
+ editorData.nodeType = this._type;
3828
+ editorData.saveOnEnter = true;
3829
+ editorData.node.destroyEditorContents(editorData);
3830
+
3831
+ editorData.inputElement = input = editorData.inputContainer.appendChild(document.createElement('input'));
3832
+
3833
+ } else {
3834
+ // if the last node edited was of the same time, reuse the input element.
3835
+ input = editorData.inputElement;
3836
+ }
3837
+ editorData.oldValue = this.label;
3838
+ input.value = this.label;
3839
+ input.focus();
3840
+ input.select();
3841
+ };
3842
+
3843
+ /**
3844
+ * Returns the value from the input element.
3845
+ * Overrides Node.getEditorValue.
3846
+ * @method getEditorValue
3847
+ * @param editorData {YAHOO.widget.TreeView.editorData} a shortcut to the static object holding editing information
3848
+ * @return {string} value entered
3849
+ * @for YAHOO.widget.TextNode
3850
+ */
3851
+
3852
+ TNproto.getEditorValue = function (editorData) {
3853
+ return editorData.inputElement.value;
3854
+ };
3855
+
3856
+ /**
3857
+ * Finally displays the newly edited value in the tree.
3858
+ * Overrides Node.displayEditedValue.
3859
+ * @method displayEditedValue
3860
+ * @param value {string} value to be displayed and stored in the node
3861
+ * @param editorData {YAHOO.widget.TreeView.editorData} a shortcut to the static object holding editing information
3862
+ * @for YAHOO.widget.TextNode
3863
+ */
3864
+ TNproto.displayEditedValue = function (value,editorData) {
3865
+ var node = editorData.node;
3866
+ node.label = value;
3867
+ node.getLabelEl().innerHTML = value;
3868
+ };
3869
+
3870
+ /**
3871
+ * Destroys the contents of the inline editor panel.
3872
+ * Overrides Node.destroyEditorContent.
3873
+ * Since we didn't set any event listeners on this inline editor, it is more efficient to avoid the generic method in Node.
3874
+ * @method destroyEditorContents
3875
+ * @param editorData {YAHOO.widget.TreeView.editorData} a shortcut to the static object holding editing information
3876
+ * @for YAHOO.widget.TextNode
3877
+ */
3878
+ TNproto.destroyEditorContents = function (editorData) {
3879
+ editorData.inputContainer.innerHTML = '';
3880
+ };
3881
+ })();
3882
+
3883
+ /**
3884
+ * A static factory class for tree view expand/collapse animations
3885
+ * @class TVAnim
3886
+ * @static
3887
+ */
3888
+ YAHOO.widget.TVAnim = function() {
3889
+ return {
3890
+ /**
3891
+ * Constant for the fade in animation
3892
+ * @property FADE_IN
3893
+ * @type string
3894
+ * @static
3895
+ */
3896
+ FADE_IN: "TVFadeIn",
3897
+
3898
+ /**
3899
+ * Constant for the fade out animation
3900
+ * @property FADE_OUT
3901
+ * @type string
3902
+ * @static
3903
+ */
3904
+ FADE_OUT: "TVFadeOut",
3905
+
3906
+ /**
3907
+ * Returns a ygAnim instance of the given type
3908
+ * @method getAnim
3909
+ * @param type {string} the type of animation
3910
+ * @param el {HTMLElement} the element to element (probably the children div)
3911
+ * @param callback {function} function to invoke when the animation is done.
3912
+ * @return {YAHOO.util.Animation} the animation instance
3913
+ * @static
3914
+ */
3915
+ getAnim: function(type, el, callback) {
3916
+ if (YAHOO.widget[type]) {
3917
+ return new YAHOO.widget[type](el, callback);
3918
+ } else {
3919
+ return null;
3920
+ }
3921
+ },
3922
+
3923
+ /**
3924
+ * Returns true if the specified animation class is available
3925
+ * @method isValid
3926
+ * @param type {string} the type of animation
3927
+ * @return {boolean} true if valid, false if not
3928
+ * @static
3929
+ */
3930
+ isValid: function(type) {
3931
+ return (YAHOO.widget[type]);
3932
+ }
3933
+ };
3934
+ } ();
3935
+
3936
+ /**
3937
+ * A 1/2 second fade-in animation.
3938
+ * @class TVFadeIn
3939
+ * @constructor
3940
+ * @param el {HTMLElement} the element to animate
3941
+ * @param callback {function} function to invoke when the animation is finished
3942
+ */
3943
+ YAHOO.widget.TVFadeIn = function(el, callback) {
3944
+ /**
3945
+ * The element to animate
3946
+ * @property el
3947
+ * @type HTMLElement
3948
+ */
3949
+ this.el = el;
3950
+
3951
+ /**
3952
+ * the callback to invoke when the animation is complete
3953
+ * @property callback
3954
+ * @type function
3955
+ */
3956
+ this.callback = callback;
3957
+
3958
+ this.logger = new YAHOO.widget.LogWriter(this.toString());
3959
+ };
3960
+
3961
+ YAHOO.widget.TVFadeIn.prototype = {
3962
+ /**
3963
+ * Performs the animation
3964
+ * @method animate
3965
+ */
3966
+ animate: function() {
3967
+ var tvanim = this;
3968
+
3969
+ var s = this.el.style;
3970
+ s.opacity = 0.1;
3971
+ s.filter = "alpha(opacity=10)";
3972
+ s.display = "";
3973
+
3974
+ var dur = 0.4;
3975
+ var a = new YAHOO.util.Anim(this.el, {opacity: {from: 0.1, to: 1, unit:""}}, dur);
3976
+ a.onComplete.subscribe( function() { tvanim.onComplete(); } );
3977
+ a.animate();
3978
+ },
3979
+
3980
+ /**
3981
+ * Clean up and invoke callback
3982
+ * @method onComplete
3983
+ */
3984
+ onComplete: function() {
3985
+ this.callback();
3986
+ },
3987
+
3988
+ /**
3989
+ * toString
3990
+ * @method toString
3991
+ * @return {string} the string representation of the instance
3992
+ */
3993
+ toString: function() {
3994
+ return "TVFadeIn";
3995
+ }
3996
+ };
3997
+
3998
+ /**
3999
+ * A 1/2 second fade out animation.
4000
+ * @class TVFadeOut
4001
+ * @constructor
4002
+ * @param el {HTMLElement} the element to animate
4003
+ * @param callback {Function} function to invoke when the animation is finished
4004
+ */
4005
+ YAHOO.widget.TVFadeOut = function(el, callback) {
4006
+ /**
4007
+ * The element to animate
4008
+ * @property el
4009
+ * @type HTMLElement
4010
+ */
4011
+ this.el = el;
4012
+
4013
+ /**
4014
+ * the callback to invoke when the animation is complete
4015
+ * @property callback
4016
+ * @type function
4017
+ */
4018
+ this.callback = callback;
4019
+
4020
+ this.logger = new YAHOO.widget.LogWriter(this.toString());
4021
+ };
4022
+
4023
+ YAHOO.widget.TVFadeOut.prototype = {
4024
+ /**
4025
+ * Performs the animation
4026
+ * @method animate
4027
+ */
4028
+ animate: function() {
4029
+ var tvanim = this;
4030
+ var dur = 0.4;
4031
+ var a = new YAHOO.util.Anim(this.el, {opacity: {from: 1, to: 0.1, unit:""}}, dur);
4032
+ a.onComplete.subscribe( function() { tvanim.onComplete(); } );
4033
+ a.animate();
4034
+ },
4035
+
4036
+ /**
4037
+ * Clean up and invoke callback
4038
+ * @method onComplete
4039
+ */
4040
+ onComplete: function() {
4041
+ var s = this.el.style;
4042
+ s.display = "none";
4043
+ s.opacity = 1;
4044
+ s.filter = "alpha(opacity=100)";
4045
+ this.callback();
4046
+ },
4047
+
4048
+ /**
4049
+ * toString
4050
+ * @method toString
4051
+ * @return {string} the string representation of the instance
4052
+ */
4053
+ toString: function() {
4054
+ return "TVFadeOut";
4055
+ }
4056
+ };
4057
+
4058
+ YAHOO.register("treeview", YAHOO.widget.TreeView, {version: "2.8.1", build: "19"});