yui-rails-asset 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,10 @@
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
+ if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=function(){var A=YAHOO.util.Event,B=YAHOO.util.Dom;return{useShim:false,_shimActive:false,_shimState:false,_debugShim:false,_createShim:function(){var C=document.createElement("div");C.id="yui-ddm-shim";if(document.body.firstChild){document.body.insertBefore(C,document.body.firstChild);}else{document.body.appendChild(C);}C.style.display="none";C.style.backgroundColor="red";C.style.position="absolute";C.style.zIndex="99999";B.setStyle(C,"opacity","0");this._shim=C;A.on(C,"mouseup",this.handleMouseUp,this,true);A.on(C,"mousemove",this.handleMouseMove,this,true);A.on(window,"scroll",this._sizeShim,this,true);},_sizeShim:function(){if(this._shimActive){var C=this._shim;C.style.height=B.getDocumentHeight()+"px";C.style.width=B.getDocumentWidth()+"px";C.style.top="0";C.style.left="0";}},_activateShim:function(){if(this.useShim){if(!this._shim){this._createShim();}this._shimActive=true;var C=this._shim,D="0";if(this._debugShim){D=".5";}B.setStyle(C,"opacity",D);this._sizeShim();C.style.display="block";}},_deactivateShim:function(){this._shim.style.display="none";this._shimActive=false;},_shim:null,ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initialized:false,locked:false,interactionInfo:null,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,STRICT_INTERSECT:2,mode:0,_execOnAll:function(E,D){for(var F in this.ids){for(var C in this.ids[F]){var G=this.ids[F][C];if(!this.isTypeOfDD(G)){continue;}G[E].apply(G,D);}}},_onLoad:function(){this.init();A.on(document,"mouseup",this.handleMouseUp,this,true);A.on(document,"mousemove",this.handleMouseMove,this,true);A.on(window,"unload",this._onUnload,this,true);A.on(window,"resize",this._onResize,this,true);},_onResize:function(C){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:1000,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,fromTimeout:false,regDragDrop:function(D,C){if(!this.initialized){this.init();}if(!this.ids[C]){this.ids[C]={};}this.ids[C][D.id]=D;},removeDDFromGroup:function(E,C){if(!this.ids[C]){this.ids[C]={};}var D=this.ids[C];if(D&&D[E.id]){delete D[E.id];}},_remove:function(E){for(var D in E.groups){if(D){var C=this.ids[D];if(C&&C[E.id]){delete C[E.id];}}}delete this.handleIds[E.id];},regHandle:function(D,C){if(!this.handleIds[D]){this.handleIds[D]={};}this.handleIds[D][C]=C;},isDragDrop:function(C){return(this.getDDById(C))?true:false;},getRelated:function(H,D){var G=[];for(var F in H.groups){for(var E in this.ids[F]){var C=this.ids[F][E];if(!this.isTypeOfDD(C)){continue;}if(!D||C.isTarget){G[G.length]=C;}}}return G;},isLegalTarget:function(G,F){var D=this.getRelated(G,true);for(var E=0,C=D.length;E<C;++E){if(D[E].id==F.id){return true;}}return false;},isTypeOfDD:function(C){return(C&&C.__ygDragDrop);},isHandle:function(D,C){return(this.handleIds[D]&&this.handleIds[D][C]);},getDDById:function(D){for(var C in this.ids){if(this.ids[C][D]){return this.ids[C][D];}}return null;},handleMouseDown:function(E,D){this.currentTarget=YAHOO.util.Event.getTarget(E);this.dragCurrent=D;var C=D.getEl();this.startX=YAHOO.util.Event.getPageX(E);this.startY=YAHOO.util.Event.getPageY(E);this.deltaX=this.startX-C.offsetLeft;this.deltaY=this.startY-C.offsetTop;this.dragThreshMet=false;this.clickTimeout=setTimeout(function(){var F=YAHOO.util.DDM;F.startDrag(F.startX,F.startY);F.fromTimeout=true;},this.clickTimeThresh);},startDrag:function(C,E){if(this.dragCurrent&&this.dragCurrent.useShim){this._shimState=this.useShim;this.useShim=true;}this._activateShim();clearTimeout(this.clickTimeout);var D=this.dragCurrent;if(D&&D.events.b4StartDrag){D.b4StartDrag(C,E);D.fireEvent("b4StartDragEvent",{x:C,y:E});}if(D&&D.events.startDrag){D.startDrag(C,E);D.fireEvent("startDragEvent",{x:C,y:E});}this.dragThreshMet=true;},handleMouseUp:function(C){if(this.dragCurrent){clearTimeout(this.clickTimeout);if(this.dragThreshMet){if(this.fromTimeout){this.fromTimeout=false;this.handleMouseMove(C);}this.fromTimeout=false;this.fireEvents(C,true);}else{}this.stopDrag(C);this.stopEvent(C);}},stopEvent:function(C){if(this.stopPropagation){YAHOO.util.Event.stopPropagation(C);}if(this.preventDefault){YAHOO.util.Event.preventDefault(C);}},stopDrag:function(E,D){var C=this.dragCurrent;if(C&&!D){if(this.dragThreshMet){if(C.events.b4EndDrag){C.b4EndDrag(E);C.fireEvent("b4EndDragEvent",{e:E});}if(C.events.endDrag){C.endDrag(E);C.fireEvent("endDragEvent",{e:E});}}if(C.events.mouseUp){C.onMouseUp(E);C.fireEvent("mouseUpEvent",{e:E});}}if(this._shimActive){this._deactivateShim();if(this.dragCurrent&&this.dragCurrent.useShim){this.useShim=this._shimState;this._shimState=false;}}this.dragCurrent=null;this.dragOvers={};},handleMouseMove:function(F){var C=this.dragCurrent;if(C){if(YAHOO.util.Event.isIE&&!F.button){this.stopEvent(F);return this.handleMouseUp(F);}else{if(F.clientX<0||F.clientY<0){}}if(!this.dragThreshMet){var E=Math.abs(this.startX-YAHOO.util.Event.getPageX(F));var D=Math.abs(this.startY-YAHOO.util.Event.getPageY(F));if(E>this.clickPixelThresh||D>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}if(this.dragThreshMet){if(C&&C.events.b4Drag){C.b4Drag(F);C.fireEvent("b4DragEvent",{e:F});}if(C&&C.events.drag){C.onDrag(F);C.fireEvent("dragEvent",{e:F});}if(C){this.fireEvents(F,false);}}this.stopEvent(F);}},fireEvents:function(V,L){var a=this.dragCurrent;if(!a||a.isLocked()||a.dragOnly){return;}var N=YAHOO.util.Event.getPageX(V),M=YAHOO.util.Event.getPageY(V),P=new YAHOO.util.Point(N,M),K=a.getTargetCoord(P.x,P.y),F=a.getDragEl(),E=["out","over","drop","enter"],U=new YAHOO.util.Region(K.y,K.x+F.offsetWidth,K.y+F.offsetHeight,K.x),I=[],D={},Q=[],c={outEvts:[],overEvts:[],dropEvts:[],enterEvts:[]};for(var S in this.dragOvers){var d=this.dragOvers[S];if(!this.isTypeOfDD(d)){continue;
8
+ }if(!this.isOverTarget(P,d,this.mode,U)){c.outEvts.push(d);}I[S]=true;delete this.dragOvers[S];}for(var R in a.groups){if("string"!=typeof R){continue;}for(S in this.ids[R]){var G=this.ids[R][S];if(!this.isTypeOfDD(G)){continue;}if(G.isTarget&&!G.isLocked()&&G!=a){if(this.isOverTarget(P,G,this.mode,U)){D[R]=true;if(L){c.dropEvts.push(G);}else{if(!I[G.id]){c.enterEvts.push(G);}else{c.overEvts.push(G);}this.dragOvers[G.id]=G;}}}}}this.interactionInfo={out:c.outEvts,enter:c.enterEvts,over:c.overEvts,drop:c.dropEvts,point:P,draggedRegion:U,sourceRegion:this.locationCache[a.id],validDrop:L};for(var C in D){Q.push(C);}if(L&&!c.dropEvts.length){this.interactionInfo.validDrop=false;if(a.events.invalidDrop){a.onInvalidDrop(V);a.fireEvent("invalidDropEvent",{e:V});}}for(S=0;S<E.length;S++){var Y=null;if(c[E[S]+"Evts"]){Y=c[E[S]+"Evts"];}if(Y&&Y.length){var H=E[S].charAt(0).toUpperCase()+E[S].substr(1),X="onDrag"+H,J="b4Drag"+H,O="drag"+H+"Event",W="drag"+H;if(this.mode){if(a.events[J]){a[J](V,Y,Q);a.fireEvent(J+"Event",{event:V,info:Y,group:Q});}if(a.events[W]){a[X](V,Y,Q);a.fireEvent(O,{event:V,info:Y,group:Q});}}else{for(var Z=0,T=Y.length;Z<T;++Z){if(a.events[J]){a[J](V,Y[Z].id,Q[0]);a.fireEvent(J+"Event",{event:V,info:Y[Z].id,group:Q[0]});}if(a.events[W]){a[X](V,Y[Z].id,Q[0]);a.fireEvent(O,{event:V,info:Y[Z].id,group:Q[0]});}}}}}},getBestMatch:function(E){var G=null;var D=E.length;if(D==1){G=E[0];}else{for(var F=0;F<D;++F){var C=E[F];if(this.mode==this.INTERSECT&&C.cursorIsOver){G=C;break;}else{if(!G||!G.overlap||(C.overlap&&G.overlap.getArea()<C.overlap.getArea())){G=C;}}}}return G;},refreshCache:function(D){var F=D||this.ids;for(var C in F){if("string"!=typeof C){continue;}for(var E in this.ids[C]){var G=this.ids[C][E];if(this.isTypeOfDD(G)){var H=this.getLocation(G);if(H){this.locationCache[G.id]=H;}else{delete this.locationCache[G.id];}}}}},verifyEl:function(D){try{if(D){var C=D.offsetParent;if(C){return true;}}}catch(E){}return false;},getLocation:function(H){if(!this.isTypeOfDD(H)){return null;}var F=H.getEl(),K,E,D,M,L,N,C,J,G;try{K=YAHOO.util.Dom.getXY(F);}catch(I){}if(!K){return null;}E=K[0];D=E+F.offsetWidth;M=K[1];L=M+F.offsetHeight;N=M-H.padding[0];C=D+H.padding[1];J=L+H.padding[2];G=E-H.padding[3];return new YAHOO.util.Region(N,C,J,G);},isOverTarget:function(K,C,E,F){var G=this.locationCache[C.id];if(!G||!this.useCache){G=this.getLocation(C);this.locationCache[C.id]=G;}if(!G){return false;}C.cursorIsOver=G.contains(K);var J=this.dragCurrent;if(!J||(!E&&!J.constrainX&&!J.constrainY)){return C.cursorIsOver;}C.overlap=null;if(!F){var H=J.getTargetCoord(K.x,K.y);var D=J.getDragEl();F=new YAHOO.util.Region(H.y,H.x+D.offsetWidth,H.y+D.offsetHeight,H.x);}var I=F.intersect(G);if(I){C.overlap=I;return(E)?true:C.cursorIsOver;}else{return false;}},_onUnload:function(D,C){this.unregAll();},unregAll:function(){if(this.dragCurrent){this.stopDrag();this.dragCurrent=null;}this._execOnAll("unreg",[]);this.ids={};},elementCache:{},getElWrapper:function(D){var C=this.elementCache[D];if(!C||!C.el){C=this.elementCache[D]=new this.ElementWrapper(YAHOO.util.Dom.get(D));}return C;},getElement:function(C){return YAHOO.util.Dom.get(C);},getCss:function(D){var C=YAHOO.util.Dom.get(D);return(C)?C.style:null;},ElementWrapper:function(C){this.el=C||null;this.id=this.el&&C.id;this.css=this.el&&C.style;},getPosX:function(C){return YAHOO.util.Dom.getX(C);},getPosY:function(C){return YAHOO.util.Dom.getY(C);},swapNode:function(E,C){if(E.swapNode){E.swapNode(C);}else{var F=C.parentNode;var D=C.nextSibling;if(D==E){F.insertBefore(E,C);}else{if(C==E.nextSibling){F.insertBefore(C,E);}else{E.parentNode.replaceChild(C,E);F.insertBefore(E,D);}}}},getScroll:function(){var E,C,F=document.documentElement,D=document.body;if(F&&(F.scrollTop||F.scrollLeft)){E=F.scrollTop;C=F.scrollLeft;}else{if(D){E=D.scrollTop;C=D.scrollLeft;}else{}}return{top:E,left:C};},getStyle:function(D,C){return YAHOO.util.Dom.getStyle(D,C);},getScrollTop:function(){return this.getScroll().top;},getScrollLeft:function(){return this.getScroll().left;},moveToEl:function(C,E){var D=YAHOO.util.Dom.getXY(E);YAHOO.util.Dom.setXY(C,D);},getClientHeight:function(){return YAHOO.util.Dom.getViewportHeight();},getClientWidth:function(){return YAHOO.util.Dom.getViewportWidth();},numericSort:function(D,C){return(D-C);},_timeoutCount:0,_addListeners:function(){var C=YAHOO.util.DDM;if(YAHOO.util.Event&&document){C._onLoad();}else{if(C._timeoutCount>2000){}else{setTimeout(C._addListeners,10);if(document&&document.body){C._timeoutCount+=1;}}}},handleWasClicked:function(C,E){if(this.isHandle(E,C.id)){return true;}else{var D=C.parentNode;while(D){if(this.isHandle(E,D.id)){return true;}else{D=D.parentNode;}}}return false;}};}();YAHOO.util.DDM=YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners();}(function(){var A=YAHOO.util.Event;var B=YAHOO.util.Dom;YAHOO.util.DragDrop=function(E,C,D){if(E){this.init(E,C,D);}};YAHOO.util.DragDrop.prototype={events:null,on:function(){this.subscribe.apply(this,arguments);},id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,dragOnly:false,useShim:false,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,deltaX:0,deltaY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,cursorIsOver:false,overlap:null,b4StartDrag:function(C,D){},startDrag:function(C,D){},b4Drag:function(C){},onDrag:function(C){},onDragEnter:function(C,D){},b4DragOver:function(C){},onDragOver:function(C,D){},b4DragOut:function(C){},onDragOut:function(C,D){},b4DragDrop:function(C){},onDragDrop:function(C,D){},onInvalidDrop:function(C){},b4EndDrag:function(C){},endDrag:function(C){},b4MouseDown:function(C){},onMouseDown:function(C){},onMouseUp:function(C){},onAvailable:function(){},getEl:function(){if(!this._domRef){this._domRef=B.get(this.id);
9
+ }return this._domRef;},getDragEl:function(){return B.get(this.dragElId);},init:function(F,C,D){this.initTarget(F,C,D);A.on(this._domRef||this.id,"mousedown",this.handleMouseDown,this,true);for(var E in this.events){this.createEvent(E+"Event");}},initTarget:function(E,C,D){this.config=D||{};this.events={};this.DDM=YAHOO.util.DDM;this.groups={};if(typeof E!=="string"){this._domRef=E;E=B.generateId(E);}this.id=E;this.addToGroup((C)?C:"default");this.handleElId=E;A.onAvailable(E,this.handleOnAvailable,this,true);this.setDragElId(E);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();},applyConfig:function(){this.events={mouseDown:true,b4MouseDown:true,mouseUp:true,b4StartDrag:true,startDrag:true,b4EndDrag:true,endDrag:true,drag:true,b4Drag:true,invalidDrop:true,b4DragOut:true,dragOut:true,dragEnter:true,b4DragOver:true,dragOver:true,b4DragDrop:true,dragDrop:true};if(this.config.events){for(var C in this.config.events){if(this.config.events[C]===false){this.events[C]=false;}}}this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);this.dragOnly=((this.config.dragOnly===true)?true:false);this.useShim=((this.config.useShim===true)?true:false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(E,C,F,D){if(!C&&0!==C){this.padding=[E,E,E,E];}else{if(!F&&0!==F){this.padding=[E,C,E,C];}else{this.padding=[E,C,F,D];}}},setInitPosition:function(F,E){var G=this.getEl();if(!this.DDM.verifyEl(G)){if(G&&G.style&&(G.style.display=="none")){}else{}return;}var D=F||0;var C=E||0;var H=B.getXY(G);this.initPageX=H[0]-D;this.initPageY=H[1]-C;this.lastPageX=H[0];this.lastPageY=H[1];this.setStartPosition(H);},setStartPosition:function(D){var C=D||B.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=C[0];this.startPageY=C[1];},addToGroup:function(C){this.groups[C]=true;this.DDM.regDragDrop(this,C);},removeFromGroup:function(C){if(this.groups[C]){delete this.groups[C];}this.DDM.removeDDFromGroup(this,C);},setDragElId:function(C){this.dragElId=C;},setHandleElId:function(C){if(typeof C!=="string"){C=B.generateId(C);}this.handleElId=C;this.DDM.regHandle(this.id,C);},setOuterHandleElId:function(C){if(typeof C!=="string"){C=B.generateId(C);}A.on(C,"mousedown",this.handleMouseDown,this,true);this.setHandleElId(C);this.hasOuterHandles=true;},unreg:function(){A.removeListener(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},isLocked:function(){return(this.DDM.isLocked()||this.locked);},handleMouseDown:function(J,I){var D=J.which||J.button;if(this.primaryButtonOnly&&D>1){return;}if(this.isLocked()){return;}var C=this.b4MouseDown(J),F=true;if(this.events.b4MouseDown){F=this.fireEvent("b4MouseDownEvent",J);}var E=this.onMouseDown(J),H=true;if(this.events.mouseDown){H=this.fireEvent("mouseDownEvent",J);}if((C===false)||(E===false)||(F===false)||(H===false)){return;}this.DDM.refreshCache(this.groups);var G=new YAHOO.util.Point(A.getPageX(J),A.getPageY(J));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(G,this)){}else{if(this.clickValidator(J)){this.setStartPosition();this.DDM.handleMouseDown(J,this);this.DDM.stopEvent(J);}else{}}},clickValidator:function(D){var C=YAHOO.util.Event.getTarget(D);return(this.isValidHandleChild(C)&&(this.id==this.handleElId||this.DDM.handleWasClicked(C,this.id)));},getTargetCoord:function(E,D){var C=E-this.deltaX;var F=D-this.deltaY;if(this.constrainX){if(C<this.minX){C=this.minX;}if(C>this.maxX){C=this.maxX;}}if(this.constrainY){if(F<this.minY){F=this.minY;}if(F>this.maxY){F=this.maxY;}}C=this.getTick(C,this.xTicks);F=this.getTick(F,this.yTicks);return{x:C,y:F};},addInvalidHandleType:function(C){var D=C.toUpperCase();this.invalidHandleTypes[D]=D;},addInvalidHandleId:function(C){if(typeof C!=="string"){C=B.generateId(C);}this.invalidHandleIds[C]=C;},addInvalidHandleClass:function(C){this.invalidHandleClasses.push(C);},removeInvalidHandleType:function(C){var D=C.toUpperCase();delete this.invalidHandleTypes[D];},removeInvalidHandleId:function(C){if(typeof C!=="string"){C=B.generateId(C);}delete this.invalidHandleIds[C];},removeInvalidHandleClass:function(D){for(var E=0,C=this.invalidHandleClasses.length;E<C;++E){if(this.invalidHandleClasses[E]==D){delete this.invalidHandleClasses[E];}}},isValidHandleChild:function(F){var E=true;var H;try{H=F.nodeName.toUpperCase();}catch(G){H=F.nodeName;}E=E&&!this.invalidHandleTypes[H];E=E&&!this.invalidHandleIds[F.id];for(var D=0,C=this.invalidHandleClasses.length;E&&D<C;++D){E=!B.hasClass(F,this.invalidHandleClasses[D]);}return E;},setXTicks:function(F,C){this.xTicks=[];this.xTickSize=C;var E={};for(var D=this.initPageX;D>=this.minX;D=D-C){if(!E[D]){this.xTicks[this.xTicks.length]=D;E[D]=true;}}for(D=this.initPageX;D<=this.maxX;D=D+C){if(!E[D]){this.xTicks[this.xTicks.length]=D;E[D]=true;}}this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(F,C){this.yTicks=[];this.yTickSize=C;var E={};for(var D=this.initPageY;D>=this.minY;D=D-C){if(!E[D]){this.yTicks[this.yTicks.length]=D;E[D]=true;}}for(D=this.initPageY;D<=this.maxY;D=D+C){if(!E[D]){this.yTicks[this.yTicks.length]=D;E[D]=true;}}this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(E,D,C){this.leftConstraint=parseInt(E,10);this.rightConstraint=parseInt(D,10);this.minX=this.initPageX-this.leftConstraint;this.maxX=this.initPageX+this.rightConstraint;if(C){this.setXTicks(this.initPageX,C);}this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(C,E,D){this.topConstraint=parseInt(C,10);this.bottomConstraint=parseInt(E,10);this.minY=this.initPageY-this.topConstraint;this.maxY=this.initPageY+this.bottomConstraint;if(D){this.setYTicks(this.initPageY,D);
10
+ }this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var D=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var C=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(D,C);}else{this.setInitPosition();}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(I,F){if(!F){return I;}else{if(F[0]>=I){return F[0];}else{for(var D=0,C=F.length;D<C;++D){var E=D+1;if(F[E]&&F[E]>=I){var H=I-F[D];var G=F[E]-I;return(G>H)?F[D]:F[E];}}return F[F.length-1];}}},toString:function(){return("DragDrop "+this.id);}};YAHOO.augment(YAHOO.util.DragDrop,YAHOO.util.EventProvider);})();YAHOO.util.DD=function(C,A,B){if(C){this.init(C,A,B);}};YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop,{scroll:true,autoOffset:function(C,B){var A=C-this.startPageX;var D=B-this.startPageY;this.setDelta(A,D);},setDelta:function(B,A){this.deltaX=B;this.deltaY=A;},setDragElPos:function(C,B){var A=this.getDragEl();this.alignElWithMouse(A,C,B);},alignElWithMouse:function(C,G,F){var E=this.getTargetCoord(G,F);if(!this.deltaSetXY){var H=[E.x,E.y];YAHOO.util.Dom.setXY(C,H);var D=parseInt(YAHOO.util.Dom.getStyle(C,"left"),10);var B=parseInt(YAHOO.util.Dom.getStyle(C,"top"),10);this.deltaSetXY=[D-E.x,B-E.y];}else{YAHOO.util.Dom.setStyle(C,"left",(E.x+this.deltaSetXY[0])+"px");YAHOO.util.Dom.setStyle(C,"top",(E.y+this.deltaSetXY[1])+"px");}this.cachePosition(E.x,E.y);var A=this;setTimeout(function(){A.autoScroll.call(A,E.x,E.y,C.offsetHeight,C.offsetWidth);},0);},cachePosition:function(B,A){if(B){this.lastPageX=B;this.lastPageY=A;}else{var C=YAHOO.util.Dom.getXY(this.getEl());this.lastPageX=C[0];this.lastPageY=C[1];}},autoScroll:function(J,I,E,K){if(this.scroll){var L=this.DDM.getClientHeight();var B=this.DDM.getClientWidth();var N=this.DDM.getScrollTop();var D=this.DDM.getScrollLeft();var H=E+I;var M=K+J;var G=(L+N-I-this.deltaY);var F=(B+D-J-this.deltaX);var C=40;var A=(document.all)?80:30;if(H>L&&G<C){window.scrollTo(D,N+A);}if(I<N&&N>0&&I-N<C){window.scrollTo(D,N-A);}if(M>B&&F<C){window.scrollTo(D+A,N);}if(J<D&&D>0&&J-D<C){window.scrollTo(D-A,N);}}},applyConfig:function(){YAHOO.util.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);},b4MouseDown:function(A){this.setStartPosition();this.autoOffset(YAHOO.util.Event.getPageX(A),YAHOO.util.Event.getPageY(A));},b4Drag:function(A){this.setDragElPos(YAHOO.util.Event.getPageX(A),YAHOO.util.Event.getPageY(A));},toString:function(){return("DD "+this.id);}});YAHOO.util.DDProxy=function(C,A,B){if(C){this.init(C,A,B);this.initFrame();}};YAHOO.util.DDProxy.dragElId="ygddfdiv";YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var B=this,A=document.body;if(!A||!A.firstChild){setTimeout(function(){B.createFrame();},50);return;}var F=this.getDragEl(),E=YAHOO.util.Dom;if(!F){F=document.createElement("div");F.id=this.dragElId;var D=F.style;D.position="absolute";D.visibility="hidden";D.cursor="move";D.border="2px solid #aaa";D.zIndex=999;D.height="25px";D.width="25px";var C=document.createElement("div");E.setStyle(C,"height","100%");E.setStyle(C,"width","100%");E.setStyle(C,"background-color","#ccc");E.setStyle(C,"opacity","0");F.appendChild(C);A.insertBefore(F,A.firstChild);}},initFrame:function(){this.createFrame();},applyConfig:function(){YAHOO.util.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||YAHOO.util.DDProxy.dragElId);},showFrame:function(E,D){var C=this.getEl();var A=this.getDragEl();var B=A.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(B.width,10)/2),Math.round(parseInt(B.height,10)/2));}this.setDragElPos(E,D);YAHOO.util.Dom.setStyle(A,"visibility","visible");},_resizeProxy:function(){if(this.resizeFrame){var H=YAHOO.util.Dom;var B=this.getEl();var C=this.getDragEl();var G=parseInt(H.getStyle(C,"borderTopWidth"),10);var I=parseInt(H.getStyle(C,"borderRightWidth"),10);var F=parseInt(H.getStyle(C,"borderBottomWidth"),10);var D=parseInt(H.getStyle(C,"borderLeftWidth"),10);if(isNaN(G)){G=0;}if(isNaN(I)){I=0;}if(isNaN(F)){F=0;}if(isNaN(D)){D=0;}var E=Math.max(0,B.offsetWidth-I-D);var A=Math.max(0,B.offsetHeight-G-F);H.setStyle(C,"width",E+"px");H.setStyle(C,"height",A+"px");}},b4MouseDown:function(B){this.setStartPosition();var A=YAHOO.util.Event.getPageX(B);var C=YAHOO.util.Event.getPageY(B);this.autoOffset(A,C);},b4StartDrag:function(A,B){this.showFrame(A,B);},b4EndDrag:function(A){YAHOO.util.Dom.setStyle(this.getDragEl(),"visibility","hidden");},endDrag:function(D){var C=YAHOO.util.Dom;var B=this.getEl();var A=this.getDragEl();C.setStyle(A,"visibility","");C.setStyle(B,"visibility","hidden");YAHOO.util.DDM.moveToEl(B,A);C.setStyle(A,"visibility","hidden");C.setStyle(B,"visibility","");},toString:function(){return("DDProxy "+this.id);}});YAHOO.util.DDTarget=function(C,A,B){if(C){this.initTarget(C,A,B);}};YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop,{toString:function(){return("DDTarget "+this.id);}});YAHOO.register("dragdrop",YAHOO.util.DragDropMgr,{version:"2.8.1",build:"19"});
@@ -0,0 +1,3601 @@
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
+ * The drag and drop utility provides a framework for building drag and drop
9
+ * applications. In addition to enabling drag and drop for specific elements,
10
+ * the drag and drop elements are tracked by the manager class, and the
11
+ * interactions between the various elements are tracked during the drag and
12
+ * the implementing code is notified about these important moments.
13
+ * @module dragdrop
14
+ * @title Drag and Drop
15
+ * @requires yahoo,dom,event
16
+ * @namespace YAHOO.util
17
+ */
18
+
19
+ // Only load the library once. Rewriting the manager class would orphan
20
+ // existing drag and drop instances.
21
+ if (!YAHOO.util.DragDropMgr) {
22
+
23
+ /**
24
+ * DragDropMgr is a singleton that tracks the element interaction for
25
+ * all DragDrop items in the window. Generally, you will not call
26
+ * this class directly, but it does have helper methods that could
27
+ * be useful in your DragDrop implementations.
28
+ * @class DragDropMgr
29
+ * @static
30
+ */
31
+ YAHOO.util.DragDropMgr = function() {
32
+
33
+ var Event = YAHOO.util.Event,
34
+ Dom = YAHOO.util.Dom;
35
+
36
+ return {
37
+ /**
38
+ * This property is used to turn on global use of the shim element on all DragDrop instances, defaults to false for backcompat. (Use: YAHOO.util.DDM.useShim = true)
39
+ * @property useShim
40
+ * @type Boolean
41
+ * @static
42
+ */
43
+ useShim: false,
44
+ /**
45
+ * This property is used to determine if the shim is active over the screen, default false.
46
+ * @private
47
+ * @property _shimActive
48
+ * @type Boolean
49
+ * @static
50
+ */
51
+ _shimActive: false,
52
+ /**
53
+ * This property is used when useShim is set on a DragDrop object to store the current state of DDM.useShim so it can be reset when a drag operation is done.
54
+ * @private
55
+ * @property _shimState
56
+ * @type Boolean
57
+ * @static
58
+ */
59
+ _shimState: false,
60
+ /**
61
+ * This property is used when useShim is set to true, it will set the opacity on the shim to .5 for debugging. Use: (YAHOO.util.DDM._debugShim = true;)
62
+ * @private
63
+ * @property _debugShim
64
+ * @type Boolean
65
+ * @static
66
+ */
67
+ _debugShim: false,
68
+ /**
69
+ * This method will create a shim element (giving it the id of yui-ddm-shim), it also attaches the mousemove and mouseup listeners to it and attaches a scroll listener on the window
70
+ * @private
71
+ * @method _sizeShim
72
+ * @static
73
+ */
74
+ _createShim: function() {
75
+ var s = document.createElement('div');
76
+ s.id = 'yui-ddm-shim';
77
+ if (document.body.firstChild) {
78
+ document.body.insertBefore(s, document.body.firstChild);
79
+ } else {
80
+ document.body.appendChild(s);
81
+ }
82
+ s.style.display = 'none';
83
+ s.style.backgroundColor = 'red';
84
+ s.style.position = 'absolute';
85
+ s.style.zIndex = '99999';
86
+ Dom.setStyle(s, 'opacity', '0');
87
+ this._shim = s;
88
+ Event.on(s, "mouseup", this.handleMouseUp, this, true);
89
+ Event.on(s, "mousemove", this.handleMouseMove, this, true);
90
+ Event.on(window, 'scroll', this._sizeShim, this, true);
91
+ },
92
+ /**
93
+ * This method will size the shim, called from activate and on window scroll event
94
+ * @private
95
+ * @method _sizeShim
96
+ * @static
97
+ */
98
+ _sizeShim: function() {
99
+ if (this._shimActive) {
100
+ var s = this._shim;
101
+ s.style.height = Dom.getDocumentHeight() + 'px';
102
+ s.style.width = Dom.getDocumentWidth() + 'px';
103
+ s.style.top = '0';
104
+ s.style.left = '0';
105
+ }
106
+ },
107
+ /**
108
+ * This method will create the shim element if needed, then show the shim element, size the element and set the _shimActive property to true
109
+ * @private
110
+ * @method _activateShim
111
+ * @static
112
+ */
113
+ _activateShim: function() {
114
+ if (this.useShim) {
115
+ if (!this._shim) {
116
+ this._createShim();
117
+ }
118
+ this._shimActive = true;
119
+ var s = this._shim,
120
+ o = '0';
121
+ if (this._debugShim) {
122
+ o = '.5';
123
+ }
124
+ Dom.setStyle(s, 'opacity', o);
125
+ this._sizeShim();
126
+ s.style.display = 'block';
127
+ }
128
+ },
129
+ /**
130
+ * This method will hide the shim element and set the _shimActive property to false
131
+ * @private
132
+ * @method _deactivateShim
133
+ * @static
134
+ */
135
+ _deactivateShim: function() {
136
+ this._shim.style.display = 'none';
137
+ this._shimActive = false;
138
+ },
139
+ /**
140
+ * The HTML element created to use as a shim over the document to track mouse movements
141
+ * @private
142
+ * @property _shim
143
+ * @type HTMLElement
144
+ * @static
145
+ */
146
+ _shim: null,
147
+ /**
148
+ * Two dimensional Array of registered DragDrop objects. The first
149
+ * dimension is the DragDrop item group, the second the DragDrop
150
+ * object.
151
+ * @property ids
152
+ * @type {string: string}
153
+ * @private
154
+ * @static
155
+ */
156
+ ids: {},
157
+
158
+ /**
159
+ * Array of element ids defined as drag handles. Used to determine
160
+ * if the element that generated the mousedown event is actually the
161
+ * handle and not the html element itself.
162
+ * @property handleIds
163
+ * @type {string: string}
164
+ * @private
165
+ * @static
166
+ */
167
+ handleIds: {},
168
+
169
+ /**
170
+ * the DragDrop object that is currently being dragged
171
+ * @property dragCurrent
172
+ * @type DragDrop
173
+ * @private
174
+ * @static
175
+ **/
176
+ dragCurrent: null,
177
+
178
+ /**
179
+ * the DragDrop object(s) that are being hovered over
180
+ * @property dragOvers
181
+ * @type Array
182
+ * @private
183
+ * @static
184
+ */
185
+ dragOvers: {},
186
+
187
+ /**
188
+ * the X distance between the cursor and the object being dragged
189
+ * @property deltaX
190
+ * @type int
191
+ * @private
192
+ * @static
193
+ */
194
+ deltaX: 0,
195
+
196
+ /**
197
+ * the Y distance between the cursor and the object being dragged
198
+ * @property deltaY
199
+ * @type int
200
+ * @private
201
+ * @static
202
+ */
203
+ deltaY: 0,
204
+
205
+ /**
206
+ * Flag to determine if we should prevent the default behavior of the
207
+ * events we define. By default this is true, but this can be set to
208
+ * false if you need the default behavior (not recommended)
209
+ * @property preventDefault
210
+ * @type boolean
211
+ * @static
212
+ */
213
+ preventDefault: true,
214
+
215
+ /**
216
+ * Flag to determine if we should stop the propagation of the events
217
+ * we generate. This is true by default but you may want to set it to
218
+ * false if the html element contains other features that require the
219
+ * mouse click.
220
+ * @property stopPropagation
221
+ * @type boolean
222
+ * @static
223
+ */
224
+ stopPropagation: true,
225
+
226
+ /**
227
+ * Internal flag that is set to true when drag and drop has been
228
+ * initialized
229
+ * @property initialized
230
+ * @private
231
+ * @static
232
+ */
233
+ initialized: false,
234
+
235
+ /**
236
+ * All drag and drop can be disabled.
237
+ * @property locked
238
+ * @private
239
+ * @static
240
+ */
241
+ locked: false,
242
+
243
+ /**
244
+ * Provides additional information about the the current set of
245
+ * interactions. Can be accessed from the event handlers. It
246
+ * contains the following properties:
247
+ *
248
+ * out: onDragOut interactions
249
+ * enter: onDragEnter interactions
250
+ * over: onDragOver interactions
251
+ * drop: onDragDrop interactions
252
+ * point: The location of the cursor
253
+ * draggedRegion: The location of dragged element at the time
254
+ * of the interaction
255
+ * sourceRegion: The location of the source elemtn at the time
256
+ * of the interaction
257
+ * validDrop: boolean
258
+ * @property interactionInfo
259
+ * @type object
260
+ * @static
261
+ */
262
+ interactionInfo: null,
263
+
264
+ /**
265
+ * Called the first time an element is registered.
266
+ * @method init
267
+ * @private
268
+ * @static
269
+ */
270
+ init: function() {
271
+ this.initialized = true;
272
+ },
273
+
274
+ /**
275
+ * In point mode, drag and drop interaction is defined by the
276
+ * location of the cursor during the drag/drop
277
+ * @property POINT
278
+ * @type int
279
+ * @static
280
+ * @final
281
+ */
282
+ POINT: 0,
283
+
284
+ /**
285
+ * In intersect mode, drag and drop interaction is defined by the
286
+ * cursor position or the amount of overlap of two or more drag and
287
+ * drop objects.
288
+ * @property INTERSECT
289
+ * @type int
290
+ * @static
291
+ * @final
292
+ */
293
+ INTERSECT: 1,
294
+
295
+ /**
296
+ * In intersect mode, drag and drop interaction is defined only by the
297
+ * overlap of two or more drag and drop objects.
298
+ * @property STRICT_INTERSECT
299
+ * @type int
300
+ * @static
301
+ * @final
302
+ */
303
+ STRICT_INTERSECT: 2,
304
+
305
+ /**
306
+ * The current drag and drop mode. Default: POINT
307
+ * @property mode
308
+ * @type int
309
+ * @static
310
+ */
311
+ mode: 0,
312
+
313
+ /**
314
+ * Runs method on all drag and drop objects
315
+ * @method _execOnAll
316
+ * @private
317
+ * @static
318
+ */
319
+ _execOnAll: function(sMethod, args) {
320
+ for (var i in this.ids) {
321
+ for (var j in this.ids[i]) {
322
+ var oDD = this.ids[i][j];
323
+ if (! this.isTypeOfDD(oDD)) {
324
+ continue;
325
+ }
326
+ oDD[sMethod].apply(oDD, args);
327
+ }
328
+ }
329
+ },
330
+
331
+ /**
332
+ * Drag and drop initialization. Sets up the global event handlers
333
+ * @method _onLoad
334
+ * @private
335
+ * @static
336
+ */
337
+ _onLoad: function() {
338
+
339
+ this.init();
340
+
341
+ Event.on(document, "mouseup", this.handleMouseUp, this, true);
342
+ Event.on(document, "mousemove", this.handleMouseMove, this, true);
343
+ Event.on(window, "unload", this._onUnload, this, true);
344
+ Event.on(window, "resize", this._onResize, this, true);
345
+ // Event.on(window, "mouseout", this._test);
346
+
347
+ },
348
+
349
+ /**
350
+ * Reset constraints on all drag and drop objs
351
+ * @method _onResize
352
+ * @private
353
+ * @static
354
+ */
355
+ _onResize: function(e) {
356
+ this._execOnAll("resetConstraints", []);
357
+ },
358
+
359
+ /**
360
+ * Lock all drag and drop functionality
361
+ * @method lock
362
+ * @static
363
+ */
364
+ lock: function() { this.locked = true; },
365
+
366
+ /**
367
+ * Unlock all drag and drop functionality
368
+ * @method unlock
369
+ * @static
370
+ */
371
+ unlock: function() { this.locked = false; },
372
+
373
+ /**
374
+ * Is drag and drop locked?
375
+ * @method isLocked
376
+ * @return {boolean} True if drag and drop is locked, false otherwise.
377
+ * @static
378
+ */
379
+ isLocked: function() { return this.locked; },
380
+
381
+ /**
382
+ * Location cache that is set for all drag drop objects when a drag is
383
+ * initiated, cleared when the drag is finished.
384
+ * @property locationCache
385
+ * @private
386
+ * @static
387
+ */
388
+ locationCache: {},
389
+
390
+ /**
391
+ * Set useCache to false if you want to force object the lookup of each
392
+ * drag and drop linked element constantly during a drag.
393
+ * @property useCache
394
+ * @type boolean
395
+ * @static
396
+ */
397
+ useCache: true,
398
+
399
+ /**
400
+ * The number of pixels that the mouse needs to move after the
401
+ * mousedown before the drag is initiated. Default=3;
402
+ * @property clickPixelThresh
403
+ * @type int
404
+ * @static
405
+ */
406
+ clickPixelThresh: 3,
407
+
408
+ /**
409
+ * The number of milliseconds after the mousedown event to initiate the
410
+ * drag if we don't get a mouseup event. Default=1000
411
+ * @property clickTimeThresh
412
+ * @type int
413
+ * @static
414
+ */
415
+ clickTimeThresh: 1000,
416
+
417
+ /**
418
+ * Flag that indicates that either the drag pixel threshold or the
419
+ * mousdown time threshold has been met
420
+ * @property dragThreshMet
421
+ * @type boolean
422
+ * @private
423
+ * @static
424
+ */
425
+ dragThreshMet: false,
426
+
427
+ /**
428
+ * Timeout used for the click time threshold
429
+ * @property clickTimeout
430
+ * @type Object
431
+ * @private
432
+ * @static
433
+ */
434
+ clickTimeout: null,
435
+
436
+ /**
437
+ * The X position of the mousedown event stored for later use when a
438
+ * drag threshold is met.
439
+ * @property startX
440
+ * @type int
441
+ * @private
442
+ * @static
443
+ */
444
+ startX: 0,
445
+
446
+ /**
447
+ * The Y position of the mousedown event stored for later use when a
448
+ * drag threshold is met.
449
+ * @property startY
450
+ * @type int
451
+ * @private
452
+ * @static
453
+ */
454
+ startY: 0,
455
+
456
+ /**
457
+ * Flag to determine if the drag event was fired from the click timeout and
458
+ * not the mouse move threshold.
459
+ * @property fromTimeout
460
+ * @type boolean
461
+ * @private
462
+ * @static
463
+ */
464
+ fromTimeout: false,
465
+
466
+ /**
467
+ * Each DragDrop instance must be registered with the DragDropMgr.
468
+ * This is executed in DragDrop.init()
469
+ * @method regDragDrop
470
+ * @param {DragDrop} oDD the DragDrop object to register
471
+ * @param {String} sGroup the name of the group this element belongs to
472
+ * @static
473
+ */
474
+ regDragDrop: function(oDD, sGroup) {
475
+ if (!this.initialized) { this.init(); }
476
+
477
+ if (!this.ids[sGroup]) {
478
+ this.ids[sGroup] = {};
479
+ }
480
+ this.ids[sGroup][oDD.id] = oDD;
481
+ },
482
+
483
+ /**
484
+ * Removes the supplied dd instance from the supplied group. Executed
485
+ * by DragDrop.removeFromGroup, so don't call this function directly.
486
+ * @method removeDDFromGroup
487
+ * @private
488
+ * @static
489
+ */
490
+ removeDDFromGroup: function(oDD, sGroup) {
491
+ if (!this.ids[sGroup]) {
492
+ this.ids[sGroup] = {};
493
+ }
494
+
495
+ var obj = this.ids[sGroup];
496
+ if (obj && obj[oDD.id]) {
497
+ delete obj[oDD.id];
498
+ }
499
+ },
500
+
501
+ /**
502
+ * Unregisters a drag and drop item. This is executed in
503
+ * DragDrop.unreg, use that method instead of calling this directly.
504
+ * @method _remove
505
+ * @private
506
+ * @static
507
+ */
508
+ _remove: function(oDD) {
509
+ for (var g in oDD.groups) {
510
+ if (g) {
511
+ var item = this.ids[g];
512
+ if (item && item[oDD.id]) {
513
+ delete item[oDD.id];
514
+ }
515
+ }
516
+
517
+ }
518
+ delete this.handleIds[oDD.id];
519
+ },
520
+
521
+ /**
522
+ * Each DragDrop handle element must be registered. This is done
523
+ * automatically when executing DragDrop.setHandleElId()
524
+ * @method regHandle
525
+ * @param {String} sDDId the DragDrop id this element is a handle for
526
+ * @param {String} sHandleId the id of the element that is the drag
527
+ * handle
528
+ * @static
529
+ */
530
+ regHandle: function(sDDId, sHandleId) {
531
+ if (!this.handleIds[sDDId]) {
532
+ this.handleIds[sDDId] = {};
533
+ }
534
+ this.handleIds[sDDId][sHandleId] = sHandleId;
535
+ },
536
+
537
+ /**
538
+ * Utility function to determine if a given element has been
539
+ * registered as a drag drop item.
540
+ * @method isDragDrop
541
+ * @param {String} id the element id to check
542
+ * @return {boolean} true if this element is a DragDrop item,
543
+ * false otherwise
544
+ * @static
545
+ */
546
+ isDragDrop: function(id) {
547
+ return ( this.getDDById(id) ) ? true : false;
548
+ },
549
+
550
+ /**
551
+ * Returns the drag and drop instances that are in all groups the
552
+ * passed in instance belongs to.
553
+ * @method getRelated
554
+ * @param {DragDrop} p_oDD the obj to get related data for
555
+ * @param {boolean} bTargetsOnly if true, only return targetable objs
556
+ * @return {DragDrop[]} the related instances
557
+ * @static
558
+ */
559
+ getRelated: function(p_oDD, bTargetsOnly) {
560
+ var oDDs = [];
561
+ for (var i in p_oDD.groups) {
562
+ for (var j in this.ids[i]) {
563
+ var dd = this.ids[i][j];
564
+ if (! this.isTypeOfDD(dd)) {
565
+ continue;
566
+ }
567
+ if (!bTargetsOnly || dd.isTarget) {
568
+ oDDs[oDDs.length] = dd;
569
+ }
570
+ }
571
+ }
572
+
573
+ return oDDs;
574
+ },
575
+
576
+ /**
577
+ * Returns true if the specified dd target is a legal target for
578
+ * the specifice drag obj
579
+ * @method isLegalTarget
580
+ * @param {DragDrop} the drag obj
581
+ * @param {DragDrop} the target
582
+ * @return {boolean} true if the target is a legal target for the
583
+ * dd obj
584
+ * @static
585
+ */
586
+ isLegalTarget: function (oDD, oTargetDD) {
587
+ var targets = this.getRelated(oDD, true);
588
+ for (var i=0, len=targets.length;i<len;++i) {
589
+ if (targets[i].id == oTargetDD.id) {
590
+ return true;
591
+ }
592
+ }
593
+
594
+ return false;
595
+ },
596
+
597
+ /**
598
+ * My goal is to be able to transparently determine if an object is
599
+ * typeof DragDrop, and the exact subclass of DragDrop. typeof
600
+ * returns "object", oDD.constructor.toString() always returns
601
+ * "DragDrop" and not the name of the subclass. So for now it just
602
+ * evaluates a well-known variable in DragDrop.
603
+ * @method isTypeOfDD
604
+ * @param {Object} the object to evaluate
605
+ * @return {boolean} true if typeof oDD = DragDrop
606
+ * @static
607
+ */
608
+ isTypeOfDD: function (oDD) {
609
+ return (oDD && oDD.__ygDragDrop);
610
+ },
611
+
612
+ /**
613
+ * Utility function to determine if a given element has been
614
+ * registered as a drag drop handle for the given Drag Drop object.
615
+ * @method isHandle
616
+ * @param {String} id the element id to check
617
+ * @return {boolean} true if this element is a DragDrop handle, false
618
+ * otherwise
619
+ * @static
620
+ */
621
+ isHandle: function(sDDId, sHandleId) {
622
+ return ( this.handleIds[sDDId] &&
623
+ this.handleIds[sDDId][sHandleId] );
624
+ },
625
+
626
+ /**
627
+ * Returns the DragDrop instance for a given id
628
+ * @method getDDById
629
+ * @param {String} id the id of the DragDrop object
630
+ * @return {DragDrop} the drag drop object, null if it is not found
631
+ * @static
632
+ */
633
+ getDDById: function(id) {
634
+ for (var i in this.ids) {
635
+ if (this.ids[i][id]) {
636
+ return this.ids[i][id];
637
+ }
638
+ }
639
+ return null;
640
+ },
641
+
642
+ /**
643
+ * Fired after a registered DragDrop object gets the mousedown event.
644
+ * Sets up the events required to track the object being dragged
645
+ * @method handleMouseDown
646
+ * @param {Event} e the event
647
+ * @param oDD the DragDrop object being dragged
648
+ * @private
649
+ * @static
650
+ */
651
+ handleMouseDown: function(e, oDD) {
652
+ //this._activateShim();
653
+
654
+ this.currentTarget = YAHOO.util.Event.getTarget(e);
655
+
656
+ this.dragCurrent = oDD;
657
+
658
+ var el = oDD.getEl();
659
+
660
+ // track start position
661
+ this.startX = YAHOO.util.Event.getPageX(e);
662
+ this.startY = YAHOO.util.Event.getPageY(e);
663
+
664
+ this.deltaX = this.startX - el.offsetLeft;
665
+ this.deltaY = this.startY - el.offsetTop;
666
+
667
+ this.dragThreshMet = false;
668
+
669
+ this.clickTimeout = setTimeout(
670
+ function() {
671
+ var DDM = YAHOO.util.DDM;
672
+ DDM.startDrag(DDM.startX, DDM.startY);
673
+ DDM.fromTimeout = true;
674
+ },
675
+ this.clickTimeThresh );
676
+ },
677
+
678
+ /**
679
+ * Fired when either the drag pixel threshold or the mousedown hold
680
+ * time threshold has been met.
681
+ * @method startDrag
682
+ * @param x {int} the X position of the original mousedown
683
+ * @param y {int} the Y position of the original mousedown
684
+ * @static
685
+ */
686
+ startDrag: function(x, y) {
687
+ if (this.dragCurrent && this.dragCurrent.useShim) {
688
+ this._shimState = this.useShim;
689
+ this.useShim = true;
690
+ }
691
+ this._activateShim();
692
+ clearTimeout(this.clickTimeout);
693
+ var dc = this.dragCurrent;
694
+ if (dc && dc.events.b4StartDrag) {
695
+ dc.b4StartDrag(x, y);
696
+ dc.fireEvent('b4StartDragEvent', { x: x, y: y });
697
+ }
698
+ if (dc && dc.events.startDrag) {
699
+ dc.startDrag(x, y);
700
+ dc.fireEvent('startDragEvent', { x: x, y: y });
701
+ }
702
+ this.dragThreshMet = true;
703
+ },
704
+
705
+ /**
706
+ * Internal function to handle the mouseup event. Will be invoked
707
+ * from the context of the document.
708
+ * @method handleMouseUp
709
+ * @param {Event} e the event
710
+ * @private
711
+ * @static
712
+ */
713
+ handleMouseUp: function(e) {
714
+ if (this.dragCurrent) {
715
+ clearTimeout(this.clickTimeout);
716
+
717
+ if (this.dragThreshMet) {
718
+ if (this.fromTimeout) {
719
+ this.fromTimeout = false;
720
+ this.handleMouseMove(e);
721
+ }
722
+ this.fromTimeout = false;
723
+ this.fireEvents(e, true);
724
+ } else {
725
+ }
726
+
727
+ this.stopDrag(e);
728
+
729
+ this.stopEvent(e);
730
+ }
731
+ },
732
+
733
+ /**
734
+ * Utility to stop event propagation and event default, if these
735
+ * features are turned on.
736
+ * @method stopEvent
737
+ * @param {Event} e the event as returned by this.getEvent()
738
+ * @static
739
+ */
740
+ stopEvent: function(e) {
741
+ if (this.stopPropagation) {
742
+ YAHOO.util.Event.stopPropagation(e);
743
+ }
744
+
745
+ if (this.preventDefault) {
746
+ YAHOO.util.Event.preventDefault(e);
747
+ }
748
+ },
749
+
750
+ /**
751
+ * Ends the current drag, cleans up the state, and fires the endDrag
752
+ * and mouseUp events. Called internally when a mouseup is detected
753
+ * during the drag. Can be fired manually during the drag by passing
754
+ * either another event (such as the mousemove event received in onDrag)
755
+ * or a fake event with pageX and pageY defined (so that endDrag and
756
+ * onMouseUp have usable position data.). Alternatively, pass true
757
+ * for the silent parameter so that the endDrag and onMouseUp events
758
+ * are skipped (so no event data is needed.)
759
+ *
760
+ * @method stopDrag
761
+ * @param {Event} e the mouseup event, another event (or a fake event)
762
+ * with pageX and pageY defined, or nothing if the
763
+ * silent parameter is true
764
+ * @param {boolean} silent skips the enddrag and mouseup events if true
765
+ * @static
766
+ */
767
+ stopDrag: function(e, silent) {
768
+ var dc = this.dragCurrent;
769
+ // Fire the drag end event for the item that was dragged
770
+ if (dc && !silent) {
771
+ if (this.dragThreshMet) {
772
+ if (dc.events.b4EndDrag) {
773
+ dc.b4EndDrag(e);
774
+ dc.fireEvent('b4EndDragEvent', { e: e });
775
+ }
776
+ if (dc.events.endDrag) {
777
+ dc.endDrag(e);
778
+ dc.fireEvent('endDragEvent', { e: e });
779
+ }
780
+ }
781
+ if (dc.events.mouseUp) {
782
+ dc.onMouseUp(e);
783
+ dc.fireEvent('mouseUpEvent', { e: e });
784
+ }
785
+ }
786
+
787
+ if (this._shimActive) {
788
+ this._deactivateShim();
789
+ if (this.dragCurrent && this.dragCurrent.useShim) {
790
+ this.useShim = this._shimState;
791
+ this._shimState = false;
792
+ }
793
+ }
794
+
795
+ this.dragCurrent = null;
796
+ this.dragOvers = {};
797
+ },
798
+
799
+ /**
800
+ * Internal function to handle the mousemove event. Will be invoked
801
+ * from the context of the html element.
802
+ *
803
+ * @TODO figure out what we can do about mouse events lost when the
804
+ * user drags objects beyond the window boundary. Currently we can
805
+ * detect this in internet explorer by verifying that the mouse is
806
+ * down during the mousemove event. Firefox doesn't give us the
807
+ * button state on the mousemove event.
808
+ * @method handleMouseMove
809
+ * @param {Event} e the event
810
+ * @private
811
+ * @static
812
+ */
813
+ handleMouseMove: function(e) {
814
+
815
+ var dc = this.dragCurrent;
816
+ if (dc) {
817
+
818
+ // var button = e.which || e.button;
819
+
820
+ // check for IE mouseup outside of page boundary
821
+ if (YAHOO.util.Event.isIE && !e.button) {
822
+ this.stopEvent(e);
823
+ return this.handleMouseUp(e);
824
+ } else {
825
+ if (e.clientX < 0 || e.clientY < 0) {
826
+ //This will stop the element from leaving the viewport in FF, Opera & Safari
827
+ //Not turned on yet
828
+ //this.stopEvent(e);
829
+ //return false;
830
+ }
831
+ }
832
+
833
+ if (!this.dragThreshMet) {
834
+ var diffX = Math.abs(this.startX - YAHOO.util.Event.getPageX(e));
835
+ var diffY = Math.abs(this.startY - YAHOO.util.Event.getPageY(e));
836
+ if (diffX > this.clickPixelThresh ||
837
+ diffY > this.clickPixelThresh) {
838
+ this.startDrag(this.startX, this.startY);
839
+ }
840
+ }
841
+
842
+ if (this.dragThreshMet) {
843
+ if (dc && dc.events.b4Drag) {
844
+ dc.b4Drag(e);
845
+ dc.fireEvent('b4DragEvent', { e: e});
846
+ }
847
+ if (dc && dc.events.drag) {
848
+ dc.onDrag(e);
849
+ dc.fireEvent('dragEvent', { e: e});
850
+ }
851
+ if (dc) {
852
+ this.fireEvents(e, false);
853
+ }
854
+ }
855
+
856
+ this.stopEvent(e);
857
+ }
858
+ },
859
+
860
+ /**
861
+ * Iterates over all of the DragDrop elements to find ones we are
862
+ * hovering over or dropping on
863
+ * @method fireEvents
864
+ * @param {Event} e the event
865
+ * @param {boolean} isDrop is this a drop op or a mouseover op?
866
+ * @private
867
+ * @static
868
+ */
869
+ fireEvents: function(e, isDrop) {
870
+ var dc = this.dragCurrent;
871
+
872
+ // If the user did the mouse up outside of the window, we could
873
+ // get here even though we have ended the drag.
874
+ // If the config option dragOnly is true, bail out and don't fire the events
875
+ if (!dc || dc.isLocked() || dc.dragOnly) {
876
+ return;
877
+ }
878
+
879
+ var x = YAHOO.util.Event.getPageX(e),
880
+ y = YAHOO.util.Event.getPageY(e),
881
+ pt = new YAHOO.util.Point(x,y),
882
+ pos = dc.getTargetCoord(pt.x, pt.y),
883
+ el = dc.getDragEl(),
884
+ events = ['out', 'over', 'drop', 'enter'],
885
+ curRegion = new YAHOO.util.Region( pos.y,
886
+ pos.x + el.offsetWidth,
887
+ pos.y + el.offsetHeight,
888
+ pos.x ),
889
+
890
+ oldOvers = [], // cache the previous dragOver array
891
+ inGroupsObj = {},
892
+ inGroups = [],
893
+ data = {
894
+ outEvts: [],
895
+ overEvts: [],
896
+ dropEvts: [],
897
+ enterEvts: []
898
+ };
899
+
900
+
901
+ // Check to see if the object(s) we were hovering over is no longer
902
+ // being hovered over so we can fire the onDragOut event
903
+ for (var i in this.dragOvers) {
904
+
905
+ var ddo = this.dragOvers[i];
906
+
907
+ if (! this.isTypeOfDD(ddo)) {
908
+ continue;
909
+ }
910
+ if (! this.isOverTarget(pt, ddo, this.mode, curRegion)) {
911
+ data.outEvts.push( ddo );
912
+ }
913
+
914
+ oldOvers[i] = true;
915
+ delete this.dragOvers[i];
916
+ }
917
+
918
+ for (var sGroup in dc.groups) {
919
+
920
+ if ("string" != typeof sGroup) {
921
+ continue;
922
+ }
923
+
924
+ for (i in this.ids[sGroup]) {
925
+ var oDD = this.ids[sGroup][i];
926
+ if (! this.isTypeOfDD(oDD)) {
927
+ continue;
928
+ }
929
+
930
+ if (oDD.isTarget && !oDD.isLocked() && oDD != dc) {
931
+ if (this.isOverTarget(pt, oDD, this.mode, curRegion)) {
932
+ inGroupsObj[sGroup] = true;
933
+ // look for drop interactions
934
+ if (isDrop) {
935
+ data.dropEvts.push( oDD );
936
+ // look for drag enter and drag over interactions
937
+ } else {
938
+
939
+ // initial drag over: dragEnter fires
940
+ if (!oldOvers[oDD.id]) {
941
+ data.enterEvts.push( oDD );
942
+ // subsequent drag overs: dragOver fires
943
+ } else {
944
+ data.overEvts.push( oDD );
945
+ }
946
+
947
+ this.dragOvers[oDD.id] = oDD;
948
+ }
949
+ }
950
+ }
951
+ }
952
+ }
953
+
954
+ this.interactionInfo = {
955
+ out: data.outEvts,
956
+ enter: data.enterEvts,
957
+ over: data.overEvts,
958
+ drop: data.dropEvts,
959
+ point: pt,
960
+ draggedRegion: curRegion,
961
+ sourceRegion: this.locationCache[dc.id],
962
+ validDrop: isDrop
963
+ };
964
+
965
+
966
+ for (var inG in inGroupsObj) {
967
+ inGroups.push(inG);
968
+ }
969
+
970
+ // notify about a drop that did not find a target
971
+ if (isDrop && !data.dropEvts.length) {
972
+ this.interactionInfo.validDrop = false;
973
+ if (dc.events.invalidDrop) {
974
+ dc.onInvalidDrop(e);
975
+ dc.fireEvent('invalidDropEvent', { e: e });
976
+ }
977
+ }
978
+ for (i = 0; i < events.length; i++) {
979
+ var tmp = null;
980
+ if (data[events[i] + 'Evts']) {
981
+ tmp = data[events[i] + 'Evts'];
982
+ }
983
+ if (tmp && tmp.length) {
984
+ var type = events[i].charAt(0).toUpperCase() + events[i].substr(1),
985
+ ev = 'onDrag' + type,
986
+ b4 = 'b4Drag' + type,
987
+ cev = 'drag' + type + 'Event',
988
+ check = 'drag' + type;
989
+ if (this.mode) {
990
+ if (dc.events[b4]) {
991
+ dc[b4](e, tmp, inGroups);
992
+ dc.fireEvent(b4 + 'Event', { event: e, info: tmp, group: inGroups });
993
+
994
+ }
995
+ if (dc.events[check]) {
996
+ dc[ev](e, tmp, inGroups);
997
+ dc.fireEvent(cev, { event: e, info: tmp, group: inGroups });
998
+ }
999
+ } else {
1000
+ for (var b = 0, len = tmp.length; b < len; ++b) {
1001
+ if (dc.events[b4]) {
1002
+ dc[b4](e, tmp[b].id, inGroups[0]);
1003
+ dc.fireEvent(b4 + 'Event', { event: e, info: tmp[b].id, group: inGroups[0] });
1004
+ }
1005
+ if (dc.events[check]) {
1006
+ dc[ev](e, tmp[b].id, inGroups[0]);
1007
+ dc.fireEvent(cev, { event: e, info: tmp[b].id, group: inGroups[0] });
1008
+ }
1009
+ }
1010
+ }
1011
+ }
1012
+ }
1013
+ },
1014
+
1015
+ /**
1016
+ * Helper function for getting the best match from the list of drag
1017
+ * and drop objects returned by the drag and drop events when we are
1018
+ * in INTERSECT mode. It returns either the first object that the
1019
+ * cursor is over, or the object that has the greatest overlap with
1020
+ * the dragged element.
1021
+ * @method getBestMatch
1022
+ * @param {DragDrop[]} dds The array of drag and drop objects
1023
+ * targeted
1024
+ * @return {DragDrop} The best single match
1025
+ * @static
1026
+ */
1027
+ getBestMatch: function(dds) {
1028
+ var winner = null;
1029
+
1030
+ var len = dds.length;
1031
+
1032
+ if (len == 1) {
1033
+ winner = dds[0];
1034
+ } else {
1035
+ // Loop through the targeted items
1036
+ for (var i=0; i<len; ++i) {
1037
+ var dd = dds[i];
1038
+ // If the cursor is over the object, it wins. If the
1039
+ // cursor is over multiple matches, the first one we come
1040
+ // to wins.
1041
+ if (this.mode == this.INTERSECT && dd.cursorIsOver) {
1042
+ winner = dd;
1043
+ break;
1044
+ // Otherwise the object with the most overlap wins
1045
+ } else {
1046
+ if (!winner || !winner.overlap || (dd.overlap &&
1047
+ winner.overlap.getArea() < dd.overlap.getArea())) {
1048
+ winner = dd;
1049
+ }
1050
+ }
1051
+ }
1052
+ }
1053
+
1054
+ return winner;
1055
+ },
1056
+
1057
+ /**
1058
+ * Refreshes the cache of the top-left and bottom-right points of the
1059
+ * drag and drop objects in the specified group(s). This is in the
1060
+ * format that is stored in the drag and drop instance, so typical
1061
+ * usage is:
1062
+ * <code>
1063
+ * YAHOO.util.DragDropMgr.refreshCache(ddinstance.groups);
1064
+ * </code>
1065
+ * Alternatively:
1066
+ * <code>
1067
+ * YAHOO.util.DragDropMgr.refreshCache({group1:true, group2:true});
1068
+ * </code>
1069
+ * @TODO this really should be an indexed array. Alternatively this
1070
+ * method could accept both.
1071
+ * @method refreshCache
1072
+ * @param {Object} groups an associative array of groups to refresh
1073
+ * @static
1074
+ */
1075
+ refreshCache: function(groups) {
1076
+
1077
+ // refresh everything if group array is not provided
1078
+ var g = groups || this.ids;
1079
+
1080
+ for (var sGroup in g) {
1081
+ if ("string" != typeof sGroup) {
1082
+ continue;
1083
+ }
1084
+ for (var i in this.ids[sGroup]) {
1085
+ var oDD = this.ids[sGroup][i];
1086
+
1087
+ if (this.isTypeOfDD(oDD)) {
1088
+ var loc = this.getLocation(oDD);
1089
+ if (loc) {
1090
+ this.locationCache[oDD.id] = loc;
1091
+ } else {
1092
+ delete this.locationCache[oDD.id];
1093
+ }
1094
+ }
1095
+ }
1096
+ }
1097
+ },
1098
+
1099
+ /**
1100
+ * This checks to make sure an element exists and is in the DOM. The
1101
+ * main purpose is to handle cases where innerHTML is used to remove
1102
+ * drag and drop objects from the DOM. IE provides an 'unspecified
1103
+ * error' when trying to access the offsetParent of such an element
1104
+ * @method verifyEl
1105
+ * @param {HTMLElement} el the element to check
1106
+ * @return {boolean} true if the element looks usable
1107
+ * @static
1108
+ */
1109
+ verifyEl: function(el) {
1110
+ try {
1111
+ if (el) {
1112
+ var parent = el.offsetParent;
1113
+ if (parent) {
1114
+ return true;
1115
+ }
1116
+ }
1117
+ } catch(e) {
1118
+ }
1119
+
1120
+ return false;
1121
+ },
1122
+
1123
+ /**
1124
+ * Returns a Region object containing the drag and drop element's position
1125
+ * and size, including the padding configured for it
1126
+ * @method getLocation
1127
+ * @param {DragDrop} oDD the drag and drop object to get the
1128
+ * location for
1129
+ * @return {YAHOO.util.Region} a Region object representing the total area
1130
+ * the element occupies, including any padding
1131
+ * the instance is configured for.
1132
+ * @static
1133
+ */
1134
+ getLocation: function(oDD) {
1135
+ if (! this.isTypeOfDD(oDD)) {
1136
+ return null;
1137
+ }
1138
+
1139
+ var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l;
1140
+
1141
+ try {
1142
+ pos= YAHOO.util.Dom.getXY(el);
1143
+ } catch (e) { }
1144
+
1145
+ if (!pos) {
1146
+ return null;
1147
+ }
1148
+
1149
+ x1 = pos[0];
1150
+ x2 = x1 + el.offsetWidth;
1151
+ y1 = pos[1];
1152
+ y2 = y1 + el.offsetHeight;
1153
+
1154
+ t = y1 - oDD.padding[0];
1155
+ r = x2 + oDD.padding[1];
1156
+ b = y2 + oDD.padding[2];
1157
+ l = x1 - oDD.padding[3];
1158
+
1159
+ return new YAHOO.util.Region( t, r, b, l );
1160
+ },
1161
+
1162
+ /**
1163
+ * Checks the cursor location to see if it over the target
1164
+ * @method isOverTarget
1165
+ * @param {YAHOO.util.Point} pt The point to evaluate
1166
+ * @param {DragDrop} oTarget the DragDrop object we are inspecting
1167
+ * @param {boolean} intersect true if we are in intersect mode
1168
+ * @param {YAHOO.util.Region} pre-cached location of the dragged element
1169
+ * @return {boolean} true if the mouse is over the target
1170
+ * @private
1171
+ * @static
1172
+ */
1173
+ isOverTarget: function(pt, oTarget, intersect, curRegion) {
1174
+ // use cache if available
1175
+ var loc = this.locationCache[oTarget.id];
1176
+ if (!loc || !this.useCache) {
1177
+ loc = this.getLocation(oTarget);
1178
+ this.locationCache[oTarget.id] = loc;
1179
+
1180
+ }
1181
+
1182
+ if (!loc) {
1183
+ return false;
1184
+ }
1185
+
1186
+ oTarget.cursorIsOver = loc.contains( pt );
1187
+
1188
+ // DragDrop is using this as a sanity check for the initial mousedown
1189
+ // in this case we are done. In POINT mode, if the drag obj has no
1190
+ // contraints, we are done. Otherwise we need to evaluate the
1191
+ // region the target as occupies to determine if the dragged element
1192
+ // overlaps with it.
1193
+
1194
+ var dc = this.dragCurrent;
1195
+ if (!dc || (!intersect && !dc.constrainX && !dc.constrainY)) {
1196
+
1197
+ //if (oTarget.cursorIsOver) {
1198
+ //}
1199
+ return oTarget.cursorIsOver;
1200
+ }
1201
+
1202
+ oTarget.overlap = null;
1203
+
1204
+
1205
+ // Get the current location of the drag element, this is the
1206
+ // location of the mouse event less the delta that represents
1207
+ // where the original mousedown happened on the element. We
1208
+ // need to consider constraints and ticks as well.
1209
+
1210
+ if (!curRegion) {
1211
+ var pos = dc.getTargetCoord(pt.x, pt.y);
1212
+ var el = dc.getDragEl();
1213
+ curRegion = new YAHOO.util.Region( pos.y,
1214
+ pos.x + el.offsetWidth,
1215
+ pos.y + el.offsetHeight,
1216
+ pos.x );
1217
+ }
1218
+
1219
+ var overlap = curRegion.intersect(loc);
1220
+
1221
+ if (overlap) {
1222
+ oTarget.overlap = overlap;
1223
+ return (intersect) ? true : oTarget.cursorIsOver;
1224
+ } else {
1225
+ return false;
1226
+ }
1227
+ },
1228
+
1229
+ /**
1230
+ * unload event handler
1231
+ * @method _onUnload
1232
+ * @private
1233
+ * @static
1234
+ */
1235
+ _onUnload: function(e, me) {
1236
+ this.unregAll();
1237
+ },
1238
+
1239
+ /**
1240
+ * Cleans up the drag and drop events and objects.
1241
+ * @method unregAll
1242
+ * @private
1243
+ * @static
1244
+ */
1245
+ unregAll: function() {
1246
+
1247
+ if (this.dragCurrent) {
1248
+ this.stopDrag();
1249
+ this.dragCurrent = null;
1250
+ }
1251
+
1252
+ this._execOnAll("unreg", []);
1253
+
1254
+ //for (var i in this.elementCache) {
1255
+ //delete this.elementCache[i];
1256
+ //}
1257
+ //this.elementCache = {};
1258
+
1259
+ this.ids = {};
1260
+ },
1261
+
1262
+ /**
1263
+ * A cache of DOM elements
1264
+ * @property elementCache
1265
+ * @private
1266
+ * @static
1267
+ * @deprecated elements are not cached now
1268
+ */
1269
+ elementCache: {},
1270
+
1271
+ /**
1272
+ * Get the wrapper for the DOM element specified
1273
+ * @method getElWrapper
1274
+ * @param {String} id the id of the element to get
1275
+ * @return {YAHOO.util.DDM.ElementWrapper} the wrapped element
1276
+ * @private
1277
+ * @deprecated This wrapper isn't that useful
1278
+ * @static
1279
+ */
1280
+ getElWrapper: function(id) {
1281
+ var oWrapper = this.elementCache[id];
1282
+ if (!oWrapper || !oWrapper.el) {
1283
+ oWrapper = this.elementCache[id] =
1284
+ new this.ElementWrapper(YAHOO.util.Dom.get(id));
1285
+ }
1286
+ return oWrapper;
1287
+ },
1288
+
1289
+ /**
1290
+ * Returns the actual DOM element
1291
+ * @method getElement
1292
+ * @param {String} id the id of the elment to get
1293
+ * @return {Object} The element
1294
+ * @deprecated use YAHOO.util.Dom.get instead
1295
+ * @static
1296
+ */
1297
+ getElement: function(id) {
1298
+ return YAHOO.util.Dom.get(id);
1299
+ },
1300
+
1301
+ /**
1302
+ * Returns the style property for the DOM element (i.e.,
1303
+ * document.getElById(id).style)
1304
+ * @method getCss
1305
+ * @param {String} id the id of the elment to get
1306
+ * @return {Object} The style property of the element
1307
+ * @deprecated use YAHOO.util.Dom instead
1308
+ * @static
1309
+ */
1310
+ getCss: function(id) {
1311
+ var el = YAHOO.util.Dom.get(id);
1312
+ return (el) ? el.style : null;
1313
+ },
1314
+
1315
+ /**
1316
+ * Inner class for cached elements
1317
+ * @class DragDropMgr.ElementWrapper
1318
+ * @for DragDropMgr
1319
+ * @private
1320
+ * @deprecated
1321
+ */
1322
+ ElementWrapper: function(el) {
1323
+ /**
1324
+ * The element
1325
+ * @property el
1326
+ */
1327
+ this.el = el || null;
1328
+ /**
1329
+ * The element id
1330
+ * @property id
1331
+ */
1332
+ this.id = this.el && el.id;
1333
+ /**
1334
+ * A reference to the style property
1335
+ * @property css
1336
+ */
1337
+ this.css = this.el && el.style;
1338
+ },
1339
+
1340
+ /**
1341
+ * Returns the X position of an html element
1342
+ * @method getPosX
1343
+ * @param el the element for which to get the position
1344
+ * @return {int} the X coordinate
1345
+ * @for DragDropMgr
1346
+ * @deprecated use YAHOO.util.Dom.getX instead
1347
+ * @static
1348
+ */
1349
+ getPosX: function(el) {
1350
+ return YAHOO.util.Dom.getX(el);
1351
+ },
1352
+
1353
+ /**
1354
+ * Returns the Y position of an html element
1355
+ * @method getPosY
1356
+ * @param el the element for which to get the position
1357
+ * @return {int} the Y coordinate
1358
+ * @deprecated use YAHOO.util.Dom.getY instead
1359
+ * @static
1360
+ */
1361
+ getPosY: function(el) {
1362
+ return YAHOO.util.Dom.getY(el);
1363
+ },
1364
+
1365
+ /**
1366
+ * Swap two nodes. In IE, we use the native method, for others we
1367
+ * emulate the IE behavior
1368
+ * @method swapNode
1369
+ * @param n1 the first node to swap
1370
+ * @param n2 the other node to swap
1371
+ * @static
1372
+ */
1373
+ swapNode: function(n1, n2) {
1374
+ if (n1.swapNode) {
1375
+ n1.swapNode(n2);
1376
+ } else {
1377
+ var p = n2.parentNode;
1378
+ var s = n2.nextSibling;
1379
+
1380
+ if (s == n1) {
1381
+ p.insertBefore(n1, n2);
1382
+ } else if (n2 == n1.nextSibling) {
1383
+ p.insertBefore(n2, n1);
1384
+ } else {
1385
+ n1.parentNode.replaceChild(n2, n1);
1386
+ p.insertBefore(n1, s);
1387
+ }
1388
+ }
1389
+ },
1390
+
1391
+ /**
1392
+ * Returns the current scroll position
1393
+ * @method getScroll
1394
+ * @private
1395
+ * @static
1396
+ */
1397
+ getScroll: function () {
1398
+ var t, l, dde=document.documentElement, db=document.body;
1399
+ if (dde && (dde.scrollTop || dde.scrollLeft)) {
1400
+ t = dde.scrollTop;
1401
+ l = dde.scrollLeft;
1402
+ } else if (db) {
1403
+ t = db.scrollTop;
1404
+ l = db.scrollLeft;
1405
+ } else {
1406
+ }
1407
+ return { top: t, left: l };
1408
+ },
1409
+
1410
+ /**
1411
+ * Returns the specified element style property
1412
+ * @method getStyle
1413
+ * @param {HTMLElement} el the element
1414
+ * @param {string} styleProp the style property
1415
+ * @return {string} The value of the style property
1416
+ * @deprecated use YAHOO.util.Dom.getStyle
1417
+ * @static
1418
+ */
1419
+ getStyle: function(el, styleProp) {
1420
+ return YAHOO.util.Dom.getStyle(el, styleProp);
1421
+ },
1422
+
1423
+ /**
1424
+ * Gets the scrollTop
1425
+ * @method getScrollTop
1426
+ * @return {int} the document's scrollTop
1427
+ * @static
1428
+ */
1429
+ getScrollTop: function () { return this.getScroll().top; },
1430
+
1431
+ /**
1432
+ * Gets the scrollLeft
1433
+ * @method getScrollLeft
1434
+ * @return {int} the document's scrollTop
1435
+ * @static
1436
+ */
1437
+ getScrollLeft: function () { return this.getScroll().left; },
1438
+
1439
+ /**
1440
+ * Sets the x/y position of an element to the location of the
1441
+ * target element.
1442
+ * @method moveToEl
1443
+ * @param {HTMLElement} moveEl The element to move
1444
+ * @param {HTMLElement} targetEl The position reference element
1445
+ * @static
1446
+ */
1447
+ moveToEl: function (moveEl, targetEl) {
1448
+ var aCoord = YAHOO.util.Dom.getXY(targetEl);
1449
+ YAHOO.util.Dom.setXY(moveEl, aCoord);
1450
+ },
1451
+
1452
+ /**
1453
+ * Gets the client height
1454
+ * @method getClientHeight
1455
+ * @return {int} client height in px
1456
+ * @deprecated use YAHOO.util.Dom.getViewportHeight instead
1457
+ * @static
1458
+ */
1459
+ getClientHeight: function() {
1460
+ return YAHOO.util.Dom.getViewportHeight();
1461
+ },
1462
+
1463
+ /**
1464
+ * Gets the client width
1465
+ * @method getClientWidth
1466
+ * @return {int} client width in px
1467
+ * @deprecated use YAHOO.util.Dom.getViewportWidth instead
1468
+ * @static
1469
+ */
1470
+ getClientWidth: function() {
1471
+ return YAHOO.util.Dom.getViewportWidth();
1472
+ },
1473
+
1474
+ /**
1475
+ * Numeric array sort function
1476
+ * @method numericSort
1477
+ * @static
1478
+ */
1479
+ numericSort: function(a, b) { return (a - b); },
1480
+
1481
+ /**
1482
+ * Internal counter
1483
+ * @property _timeoutCount
1484
+ * @private
1485
+ * @static
1486
+ */
1487
+ _timeoutCount: 0,
1488
+
1489
+ /**
1490
+ * Trying to make the load order less important. Without this we get
1491
+ * an error if this file is loaded before the Event Utility.
1492
+ * @method _addListeners
1493
+ * @private
1494
+ * @static
1495
+ */
1496
+ _addListeners: function() {
1497
+ var DDM = YAHOO.util.DDM;
1498
+ if ( YAHOO.util.Event && document ) {
1499
+ DDM._onLoad();
1500
+ } else {
1501
+ if (DDM._timeoutCount > 2000) {
1502
+ } else {
1503
+ setTimeout(DDM._addListeners, 10);
1504
+ if (document && document.body) {
1505
+ DDM._timeoutCount += 1;
1506
+ }
1507
+ }
1508
+ }
1509
+ },
1510
+
1511
+ /**
1512
+ * Recursively searches the immediate parent and all child nodes for
1513
+ * the handle element in order to determine wheter or not it was
1514
+ * clicked.
1515
+ * @method handleWasClicked
1516
+ * @param node the html element to inspect
1517
+ * @static
1518
+ */
1519
+ handleWasClicked: function(node, id) {
1520
+ if (this.isHandle(id, node.id)) {
1521
+ return true;
1522
+ } else {
1523
+ // check to see if this is a text node child of the one we want
1524
+ var p = node.parentNode;
1525
+
1526
+ while (p) {
1527
+ if (this.isHandle(id, p.id)) {
1528
+ return true;
1529
+ } else {
1530
+ p = p.parentNode;
1531
+ }
1532
+ }
1533
+ }
1534
+
1535
+ return false;
1536
+ }
1537
+
1538
+ };
1539
+
1540
+ }();
1541
+
1542
+ // shorter alias, save a few bytes
1543
+ YAHOO.util.DDM = YAHOO.util.DragDropMgr;
1544
+ YAHOO.util.DDM._addListeners();
1545
+
1546
+ }
1547
+
1548
+ (function() {
1549
+
1550
+ var Event=YAHOO.util.Event;
1551
+ var Dom=YAHOO.util.Dom;
1552
+
1553
+ /**
1554
+ * Defines the interface and base operation of items that that can be
1555
+ * dragged or can be drop targets. It was designed to be extended, overriding
1556
+ * the event handlers for startDrag, onDrag, onDragOver, onDragOut.
1557
+ * Up to three html elements can be associated with a DragDrop instance:
1558
+ * <ul>
1559
+ * <li>linked element: the element that is passed into the constructor.
1560
+ * This is the element which defines the boundaries for interaction with
1561
+ * other DragDrop objects.</li>
1562
+ * <li>handle element(s): The drag operation only occurs if the element that
1563
+ * was clicked matches a handle element. By default this is the linked
1564
+ * element, but there are times that you will want only a portion of the
1565
+ * linked element to initiate the drag operation, and the setHandleElId()
1566
+ * method provides a way to define this.</li>
1567
+ * <li>drag element: this represents an the element that would be moved along
1568
+ * with the cursor during a drag operation. By default, this is the linked
1569
+ * element itself as in {@link YAHOO.util.DD}. setDragElId() lets you define
1570
+ * a separate element that would be moved, as in {@link YAHOO.util.DDProxy}
1571
+ * </li>
1572
+ * </ul>
1573
+ * This class should not be instantiated until the onload event to ensure that
1574
+ * the associated elements are available.
1575
+ * The following would define a DragDrop obj that would interact with any
1576
+ * other DragDrop obj in the "group1" group:
1577
+ * <pre>
1578
+ * dd = new YAHOO.util.DragDrop("div1", "group1");
1579
+ * </pre>
1580
+ * Since none of the event handlers have been implemented, nothing would
1581
+ * actually happen if you were to run the code above. Normally you would
1582
+ * override this class or one of the default implementations, but you can
1583
+ * also override the methods you want on an instance of the class...
1584
+ * <pre>
1585
+ * dd.onDragDrop = function(e, id) {
1586
+ * &nbsp;&nbsp;alert("dd was dropped on " + id);
1587
+ * }
1588
+ * </pre>
1589
+ * @namespace YAHOO.util
1590
+ * @class DragDrop
1591
+ * @constructor
1592
+ * @param {String} id of the element that is linked to this instance
1593
+ * @param {String} sGroup the group of related DragDrop objects
1594
+ * @param {object} config an object containing configurable attributes
1595
+ * Valid properties for DragDrop:
1596
+ * padding, isTarget, maintainOffset, primaryButtonOnly,
1597
+ */
1598
+ YAHOO.util.DragDrop = function(id, sGroup, config) {
1599
+ if (id) {
1600
+ this.init(id, sGroup, config);
1601
+ }
1602
+ };
1603
+
1604
+ YAHOO.util.DragDrop.prototype = {
1605
+ /**
1606
+ * An Object Literal containing the events that we will be using: mouseDown, b4MouseDown, mouseUp, b4StartDrag, startDrag, b4EndDrag, endDrag, mouseUp, drag, b4Drag, invalidDrop, b4DragOut, dragOut, dragEnter, b4DragOver, dragOver, b4DragDrop, dragDrop
1607
+ * By setting any of these to false, then event will not be fired.
1608
+ * @property events
1609
+ * @type object
1610
+ */
1611
+ events: null,
1612
+ /**
1613
+ * @method on
1614
+ * @description Shortcut for EventProvider.subscribe, see <a href="YAHOO.util.EventProvider.html#subscribe">YAHOO.util.EventProvider.subscribe</a>
1615
+ */
1616
+ on: function() {
1617
+ this.subscribe.apply(this, arguments);
1618
+ },
1619
+ /**
1620
+ * The id of the element associated with this object. This is what we
1621
+ * refer to as the "linked element" because the size and position of
1622
+ * this element is used to determine when the drag and drop objects have
1623
+ * interacted.
1624
+ * @property id
1625
+ * @type String
1626
+ */
1627
+ id: null,
1628
+
1629
+ /**
1630
+ * Configuration attributes passed into the constructor
1631
+ * @property config
1632
+ * @type object
1633
+ */
1634
+ config: null,
1635
+
1636
+ /**
1637
+ * The id of the element that will be dragged. By default this is same
1638
+ * as the linked element , but could be changed to another element. Ex:
1639
+ * YAHOO.util.DDProxy
1640
+ * @property dragElId
1641
+ * @type String
1642
+ * @private
1643
+ */
1644
+ dragElId: null,
1645
+
1646
+ /**
1647
+ * the id of the element that initiates the drag operation. By default
1648
+ * this is the linked element, but could be changed to be a child of this
1649
+ * element. This lets us do things like only starting the drag when the
1650
+ * header element within the linked html element is clicked.
1651
+ * @property handleElId
1652
+ * @type String
1653
+ * @private
1654
+ */
1655
+ handleElId: null,
1656
+
1657
+ /**
1658
+ * An associative array of HTML tags that will be ignored if clicked.
1659
+ * @property invalidHandleTypes
1660
+ * @type {string: string}
1661
+ */
1662
+ invalidHandleTypes: null,
1663
+
1664
+ /**
1665
+ * An associative array of ids for elements that will be ignored if clicked
1666
+ * @property invalidHandleIds
1667
+ * @type {string: string}
1668
+ */
1669
+ invalidHandleIds: null,
1670
+
1671
+ /**
1672
+ * An indexted array of css class names for elements that will be ignored
1673
+ * if clicked.
1674
+ * @property invalidHandleClasses
1675
+ * @type string[]
1676
+ */
1677
+ invalidHandleClasses: null,
1678
+
1679
+ /**
1680
+ * The linked element's absolute X position at the time the drag was
1681
+ * started
1682
+ * @property startPageX
1683
+ * @type int
1684
+ * @private
1685
+ */
1686
+ startPageX: 0,
1687
+
1688
+ /**
1689
+ * The linked element's absolute X position at the time the drag was
1690
+ * started
1691
+ * @property startPageY
1692
+ * @type int
1693
+ * @private
1694
+ */
1695
+ startPageY: 0,
1696
+
1697
+ /**
1698
+ * The group defines a logical collection of DragDrop objects that are
1699
+ * related. Instances only get events when interacting with other
1700
+ * DragDrop object in the same group. This lets us define multiple
1701
+ * groups using a single DragDrop subclass if we want.
1702
+ * @property groups
1703
+ * @type {string: string}
1704
+ */
1705
+ groups: null,
1706
+
1707
+ /**
1708
+ * Individual drag/drop instances can be locked. This will prevent
1709
+ * onmousedown start drag.
1710
+ * @property locked
1711
+ * @type boolean
1712
+ * @private
1713
+ */
1714
+ locked: false,
1715
+
1716
+ /**
1717
+ * Lock this instance
1718
+ * @method lock
1719
+ */
1720
+ lock: function() { this.locked = true; },
1721
+
1722
+ /**
1723
+ * Unlock this instace
1724
+ * @method unlock
1725
+ */
1726
+ unlock: function() { this.locked = false; },
1727
+
1728
+ /**
1729
+ * By default, all instances can be a drop target. This can be disabled by
1730
+ * setting isTarget to false.
1731
+ * @property isTarget
1732
+ * @type boolean
1733
+ */
1734
+ isTarget: true,
1735
+
1736
+ /**
1737
+ * The padding configured for this drag and drop object for calculating
1738
+ * the drop zone intersection with this object.
1739
+ * @property padding
1740
+ * @type int[]
1741
+ */
1742
+ padding: null,
1743
+ /**
1744
+ * If this flag is true, do not fire drop events. The element is a drag only element (for movement not dropping)
1745
+ * @property dragOnly
1746
+ * @type Boolean
1747
+ */
1748
+ dragOnly: false,
1749
+
1750
+ /**
1751
+ * If this flag is true, a shim will be placed over the screen/viewable area to track mouse events. Should help with dragging elements over iframes and other controls.
1752
+ * @property useShim
1753
+ * @type Boolean
1754
+ */
1755
+ useShim: false,
1756
+
1757
+ /**
1758
+ * Cached reference to the linked element
1759
+ * @property _domRef
1760
+ * @private
1761
+ */
1762
+ _domRef: null,
1763
+
1764
+ /**
1765
+ * Internal typeof flag
1766
+ * @property __ygDragDrop
1767
+ * @private
1768
+ */
1769
+ __ygDragDrop: true,
1770
+
1771
+ /**
1772
+ * Set to true when horizontal contraints are applied
1773
+ * @property constrainX
1774
+ * @type boolean
1775
+ * @private
1776
+ */
1777
+ constrainX: false,
1778
+
1779
+ /**
1780
+ * Set to true when vertical contraints are applied
1781
+ * @property constrainY
1782
+ * @type boolean
1783
+ * @private
1784
+ */
1785
+ constrainY: false,
1786
+
1787
+ /**
1788
+ * The left constraint
1789
+ * @property minX
1790
+ * @type int
1791
+ * @private
1792
+ */
1793
+ minX: 0,
1794
+
1795
+ /**
1796
+ * The right constraint
1797
+ * @property maxX
1798
+ * @type int
1799
+ * @private
1800
+ */
1801
+ maxX: 0,
1802
+
1803
+ /**
1804
+ * The up constraint
1805
+ * @property minY
1806
+ * @type int
1807
+ * @type int
1808
+ * @private
1809
+ */
1810
+ minY: 0,
1811
+
1812
+ /**
1813
+ * The down constraint
1814
+ * @property maxY
1815
+ * @type int
1816
+ * @private
1817
+ */
1818
+ maxY: 0,
1819
+
1820
+ /**
1821
+ * The difference between the click position and the source element's location
1822
+ * @property deltaX
1823
+ * @type int
1824
+ * @private
1825
+ */
1826
+ deltaX: 0,
1827
+
1828
+ /**
1829
+ * The difference between the click position and the source element's location
1830
+ * @property deltaY
1831
+ * @type int
1832
+ * @private
1833
+ */
1834
+ deltaY: 0,
1835
+
1836
+ /**
1837
+ * Maintain offsets when we resetconstraints. Set to true when you want
1838
+ * the position of the element relative to its parent to stay the same
1839
+ * when the page changes
1840
+ *
1841
+ * @property maintainOffset
1842
+ * @type boolean
1843
+ */
1844
+ maintainOffset: false,
1845
+
1846
+ /**
1847
+ * Array of pixel locations the element will snap to if we specified a
1848
+ * horizontal graduation/interval. This array is generated automatically
1849
+ * when you define a tick interval.
1850
+ * @property xTicks
1851
+ * @type int[]
1852
+ */
1853
+ xTicks: null,
1854
+
1855
+ /**
1856
+ * Array of pixel locations the element will snap to if we specified a
1857
+ * vertical graduation/interval. This array is generated automatically
1858
+ * when you define a tick interval.
1859
+ * @property yTicks
1860
+ * @type int[]
1861
+ */
1862
+ yTicks: null,
1863
+
1864
+ /**
1865
+ * By default the drag and drop instance will only respond to the primary
1866
+ * button click (left button for a right-handed mouse). Set to true to
1867
+ * allow drag and drop to start with any mouse click that is propogated
1868
+ * by the browser
1869
+ * @property primaryButtonOnly
1870
+ * @type boolean
1871
+ */
1872
+ primaryButtonOnly: true,
1873
+
1874
+ /**
1875
+ * The availabe property is false until the linked dom element is accessible.
1876
+ * @property available
1877
+ * @type boolean
1878
+ */
1879
+ available: false,
1880
+
1881
+ /**
1882
+ * By default, drags can only be initiated if the mousedown occurs in the
1883
+ * region the linked element is. This is done in part to work around a
1884
+ * bug in some browsers that mis-report the mousedown if the previous
1885
+ * mouseup happened outside of the window. This property is set to true
1886
+ * if outer handles are defined.
1887
+ *
1888
+ * @property hasOuterHandles
1889
+ * @type boolean
1890
+ * @default false
1891
+ */
1892
+ hasOuterHandles: false,
1893
+
1894
+ /**
1895
+ * Property that is assigned to a drag and drop object when testing to
1896
+ * see if it is being targeted by another dd object. This property
1897
+ * can be used in intersect mode to help determine the focus of
1898
+ * the mouse interaction. DDM.getBestMatch uses this property first to
1899
+ * determine the closest match in INTERSECT mode when multiple targets
1900
+ * are part of the same interaction.
1901
+ * @property cursorIsOver
1902
+ * @type boolean
1903
+ */
1904
+ cursorIsOver: false,
1905
+
1906
+ /**
1907
+ * Property that is assigned to a drag and drop object when testing to
1908
+ * see if it is being targeted by another dd object. This is a region
1909
+ * that represents the area the draggable element overlaps this target.
1910
+ * DDM.getBestMatch uses this property to compare the size of the overlap
1911
+ * to that of other targets in order to determine the closest match in
1912
+ * INTERSECT mode when multiple targets are part of the same interaction.
1913
+ * @property overlap
1914
+ * @type YAHOO.util.Region
1915
+ */
1916
+ overlap: null,
1917
+
1918
+ /**
1919
+ * Code that executes immediately before the startDrag event
1920
+ * @method b4StartDrag
1921
+ * @private
1922
+ */
1923
+ b4StartDrag: function(x, y) { },
1924
+
1925
+ /**
1926
+ * Abstract method called after a drag/drop object is clicked
1927
+ * and the drag or mousedown time thresholds have beeen met.
1928
+ * @method startDrag
1929
+ * @param {int} X click location
1930
+ * @param {int} Y click location
1931
+ */
1932
+ startDrag: function(x, y) { /* override this */ },
1933
+
1934
+ /**
1935
+ * Code that executes immediately before the onDrag event
1936
+ * @method b4Drag
1937
+ * @private
1938
+ */
1939
+ b4Drag: function(e) { },
1940
+
1941
+ /**
1942
+ * Abstract method called during the onMouseMove event while dragging an
1943
+ * object.
1944
+ * @method onDrag
1945
+ * @param {Event} e the mousemove event
1946
+ */
1947
+ onDrag: function(e) { /* override this */ },
1948
+
1949
+ /**
1950
+ * Abstract method called when this element fist begins hovering over
1951
+ * another DragDrop obj
1952
+ * @method onDragEnter
1953
+ * @param {Event} e the mousemove event
1954
+ * @param {String|DragDrop[]} id In POINT mode, the element
1955
+ * id this is hovering over. In INTERSECT mode, an array of one or more
1956
+ * dragdrop items being hovered over.
1957
+ */
1958
+ onDragEnter: function(e, id) { /* override this */ },
1959
+
1960
+ /**
1961
+ * Code that executes immediately before the onDragOver event
1962
+ * @method b4DragOver
1963
+ * @private
1964
+ */
1965
+ b4DragOver: function(e) { },
1966
+
1967
+ /**
1968
+ * Abstract method called when this element is hovering over another
1969
+ * DragDrop obj
1970
+ * @method onDragOver
1971
+ * @param {Event} e the mousemove event
1972
+ * @param {String|DragDrop[]} id In POINT mode, the element
1973
+ * id this is hovering over. In INTERSECT mode, an array of dd items
1974
+ * being hovered over.
1975
+ */
1976
+ onDragOver: function(e, id) { /* override this */ },
1977
+
1978
+ /**
1979
+ * Code that executes immediately before the onDragOut event
1980
+ * @method b4DragOut
1981
+ * @private
1982
+ */
1983
+ b4DragOut: function(e) { },
1984
+
1985
+ /**
1986
+ * Abstract method called when we are no longer hovering over an element
1987
+ * @method onDragOut
1988
+ * @param {Event} e the mousemove event
1989
+ * @param {String|DragDrop[]} id In POINT mode, the element
1990
+ * id this was hovering over. In INTERSECT mode, an array of dd items
1991
+ * that the mouse is no longer over.
1992
+ */
1993
+ onDragOut: function(e, id) { /* override this */ },
1994
+
1995
+ /**
1996
+ * Code that executes immediately before the onDragDrop event
1997
+ * @method b4DragDrop
1998
+ * @private
1999
+ */
2000
+ b4DragDrop: function(e) { },
2001
+
2002
+ /**
2003
+ * Abstract method called when this item is dropped on another DragDrop
2004
+ * obj
2005
+ * @method onDragDrop
2006
+ * @param {Event} e the mouseup event
2007
+ * @param {String|DragDrop[]} id In POINT mode, the element
2008
+ * id this was dropped on. In INTERSECT mode, an array of dd items this
2009
+ * was dropped on.
2010
+ */
2011
+ onDragDrop: function(e, id) { /* override this */ },
2012
+
2013
+ /**
2014
+ * Abstract method called when this item is dropped on an area with no
2015
+ * drop target
2016
+ * @method onInvalidDrop
2017
+ * @param {Event} e the mouseup event
2018
+ */
2019
+ onInvalidDrop: function(e) { /* override this */ },
2020
+
2021
+ /**
2022
+ * Code that executes immediately before the endDrag event
2023
+ * @method b4EndDrag
2024
+ * @private
2025
+ */
2026
+ b4EndDrag: function(e) { },
2027
+
2028
+ /**
2029
+ * Fired when we are done dragging the object
2030
+ * @method endDrag
2031
+ * @param {Event} e the mouseup event
2032
+ */
2033
+ endDrag: function(e) { /* override this */ },
2034
+
2035
+ /**
2036
+ * Code executed immediately before the onMouseDown event
2037
+ * @method b4MouseDown
2038
+ * @param {Event} e the mousedown event
2039
+ * @private
2040
+ */
2041
+ b4MouseDown: function(e) { },
2042
+
2043
+ /**
2044
+ * Event handler that fires when a drag/drop obj gets a mousedown
2045
+ * @method onMouseDown
2046
+ * @param {Event} e the mousedown event
2047
+ */
2048
+ onMouseDown: function(e) { /* override this */ },
2049
+
2050
+ /**
2051
+ * Event handler that fires when a drag/drop obj gets a mouseup
2052
+ * @method onMouseUp
2053
+ * @param {Event} e the mouseup event
2054
+ */
2055
+ onMouseUp: function(e) { /* override this */ },
2056
+
2057
+ /**
2058
+ * Override the onAvailable method to do what is needed after the initial
2059
+ * position was determined.
2060
+ * @method onAvailable
2061
+ */
2062
+ onAvailable: function () {
2063
+ },
2064
+
2065
+ /**
2066
+ * Returns a reference to the linked element
2067
+ * @method getEl
2068
+ * @return {HTMLElement} the html element
2069
+ */
2070
+ getEl: function() {
2071
+ if (!this._domRef) {
2072
+ this._domRef = Dom.get(this.id);
2073
+ }
2074
+
2075
+ return this._domRef;
2076
+ },
2077
+
2078
+ /**
2079
+ * Returns a reference to the actual element to drag. By default this is
2080
+ * the same as the html element, but it can be assigned to another
2081
+ * element. An example of this can be found in YAHOO.util.DDProxy
2082
+ * @method getDragEl
2083
+ * @return {HTMLElement} the html element
2084
+ */
2085
+ getDragEl: function() {
2086
+ return Dom.get(this.dragElId);
2087
+ },
2088
+
2089
+ /**
2090
+ * Sets up the DragDrop object. Must be called in the constructor of any
2091
+ * YAHOO.util.DragDrop subclass
2092
+ * @method init
2093
+ * @param id the id of the linked element
2094
+ * @param {String} sGroup the group of related items
2095
+ * @param {object} config configuration attributes
2096
+ */
2097
+ init: function(id, sGroup, config) {
2098
+ this.initTarget(id, sGroup, config);
2099
+ Event.on(this._domRef || this.id, "mousedown",
2100
+ this.handleMouseDown, this, true);
2101
+
2102
+ // Event.on(this.id, "selectstart", Event.preventDefault);
2103
+ for (var i in this.events) {
2104
+ this.createEvent(i + 'Event');
2105
+ }
2106
+
2107
+ },
2108
+
2109
+ /**
2110
+ * Initializes Targeting functionality only... the object does not
2111
+ * get a mousedown handler.
2112
+ * @method initTarget
2113
+ * @param id the id of the linked element
2114
+ * @param {String} sGroup the group of related items
2115
+ * @param {object} config configuration attributes
2116
+ */
2117
+ initTarget: function(id, sGroup, config) {
2118
+
2119
+ // configuration attributes
2120
+ this.config = config || {};
2121
+
2122
+ this.events = {};
2123
+
2124
+ // create a local reference to the drag and drop manager
2125
+ this.DDM = YAHOO.util.DDM;
2126
+
2127
+ // initialize the groups object
2128
+ this.groups = {};
2129
+
2130
+ // assume that we have an element reference instead of an id if the
2131
+ // parameter is not a string
2132
+ if (typeof id !== "string") {
2133
+ this._domRef = id;
2134
+ id = Dom.generateId(id);
2135
+ }
2136
+
2137
+ // set the id
2138
+ this.id = id;
2139
+
2140
+ // add to an interaction group
2141
+ this.addToGroup((sGroup) ? sGroup : "default");
2142
+
2143
+ // We don't want to register this as the handle with the manager
2144
+ // so we just set the id rather than calling the setter.
2145
+ this.handleElId = id;
2146
+
2147
+ Event.onAvailable(id, this.handleOnAvailable, this, true);
2148
+
2149
+
2150
+ // the linked element is the element that gets dragged by default
2151
+ this.setDragElId(id);
2152
+
2153
+ // by default, clicked anchors will not start drag operations.
2154
+ // @TODO what else should be here? Probably form fields.
2155
+ this.invalidHandleTypes = { A: "A" };
2156
+ this.invalidHandleIds = {};
2157
+ this.invalidHandleClasses = [];
2158
+
2159
+ this.applyConfig();
2160
+ },
2161
+
2162
+ /**
2163
+ * Applies the configuration parameters that were passed into the constructor.
2164
+ * This is supposed to happen at each level through the inheritance chain. So
2165
+ * a DDProxy implentation will execute apply config on DDProxy, DD, and
2166
+ * DragDrop in order to get all of the parameters that are available in
2167
+ * each object.
2168
+ * @method applyConfig
2169
+ */
2170
+ applyConfig: function() {
2171
+ this.events = {
2172
+ mouseDown: true,
2173
+ b4MouseDown: true,
2174
+ mouseUp: true,
2175
+ b4StartDrag: true,
2176
+ startDrag: true,
2177
+ b4EndDrag: true,
2178
+ endDrag: true,
2179
+ drag: true,
2180
+ b4Drag: true,
2181
+ invalidDrop: true,
2182
+ b4DragOut: true,
2183
+ dragOut: true,
2184
+ dragEnter: true,
2185
+ b4DragOver: true,
2186
+ dragOver: true,
2187
+ b4DragDrop: true,
2188
+ dragDrop: true
2189
+ };
2190
+
2191
+ if (this.config.events) {
2192
+ for (var i in this.config.events) {
2193
+ if (this.config.events[i] === false) {
2194
+ this.events[i] = false;
2195
+ }
2196
+ }
2197
+ }
2198
+
2199
+
2200
+ // configurable properties:
2201
+ // padding, isTarget, maintainOffset, primaryButtonOnly
2202
+ this.padding = this.config.padding || [0, 0, 0, 0];
2203
+ this.isTarget = (this.config.isTarget !== false);
2204
+ this.maintainOffset = (this.config.maintainOffset);
2205
+ this.primaryButtonOnly = (this.config.primaryButtonOnly !== false);
2206
+ this.dragOnly = ((this.config.dragOnly === true) ? true : false);
2207
+ this.useShim = ((this.config.useShim === true) ? true : false);
2208
+ },
2209
+
2210
+ /**
2211
+ * Executed when the linked element is available
2212
+ * @method handleOnAvailable
2213
+ * @private
2214
+ */
2215
+ handleOnAvailable: function() {
2216
+ this.available = true;
2217
+ this.resetConstraints();
2218
+ this.onAvailable();
2219
+ },
2220
+
2221
+ /**
2222
+ * Configures the padding for the target zone in px. Effectively expands
2223
+ * (or reduces) the virtual object size for targeting calculations.
2224
+ * Supports css-style shorthand; if only one parameter is passed, all sides
2225
+ * will have that padding, and if only two are passed, the top and bottom
2226
+ * will have the first param, the left and right the second.
2227
+ * @method setPadding
2228
+ * @param {int} iTop Top pad
2229
+ * @param {int} iRight Right pad
2230
+ * @param {int} iBot Bot pad
2231
+ * @param {int} iLeft Left pad
2232
+ */
2233
+ setPadding: function(iTop, iRight, iBot, iLeft) {
2234
+ // this.padding = [iLeft, iRight, iTop, iBot];
2235
+ if (!iRight && 0 !== iRight) {
2236
+ this.padding = [iTop, iTop, iTop, iTop];
2237
+ } else if (!iBot && 0 !== iBot) {
2238
+ this.padding = [iTop, iRight, iTop, iRight];
2239
+ } else {
2240
+ this.padding = [iTop, iRight, iBot, iLeft];
2241
+ }
2242
+ },
2243
+
2244
+ /**
2245
+ * Stores the initial placement of the linked element.
2246
+ * @method setInitialPosition
2247
+ * @param {int} diffX the X offset, default 0
2248
+ * @param {int} diffY the Y offset, default 0
2249
+ * @private
2250
+ */
2251
+ setInitPosition: function(diffX, diffY) {
2252
+ var el = this.getEl();
2253
+
2254
+ if (!this.DDM.verifyEl(el)) {
2255
+ if (el && el.style && (el.style.display == 'none')) {
2256
+ } else {
2257
+ }
2258
+ return;
2259
+ }
2260
+
2261
+ var dx = diffX || 0;
2262
+ var dy = diffY || 0;
2263
+
2264
+ var p = Dom.getXY( el );
2265
+
2266
+ this.initPageX = p[0] - dx;
2267
+ this.initPageY = p[1] - dy;
2268
+
2269
+ this.lastPageX = p[0];
2270
+ this.lastPageY = p[1];
2271
+
2272
+
2273
+
2274
+ this.setStartPosition(p);
2275
+ },
2276
+
2277
+ /**
2278
+ * Sets the start position of the element. This is set when the obj
2279
+ * is initialized, the reset when a drag is started.
2280
+ * @method setStartPosition
2281
+ * @param pos current position (from previous lookup)
2282
+ * @private
2283
+ */
2284
+ setStartPosition: function(pos) {
2285
+ var p = pos || Dom.getXY(this.getEl());
2286
+
2287
+ this.deltaSetXY = null;
2288
+
2289
+ this.startPageX = p[0];
2290
+ this.startPageY = p[1];
2291
+ },
2292
+
2293
+ /**
2294
+ * Add this instance to a group of related drag/drop objects. All
2295
+ * instances belong to at least one group, and can belong to as many
2296
+ * groups as needed.
2297
+ * @method addToGroup
2298
+ * @param sGroup {string} the name of the group
2299
+ */
2300
+ addToGroup: function(sGroup) {
2301
+ this.groups[sGroup] = true;
2302
+ this.DDM.regDragDrop(this, sGroup);
2303
+ },
2304
+
2305
+ /**
2306
+ * Remove's this instance from the supplied interaction group
2307
+ * @method removeFromGroup
2308
+ * @param {string} sGroup The group to drop
2309
+ */
2310
+ removeFromGroup: function(sGroup) {
2311
+ if (this.groups[sGroup]) {
2312
+ delete this.groups[sGroup];
2313
+ }
2314
+
2315
+ this.DDM.removeDDFromGroup(this, sGroup);
2316
+ },
2317
+
2318
+ /**
2319
+ * Allows you to specify that an element other than the linked element
2320
+ * will be moved with the cursor during a drag
2321
+ * @method setDragElId
2322
+ * @param id {string} the id of the element that will be used to initiate the drag
2323
+ */
2324
+ setDragElId: function(id) {
2325
+ this.dragElId = id;
2326
+ },
2327
+
2328
+ /**
2329
+ * Allows you to specify a child of the linked element that should be
2330
+ * used to initiate the drag operation. An example of this would be if
2331
+ * you have a content div with text and links. Clicking anywhere in the
2332
+ * content area would normally start the drag operation. Use this method
2333
+ * to specify that an element inside of the content div is the element
2334
+ * that starts the drag operation.
2335
+ * @method setHandleElId
2336
+ * @param id {string} the id of the element that will be used to
2337
+ * initiate the drag.
2338
+ */
2339
+ setHandleElId: function(id) {
2340
+ if (typeof id !== "string") {
2341
+ id = Dom.generateId(id);
2342
+ }
2343
+ this.handleElId = id;
2344
+ this.DDM.regHandle(this.id, id);
2345
+ },
2346
+
2347
+ /**
2348
+ * Allows you to set an element outside of the linked element as a drag
2349
+ * handle
2350
+ * @method setOuterHandleElId
2351
+ * @param id the id of the element that will be used to initiate the drag
2352
+ */
2353
+ setOuterHandleElId: function(id) {
2354
+ if (typeof id !== "string") {
2355
+ id = Dom.generateId(id);
2356
+ }
2357
+ Event.on(id, "mousedown",
2358
+ this.handleMouseDown, this, true);
2359
+ this.setHandleElId(id);
2360
+
2361
+ this.hasOuterHandles = true;
2362
+ },
2363
+
2364
+ /**
2365
+ * Remove all drag and drop hooks for this element
2366
+ * @method unreg
2367
+ */
2368
+ unreg: function() {
2369
+ Event.removeListener(this.id, "mousedown",
2370
+ this.handleMouseDown);
2371
+ this._domRef = null;
2372
+ this.DDM._remove(this);
2373
+ },
2374
+
2375
+ /**
2376
+ * Returns true if this instance is locked, or the drag drop mgr is locked
2377
+ * (meaning that all drag/drop is disabled on the page.)
2378
+ * @method isLocked
2379
+ * @return {boolean} true if this obj or all drag/drop is locked, else
2380
+ * false
2381
+ */
2382
+ isLocked: function() {
2383
+ return (this.DDM.isLocked() || this.locked);
2384
+ },
2385
+
2386
+ /**
2387
+ * Fired when this object is clicked
2388
+ * @method handleMouseDown
2389
+ * @param {Event} e
2390
+ * @param {YAHOO.util.DragDrop} oDD the clicked dd object (this dd obj)
2391
+ * @private
2392
+ */
2393
+ handleMouseDown: function(e, oDD) {
2394
+
2395
+ var button = e.which || e.button;
2396
+
2397
+ if (this.primaryButtonOnly && button > 1) {
2398
+ return;
2399
+ }
2400
+
2401
+ if (this.isLocked()) {
2402
+ return;
2403
+ }
2404
+
2405
+
2406
+
2407
+ // firing the mousedown events prior to calculating positions
2408
+ var b4Return = this.b4MouseDown(e),
2409
+ b4Return2 = true;
2410
+
2411
+ if (this.events.b4MouseDown) {
2412
+ b4Return2 = this.fireEvent('b4MouseDownEvent', e);
2413
+ }
2414
+ var mDownReturn = this.onMouseDown(e),
2415
+ mDownReturn2 = true;
2416
+ if (this.events.mouseDown) {
2417
+ mDownReturn2 = this.fireEvent('mouseDownEvent', e);
2418
+ }
2419
+
2420
+ if ((b4Return === false) || (mDownReturn === false) || (b4Return2 === false) || (mDownReturn2 === false)) {
2421
+ return;
2422
+ }
2423
+
2424
+ this.DDM.refreshCache(this.groups);
2425
+ // var self = this;
2426
+ // setTimeout( function() { self.DDM.refreshCache(self.groups); }, 0);
2427
+
2428
+ // Only process the event if we really clicked within the linked
2429
+ // element. The reason we make this check is that in the case that
2430
+ // another element was moved between the clicked element and the
2431
+ // cursor in the time between the mousedown and mouseup events. When
2432
+ // this happens, the element gets the next mousedown event
2433
+ // regardless of where on the screen it happened.
2434
+ var pt = new YAHOO.util.Point(Event.getPageX(e), Event.getPageY(e));
2435
+ if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) ) {
2436
+ } else {
2437
+ if (this.clickValidator(e)) {
2438
+
2439
+
2440
+ // set the initial element position
2441
+ this.setStartPosition();
2442
+
2443
+ // start tracking mousemove distance and mousedown time to
2444
+ // determine when to start the actual drag
2445
+ this.DDM.handleMouseDown(e, this);
2446
+
2447
+ // this mousedown is mine
2448
+ this.DDM.stopEvent(e);
2449
+ } else {
2450
+
2451
+
2452
+ }
2453
+ }
2454
+ },
2455
+
2456
+ /**
2457
+ * @method clickValidator
2458
+ * @description Method validates that the clicked element
2459
+ * was indeed the handle or a valid child of the handle
2460
+ * @param {Event} e
2461
+ */
2462
+ clickValidator: function(e) {
2463
+ var target = YAHOO.util.Event.getTarget(e);
2464
+ return ( this.isValidHandleChild(target) &&
2465
+ (this.id == this.handleElId ||
2466
+ this.DDM.handleWasClicked(target, this.id)) );
2467
+ },
2468
+
2469
+ /**
2470
+ * Finds the location the element should be placed if we want to move
2471
+ * it to where the mouse location less the click offset would place us.
2472
+ * @method getTargetCoord
2473
+ * @param {int} iPageX the X coordinate of the click
2474
+ * @param {int} iPageY the Y coordinate of the click
2475
+ * @return an object that contains the coordinates (Object.x and Object.y)
2476
+ * @private
2477
+ */
2478
+ getTargetCoord: function(iPageX, iPageY) {
2479
+
2480
+
2481
+ var x = iPageX - this.deltaX;
2482
+ var y = iPageY - this.deltaY;
2483
+
2484
+ if (this.constrainX) {
2485
+ if (x < this.minX) { x = this.minX; }
2486
+ if (x > this.maxX) { x = this.maxX; }
2487
+ }
2488
+
2489
+ if (this.constrainY) {
2490
+ if (y < this.minY) { y = this.minY; }
2491
+ if (y > this.maxY) { y = this.maxY; }
2492
+ }
2493
+
2494
+ x = this.getTick(x, this.xTicks);
2495
+ y = this.getTick(y, this.yTicks);
2496
+
2497
+
2498
+ return {x:x, y:y};
2499
+ },
2500
+
2501
+ /**
2502
+ * Allows you to specify a tag name that should not start a drag operation
2503
+ * when clicked. This is designed to facilitate embedding links within a
2504
+ * drag handle that do something other than start the drag.
2505
+ * @method addInvalidHandleType
2506
+ * @param {string} tagName the type of element to exclude
2507
+ */
2508
+ addInvalidHandleType: function(tagName) {
2509
+ var type = tagName.toUpperCase();
2510
+ this.invalidHandleTypes[type] = type;
2511
+ },
2512
+
2513
+ /**
2514
+ * Lets you to specify an element id for a child of a drag handle
2515
+ * that should not initiate a drag
2516
+ * @method addInvalidHandleId
2517
+ * @param {string} id the element id of the element you wish to ignore
2518
+ */
2519
+ addInvalidHandleId: function(id) {
2520
+ if (typeof id !== "string") {
2521
+ id = Dom.generateId(id);
2522
+ }
2523
+ this.invalidHandleIds[id] = id;
2524
+ },
2525
+
2526
+
2527
+ /**
2528
+ * Lets you specify a css class of elements that will not initiate a drag
2529
+ * @method addInvalidHandleClass
2530
+ * @param {string} cssClass the class of the elements you wish to ignore
2531
+ */
2532
+ addInvalidHandleClass: function(cssClass) {
2533
+ this.invalidHandleClasses.push(cssClass);
2534
+ },
2535
+
2536
+ /**
2537
+ * Unsets an excluded tag name set by addInvalidHandleType
2538
+ * @method removeInvalidHandleType
2539
+ * @param {string} tagName the type of element to unexclude
2540
+ */
2541
+ removeInvalidHandleType: function(tagName) {
2542
+ var type = tagName.toUpperCase();
2543
+ // this.invalidHandleTypes[type] = null;
2544
+ delete this.invalidHandleTypes[type];
2545
+ },
2546
+
2547
+ /**
2548
+ * Unsets an invalid handle id
2549
+ * @method removeInvalidHandleId
2550
+ * @param {string} id the id of the element to re-enable
2551
+ */
2552
+ removeInvalidHandleId: function(id) {
2553
+ if (typeof id !== "string") {
2554
+ id = Dom.generateId(id);
2555
+ }
2556
+ delete this.invalidHandleIds[id];
2557
+ },
2558
+
2559
+ /**
2560
+ * Unsets an invalid css class
2561
+ * @method removeInvalidHandleClass
2562
+ * @param {string} cssClass the class of the element(s) you wish to
2563
+ * re-enable
2564
+ */
2565
+ removeInvalidHandleClass: function(cssClass) {
2566
+ for (var i=0, len=this.invalidHandleClasses.length; i<len; ++i) {
2567
+ if (this.invalidHandleClasses[i] == cssClass) {
2568
+ delete this.invalidHandleClasses[i];
2569
+ }
2570
+ }
2571
+ },
2572
+
2573
+ /**
2574
+ * Checks the tag exclusion list to see if this click should be ignored
2575
+ * @method isValidHandleChild
2576
+ * @param {HTMLElement} node the HTMLElement to evaluate
2577
+ * @return {boolean} true if this is a valid tag type, false if not
2578
+ */
2579
+ isValidHandleChild: function(node) {
2580
+
2581
+ var valid = true;
2582
+ // var n = (node.nodeName == "#text") ? node.parentNode : node;
2583
+ var nodeName;
2584
+ try {
2585
+ nodeName = node.nodeName.toUpperCase();
2586
+ } catch(e) {
2587
+ nodeName = node.nodeName;
2588
+ }
2589
+ valid = valid && !this.invalidHandleTypes[nodeName];
2590
+ valid = valid && !this.invalidHandleIds[node.id];
2591
+
2592
+ for (var i=0, len=this.invalidHandleClasses.length; valid && i<len; ++i) {
2593
+ valid = !Dom.hasClass(node, this.invalidHandleClasses[i]);
2594
+ }
2595
+
2596
+
2597
+ return valid;
2598
+
2599
+ },
2600
+
2601
+ /**
2602
+ * Create the array of horizontal tick marks if an interval was specified
2603
+ * in setXConstraint().
2604
+ * @method setXTicks
2605
+ * @private
2606
+ */
2607
+ setXTicks: function(iStartX, iTickSize) {
2608
+ this.xTicks = [];
2609
+ this.xTickSize = iTickSize;
2610
+
2611
+ var tickMap = {};
2612
+
2613
+ for (var i = this.initPageX; i >= this.minX; i = i - iTickSize) {
2614
+ if (!tickMap[i]) {
2615
+ this.xTicks[this.xTicks.length] = i;
2616
+ tickMap[i] = true;
2617
+ }
2618
+ }
2619
+
2620
+ for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) {
2621
+ if (!tickMap[i]) {
2622
+ this.xTicks[this.xTicks.length] = i;
2623
+ tickMap[i] = true;
2624
+ }
2625
+ }
2626
+
2627
+ this.xTicks.sort(this.DDM.numericSort) ;
2628
+ },
2629
+
2630
+ /**
2631
+ * Create the array of vertical tick marks if an interval was specified in
2632
+ * setYConstraint().
2633
+ * @method setYTicks
2634
+ * @private
2635
+ */
2636
+ setYTicks: function(iStartY, iTickSize) {
2637
+ this.yTicks = [];
2638
+ this.yTickSize = iTickSize;
2639
+
2640
+ var tickMap = {};
2641
+
2642
+ for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) {
2643
+ if (!tickMap[i]) {
2644
+ this.yTicks[this.yTicks.length] = i;
2645
+ tickMap[i] = true;
2646
+ }
2647
+ }
2648
+
2649
+ for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) {
2650
+ if (!tickMap[i]) {
2651
+ this.yTicks[this.yTicks.length] = i;
2652
+ tickMap[i] = true;
2653
+ }
2654
+ }
2655
+
2656
+ this.yTicks.sort(this.DDM.numericSort) ;
2657
+ },
2658
+
2659
+ /**
2660
+ * By default, the element can be dragged any place on the screen. Use
2661
+ * this method to limit the horizontal travel of the element. Pass in
2662
+ * 0,0 for the parameters if you want to lock the drag to the y axis.
2663
+ * @method setXConstraint
2664
+ * @param {int} iLeft the number of pixels the element can move to the left
2665
+ * @param {int} iRight the number of pixels the element can move to the
2666
+ * right
2667
+ * @param {int} iTickSize optional parameter for specifying that the
2668
+ * element
2669
+ * should move iTickSize pixels at a time.
2670
+ */
2671
+ setXConstraint: function(iLeft, iRight, iTickSize) {
2672
+ this.leftConstraint = parseInt(iLeft, 10);
2673
+ this.rightConstraint = parseInt(iRight, 10);
2674
+
2675
+ this.minX = this.initPageX - this.leftConstraint;
2676
+ this.maxX = this.initPageX + this.rightConstraint;
2677
+ if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }
2678
+
2679
+ this.constrainX = true;
2680
+ },
2681
+
2682
+ /**
2683
+ * Clears any constraints applied to this instance. Also clears ticks
2684
+ * since they can't exist independent of a constraint at this time.
2685
+ * @method clearConstraints
2686
+ */
2687
+ clearConstraints: function() {
2688
+ this.constrainX = false;
2689
+ this.constrainY = false;
2690
+ this.clearTicks();
2691
+ },
2692
+
2693
+ /**
2694
+ * Clears any tick interval defined for this instance
2695
+ * @method clearTicks
2696
+ */
2697
+ clearTicks: function() {
2698
+ this.xTicks = null;
2699
+ this.yTicks = null;
2700
+ this.xTickSize = 0;
2701
+ this.yTickSize = 0;
2702
+ },
2703
+
2704
+ /**
2705
+ * By default, the element can be dragged any place on the screen. Set
2706
+ * this to limit the vertical travel of the element. Pass in 0,0 for the
2707
+ * parameters if you want to lock the drag to the x axis.
2708
+ * @method setYConstraint
2709
+ * @param {int} iUp the number of pixels the element can move up
2710
+ * @param {int} iDown the number of pixels the element can move down
2711
+ * @param {int} iTickSize optional parameter for specifying that the
2712
+ * element should move iTickSize pixels at a time.
2713
+ */
2714
+ setYConstraint: function(iUp, iDown, iTickSize) {
2715
+ this.topConstraint = parseInt(iUp, 10);
2716
+ this.bottomConstraint = parseInt(iDown, 10);
2717
+
2718
+ this.minY = this.initPageY - this.topConstraint;
2719
+ this.maxY = this.initPageY + this.bottomConstraint;
2720
+ if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }
2721
+
2722
+ this.constrainY = true;
2723
+
2724
+ },
2725
+
2726
+ /**
2727
+ * resetConstraints must be called if you manually reposition a dd element.
2728
+ * @method resetConstraints
2729
+ */
2730
+ resetConstraints: function() {
2731
+
2732
+
2733
+ // Maintain offsets if necessary
2734
+ if (this.initPageX || this.initPageX === 0) {
2735
+ // figure out how much this thing has moved
2736
+ var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0;
2737
+ var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0;
2738
+
2739
+ this.setInitPosition(dx, dy);
2740
+
2741
+ // This is the first time we have detected the element's position
2742
+ } else {
2743
+ this.setInitPosition();
2744
+ }
2745
+
2746
+ if (this.constrainX) {
2747
+ this.setXConstraint( this.leftConstraint,
2748
+ this.rightConstraint,
2749
+ this.xTickSize );
2750
+ }
2751
+
2752
+ if (this.constrainY) {
2753
+ this.setYConstraint( this.topConstraint,
2754
+ this.bottomConstraint,
2755
+ this.yTickSize );
2756
+ }
2757
+ },
2758
+
2759
+ /**
2760
+ * Normally the drag element is moved pixel by pixel, but we can specify
2761
+ * that it move a number of pixels at a time. This method resolves the
2762
+ * location when we have it set up like this.
2763
+ * @method getTick
2764
+ * @param {int} val where we want to place the object
2765
+ * @param {int[]} tickArray sorted array of valid points
2766
+ * @return {int} the closest tick
2767
+ * @private
2768
+ */
2769
+ getTick: function(val, tickArray) {
2770
+
2771
+ if (!tickArray) {
2772
+ // If tick interval is not defined, it is effectively 1 pixel,
2773
+ // so we return the value passed to us.
2774
+ return val;
2775
+ } else if (tickArray[0] >= val) {
2776
+ // The value is lower than the first tick, so we return the first
2777
+ // tick.
2778
+ return tickArray[0];
2779
+ } else {
2780
+ for (var i=0, len=tickArray.length; i<len; ++i) {
2781
+ var next = i + 1;
2782
+ if (tickArray[next] && tickArray[next] >= val) {
2783
+ var diff1 = val - tickArray[i];
2784
+ var diff2 = tickArray[next] - val;
2785
+ return (diff2 > diff1) ? tickArray[i] : tickArray[next];
2786
+ }
2787
+ }
2788
+
2789
+ // The value is larger than the last tick, so we return the last
2790
+ // tick.
2791
+ return tickArray[tickArray.length - 1];
2792
+ }
2793
+ },
2794
+
2795
+ /**
2796
+ * toString method
2797
+ * @method toString
2798
+ * @return {string} string representation of the dd obj
2799
+ */
2800
+ toString: function() {
2801
+ return ("DragDrop " + this.id);
2802
+ }
2803
+
2804
+ };
2805
+ YAHOO.augment(YAHOO.util.DragDrop, YAHOO.util.EventProvider);
2806
+
2807
+ /**
2808
+ * @event mouseDownEvent
2809
+ * @description Provides access to the mousedown event. The mousedown does not always result in a drag operation.
2810
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
2811
+ */
2812
+
2813
+ /**
2814
+ * @event b4MouseDownEvent
2815
+ * @description Provides access to the mousedown event, before the mouseDownEvent gets fired. Returning false will cancel the drag.
2816
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
2817
+ */
2818
+
2819
+ /**
2820
+ * @event mouseUpEvent
2821
+ * @description Fired from inside DragDropMgr when the drag operation is finished.
2822
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
2823
+ */
2824
+
2825
+ /**
2826
+ * @event b4StartDragEvent
2827
+ * @description Fires before the startDragEvent, returning false will cancel the startDrag Event.
2828
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
2829
+ */
2830
+
2831
+ /**
2832
+ * @event startDragEvent
2833
+ * @description Occurs after a mouse down and the drag threshold has been met. The drag threshold default is either 3 pixels of mouse movement or 1 full second of holding the mousedown.
2834
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
2835
+ */
2836
+
2837
+ /**
2838
+ * @event b4EndDragEvent
2839
+ * @description Fires before the endDragEvent. Returning false will cancel.
2840
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
2841
+ */
2842
+
2843
+ /**
2844
+ * @event endDragEvent
2845
+ * @description Fires on the mouseup event after a drag has been initiated (startDrag fired).
2846
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
2847
+ */
2848
+
2849
+ /**
2850
+ * @event dragEvent
2851
+ * @description Occurs every mousemove event while dragging.
2852
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
2853
+ */
2854
+ /**
2855
+ * @event b4DragEvent
2856
+ * @description Fires before the dragEvent.
2857
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
2858
+ */
2859
+ /**
2860
+ * @event invalidDropEvent
2861
+ * @description Fires when the dragged objects is dropped in a location that contains no drop targets.
2862
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
2863
+ */
2864
+ /**
2865
+ * @event b4DragOutEvent
2866
+ * @description Fires before the dragOutEvent
2867
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
2868
+ */
2869
+ /**
2870
+ * @event dragOutEvent
2871
+ * @description Fires when a dragged object is no longer over an object that had the onDragEnter fire.
2872
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
2873
+ */
2874
+ /**
2875
+ * @event dragEnterEvent
2876
+ * @description Occurs when the dragged object first interacts with another targettable drag and drop object.
2877
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
2878
+ */
2879
+ /**
2880
+ * @event b4DragOverEvent
2881
+ * @description Fires before the dragOverEvent.
2882
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
2883
+ */
2884
+ /**
2885
+ * @event dragOverEvent
2886
+ * @description Fires every mousemove event while over a drag and drop object.
2887
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
2888
+ */
2889
+ /**
2890
+ * @event b4DragDropEvent
2891
+ * @description Fires before the dragDropEvent
2892
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
2893
+ */
2894
+ /**
2895
+ * @event dragDropEvent
2896
+ * @description Fires when the dragged objects is dropped on another.
2897
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
2898
+ */
2899
+ })();
2900
+ /**
2901
+ * A DragDrop implementation where the linked element follows the
2902
+ * mouse cursor during a drag.
2903
+ * @class DD
2904
+ * @extends YAHOO.util.DragDrop
2905
+ * @constructor
2906
+ * @param {String} id the id of the linked element
2907
+ * @param {String} sGroup the group of related DragDrop items
2908
+ * @param {object} config an object containing configurable attributes
2909
+ * Valid properties for DD:
2910
+ * scroll
2911
+ */
2912
+ YAHOO.util.DD = function(id, sGroup, config) {
2913
+ if (id) {
2914
+ this.init(id, sGroup, config);
2915
+ }
2916
+ };
2917
+
2918
+ YAHOO.extend(YAHOO.util.DD, YAHOO.util.DragDrop, {
2919
+
2920
+ /**
2921
+ * When set to true, the utility automatically tries to scroll the browser
2922
+ * window when a drag and drop element is dragged near the viewport boundary.
2923
+ * Defaults to true.
2924
+ * @property scroll
2925
+ * @type boolean
2926
+ */
2927
+ scroll: true,
2928
+
2929
+ /**
2930
+ * Sets the pointer offset to the distance between the linked element's top
2931
+ * left corner and the location the element was clicked
2932
+ * @method autoOffset
2933
+ * @param {int} iPageX the X coordinate of the click
2934
+ * @param {int} iPageY the Y coordinate of the click
2935
+ */
2936
+ autoOffset: function(iPageX, iPageY) {
2937
+ var x = iPageX - this.startPageX;
2938
+ var y = iPageY - this.startPageY;
2939
+ this.setDelta(x, y);
2940
+ },
2941
+
2942
+ /**
2943
+ * Sets the pointer offset. You can call this directly to force the
2944
+ * offset to be in a particular location (e.g., pass in 0,0 to set it
2945
+ * to the center of the object, as done in YAHOO.widget.Slider)
2946
+ * @method setDelta
2947
+ * @param {int} iDeltaX the distance from the left
2948
+ * @param {int} iDeltaY the distance from the top
2949
+ */
2950
+ setDelta: function(iDeltaX, iDeltaY) {
2951
+ this.deltaX = iDeltaX;
2952
+ this.deltaY = iDeltaY;
2953
+ },
2954
+
2955
+ /**
2956
+ * Sets the drag element to the location of the mousedown or click event,
2957
+ * maintaining the cursor location relative to the location on the element
2958
+ * that was clicked. Override this if you want to place the element in a
2959
+ * location other than where the cursor is.
2960
+ * @method setDragElPos
2961
+ * @param {int} iPageX the X coordinate of the mousedown or drag event
2962
+ * @param {int} iPageY the Y coordinate of the mousedown or drag event
2963
+ */
2964
+ setDragElPos: function(iPageX, iPageY) {
2965
+ // the first time we do this, we are going to check to make sure
2966
+ // the element has css positioning
2967
+
2968
+ var el = this.getDragEl();
2969
+ this.alignElWithMouse(el, iPageX, iPageY);
2970
+ },
2971
+
2972
+ /**
2973
+ * Sets the element to the location of the mousedown or click event,
2974
+ * maintaining the cursor location relative to the location on the element
2975
+ * that was clicked. Override this if you want to place the element in a
2976
+ * location other than where the cursor is.
2977
+ * @method alignElWithMouse
2978
+ * @param {HTMLElement} el the element to move
2979
+ * @param {int} iPageX the X coordinate of the mousedown or drag event
2980
+ * @param {int} iPageY the Y coordinate of the mousedown or drag event
2981
+ */
2982
+ alignElWithMouse: function(el, iPageX, iPageY) {
2983
+ var oCoord = this.getTargetCoord(iPageX, iPageY);
2984
+
2985
+ if (!this.deltaSetXY) {
2986
+ var aCoord = [oCoord.x, oCoord.y];
2987
+ YAHOO.util.Dom.setXY(el, aCoord);
2988
+
2989
+ var newLeft = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 );
2990
+ var newTop = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 );
2991
+
2992
+ this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ];
2993
+ } else {
2994
+ YAHOO.util.Dom.setStyle(el, "left", (oCoord.x + this.deltaSetXY[0]) + "px");
2995
+ YAHOO.util.Dom.setStyle(el, "top", (oCoord.y + this.deltaSetXY[1]) + "px");
2996
+ }
2997
+
2998
+ this.cachePosition(oCoord.x, oCoord.y);
2999
+ var self = this;
3000
+ setTimeout(function() {
3001
+ self.autoScroll.call(self, oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
3002
+ }, 0);
3003
+ },
3004
+
3005
+ /**
3006
+ * Saves the most recent position so that we can reset the constraints and
3007
+ * tick marks on-demand. We need to know this so that we can calculate the
3008
+ * number of pixels the element is offset from its original position.
3009
+ * @method cachePosition
3010
+ * @param iPageX the current x position (optional, this just makes it so we
3011
+ * don't have to look it up again)
3012
+ * @param iPageY the current y position (optional, this just makes it so we
3013
+ * don't have to look it up again)
3014
+ */
3015
+ cachePosition: function(iPageX, iPageY) {
3016
+ if (iPageX) {
3017
+ this.lastPageX = iPageX;
3018
+ this.lastPageY = iPageY;
3019
+ } else {
3020
+ var aCoord = YAHOO.util.Dom.getXY(this.getEl());
3021
+ this.lastPageX = aCoord[0];
3022
+ this.lastPageY = aCoord[1];
3023
+ }
3024
+ },
3025
+
3026
+ /**
3027
+ * Auto-scroll the window if the dragged object has been moved beyond the
3028
+ * visible window boundary.
3029
+ * @method autoScroll
3030
+ * @param {int} x the drag element's x position
3031
+ * @param {int} y the drag element's y position
3032
+ * @param {int} h the height of the drag element
3033
+ * @param {int} w the width of the drag element
3034
+ * @private
3035
+ */
3036
+ autoScroll: function(x, y, h, w) {
3037
+
3038
+ if (this.scroll) {
3039
+ // The client height
3040
+ var clientH = this.DDM.getClientHeight();
3041
+
3042
+ // The client width
3043
+ var clientW = this.DDM.getClientWidth();
3044
+
3045
+ // The amt scrolled down
3046
+ var st = this.DDM.getScrollTop();
3047
+
3048
+ // The amt scrolled right
3049
+ var sl = this.DDM.getScrollLeft();
3050
+
3051
+ // Location of the bottom of the element
3052
+ var bot = h + y;
3053
+
3054
+ // Location of the right of the element
3055
+ var right = w + x;
3056
+
3057
+ // The distance from the cursor to the bottom of the visible area,
3058
+ // adjusted so that we don't scroll if the cursor is beyond the
3059
+ // element drag constraints
3060
+ var toBot = (clientH + st - y - this.deltaY);
3061
+
3062
+ // The distance from the cursor to the right of the visible area
3063
+ var toRight = (clientW + sl - x - this.deltaX);
3064
+
3065
+
3066
+ // How close to the edge the cursor must be before we scroll
3067
+ // var thresh = (document.all) ? 100 : 40;
3068
+ var thresh = 40;
3069
+
3070
+ // How many pixels to scroll per autoscroll op. This helps to reduce
3071
+ // clunky scrolling. IE is more sensitive about this ... it needs this
3072
+ // value to be higher.
3073
+ var scrAmt = (document.all) ? 80 : 30;
3074
+
3075
+ // Scroll down if we are near the bottom of the visible page and the
3076
+ // obj extends below the crease
3077
+ if ( bot > clientH && toBot < thresh ) {
3078
+ window.scrollTo(sl, st + scrAmt);
3079
+ }
3080
+
3081
+ // Scroll up if the window is scrolled down and the top of the object
3082
+ // goes above the top border
3083
+ if ( y < st && st > 0 && y - st < thresh ) {
3084
+ window.scrollTo(sl, st - scrAmt);
3085
+ }
3086
+
3087
+ // Scroll right if the obj is beyond the right border and the cursor is
3088
+ // near the border.
3089
+ if ( right > clientW && toRight < thresh ) {
3090
+ window.scrollTo(sl + scrAmt, st);
3091
+ }
3092
+
3093
+ // Scroll left if the window has been scrolled to the right and the obj
3094
+ // extends past the left border
3095
+ if ( x < sl && sl > 0 && x - sl < thresh ) {
3096
+ window.scrollTo(sl - scrAmt, st);
3097
+ }
3098
+ }
3099
+ },
3100
+
3101
+ /*
3102
+ * Sets up config options specific to this class. Overrides
3103
+ * YAHOO.util.DragDrop, but all versions of this method through the
3104
+ * inheritance chain are called
3105
+ */
3106
+ applyConfig: function() {
3107
+ YAHOO.util.DD.superclass.applyConfig.call(this);
3108
+ this.scroll = (this.config.scroll !== false);
3109
+ },
3110
+
3111
+ /*
3112
+ * Event that fires prior to the onMouseDown event. Overrides
3113
+ * YAHOO.util.DragDrop.
3114
+ */
3115
+ b4MouseDown: function(e) {
3116
+ this.setStartPosition();
3117
+ // this.resetConstraints();
3118
+ this.autoOffset(YAHOO.util.Event.getPageX(e),
3119
+ YAHOO.util.Event.getPageY(e));
3120
+ },
3121
+
3122
+ /*
3123
+ * Event that fires prior to the onDrag event. Overrides
3124
+ * YAHOO.util.DragDrop.
3125
+ */
3126
+ b4Drag: function(e) {
3127
+ this.setDragElPos(YAHOO.util.Event.getPageX(e),
3128
+ YAHOO.util.Event.getPageY(e));
3129
+ },
3130
+
3131
+ toString: function() {
3132
+ return ("DD " + this.id);
3133
+ }
3134
+
3135
+ //////////////////////////////////////////////////////////////////////////
3136
+ // Debugging ygDragDrop events that can be overridden
3137
+ //////////////////////////////////////////////////////////////////////////
3138
+ /*
3139
+ startDrag: function(x, y) {
3140
+ },
3141
+
3142
+ onDrag: function(e) {
3143
+ },
3144
+
3145
+ onDragEnter: function(e, id) {
3146
+ },
3147
+
3148
+ onDragOver: function(e, id) {
3149
+ },
3150
+
3151
+ onDragOut: function(e, id) {
3152
+ },
3153
+
3154
+ onDragDrop: function(e, id) {
3155
+ },
3156
+
3157
+ endDrag: function(e) {
3158
+ }
3159
+
3160
+ */
3161
+
3162
+ /**
3163
+ * @event mouseDownEvent
3164
+ * @description Provides access to the mousedown event. The mousedown does not always result in a drag operation.
3165
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3166
+ */
3167
+
3168
+ /**
3169
+ * @event b4MouseDownEvent
3170
+ * @description Provides access to the mousedown event, before the mouseDownEvent gets fired. Returning false will cancel the drag.
3171
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3172
+ */
3173
+
3174
+ /**
3175
+ * @event mouseUpEvent
3176
+ * @description Fired from inside DragDropMgr when the drag operation is finished.
3177
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3178
+ */
3179
+
3180
+ /**
3181
+ * @event b4StartDragEvent
3182
+ * @description Fires before the startDragEvent, returning false will cancel the startDrag Event.
3183
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3184
+ */
3185
+
3186
+ /**
3187
+ * @event startDragEvent
3188
+ * @description Occurs after a mouse down and the drag threshold has been met. The drag threshold default is either 3 pixels of mouse movement or 1 full second of holding the mousedown.
3189
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3190
+ */
3191
+
3192
+ /**
3193
+ * @event b4EndDragEvent
3194
+ * @description Fires before the endDragEvent. Returning false will cancel.
3195
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3196
+ */
3197
+
3198
+ /**
3199
+ * @event endDragEvent
3200
+ * @description Fires on the mouseup event after a drag has been initiated (startDrag fired).
3201
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3202
+ */
3203
+
3204
+ /**
3205
+ * @event dragEvent
3206
+ * @description Occurs every mousemove event while dragging.
3207
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3208
+ */
3209
+ /**
3210
+ * @event b4DragEvent
3211
+ * @description Fires before the dragEvent.
3212
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3213
+ */
3214
+ /**
3215
+ * @event invalidDropEvent
3216
+ * @description Fires when the dragged objects is dropped in a location that contains no drop targets.
3217
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3218
+ */
3219
+ /**
3220
+ * @event b4DragOutEvent
3221
+ * @description Fires before the dragOutEvent
3222
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3223
+ */
3224
+ /**
3225
+ * @event dragOutEvent
3226
+ * @description Fires when a dragged object is no longer over an object that had the onDragEnter fire.
3227
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3228
+ */
3229
+ /**
3230
+ * @event dragEnterEvent
3231
+ * @description Occurs when the dragged object first interacts with another targettable drag and drop object.
3232
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3233
+ */
3234
+ /**
3235
+ * @event b4DragOverEvent
3236
+ * @description Fires before the dragOverEvent.
3237
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3238
+ */
3239
+ /**
3240
+ * @event dragOverEvent
3241
+ * @description Fires every mousemove event while over a drag and drop object.
3242
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3243
+ */
3244
+ /**
3245
+ * @event b4DragDropEvent
3246
+ * @description Fires before the dragDropEvent
3247
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3248
+ */
3249
+ /**
3250
+ * @event dragDropEvent
3251
+ * @description Fires when the dragged objects is dropped on another.
3252
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3253
+ */
3254
+ });
3255
+ /**
3256
+ * A DragDrop implementation that inserts an empty, bordered div into
3257
+ * the document that follows the cursor during drag operations. At the time of
3258
+ * the click, the frame div is resized to the dimensions of the linked html
3259
+ * element, and moved to the exact location of the linked element.
3260
+ *
3261
+ * References to the "frame" element refer to the single proxy element that
3262
+ * was created to be dragged in place of all DDProxy elements on the
3263
+ * page.
3264
+ *
3265
+ * @class DDProxy
3266
+ * @extends YAHOO.util.DD
3267
+ * @constructor
3268
+ * @param {String} id the id of the linked html element
3269
+ * @param {String} sGroup the group of related DragDrop objects
3270
+ * @param {object} config an object containing configurable attributes
3271
+ * Valid properties for DDProxy in addition to those in DragDrop:
3272
+ * resizeFrame, centerFrame, dragElId
3273
+ */
3274
+ YAHOO.util.DDProxy = function(id, sGroup, config) {
3275
+ if (id) {
3276
+ this.init(id, sGroup, config);
3277
+ this.initFrame();
3278
+ }
3279
+ };
3280
+
3281
+ /**
3282
+ * The default drag frame div id
3283
+ * @property YAHOO.util.DDProxy.dragElId
3284
+ * @type String
3285
+ * @static
3286
+ */
3287
+ YAHOO.util.DDProxy.dragElId = "ygddfdiv";
3288
+
3289
+ YAHOO.extend(YAHOO.util.DDProxy, YAHOO.util.DD, {
3290
+
3291
+ /**
3292
+ * By default we resize the drag frame to be the same size as the element
3293
+ * we want to drag (this is to get the frame effect). We can turn it off
3294
+ * if we want a different behavior.
3295
+ * @property resizeFrame
3296
+ * @type boolean
3297
+ */
3298
+ resizeFrame: true,
3299
+
3300
+ /**
3301
+ * By default the frame is positioned exactly where the drag element is, so
3302
+ * we use the cursor offset provided by YAHOO.util.DD. Another option that works only if
3303
+ * you do not have constraints on the obj is to have the drag frame centered
3304
+ * around the cursor. Set centerFrame to true for this effect.
3305
+ * @property centerFrame
3306
+ * @type boolean
3307
+ */
3308
+ centerFrame: false,
3309
+
3310
+ /**
3311
+ * Creates the proxy element if it does not yet exist
3312
+ * @method createFrame
3313
+ */
3314
+ createFrame: function() {
3315
+ var self=this, body=document.body;
3316
+
3317
+ if (!body || !body.firstChild) {
3318
+ setTimeout( function() { self.createFrame(); }, 50 );
3319
+ return;
3320
+ }
3321
+
3322
+ var div=this.getDragEl(), Dom=YAHOO.util.Dom;
3323
+
3324
+ if (!div) {
3325
+ div = document.createElement("div");
3326
+ div.id = this.dragElId;
3327
+ var s = div.style;
3328
+
3329
+ s.position = "absolute";
3330
+ s.visibility = "hidden";
3331
+ s.cursor = "move";
3332
+ s.border = "2px solid #aaa";
3333
+ s.zIndex = 999;
3334
+ s.height = "25px";
3335
+ s.width = "25px";
3336
+
3337
+ var _data = document.createElement('div');
3338
+ Dom.setStyle(_data, 'height', '100%');
3339
+ Dom.setStyle(_data, 'width', '100%');
3340
+ /**
3341
+ * If the proxy element has no background-color, then it is considered to the "transparent" by Internet Explorer.
3342
+ * Since it is "transparent" then the events pass through it to the iframe below.
3343
+ * So creating a "fake" div inside the proxy element and giving it a background-color, then setting it to an
3344
+ * opacity of 0, it appears to not be there, however IE still thinks that it is so the events never pass through.
3345
+ */
3346
+ Dom.setStyle(_data, 'background-color', '#ccc');
3347
+ Dom.setStyle(_data, 'opacity', '0');
3348
+ div.appendChild(_data);
3349
+
3350
+ // appendChild can blow up IE if invoked prior to the window load event
3351
+ // while rendering a table. It is possible there are other scenarios
3352
+ // that would cause this to happen as well.
3353
+ body.insertBefore(div, body.firstChild);
3354
+ }
3355
+ },
3356
+
3357
+ /**
3358
+ * Initialization for the drag frame element. Must be called in the
3359
+ * constructor of all subclasses
3360
+ * @method initFrame
3361
+ */
3362
+ initFrame: function() {
3363
+ this.createFrame();
3364
+ },
3365
+
3366
+ applyConfig: function() {
3367
+ YAHOO.util.DDProxy.superclass.applyConfig.call(this);
3368
+
3369
+ this.resizeFrame = (this.config.resizeFrame !== false);
3370
+ this.centerFrame = (this.config.centerFrame);
3371
+ this.setDragElId(this.config.dragElId || YAHOO.util.DDProxy.dragElId);
3372
+ },
3373
+
3374
+ /**
3375
+ * Resizes the drag frame to the dimensions of the clicked object, positions
3376
+ * it over the object, and finally displays it
3377
+ * @method showFrame
3378
+ * @param {int} iPageX X click position
3379
+ * @param {int} iPageY Y click position
3380
+ * @private
3381
+ */
3382
+ showFrame: function(iPageX, iPageY) {
3383
+ var el = this.getEl();
3384
+ var dragEl = this.getDragEl();
3385
+ var s = dragEl.style;
3386
+
3387
+ this._resizeProxy();
3388
+
3389
+ if (this.centerFrame) {
3390
+ this.setDelta( Math.round(parseInt(s.width, 10)/2),
3391
+ Math.round(parseInt(s.height, 10)/2) );
3392
+ }
3393
+
3394
+ this.setDragElPos(iPageX, iPageY);
3395
+
3396
+ YAHOO.util.Dom.setStyle(dragEl, "visibility", "visible");
3397
+ },
3398
+
3399
+ /**
3400
+ * The proxy is automatically resized to the dimensions of the linked
3401
+ * element when a drag is initiated, unless resizeFrame is set to false
3402
+ * @method _resizeProxy
3403
+ * @private
3404
+ */
3405
+ _resizeProxy: function() {
3406
+ if (this.resizeFrame) {
3407
+ var DOM = YAHOO.util.Dom;
3408
+ var el = this.getEl();
3409
+ var dragEl = this.getDragEl();
3410
+
3411
+ var bt = parseInt( DOM.getStyle(dragEl, "borderTopWidth" ), 10);
3412
+ var br = parseInt( DOM.getStyle(dragEl, "borderRightWidth" ), 10);
3413
+ var bb = parseInt( DOM.getStyle(dragEl, "borderBottomWidth" ), 10);
3414
+ var bl = parseInt( DOM.getStyle(dragEl, "borderLeftWidth" ), 10);
3415
+
3416
+ if (isNaN(bt)) { bt = 0; }
3417
+ if (isNaN(br)) { br = 0; }
3418
+ if (isNaN(bb)) { bb = 0; }
3419
+ if (isNaN(bl)) { bl = 0; }
3420
+
3421
+
3422
+ var newWidth = Math.max(0, el.offsetWidth - br - bl);
3423
+ var newHeight = Math.max(0, el.offsetHeight - bt - bb);
3424
+
3425
+
3426
+ DOM.setStyle( dragEl, "width", newWidth + "px" );
3427
+ DOM.setStyle( dragEl, "height", newHeight + "px" );
3428
+ }
3429
+ },
3430
+
3431
+ // overrides YAHOO.util.DragDrop
3432
+ b4MouseDown: function(e) {
3433
+ this.setStartPosition();
3434
+ var x = YAHOO.util.Event.getPageX(e);
3435
+ var y = YAHOO.util.Event.getPageY(e);
3436
+ this.autoOffset(x, y);
3437
+
3438
+ // This causes the autoscroll code to kick off, which means autoscroll can
3439
+ // happen prior to the check for a valid drag handle.
3440
+ // this.setDragElPos(x, y);
3441
+ },
3442
+
3443
+ // overrides YAHOO.util.DragDrop
3444
+ b4StartDrag: function(x, y) {
3445
+ // show the drag frame
3446
+ this.showFrame(x, y);
3447
+ },
3448
+
3449
+ // overrides YAHOO.util.DragDrop
3450
+ b4EndDrag: function(e) {
3451
+ YAHOO.util.Dom.setStyle(this.getDragEl(), "visibility", "hidden");
3452
+ },
3453
+
3454
+ // overrides YAHOO.util.DragDrop
3455
+ // By default we try to move the element to the last location of the frame.
3456
+ // This is so that the default behavior mirrors that of YAHOO.util.DD.
3457
+ endDrag: function(e) {
3458
+ var DOM = YAHOO.util.Dom;
3459
+ var lel = this.getEl();
3460
+ var del = this.getDragEl();
3461
+
3462
+ // Show the drag frame briefly so we can get its position
3463
+ // del.style.visibility = "";
3464
+ DOM.setStyle(del, "visibility", "");
3465
+
3466
+ // Hide the linked element before the move to get around a Safari
3467
+ // rendering bug.
3468
+ //lel.style.visibility = "hidden";
3469
+ DOM.setStyle(lel, "visibility", "hidden");
3470
+ YAHOO.util.DDM.moveToEl(lel, del);
3471
+ //del.style.visibility = "hidden";
3472
+ DOM.setStyle(del, "visibility", "hidden");
3473
+ //lel.style.visibility = "";
3474
+ DOM.setStyle(lel, "visibility", "");
3475
+ },
3476
+
3477
+ toString: function() {
3478
+ return ("DDProxy " + this.id);
3479
+ }
3480
+ /**
3481
+ * @event mouseDownEvent
3482
+ * @description Provides access to the mousedown event. The mousedown does not always result in a drag operation.
3483
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3484
+ */
3485
+
3486
+ /**
3487
+ * @event b4MouseDownEvent
3488
+ * @description Provides access to the mousedown event, before the mouseDownEvent gets fired. Returning false will cancel the drag.
3489
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3490
+ */
3491
+
3492
+ /**
3493
+ * @event mouseUpEvent
3494
+ * @description Fired from inside DragDropMgr when the drag operation is finished.
3495
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3496
+ */
3497
+
3498
+ /**
3499
+ * @event b4StartDragEvent
3500
+ * @description Fires before the startDragEvent, returning false will cancel the startDrag Event.
3501
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3502
+ */
3503
+
3504
+ /**
3505
+ * @event startDragEvent
3506
+ * @description Occurs after a mouse down and the drag threshold has been met. The drag threshold default is either 3 pixels of mouse movement or 1 full second of holding the mousedown.
3507
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3508
+ */
3509
+
3510
+ /**
3511
+ * @event b4EndDragEvent
3512
+ * @description Fires before the endDragEvent. Returning false will cancel.
3513
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3514
+ */
3515
+
3516
+ /**
3517
+ * @event endDragEvent
3518
+ * @description Fires on the mouseup event after a drag has been initiated (startDrag fired).
3519
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3520
+ */
3521
+
3522
+ /**
3523
+ * @event dragEvent
3524
+ * @description Occurs every mousemove event while dragging.
3525
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3526
+ */
3527
+ /**
3528
+ * @event b4DragEvent
3529
+ * @description Fires before the dragEvent.
3530
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3531
+ */
3532
+ /**
3533
+ * @event invalidDropEvent
3534
+ * @description Fires when the dragged objects is dropped in a location that contains no drop targets.
3535
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3536
+ */
3537
+ /**
3538
+ * @event b4DragOutEvent
3539
+ * @description Fires before the dragOutEvent
3540
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3541
+ */
3542
+ /**
3543
+ * @event dragOutEvent
3544
+ * @description Fires when a dragged object is no longer over an object that had the onDragEnter fire.
3545
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3546
+ */
3547
+ /**
3548
+ * @event dragEnterEvent
3549
+ * @description Occurs when the dragged object first interacts with another targettable drag and drop object.
3550
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3551
+ */
3552
+ /**
3553
+ * @event b4DragOverEvent
3554
+ * @description Fires before the dragOverEvent.
3555
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3556
+ */
3557
+ /**
3558
+ * @event dragOverEvent
3559
+ * @description Fires every mousemove event while over a drag and drop object.
3560
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3561
+ */
3562
+ /**
3563
+ * @event b4DragDropEvent
3564
+ * @description Fires before the dragDropEvent
3565
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3566
+ */
3567
+ /**
3568
+ * @event dragDropEvent
3569
+ * @description Fires when the dragged objects is dropped on another.
3570
+ * @type YAHOO.util.CustomEvent See <a href="YAHOO.util.Element.html#addListener">Element.addListener</a> for more information on listening for this event.
3571
+ */
3572
+
3573
+ });
3574
+ /**
3575
+ * A DragDrop implementation that does not move, but can be a drop
3576
+ * target. You would get the same result by simply omitting implementation
3577
+ * for the event callbacks, but this way we reduce the processing cost of the
3578
+ * event listener and the callbacks.
3579
+ * @class DDTarget
3580
+ * @extends YAHOO.util.DragDrop
3581
+ * @constructor
3582
+ * @param {String} id the id of the element that is a drop target
3583
+ * @param {String} sGroup the group of related DragDrop objects
3584
+ * @param {object} config an object containing configurable attributes
3585
+ * Valid properties for DDTarget in addition to those in
3586
+ * DragDrop:
3587
+ * none
3588
+ */
3589
+ YAHOO.util.DDTarget = function(id, sGroup, config) {
3590
+ if (id) {
3591
+ this.initTarget(id, sGroup, config);
3592
+ }
3593
+ };
3594
+
3595
+ // YAHOO.util.DDTarget.prototype = new YAHOO.util.DragDrop();
3596
+ YAHOO.extend(YAHOO.util.DDTarget, YAHOO.util.DragDrop, {
3597
+ toString: function() {
3598
+ return ("DDTarget " + this.id);
3599
+ }
3600
+ });
3601
+ YAHOO.register("dragdrop", YAHOO.util.DragDropMgr, {version: "2.8.1", build: "19"});