lpmp 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (636) hide show
  1. data/LICENSE +3 -0
  2. data/README +3 -0
  3. data/Rakefile +45 -0
  4. data/bin/lpmp +107 -0
  5. data/config/help.yaml +1 -0
  6. data/config/hosts.yaml +2 -0
  7. data/config/log.yaml +1 -0
  8. data/config/memcache.yaml +5 -0
  9. data/erb/index.erb +62 -0
  10. data/lib/bg_pull/caichen.rb +199 -0
  11. data/lib/bg_pull/lpmp.rb +45 -0
  12. data/lib/exception.rb +8 -0
  13. data/lib/lpmp.rb +53 -0
  14. data/lib/pull/lpmp.rb +355 -0
  15. data/lib/remote_lmp.rb +129 -0
  16. data/lib/utils.rb +14 -0
  17. data/lib/xq_push/caichen.rb +174 -0
  18. data/lib/xq_push/lpmp.rb +96 -0
  19. data/log/lpmp1st.log +1 -0
  20. data/public/css/ext-portal.css +40 -0
  21. data/public/css/lpmp.css +6 -0
  22. data/public/designer/caichen.epj +1 -0
  23. data/public/designer/hostmonitor.epj +1 -0
  24. data/public/ext-3.0.0/INCLUDE_ORDER.txt +35 -0
  25. data/public/ext-3.0.0/adapter/ext/ext-base-debug.js +3589 -0
  26. data/public/ext-3.0.0/adapter/ext/ext-base.js +7 -0
  27. data/public/ext-3.0.0/adapter/jquery/ext-jquery-adapter-debug.js +2292 -0
  28. data/public/ext-3.0.0/adapter/jquery/ext-jquery-adapter.js +7 -0
  29. data/public/ext-3.0.0/adapter/prototype/ext-prototype-adapter-debug.js +2346 -0
  30. data/public/ext-3.0.0/adapter/prototype/ext-prototype-adapter.js +7 -0
  31. data/public/ext-3.0.0/adapter/yui/ext-yui-adapter-debug.js +2136 -0
  32. data/public/ext-3.0.0/adapter/yui/ext-yui-adapter.js +7 -0
  33. data/public/ext-3.0.0/ext-all-debug.js +65610 -0
  34. data/public/ext-3.0.0/ext-all.js +11 -0
  35. data/public/ext-3.0.0/license.txt +42 -0
  36. data/public/ext-3.0.0/pkgs/cmp-foundation-debug.js +11287 -0
  37. data/public/ext-3.0.0/pkgs/cmp-foundation.js +7 -0
  38. data/public/ext-3.0.0/pkgs/data-foundation-debug.js +3853 -0
  39. data/public/ext-3.0.0/pkgs/data-foundation.js +7 -0
  40. data/public/ext-3.0.0/pkgs/data-grouping-debug.js +139 -0
  41. data/public/ext-3.0.0/pkgs/data-grouping.js +7 -0
  42. data/public/ext-3.0.0/pkgs/data-json-debug.js +582 -0
  43. data/public/ext-3.0.0/pkgs/data-json.js +7 -0
  44. data/public/ext-3.0.0/pkgs/data-list-views-debug.js +1278 -0
  45. data/public/ext-3.0.0/pkgs/data-list-views.js +7 -0
  46. data/public/ext-3.0.0/pkgs/data-xml-debug.js +234 -0
  47. data/public/ext-3.0.0/pkgs/data-xml.js +7 -0
  48. data/public/ext-3.0.0/pkgs/direct-debug.js +1121 -0
  49. data/public/ext-3.0.0/pkgs/direct.js +7 -0
  50. data/public/ext-3.0.0/pkgs/ext-dd-debug.js +4567 -0
  51. data/public/ext-3.0.0/pkgs/ext-dd.js +7 -0
  52. data/public/ext-3.0.0/pkgs/ext-foundation-debug.js +13417 -0
  53. data/public/ext-3.0.0/pkgs/ext-foundation.js +7 -0
  54. data/public/ext-3.0.0/pkgs/pkg-buttons-debug.js +1060 -0
  55. data/public/ext-3.0.0/pkgs/pkg-buttons.js +7 -0
  56. data/public/ext-3.0.0/pkgs/pkg-charts-debug.js +1621 -0
  57. data/public/ext-3.0.0/pkgs/pkg-charts.js +10 -0
  58. data/public/ext-3.0.0/pkgs/pkg-forms-debug.js +7661 -0
  59. data/public/ext-3.0.0/pkgs/pkg-forms.js +7 -0
  60. data/public/ext-3.0.0/pkgs/pkg-grid-editor-debug.js +560 -0
  61. data/public/ext-3.0.0/pkgs/pkg-grid-editor.js +7 -0
  62. data/public/ext-3.0.0/pkgs/pkg-grid-foundation-debug.js +4765 -0
  63. data/public/ext-3.0.0/pkgs/pkg-grid-foundation.js +7 -0
  64. data/public/ext-3.0.0/pkgs/pkg-grid-grouping-debug.js +517 -0
  65. data/public/ext-3.0.0/pkgs/pkg-grid-grouping.js +7 -0
  66. data/public/ext-3.0.0/pkgs/pkg-grid-property-debug.js +370 -0
  67. data/public/ext-3.0.0/pkgs/pkg-grid-property.js +7 -0
  68. data/public/ext-3.0.0/pkgs/pkg-history-debug.js +203 -0
  69. data/public/ext-3.0.0/pkgs/pkg-history.js +7 -0
  70. data/public/ext-3.0.0/pkgs/pkg-menu-debug.js +1628 -0
  71. data/public/ext-3.0.0/pkgs/pkg-menu.js +7 -0
  72. data/public/ext-3.0.0/pkgs/pkg-tabs-debug.js +1100 -0
  73. data/public/ext-3.0.0/pkgs/pkg-tabs.js +7 -0
  74. data/public/ext-3.0.0/pkgs/pkg-tips-debug.js +994 -0
  75. data/public/ext-3.0.0/pkgs/pkg-tips.js +7 -0
  76. data/public/ext-3.0.0/pkgs/pkg-toolbars-debug.js +1374 -0
  77. data/public/ext-3.0.0/pkgs/pkg-toolbars.js +7 -0
  78. data/public/ext-3.0.0/pkgs/pkg-tree-debug.js +4522 -0
  79. data/public/ext-3.0.0/pkgs/pkg-tree.js +7 -0
  80. data/public/ext-3.0.0/pkgs/resizable-debug.js +760 -0
  81. data/public/ext-3.0.0/pkgs/resizable.js +7 -0
  82. data/public/ext-3.0.0/pkgs/state-debug.js +274 -0
  83. data/public/ext-3.0.0/pkgs/state.js +7 -0
  84. data/public/ext-3.0.0/pkgs/window-debug.js +1888 -0
  85. data/public/ext-3.0.0/pkgs/window.js +7 -0
  86. data/public/ext-3.0.0/resources/charts.swf +0 -0
  87. data/public/ext-3.0.0/resources/css/README.txt +3 -0
  88. data/public/ext-3.0.0/resources/css/ext-all-notheme.css +5345 -0
  89. data/public/ext-3.0.0/resources/css/ext-all.css +6990 -0
  90. data/public/ext-3.0.0/resources/css/reset-min.css +7 -0
  91. data/public/ext-3.0.0/resources/css/structure/borders.css +54 -0
  92. data/public/ext-3.0.0/resources/css/structure/box.css +80 -0
  93. data/public/ext-3.0.0/resources/css/structure/button.css +440 -0
  94. data/public/ext-3.0.0/resources/css/structure/combo.css +45 -0
  95. data/public/ext-3.0.0/resources/css/structure/core.css +326 -0
  96. data/public/ext-3.0.0/resources/css/structure/date-picker.css +265 -0
  97. data/public/ext-3.0.0/resources/css/structure/dd.css +61 -0
  98. data/public/ext-3.0.0/resources/css/structure/debug.css +26 -0
  99. data/public/ext-3.0.0/resources/css/structure/dialog.css +62 -0
  100. data/public/ext-3.0.0/resources/css/structure/editor.css +92 -0
  101. data/public/ext-3.0.0/resources/css/structure/form.css +562 -0
  102. data/public/ext-3.0.0/resources/css/structure/grid.css +552 -0
  103. data/public/ext-3.0.0/resources/css/structure/layout.css +296 -0
  104. data/public/ext-3.0.0/resources/css/structure/list-view.css +85 -0
  105. data/public/ext-3.0.0/resources/css/structure/menu.css +205 -0
  106. data/public/ext-3.0.0/resources/css/structure/panel-reset.css +130 -0
  107. data/public/ext-3.0.0/resources/css/structure/panel.css +468 -0
  108. data/public/ext-3.0.0/resources/css/structure/progress.css +42 -0
  109. data/public/ext-3.0.0/resources/css/structure/qtips.css +153 -0
  110. data/public/ext-3.0.0/resources/css/structure/reset.css +7 -0
  111. data/public/ext-3.0.0/resources/css/structure/resizable.css +149 -0
  112. data/public/ext-3.0.0/resources/css/structure/slider.css +103 -0
  113. data/public/ext-3.0.0/resources/css/structure/tabs.css +372 -0
  114. data/public/ext-3.0.0/resources/css/structure/toolbar.css +259 -0
  115. data/public/ext-3.0.0/resources/css/structure/tree.css +203 -0
  116. data/public/ext-3.0.0/resources/css/structure/window.css +222 -0
  117. data/public/ext-3.0.0/resources/css/visual/borders.css +25 -0
  118. data/public/ext-3.0.0/resources/css/visual/box.css +74 -0
  119. data/public/ext-3.0.0/resources/css/visual/button.css +94 -0
  120. data/public/ext-3.0.0/resources/css/visual/combo.css +43 -0
  121. data/public/ext-3.0.0/resources/css/visual/core.css +76 -0
  122. data/public/ext-3.0.0/resources/css/visual/date-picker.css +143 -0
  123. data/public/ext-3.0.0/resources/css/visual/dd.css +29 -0
  124. data/public/ext-3.0.0/resources/css/visual/debug.css +24 -0
  125. data/public/ext-3.0.0/resources/css/visual/dialog.css +34 -0
  126. data/public/ext-3.0.0/resources/css/visual/editor.css +13 -0
  127. data/public/ext-3.0.0/resources/css/visual/form.css +117 -0
  128. data/public/ext-3.0.0/resources/css/visual/grid.css +272 -0
  129. data/public/ext-3.0.0/resources/css/visual/layout.css +53 -0
  130. data/public/ext-3.0.0/resources/css/visual/list-view.css +37 -0
  131. data/public/ext-3.0.0/resources/css/visual/menu.css +82 -0
  132. data/public/ext-3.0.0/resources/css/visual/panel.css +87 -0
  133. data/public/ext-3.0.0/resources/css/visual/progress.css +32 -0
  134. data/public/ext-3.0.0/resources/css/visual/qtips.css +44 -0
  135. data/public/ext-3.0.0/resources/css/visual/resizable.css +43 -0
  136. data/public/ext-3.0.0/resources/css/visual/slider.css +21 -0
  137. data/public/ext-3.0.0/resources/css/visual/tabs.css +119 -0
  138. data/public/ext-3.0.0/resources/css/visual/toolbar.css +103 -0
  139. data/public/ext-3.0.0/resources/css/visual/tree.css +157 -0
  140. data/public/ext-3.0.0/resources/css/visual/window.css +86 -0
  141. data/public/ext-3.0.0/resources/css/xtheme-blue.css +1652 -0
  142. data/public/ext-3.0.0/resources/expressinstall.swf +0 -0
  143. data/public/ext-3.0.0/resources/images/default/box/corners-blue.gif +0 -0
  144. data/public/ext-3.0.0/resources/images/default/box/corners.gif +0 -0
  145. data/public/ext-3.0.0/resources/images/default/box/l-blue.gif +0 -0
  146. data/public/ext-3.0.0/resources/images/default/box/l.gif +0 -0
  147. data/public/ext-3.0.0/resources/images/default/box/r-blue.gif +0 -0
  148. data/public/ext-3.0.0/resources/images/default/box/r.gif +0 -0
  149. data/public/ext-3.0.0/resources/images/default/box/tb-blue.gif +0 -0
  150. data/public/ext-3.0.0/resources/images/default/box/tb.gif +0 -0
  151. data/public/ext-3.0.0/resources/images/default/button/arrow.gif +0 -0
  152. data/public/ext-3.0.0/resources/images/default/button/btn.gif +0 -0
  153. data/public/ext-3.0.0/resources/images/default/button/group-cs.gif +0 -0
  154. data/public/ext-3.0.0/resources/images/default/button/group-lr.gif +0 -0
  155. data/public/ext-3.0.0/resources/images/default/button/group-tb.gif +0 -0
  156. data/public/ext-3.0.0/resources/images/default/button/s-arrow-b-noline.gif +0 -0
  157. data/public/ext-3.0.0/resources/images/default/button/s-arrow-b.gif +0 -0
  158. data/public/ext-3.0.0/resources/images/default/button/s-arrow-bo.gif +0 -0
  159. data/public/ext-3.0.0/resources/images/default/button/s-arrow-noline.gif +0 -0
  160. data/public/ext-3.0.0/resources/images/default/button/s-arrow-o.gif +0 -0
  161. data/public/ext-3.0.0/resources/images/default/button/s-arrow.gif +0 -0
  162. data/public/ext-3.0.0/resources/images/default/dd/drop-add.gif +0 -0
  163. data/public/ext-3.0.0/resources/images/default/dd/drop-no.gif +0 -0
  164. data/public/ext-3.0.0/resources/images/default/dd/drop-yes.gif +0 -0
  165. data/public/ext-3.0.0/resources/images/default/editor/tb-sprite.gif +0 -0
  166. data/public/ext-3.0.0/resources/images/default/form/checkbox.gif +0 -0
  167. data/public/ext-3.0.0/resources/images/default/form/clear-trigger.gif +0 -0
  168. data/public/ext-3.0.0/resources/images/default/form/clear-trigger.psd +0 -0
  169. data/public/ext-3.0.0/resources/images/default/form/date-trigger.gif +0 -0
  170. data/public/ext-3.0.0/resources/images/default/form/date-trigger.psd +0 -0
  171. data/public/ext-3.0.0/resources/images/default/form/error-tip-corners.gif +0 -0
  172. data/public/ext-3.0.0/resources/images/default/form/exclamation.gif +0 -0
  173. data/public/ext-3.0.0/resources/images/default/form/radio.gif +0 -0
  174. data/public/ext-3.0.0/resources/images/default/form/search-trigger.gif +0 -0
  175. data/public/ext-3.0.0/resources/images/default/form/search-trigger.psd +0 -0
  176. data/public/ext-3.0.0/resources/images/default/form/text-bg.gif +0 -0
  177. data/public/ext-3.0.0/resources/images/default/form/trigger-tpl.gif +0 -0
  178. data/public/ext-3.0.0/resources/images/default/form/trigger.gif +0 -0
  179. data/public/ext-3.0.0/resources/images/default/form/trigger.psd +0 -0
  180. data/public/ext-3.0.0/resources/images/default/gradient-bg.gif +0 -0
  181. data/public/ext-3.0.0/resources/images/default/grid/arrow-left-white.gif +0 -0
  182. data/public/ext-3.0.0/resources/images/default/grid/arrow-right-white.gif +0 -0
  183. data/public/ext-3.0.0/resources/images/default/grid/col-move-bottom.gif +0 -0
  184. data/public/ext-3.0.0/resources/images/default/grid/col-move-top.gif +0 -0
  185. data/public/ext-3.0.0/resources/images/default/grid/columns.gif +0 -0
  186. data/public/ext-3.0.0/resources/images/default/grid/dirty.gif +0 -0
  187. data/public/ext-3.0.0/resources/images/default/grid/done.gif +0 -0
  188. data/public/ext-3.0.0/resources/images/default/grid/drop-no.gif +0 -0
  189. data/public/ext-3.0.0/resources/images/default/grid/drop-yes.gif +0 -0
  190. data/public/ext-3.0.0/resources/images/default/grid/footer-bg.gif +0 -0
  191. data/public/ext-3.0.0/resources/images/default/grid/grid-blue-hd.gif +0 -0
  192. data/public/ext-3.0.0/resources/images/default/grid/grid-blue-split.gif +0 -0
  193. data/public/ext-3.0.0/resources/images/default/grid/grid-hrow.gif +0 -0
  194. data/public/ext-3.0.0/resources/images/default/grid/grid-loading.gif +0 -0
  195. data/public/ext-3.0.0/resources/images/default/grid/grid-split.gif +0 -0
  196. data/public/ext-3.0.0/resources/images/default/grid/grid-vista-hd.gif +0 -0
  197. data/public/ext-3.0.0/resources/images/default/grid/grid3-hd-btn.gif +0 -0
  198. data/public/ext-3.0.0/resources/images/default/grid/grid3-hrow-over.gif +0 -0
  199. data/public/ext-3.0.0/resources/images/default/grid/grid3-hrow.gif +0 -0
  200. data/public/ext-3.0.0/resources/images/default/grid/grid3-special-col-bg.gif +0 -0
  201. data/public/ext-3.0.0/resources/images/default/grid/grid3-special-col-sel-bg.gif +0 -0
  202. data/public/ext-3.0.0/resources/images/default/grid/group-by.gif +0 -0
  203. data/public/ext-3.0.0/resources/images/default/grid/group-collapse.gif +0 -0
  204. data/public/ext-3.0.0/resources/images/default/grid/group-expand-sprite.gif +0 -0
  205. data/public/ext-3.0.0/resources/images/default/grid/group-expand.gif +0 -0
  206. data/public/ext-3.0.0/resources/images/default/grid/hd-pop.gif +0 -0
  207. data/public/ext-3.0.0/resources/images/default/grid/hmenu-asc.gif +0 -0
  208. data/public/ext-3.0.0/resources/images/default/grid/hmenu-desc.gif +0 -0
  209. data/public/ext-3.0.0/resources/images/default/grid/hmenu-lock.gif +0 -0
  210. data/public/ext-3.0.0/resources/images/default/grid/hmenu-lock.png +0 -0
  211. data/public/ext-3.0.0/resources/images/default/grid/hmenu-unlock.gif +0 -0
  212. data/public/ext-3.0.0/resources/images/default/grid/hmenu-unlock.png +0 -0
  213. data/public/ext-3.0.0/resources/images/default/grid/invalid_line.gif +0 -0
  214. data/public/ext-3.0.0/resources/images/default/grid/loading.gif +0 -0
  215. data/public/ext-3.0.0/resources/images/default/grid/mso-hd.gif +0 -0
  216. data/public/ext-3.0.0/resources/images/default/grid/nowait.gif +0 -0
  217. data/public/ext-3.0.0/resources/images/default/grid/page-first-disabled.gif +0 -0
  218. data/public/ext-3.0.0/resources/images/default/grid/page-first.gif +0 -0
  219. data/public/ext-3.0.0/resources/images/default/grid/page-last-disabled.gif +0 -0
  220. data/public/ext-3.0.0/resources/images/default/grid/page-last.gif +0 -0
  221. data/public/ext-3.0.0/resources/images/default/grid/page-next-disabled.gif +0 -0
  222. data/public/ext-3.0.0/resources/images/default/grid/page-next.gif +0 -0
  223. data/public/ext-3.0.0/resources/images/default/grid/page-prev-disabled.gif +0 -0
  224. data/public/ext-3.0.0/resources/images/default/grid/page-prev.gif +0 -0
  225. data/public/ext-3.0.0/resources/images/default/grid/pick-button.gif +0 -0
  226. data/public/ext-3.0.0/resources/images/default/grid/refresh.gif +0 -0
  227. data/public/ext-3.0.0/resources/images/default/grid/row-check-sprite.gif +0 -0
  228. data/public/ext-3.0.0/resources/images/default/grid/row-expand-sprite.gif +0 -0
  229. data/public/ext-3.0.0/resources/images/default/grid/row-over.gif +0 -0
  230. data/public/ext-3.0.0/resources/images/default/grid/row-sel.gif +0 -0
  231. data/public/ext-3.0.0/resources/images/default/grid/sort-hd.gif +0 -0
  232. data/public/ext-3.0.0/resources/images/default/grid/sort_asc.gif +0 -0
  233. data/public/ext-3.0.0/resources/images/default/grid/sort_desc.gif +0 -0
  234. data/public/ext-3.0.0/resources/images/default/grid/wait.gif +0 -0
  235. data/public/ext-3.0.0/resources/images/default/layout/collapse.gif +0 -0
  236. data/public/ext-3.0.0/resources/images/default/layout/expand.gif +0 -0
  237. data/public/ext-3.0.0/resources/images/default/layout/gradient-bg.gif +0 -0
  238. data/public/ext-3.0.0/resources/images/default/layout/mini-bottom.gif +0 -0
  239. data/public/ext-3.0.0/resources/images/default/layout/mini-left.gif +0 -0
  240. data/public/ext-3.0.0/resources/images/default/layout/mini-right.gif +0 -0
  241. data/public/ext-3.0.0/resources/images/default/layout/mini-top.gif +0 -0
  242. data/public/ext-3.0.0/resources/images/default/layout/ns-collapse.gif +0 -0
  243. data/public/ext-3.0.0/resources/images/default/layout/ns-expand.gif +0 -0
  244. data/public/ext-3.0.0/resources/images/default/layout/panel-close.gif +0 -0
  245. data/public/ext-3.0.0/resources/images/default/layout/panel-title-bg.gif +0 -0
  246. data/public/ext-3.0.0/resources/images/default/layout/panel-title-light-bg.gif +0 -0
  247. data/public/ext-3.0.0/resources/images/default/layout/stick.gif +0 -0
  248. data/public/ext-3.0.0/resources/images/default/layout/stuck.gif +0 -0
  249. data/public/ext-3.0.0/resources/images/default/layout/tab-close-on.gif +0 -0
  250. data/public/ext-3.0.0/resources/images/default/layout/tab-close.gif +0 -0
  251. data/public/ext-3.0.0/resources/images/default/menu/checked.gif +0 -0
  252. data/public/ext-3.0.0/resources/images/default/menu/group-checked.gif +0 -0
  253. data/public/ext-3.0.0/resources/images/default/menu/item-over.gif +0 -0
  254. data/public/ext-3.0.0/resources/images/default/menu/menu-parent.gif +0 -0
  255. data/public/ext-3.0.0/resources/images/default/menu/menu.gif +0 -0
  256. data/public/ext-3.0.0/resources/images/default/menu/unchecked.gif +0 -0
  257. data/public/ext-3.0.0/resources/images/default/panel/corners-sprite.gif +0 -0
  258. data/public/ext-3.0.0/resources/images/default/panel/left-right.gif +0 -0
  259. data/public/ext-3.0.0/resources/images/default/panel/light-hd.gif +0 -0
  260. data/public/ext-3.0.0/resources/images/default/panel/tool-sprite-tpl.gif +0 -0
  261. data/public/ext-3.0.0/resources/images/default/panel/tool-sprites.gif +0 -0
  262. data/public/ext-3.0.0/resources/images/default/panel/tools-sprites-trans.gif +0 -0
  263. data/public/ext-3.0.0/resources/images/default/panel/top-bottom.gif +0 -0
  264. data/public/ext-3.0.0/resources/images/default/panel/top-bottom.png +0 -0
  265. data/public/ext-3.0.0/resources/images/default/panel/white-corners-sprite.gif +0 -0
  266. data/public/ext-3.0.0/resources/images/default/panel/white-left-right.gif +0 -0
  267. data/public/ext-3.0.0/resources/images/default/panel/white-top-bottom.gif +0 -0
  268. data/public/ext-3.0.0/resources/images/default/progress/progress-bg.gif +0 -0
  269. data/public/ext-3.0.0/resources/images/default/qtip/bg.gif +0 -0
  270. data/public/ext-3.0.0/resources/images/default/qtip/close.gif +0 -0
  271. data/public/ext-3.0.0/resources/images/default/qtip/tip-anchor-sprite.gif +0 -0
  272. data/public/ext-3.0.0/resources/images/default/qtip/tip-sprite.gif +0 -0
  273. data/public/ext-3.0.0/resources/images/default/s.gif +0 -0
  274. data/public/ext-3.0.0/resources/images/default/shadow-c.png +0 -0
  275. data/public/ext-3.0.0/resources/images/default/shadow-lr.png +0 -0
  276. data/public/ext-3.0.0/resources/images/default/shadow.png +0 -0
  277. data/public/ext-3.0.0/resources/images/default/shared/blue-loading.gif +0 -0
  278. data/public/ext-3.0.0/resources/images/default/shared/calendar.gif +0 -0
  279. data/public/ext-3.0.0/resources/images/default/shared/glass-bg.gif +0 -0
  280. data/public/ext-3.0.0/resources/images/default/shared/hd-sprite.gif +0 -0
  281. data/public/ext-3.0.0/resources/images/default/shared/large-loading.gif +0 -0
  282. data/public/ext-3.0.0/resources/images/default/shared/left-btn.gif +0 -0
  283. data/public/ext-3.0.0/resources/images/default/shared/loading-balls.gif +0 -0
  284. data/public/ext-3.0.0/resources/images/default/shared/right-btn.gif +0 -0
  285. data/public/ext-3.0.0/resources/images/default/shared/warning.gif +0 -0
  286. data/public/ext-3.0.0/resources/images/default/sizer/e-handle-dark.gif +0 -0
  287. data/public/ext-3.0.0/resources/images/default/sizer/e-handle.gif +0 -0
  288. data/public/ext-3.0.0/resources/images/default/sizer/ne-handle-dark.gif +0 -0
  289. data/public/ext-3.0.0/resources/images/default/sizer/ne-handle.gif +0 -0
  290. data/public/ext-3.0.0/resources/images/default/sizer/nw-handle-dark.gif +0 -0
  291. data/public/ext-3.0.0/resources/images/default/sizer/nw-handle.gif +0 -0
  292. data/public/ext-3.0.0/resources/images/default/sizer/s-handle-dark.gif +0 -0
  293. data/public/ext-3.0.0/resources/images/default/sizer/s-handle.gif +0 -0
  294. data/public/ext-3.0.0/resources/images/default/sizer/se-handle-dark.gif +0 -0
  295. data/public/ext-3.0.0/resources/images/default/sizer/se-handle.gif +0 -0
  296. data/public/ext-3.0.0/resources/images/default/sizer/square.gif +0 -0
  297. data/public/ext-3.0.0/resources/images/default/sizer/sw-handle-dark.gif +0 -0
  298. data/public/ext-3.0.0/resources/images/default/sizer/sw-handle.gif +0 -0
  299. data/public/ext-3.0.0/resources/images/default/slider/slider-bg.png +0 -0
  300. data/public/ext-3.0.0/resources/images/default/slider/slider-thumb.png +0 -0
  301. data/public/ext-3.0.0/resources/images/default/slider/slider-v-bg.png +0 -0
  302. data/public/ext-3.0.0/resources/images/default/slider/slider-v-thumb.png +0 -0
  303. data/public/ext-3.0.0/resources/images/default/tabs/scroll-left.gif +0 -0
  304. data/public/ext-3.0.0/resources/images/default/tabs/scroll-right.gif +0 -0
  305. data/public/ext-3.0.0/resources/images/default/tabs/scroller-bg.gif +0 -0
  306. data/public/ext-3.0.0/resources/images/default/tabs/tab-btm-inactive-left-bg.gif +0 -0
  307. data/public/ext-3.0.0/resources/images/default/tabs/tab-btm-inactive-right-bg.gif +0 -0
  308. data/public/ext-3.0.0/resources/images/default/tabs/tab-btm-left-bg.gif +0 -0
  309. data/public/ext-3.0.0/resources/images/default/tabs/tab-btm-right-bg.gif +0 -0
  310. data/public/ext-3.0.0/resources/images/default/tabs/tab-close.gif +0 -0
  311. data/public/ext-3.0.0/resources/images/default/tabs/tab-strip-bg.gif +0 -0
  312. data/public/ext-3.0.0/resources/images/default/tabs/tab-strip-bg.png +0 -0
  313. data/public/ext-3.0.0/resources/images/default/tabs/tab-strip-btm-bg.gif +0 -0
  314. data/public/ext-3.0.0/resources/images/default/tabs/tabs-sprite.gif +0 -0
  315. data/public/ext-3.0.0/resources/images/default/toolbar/bg.gif +0 -0
  316. data/public/ext-3.0.0/resources/images/default/toolbar/btn-arrow-light.gif +0 -0
  317. data/public/ext-3.0.0/resources/images/default/toolbar/btn-arrow.gif +0 -0
  318. data/public/ext-3.0.0/resources/images/default/toolbar/btn-over-bg.gif +0 -0
  319. data/public/ext-3.0.0/resources/images/default/toolbar/gray-bg.gif +0 -0
  320. data/public/ext-3.0.0/resources/images/default/toolbar/more.gif +0 -0
  321. data/public/ext-3.0.0/resources/images/default/toolbar/tb-bg.gif +0 -0
  322. data/public/ext-3.0.0/resources/images/default/toolbar/tb-btn-sprite.gif +0 -0
  323. data/public/ext-3.0.0/resources/images/default/toolbar/tb-xl-btn-sprite.gif +0 -0
  324. data/public/ext-3.0.0/resources/images/default/toolbar/tb-xl-sep.gif +0 -0
  325. data/public/ext-3.0.0/resources/images/default/tree/arrows.gif +0 -0
  326. data/public/ext-3.0.0/resources/images/default/tree/drop-add.gif +0 -0
  327. data/public/ext-3.0.0/resources/images/default/tree/drop-between.gif +0 -0
  328. data/public/ext-3.0.0/resources/images/default/tree/drop-no.gif +0 -0
  329. data/public/ext-3.0.0/resources/images/default/tree/drop-over.gif +0 -0
  330. data/public/ext-3.0.0/resources/images/default/tree/drop-under.gif +0 -0
  331. data/public/ext-3.0.0/resources/images/default/tree/drop-yes.gif +0 -0
  332. data/public/ext-3.0.0/resources/images/default/tree/elbow-end-minus-nl.gif +0 -0
  333. data/public/ext-3.0.0/resources/images/default/tree/elbow-end-minus.gif +0 -0
  334. data/public/ext-3.0.0/resources/images/default/tree/elbow-end-plus-nl.gif +0 -0
  335. data/public/ext-3.0.0/resources/images/default/tree/elbow-end-plus.gif +0 -0
  336. data/public/ext-3.0.0/resources/images/default/tree/elbow-end.gif +0 -0
  337. data/public/ext-3.0.0/resources/images/default/tree/elbow-line.gif +0 -0
  338. data/public/ext-3.0.0/resources/images/default/tree/elbow-minus-nl.gif +0 -0
  339. data/public/ext-3.0.0/resources/images/default/tree/elbow-minus.gif +0 -0
  340. data/public/ext-3.0.0/resources/images/default/tree/elbow-plus-nl.gif +0 -0
  341. data/public/ext-3.0.0/resources/images/default/tree/elbow-plus.gif +0 -0
  342. data/public/ext-3.0.0/resources/images/default/tree/elbow.gif +0 -0
  343. data/public/ext-3.0.0/resources/images/default/tree/folder-open.gif +0 -0
  344. data/public/ext-3.0.0/resources/images/default/tree/folder.gif +0 -0
  345. data/public/ext-3.0.0/resources/images/default/tree/leaf.gif +0 -0
  346. data/public/ext-3.0.0/resources/images/default/tree/loading.gif +0 -0
  347. data/public/ext-3.0.0/resources/images/default/tree/s.gif +0 -0
  348. data/public/ext-3.0.0/resources/images/default/window/icon-error.gif +0 -0
  349. data/public/ext-3.0.0/resources/images/default/window/icon-info.gif +0 -0
  350. data/public/ext-3.0.0/resources/images/default/window/icon-question.gif +0 -0
  351. data/public/ext-3.0.0/resources/images/default/window/icon-warning.gif +0 -0
  352. data/public/ext-3.0.0/resources/images/default/window/left-corners.png +0 -0
  353. data/public/ext-3.0.0/resources/images/default/window/left-corners.psd +0 -0
  354. data/public/ext-3.0.0/resources/images/default/window/left-right.png +0 -0
  355. data/public/ext-3.0.0/resources/images/default/window/left-right.psd +0 -0
  356. data/public/ext-3.0.0/resources/images/default/window/right-corners.png +0 -0
  357. data/public/ext-3.0.0/resources/images/default/window/right-corners.psd +0 -0
  358. data/public/ext-3.0.0/resources/images/default/window/top-bottom.png +0 -0
  359. data/public/ext-3.0.0/resources/images/default/window/top-bottom.psd +0 -0
  360. data/public/ext-3.0.0/resources/images/icon/chart.gif +0 -0
  361. data/public/ext-3.0.0/src/adapter/core/ext-base-ajax.js +371 -0
  362. data/public/ext-3.0.0/src/adapter/core/ext-base-anim-extra.js +301 -0
  363. data/public/ext-3.0.0/src/adapter/core/ext-base-anim.js +477 -0
  364. data/public/ext-3.0.0/src/adapter/core/ext-base-begin.js +18 -0
  365. data/public/ext-3.0.0/src/adapter/core/ext-base-dom.js +157 -0
  366. data/public/ext-3.0.0/src/adapter/core/ext-base-end.js +21 -0
  367. data/public/ext-3.0.0/src/adapter/core/ext-base-event.js +453 -0
  368. data/public/ext-3.0.0/src/adapter/core/ext-base-point.js +17 -0
  369. data/public/ext-3.0.0/src/adapter/core/ext-base-region.js +81 -0
  370. data/public/ext-3.0.0/src/adapter/ext-base-dom-more.js +9 -0
  371. data/public/ext-3.0.0/src/adapter/jquery-bridge.js +546 -0
  372. data/public/ext-3.0.0/src/adapter/prototype-bridge.js +600 -0
  373. data/public/ext-3.0.0/src/adapter/yui-bridge.js +390 -0
  374. data/public/ext-3.0.0/src/core/CompositeElement.js +136 -0
  375. data/public/ext-3.0.0/src/core/CompositeElementLite-more.js +102 -0
  376. data/public/ext-3.0.0/src/core/DomHelper-more.js +179 -0
  377. data/public/ext-3.0.0/src/core/Element-more.js +192 -0
  378. data/public/ext-3.0.0/src/core/Element.alignment.js +370 -0
  379. data/public/ext-3.0.0/src/core/Element.dd.js +46 -0
  380. data/public/ext-3.0.0/src/core/Element.fx-more.js +152 -0
  381. data/public/ext-3.0.0/src/core/Element.insertion-more.js +52 -0
  382. data/public/ext-3.0.0/src/core/Element.keys.js +48 -0
  383. data/public/ext-3.0.0/src/core/Element.legacy.js +42 -0
  384. data/public/ext-3.0.0/src/core/Element.position-more.js +165 -0
  385. data/public/ext-3.0.0/src/core/Element.scroll-more.js +110 -0
  386. data/public/ext-3.0.0/src/core/Element.style-more.js +318 -0
  387. data/public/ext-3.0.0/src/core/Error.js +81 -0
  388. data/public/ext-3.0.0/src/core/EventManager-more.js +334 -0
  389. data/public/ext-3.0.0/src/core/Ext-more.js +669 -0
  390. data/public/ext-3.0.0/src/core/Template-more.js +115 -0
  391. data/public/ext-3.0.0/src/core/core/CompositeElementLite.js +197 -0
  392. data/public/ext-3.0.0/src/core/core/DomHelper.js +378 -0
  393. data/public/ext-3.0.0/src/core/core/DomQuery.js +826 -0
  394. data/public/ext-3.0.0/src/core/core/Element.fx.js +324 -0
  395. data/public/ext-3.0.0/src/core/core/Element.insertion.js +147 -0
  396. data/public/ext-3.0.0/src/core/core/Element.js +945 -0
  397. data/public/ext-3.0.0/src/core/core/Element.position.js +303 -0
  398. data/public/ext-3.0.0/src/core/core/Element.scroll.js +58 -0
  399. data/public/ext-3.0.0/src/core/core/Element.style.js +439 -0
  400. data/public/ext-3.0.0/src/core/core/Element.traversal.js +176 -0
  401. data/public/ext-3.0.0/src/core/core/EventManager.js +623 -0
  402. data/public/ext-3.0.0/src/core/core/Ext.js +922 -0
  403. data/public/ext-3.0.0/src/core/core/Fx.js +1115 -0
  404. data/public/ext-3.0.0/src/core/core/Template.js +185 -0
  405. data/public/ext-3.0.0/src/data/Api.js +210 -0
  406. data/public/ext-3.0.0/src/data/ArrayReader.js +102 -0
  407. data/public/ext-3.0.0/src/data/ArrayStore.js +70 -0
  408. data/public/ext-3.0.0/src/data/DataField.js +249 -0
  409. data/public/ext-3.0.0/src/data/DataProxy.js +427 -0
  410. data/public/ext-3.0.0/src/data/DataReader.js +160 -0
  411. data/public/ext-3.0.0/src/data/DataWriter.js +201 -0
  412. data/public/ext-3.0.0/src/data/DirectProxy.js +141 -0
  413. data/public/ext-3.0.0/src/data/DirectStore.js +52 -0
  414. data/public/ext-3.0.0/src/data/GroupingStore.js +139 -0
  415. data/public/ext-3.0.0/src/data/HttpProxy.js +276 -0
  416. data/public/ext-3.0.0/src/data/JsonReader.js +311 -0
  417. data/public/ext-3.0.0/src/data/JsonStore.js +49 -0
  418. data/public/ext-3.0.0/src/data/JsonWriter.js +77 -0
  419. data/public/ext-3.0.0/src/data/MemoryProxy.js +69 -0
  420. data/public/ext-3.0.0/src/data/Record.js +400 -0
  421. data/public/ext-3.0.0/src/data/ScriptTagProxy.js +279 -0
  422. data/public/ext-3.0.0/src/data/SortTypes.js +91 -0
  423. data/public/ext-3.0.0/src/data/Store.js +1492 -0
  424. data/public/ext-3.0.0/src/data/StoreMgr.js +72 -0
  425. data/public/ext-3.0.0/src/data/Tree.js +785 -0
  426. data/public/ext-3.0.0/src/data/XmlReader.js +128 -0
  427. data/public/ext-3.0.0/src/data/XmlStore.js +75 -0
  428. data/public/ext-3.0.0/src/data/XmlWriter.js +45 -0
  429. data/public/ext-3.0.0/src/data/core/Connection.js +575 -0
  430. data/public/ext-3.0.0/src/dd/DDCore.js +2992 -0
  431. data/public/ext-3.0.0/src/dd/DragSource.js +365 -0
  432. data/public/ext-3.0.0/src/dd/DragTracker.js +217 -0
  433. data/public/ext-3.0.0/src/dd/DragZone.js +133 -0
  434. data/public/ext-3.0.0/src/dd/DropTarget.js +115 -0
  435. data/public/ext-3.0.0/src/dd/DropZone.js +262 -0
  436. data/public/ext-3.0.0/src/dd/Registry.js +127 -0
  437. data/public/ext-3.0.0/src/dd/ScrollManager.js +201 -0
  438. data/public/ext-3.0.0/src/dd/StatusProxy.js +171 -0
  439. data/public/ext-3.0.0/src/debug.js +906 -0
  440. data/public/ext-3.0.0/src/direct/Direct.js +235 -0
  441. data/public/ext-3.0.0/src/direct/Event.js +34 -0
  442. data/public/ext-3.0.0/src/direct/JsonProvider.js +45 -0
  443. data/public/ext-3.0.0/src/direct/PollingProvider.js +151 -0
  444. data/public/ext-3.0.0/src/direct/Provider.js +110 -0
  445. data/public/ext-3.0.0/src/direct/RemotingProvider.js +373 -0
  446. data/public/ext-3.0.0/src/direct/Transaction.js +32 -0
  447. data/public/ext-3.0.0/src/locale/ext-lang-af.js +184 -0
  448. data/public/ext-3.0.0/src/locale/ext-lang-bg.js +278 -0
  449. data/public/ext-3.0.0/src/locale/ext-lang-ca.js +315 -0
  450. data/public/ext-3.0.0/src/locale/ext-lang-cs.js +293 -0
  451. data/public/ext-3.0.0/src/locale/ext-lang-da.js +296 -0
  452. data/public/ext-3.0.0/src/locale/ext-lang-de.js +326 -0
  453. data/public/ext-3.0.0/src/locale/ext-lang-el_GR.js +309 -0
  454. data/public/ext-3.0.0/src/locale/ext-lang-en.js +335 -0
  455. data/public/ext-3.0.0/src/locale/ext-lang-en_GB.js +315 -0
  456. data/public/ext-3.0.0/src/locale/ext-lang-es.js +318 -0
  457. data/public/ext-3.0.0/src/locale/ext-lang-fa.js +272 -0
  458. data/public/ext-3.0.0/src/locale/ext-lang-fi.js +302 -0
  459. data/public/ext-3.0.0/src/locale/ext-lang-fr.js +335 -0
  460. data/public/ext-3.0.0/src/locale/ext-lang-fr_CA.js +218 -0
  461. data/public/ext-3.0.0/src/locale/ext-lang-gr.js +175 -0
  462. data/public/ext-3.0.0/src/locale/ext-lang-he.js +292 -0
  463. data/public/ext-3.0.0/src/locale/ext-lang-hr.js +295 -0
  464. data/public/ext-3.0.0/src/locale/ext-lang-hu.js +296 -0
  465. data/public/ext-3.0.0/src/locale/ext-lang-id.js +302 -0
  466. data/public/ext-3.0.0/src/locale/ext-lang-it.js +295 -0
  467. data/public/ext-3.0.0/src/locale/ext-lang-ja.js +318 -0
  468. data/public/ext-3.0.0/src/locale/ext-lang-ko.js +267 -0
  469. data/public/ext-3.0.0/src/locale/ext-lang-lt.js +333 -0
  470. data/public/ext-3.0.0/src/locale/ext-lang-lv.js +176 -0
  471. data/public/ext-3.0.0/src/locale/ext-lang-mk.js +176 -0
  472. data/public/ext-3.0.0/src/locale/ext-lang-nl.js +323 -0
  473. data/public/ext-3.0.0/src/locale/ext-lang-no_NB.js +294 -0
  474. data/public/ext-3.0.0/src/locale/ext-lang-no_NN.js +294 -0
  475. data/public/ext-3.0.0/src/locale/ext-lang-pl.js +304 -0
  476. data/public/ext-3.0.0/src/locale/ext-lang-pt.js +260 -0
  477. data/public/ext-3.0.0/src/locale/ext-lang-pt_BR.js +302 -0
  478. data/public/ext-3.0.0/src/locale/ext-lang-pt_PT.js +298 -0
  479. data/public/ext-3.0.0/src/locale/ext-lang-ro.js +295 -0
  480. data/public/ext-3.0.0/src/locale/ext-lang-ru.js +319 -0
  481. data/public/ext-3.0.0/src/locale/ext-lang-sk.js +182 -0
  482. data/public/ext-3.0.0/src/locale/ext-lang-sl.js +176 -0
  483. data/public/ext-3.0.0/src/locale/ext-lang-sr.js +179 -0
  484. data/public/ext-3.0.0/src/locale/ext-lang-sr_RS.js +178 -0
  485. data/public/ext-3.0.0/src/locale/ext-lang-sv_SE.js +178 -0
  486. data/public/ext-3.0.0/src/locale/ext-lang-th.js +294 -0
  487. data/public/ext-3.0.0/src/locale/ext-lang-tr.js +306 -0
  488. data/public/ext-3.0.0/src/locale/ext-lang-ukr.js +258 -0
  489. data/public/ext-3.0.0/src/locale/ext-lang-vn.js +181 -0
  490. data/public/ext-3.0.0/src/locale/ext-lang-zh_CN.js +174 -0
  491. data/public/ext-3.0.0/src/locale/ext-lang-zh_TW.js +178 -0
  492. data/public/ext-3.0.0/src/state/CookieProvider.js +91 -0
  493. data/public/ext-3.0.0/src/state/Provider.js +127 -0
  494. data/public/ext-3.0.0/src/state/StateManager.js +69 -0
  495. data/public/ext-3.0.0/src/util/CSS.js +161 -0
  496. data/public/ext-3.0.0/src/util/ClickRepeater.js +200 -0
  497. data/public/ext-3.0.0/src/util/Cookies.js +96 -0
  498. data/public/ext-3.0.0/src/util/Date.js +1317 -0
  499. data/public/ext-3.0.0/src/util/Format.js +356 -0
  500. data/public/ext-3.0.0/src/util/History.js +203 -0
  501. data/public/ext-3.0.0/src/util/KeyMap.js +242 -0
  502. data/public/ext-3.0.0/src/util/KeyNav.js +161 -0
  503. data/public/ext-3.0.0/src/util/MixedCollection.js +576 -0
  504. data/public/ext-3.0.0/src/util/Observable-more.js +178 -0
  505. data/public/ext-3.0.0/src/util/TextMetrics.js +131 -0
  506. data/public/ext-3.0.0/src/util/UpdateManager.js +536 -0
  507. data/public/ext-3.0.0/src/util/XTemplate.js +379 -0
  508. data/public/ext-3.0.0/src/util/core/DelayedTask.js +68 -0
  509. data/public/ext-3.0.0/src/util/core/JSON.js +174 -0
  510. data/public/ext-3.0.0/src/util/core/Observable.js +483 -0
  511. data/public/ext-3.0.0/src/util/core/TaskMgr.js +174 -0
  512. data/public/ext-3.0.0/src/widgets/Action.js +252 -0
  513. data/public/ext-3.0.0/src/widgets/BoxComponent.js +519 -0
  514. data/public/ext-3.0.0/src/widgets/Button.js +762 -0
  515. data/public/ext-3.0.0/src/widgets/ButtonGroup.js +103 -0
  516. data/public/ext-3.0.0/src/widgets/ColorPalette.js +148 -0
  517. data/public/ext-3.0.0/src/widgets/Component.js +1540 -0
  518. data/public/ext-3.0.0/src/widgets/ComponentMgr.js +159 -0
  519. data/public/ext-3.0.0/src/widgets/Container.js +894 -0
  520. data/public/ext-3.0.0/src/widgets/CycleButton.js +188 -0
  521. data/public/ext-3.0.0/src/widgets/DataView.js +749 -0
  522. data/public/ext-3.0.0/src/widgets/DatePicker.js +771 -0
  523. data/public/ext-3.0.0/src/widgets/Editor.js +385 -0
  524. data/public/ext-3.0.0/src/widgets/Layer.js +466 -0
  525. data/public/ext-3.0.0/src/widgets/LoadMask.js +123 -0
  526. data/public/ext-3.0.0/src/widgets/MessageBox.js +626 -0
  527. data/public/ext-3.0.0/src/widgets/PagingToolbar.js +502 -0
  528. data/public/ext-3.0.0/src/widgets/Panel.js +1772 -0
  529. data/public/ext-3.0.0/src/widgets/PanelDD.js +154 -0
  530. data/public/ext-3.0.0/src/widgets/ProgressBar.js +289 -0
  531. data/public/ext-3.0.0/src/widgets/Resizable.js +760 -0
  532. data/public/ext-3.0.0/src/widgets/Shadow.js +192 -0
  533. data/public/ext-3.0.0/src/widgets/Slider.js +426 -0
  534. data/public/ext-3.0.0/src/widgets/SplitBar.js +436 -0
  535. data/public/ext-3.0.0/src/widgets/SplitButton.js +124 -0
  536. data/public/ext-3.0.0/src/widgets/TabPanel.js +1100 -0
  537. data/public/ext-3.0.0/src/widgets/Toolbar.js +781 -0
  538. data/public/ext-3.0.0/src/widgets/Viewport.js +124 -0
  539. data/public/ext-3.0.0/src/widgets/Window.js +941 -0
  540. data/public/ext-3.0.0/src/widgets/WindowManager.js +187 -0
  541. data/public/ext-3.0.0/src/widgets/chart/Chart.js +721 -0
  542. data/public/ext-3.0.0/src/widgets/chart/EventProxy.js +20 -0
  543. data/public/ext-3.0.0/src/widgets/chart/FlashComponent.js +117 -0
  544. data/public/ext-3.0.0/src/widgets/chart/swfobject.js +783 -0
  545. data/public/ext-3.0.0/src/widgets/form/Action.js +626 -0
  546. data/public/ext-3.0.0/src/widgets/form/BasicForm.js +735 -0
  547. data/public/ext-3.0.0/src/widgets/form/Checkbox.js +177 -0
  548. data/public/ext-3.0.0/src/widgets/form/CheckboxGroup.js +419 -0
  549. data/public/ext-3.0.0/src/widgets/form/Combo.js +1232 -0
  550. data/public/ext-3.0.0/src/widgets/form/DateField.js +389 -0
  551. data/public/ext-3.0.0/src/widgets/form/DisplayField.js +98 -0
  552. data/public/ext-3.0.0/src/widgets/form/Field.js +640 -0
  553. data/public/ext-3.0.0/src/widgets/form/FieldSet.js +305 -0
  554. data/public/ext-3.0.0/src/widgets/form/Form.js +335 -0
  555. data/public/ext-3.0.0/src/widgets/form/Hidden.js +39 -0
  556. data/public/ext-3.0.0/src/widgets/form/HtmlEditor.js +1179 -0
  557. data/public/ext-3.0.0/src/widgets/form/Label.js +64 -0
  558. data/public/ext-3.0.0/src/widgets/form/NumberField.js +139 -0
  559. data/public/ext-3.0.0/src/widgets/form/Radio.js +81 -0
  560. data/public/ext-3.0.0/src/widgets/form/RadioGroup.js +116 -0
  561. data/public/ext-3.0.0/src/widgets/form/TextArea.js +117 -0
  562. data/public/ext-3.0.0/src/widgets/form/TextField.js +491 -0
  563. data/public/ext-3.0.0/src/widgets/form/TimeField.js +146 -0
  564. data/public/ext-3.0.0/src/widgets/form/TriggerField.js +328 -0
  565. data/public/ext-3.0.0/src/widgets/form/VTypes.js +135 -0
  566. data/public/ext-3.0.0/src/widgets/grid/AbstractSelectionModel.js +57 -0
  567. data/public/ext-3.0.0/src/widgets/grid/CellSelectionModel.js +262 -0
  568. data/public/ext-3.0.0/src/widgets/grid/CheckboxSelectionModel.js +103 -0
  569. data/public/ext-3.0.0/src/widgets/grid/Column.js +406 -0
  570. data/public/ext-3.0.0/src/widgets/grid/ColumnDD.js +199 -0
  571. data/public/ext-3.0.0/src/widgets/grid/ColumnModel.js +592 -0
  572. data/public/ext-3.0.0/src/widgets/grid/ColumnSplitDD.js +62 -0
  573. data/public/ext-3.0.0/src/widgets/grid/EditorGrid.js +291 -0
  574. data/public/ext-3.0.0/src/widgets/grid/GridDD.js +95 -0
  575. data/public/ext-3.0.0/src/widgets/grid/GridEditor.js +21 -0
  576. data/public/ext-3.0.0/src/widgets/grid/GridPanel.js +952 -0
  577. data/public/ext-3.0.0/src/widgets/grid/GridView.js +1776 -0
  578. data/public/ext-3.0.0/src/widgets/grid/GroupingView.js +517 -0
  579. data/public/ext-3.0.0/src/widgets/grid/PropertyGrid.js +370 -0
  580. data/public/ext-3.0.0/src/widgets/grid/RowNumberer.js +61 -0
  581. data/public/ext-3.0.0/src/widgets/grid/RowSelectionModel.js +530 -0
  582. data/public/ext-3.0.0/src/widgets/layout/AbsoluteLayout.js +82 -0
  583. data/public/ext-3.0.0/src/widgets/layout/AccordionLayout.js +177 -0
  584. data/public/ext-3.0.0/src/widgets/layout/AnchorLayout.js +200 -0
  585. data/public/ext-3.0.0/src/widgets/layout/BorderLayout.js +1108 -0
  586. data/public/ext-3.0.0/src/widgets/layout/BoxLayout.js +417 -0
  587. data/public/ext-3.0.0/src/widgets/layout/CardLayout.js +127 -0
  588. data/public/ext-3.0.0/src/widgets/layout/ColumnLayout.js +130 -0
  589. data/public/ext-3.0.0/src/widgets/layout/ContainerLayout.js +215 -0
  590. data/public/ext-3.0.0/src/widgets/layout/FitLayout.js +48 -0
  591. data/public/ext-3.0.0/src/widgets/layout/FormLayout.js +266 -0
  592. data/public/ext-3.0.0/src/widgets/layout/TableLayout.js +194 -0
  593. data/public/ext-3.0.0/src/widgets/list/ColumnResizer.js +123 -0
  594. data/public/ext-3.0.0/src/widgets/list/ListView.js +357 -0
  595. data/public/ext-3.0.0/src/widgets/list/Sorter.js +70 -0
  596. data/public/ext-3.0.0/src/widgets/menu/BaseItem.js +160 -0
  597. data/public/ext-3.0.0/src/widgets/menu/CheckItem.js +114 -0
  598. data/public/ext-3.0.0/src/widgets/menu/ColorMenu.js +72 -0
  599. data/public/ext-3.0.0/src/widgets/menu/DateMenu.js +90 -0
  600. data/public/ext-3.0.0/src/widgets/menu/Item.js +211 -0
  601. data/public/ext-3.0.0/src/widgets/menu/Menu.js +733 -0
  602. data/public/ext-3.0.0/src/widgets/menu/MenuMgr.js +211 -0
  603. data/public/ext-3.0.0/src/widgets/menu/Separator.js +46 -0
  604. data/public/ext-3.0.0/src/widgets/menu/TextItem.js +46 -0
  605. data/public/ext-3.0.0/src/widgets/tips/QuickTip.js +207 -0
  606. data/public/ext-3.0.0/src/widgets/tips/QuickTips.js +159 -0
  607. data/public/ext-3.0.0/src/widgets/tips/Tip.js +157 -0
  608. data/public/ext-3.0.0/src/widgets/tips/ToolTip.js +492 -0
  609. data/public/ext-3.0.0/src/widgets/tree/AsyncTreeNode.js +114 -0
  610. data/public/ext-3.0.0/src/widgets/tree/TreeDragZone.js +82 -0
  611. data/public/ext-3.0.0/src/widgets/tree/TreeDropZone.js +321 -0
  612. data/public/ext-3.0.0/src/widgets/tree/TreeEditor.js +160 -0
  613. data/public/ext-3.0.0/src/widgets/tree/TreeEventModel.js +169 -0
  614. data/public/ext-3.0.0/src/widgets/tree/TreeFilter.js +114 -0
  615. data/public/ext-3.0.0/src/widgets/tree/TreeLoader.js +342 -0
  616. data/public/ext-3.0.0/src/widgets/tree/TreeNode.js +546 -0
  617. data/public/ext-3.0.0/src/widgets/tree/TreeNodeUI.js +633 -0
  618. data/public/ext-3.0.0/src/widgets/tree/TreePanel.js +918 -0
  619. data/public/ext-3.0.0/src/widgets/tree/TreeSelectionModel.js +315 -0
  620. data/public/ext-3.0.0/src/widgets/tree/TreeSorter.js +106 -0
  621. data/public/js/ext-portal.js +235 -0
  622. data/public/js/global.js +7 -0
  623. data/public/js/outerframe.js +47 -0
  624. data/public/js/portal.js +713 -0
  625. data/public/js/test_chart.js +152 -0
  626. data/test/config.rb +62 -0
  627. data/test/config/hosts.yaml +5 -0
  628. data/test/config/log.yaml +1 -0
  629. data/test/config/memcache.yaml +5 -0
  630. data/test/exception.rb +39 -0
  631. data/test/method_missing.rb +14 -0
  632. data/test/module.rb +39 -0
  633. data/test/remote_lmp.rb +126 -0
  634. data/test/sinatra.rb +29 -0
  635. data/test/sinatra_base.rb +16 -0
  636. metadata +690 -0
@@ -0,0 +1,7 @@
1
+ /*
2
+ * Ext JS Library 3.0.0
3
+ * Copyright(c) 2006-2009 Ext JS, LLC
4
+ * licensing@extjs.com
5
+ * http://www.extjs.com/license
6
+ */
7
+ Ext.data.DirectProxy=function(a){Ext.apply(this,a);if(typeof this.paramOrder=="string"){this.paramOrder=this.paramOrder.split(/[\s,|]/)}Ext.data.DirectProxy.superclass.constructor.call(this,a)};Ext.extend(Ext.data.DirectProxy,Ext.data.DataProxy,{paramOrder:undefined,paramsAsHash:true,directFn:undefined,doRequest:function(b,c,a,e,j,k,m){var h=[];var g=this.api[b]||this.directFn;switch(b){case Ext.data.Api.actions.create:h.push(a[e.meta.root]);break;case Ext.data.Api.actions.read:if(this.paramOrder){for(var d=0,f=this.paramOrder.length;d<f;d++){h.push(a[this.paramOrder[d]])}}else{if(this.paramsAsHash){h.push(a)}}break;case Ext.data.Api.actions.update:h.push(a[e.meta.idProperty]);h.push(a[e.meta.root]);break;case Ext.data.Api.actions.destroy:h.push(a[e.meta.root]);break}var l={params:a||{},callback:j,scope:k,arg:m,reader:e};h.push(this.createCallback(b,c,l),this);g.apply(window,h)},createCallback:function(c,a,b){return function(d,e){if(!e.status){if(c===Ext.data.Api.actions.read){this.fireEvent("loadexception",this,b,e,null)}this.fireEvent("exception",this,"remote",c,b,e,null);b.callback.call(b.scope,null,b.arg,false);return}if(c===Ext.data.Api.actions.read){this.onRead(c,b,d,e)}else{this.onWrite(c,b,d,e,a)}}},onRead:function(f,e,a,d){var b;try{b=e.reader.readRecords(a)}catch(c){this.fireEvent("loadexception",this,e,d,c);this.fireEvent("exception",this,"response",f,e,d,c);e.callback.call(e.scope,null,e.arg,false);return}this.fireEvent("load",this,d,e.arg);e.callback.call(e.scope,b,e.arg,true)},onWrite:function(e,d,a,c,b){this.fireEvent("write",this,e,a,c,b,d.arg);d.callback.call(d.scope,a,c,true)}});Ext.data.DirectStore=function(a){a.batchTransactions=false;Ext.data.DirectStore.superclass.constructor.call(this,Ext.apply(a,{proxy:(typeof(a.proxy)=="undefined")?new Ext.data.DirectProxy(Ext.copyTo({},a,"paramOrder,paramsAsHash,directFn,api")):a.proxy,reader:(typeof(a.reader)=="undefined"&&typeof(a.fields)=="object")?new Ext.data.JsonReader(Ext.copyTo({},a,"totalProperty,root,idProperty"),a.fields):a.reader}))};Ext.extend(Ext.data.DirectStore,Ext.data.Store,{});Ext.reg("directstore",Ext.data.DirectStore);Ext.Direct=Ext.extend(Ext.util.Observable,{exceptions:{TRANSPORT:"xhr",PARSE:"parse",LOGIN:"login",SERVER:"exception"},constructor:function(){this.addEvents("event","exception");this.transactions={};this.providers={}},addProvider:function(e){var c=arguments;if(c.length>1){for(var d=0,b=c.length;d<b;d++){this.addProvider(c[d])}return}if(!e.events){e=new Ext.Direct.PROVIDERS[e.type](e)}e.id=e.id||Ext.id();this.providers[e.id]=e;e.on("data",this.onProviderData,this);e.on("exception",this.onProviderException,this);if(!e.isConnected()){e.connect()}return e},getProvider:function(a){return this.providers[a]},removeProvider:function(b){var a=b.id?b:this.providers[b.id];a.un("data",this.onProviderData,this);a.un("exception",this.onProviderException,this);delete this.providers[a.id];return a},addTransaction:function(a){this.transactions[a.tid]=a;return a},removeTransaction:function(a){delete this.transactions[a.tid||a];return a},getTransaction:function(a){return this.transactions[a.tid||a]},onProviderData:function(d,c){if(Ext.isArray(c)){for(var b=0,a=c.length;b<a;b++){this.onProviderData(d,c[b])}return}if(c.name&&c.name!="event"&&c.name!="exception"){this.fireEvent(c.name,c)}else{if(c.type=="exception"){this.fireEvent("exception",c)}}this.fireEvent("event",c,d)},createEvent:function(a,b){return new Ext.Direct.eventTypes[a.type](Ext.apply(a,b))}});Ext.Direct=new Ext.Direct();Ext.Direct.TID=1;Ext.Direct.PROVIDERS={};Ext.Direct.Transaction=function(a){Ext.apply(this,a);this.tid=++Ext.Direct.TID;this.retryCount=0};Ext.Direct.Transaction.prototype={send:function(){this.provider.queueTransaction(this)},retry:function(){this.retryCount++;this.send()},getProvider:function(){return this.provider}};Ext.Direct.Event=function(a){Ext.apply(this,a)};Ext.Direct.Event.prototype={status:true,getData:function(){return this.data}};Ext.Direct.RemotingEvent=Ext.extend(Ext.Direct.Event,{type:"rpc",getTransaction:function(){return this.transaction||Ext.Direct.getTransaction(this.tid)}});Ext.Direct.ExceptionEvent=Ext.extend(Ext.Direct.RemotingEvent,{status:false,type:"exception"});Ext.Direct.eventTypes={rpc:Ext.Direct.RemotingEvent,event:Ext.Direct.Event,exception:Ext.Direct.ExceptionEvent};Ext.direct.Provider=Ext.extend(Ext.util.Observable,{priority:1,constructor:function(a){Ext.apply(this,a);this.addEvents("connect","disconnect","data","exception");Ext.direct.Provider.superclass.constructor.call(this,a)},isConnected:function(){return false},connect:Ext.emptyFn,disconnect:Ext.emptyFn});Ext.direct.JsonProvider=Ext.extend(Ext.direct.Provider,{parseResponse:function(a){if(!Ext.isEmpty(a.responseText)){if(typeof a.responseText=="object"){return a.responseText}return Ext.decode(a.responseText)}return null},getEvents:function(h){var f=null;try{f=this.parseResponse(h)}catch(g){var d=new Ext.Direct.ExceptionEvent({data:g,xhr:h,code:Ext.Direct.exceptions.PARSE,message:"Error parsing json response: \n\n "+f});return[d]}var c=[];if(Ext.isArray(f)){for(var b=0,a=f.length;b<a;b++){c.push(Ext.Direct.createEvent(f[b]))}}else{c.push(Ext.Direct.createEvent(f))}return c}});Ext.direct.PollingProvider=Ext.extend(Ext.direct.JsonProvider,{priority:3,interval:3000,constructor:function(a){Ext.direct.PollingProvider.superclass.constructor.call(this,a);this.addEvents("beforepoll","poll")},isConnected:function(){return !!this.pollTask},connect:function(){if(this.url&&!this.pollTask){this.pollTask=Ext.TaskMgr.start({run:function(){if(this.fireEvent("beforepoll",this)!==false){if(typeof this.url=="function"){this.url(this.baseParams)}else{Ext.Ajax.request({url:this.url,callback:this.onData,scope:this,params:this.baseParams})}}},interval:this.interval,scope:this});this.fireEvent("connect",this)}else{if(!this.url){throw"Error initializing PollingProvider, no url configured."}}},disconnect:function(){if(this.pollTask){Ext.TaskMgr.stop(this.pollTask);delete this.pollTask;this.fireEvent("disconnect",this)}},onData:function(d,h,g){if(h){var c=this.getEvents(g);for(var b=0,a=c.length;b<a;b++){var f=c[b];this.fireEvent("data",this,f)}}else{var f=new Ext.Direct.ExceptionEvent({data:f,code:Ext.Direct.exceptions.TRANSPORT,message:"Unable to connect to the server.",xhr:g});this.fireEvent("data",this,f)}}});Ext.Direct.PROVIDERS.polling=Ext.direct.PollingProvider;Ext.direct.RemotingProvider=Ext.extend(Ext.direct.JsonProvider,{enableBuffer:10,maxRetries:1,constructor:function(a){Ext.direct.RemotingProvider.superclass.constructor.call(this,a);this.addEvents("beforecall","call");this.namespace=(typeof this.namespace==="string")?Ext.ns(this.namespace):this.namespace||window;this.transactions={};this.callBuffer=[]},initAPI:function(){var g=this.actions;for(var h in g){var d=this.namespace[h]||(this.namespace[h]={});var e=g[h];for(var f=0,b=e.length;f<b;f++){var a=e[f];d[a.name]=this.createMethod(h,a)}}},isConnected:function(){return !!this.connected},connect:function(){if(this.url){this.initAPI();this.connected=true;this.fireEvent("connect",this)}else{if(!this.url){throw"Error initializing RemotingProvider, no url configured."}}},disconnect:function(){if(this.connected){this.connected=false;this.fireEvent("disconnect",this)}},onData:function(a,g,h){if(g){var j=this.getEvents(h);for(var b=0,c=j.length;b<c;b++){var d=j[b];var k=this.getTransaction(d);this.fireEvent("data",this,d);if(k){this.doCallback(k,d,true);Ext.Direct.removeTransaction(k)}}}else{var f=[].concat(a.ts);for(var b=0,c=f.length;b<c;b++){var k=this.getTransaction(f[b]);if(k&&k.retryCount<this.maxRetries){k.retry()}else{var d=new Ext.Direct.ExceptionEvent({data:d,transaction:k,code:Ext.Direct.exceptions.TRANSPORT,message:"Unable to connect to the server.",xhr:h});this.fireEvent("data",this,d);if(k){this.doCallback(k,d,false);Ext.Direct.removeTransaction(k)}}}}},getCallData:function(a){return{action:a.action,method:a.method,data:a.data,type:"rpc",tid:a.tid}},doSend:function(d){var f={url:this.url,callback:this.onData,scope:this,ts:d};var b;if(Ext.isArray(d)){b=[];for(var c=0,a=d.length;c<a;c++){b.push(this.getCallData(d[c]))}}else{b=this.getCallData(d)}if(this.enableUrlEncode){var e={};e[typeof this.enableUrlEncode=="string"?this.enableUrlEncode:"data"]=Ext.encode(b);f.params=e}else{f.jsonData=b}Ext.Ajax.request(f)},combineAndSend:function(){var a=this.callBuffer.length;if(a>0){this.doSend(a==1?this.callBuffer[0]:this.callBuffer);this.callBuffer=[]}},queueTransaction:function(a){if(a.form){this.processForm(a);return}this.callBuffer.push(a);if(this.enableBuffer){if(!this.callTask){this.callTask=new Ext.util.DelayedTask(this.combineAndSend,this)}this.callTask.delay(typeof this.enableBuffer=="number"?this.enableBuffer:10)}else{this.combineAndSend()}},doCall:function(h,a,b){var g=null,e=b[a.len],f=b[a.len+1];if(a.len!==0){g=b.slice(0,a.len)}var d=new Ext.Direct.Transaction({provider:this,args:b,action:h,method:a.name,data:g,cb:f&&Ext.isFunction(e)?e.createDelegate(f):e});if(this.fireEvent("beforecall",this,d)!==false){Ext.Direct.addTransaction(d);this.queueTransaction(d);this.fireEvent("call",this,d)}},doForm:function(i,b,f,h,e){var d=new Ext.Direct.Transaction({provider:this,action:i,method:b.name,args:[f,h,e],cb:e&&Ext.isFunction(h)?h.createDelegate(e):h,isForm:true});if(this.fireEvent("beforecall",this,d)!==false){Ext.Direct.addTransaction(d);var a=String(f.getAttribute("enctype")).toLowerCase()=="multipart/form-data",g={extTID:d.tid,extAction:i,extMethod:b.name,extType:"rpc",extUpload:String(a)};Ext.apply(d,{form:Ext.getDom(f),isUpload:a,params:h&&Ext.isObject(h.params)?Ext.apply(g,h.params):g});this.fireEvent("call",this,d);this.processForm(d)}},processForm:function(a){Ext.Ajax.request({url:this.url,params:a.params,callback:this.onData,scope:this,form:a.form,isUpload:a.isUpload,ts:a})},createMethod:function(d,a){var b;if(!a.formHandler){b=function(){this.doCall(d,a,Array.prototype.slice.call(arguments,0))}.createDelegate(this)}else{b=function(e,f,c){this.doForm(d,a,e,f,c)}.createDelegate(this)}b.directCfg={action:d,method:a};return b},getTransaction:function(a){return a&&a.tid?Ext.Direct.getTransaction(a.tid):null},doCallback:function(c,f){var d=f.status?"success":"failure";if(c&&c.cb){var b=c.cb;var a=f.result||f.data;if(Ext.isFunction(b)){b(a,f)}else{Ext.callback(b[d],b.scope,[a,f]);Ext.callback(b.callback,b.scope,[a,f])}}}});Ext.Direct.PROVIDERS.remoting=Ext.direct.RemotingProvider;
@@ -0,0 +1,4567 @@
1
+ /*!
2
+ * Ext JS Library 3.0.0
3
+ * Copyright(c) 2006-2009 Ext JS, LLC
4
+ * licensing@extjs.com
5
+ * http://www.extjs.com/license
6
+ */
7
+ /*
8
+ * These classes are derivatives of the similarly named classes in the YUI Library.
9
+ * The original license:
10
+ * Copyright (c) 2006, Yahoo! Inc. All rights reserved.
11
+ * Code licensed under the BSD License:
12
+ * http://developer.yahoo.net/yui/license.txt
13
+ */
14
+
15
+ (function() {
16
+
17
+ var Event=Ext.EventManager;
18
+ var Dom=Ext.lib.Dom;
19
+
20
+ /**
21
+ * @class Ext.dd.DragDrop
22
+ * Defines the interface and base operation of items that that can be
23
+ * dragged or can be drop targets. It was designed to be extended, overriding
24
+ * the event handlers for startDrag, onDrag, onDragOver and onDragOut.
25
+ * Up to three html elements can be associated with a DragDrop instance:
26
+ * <ul>
27
+ * <li>linked element: the element that is passed into the constructor.
28
+ * This is the element which defines the boundaries for interaction with
29
+ * other DragDrop objects.</li>
30
+ * <li>handle element(s): The drag operation only occurs if the element that
31
+ * was clicked matches a handle element. By default this is the linked
32
+ * element, but there are times that you will want only a portion of the
33
+ * linked element to initiate the drag operation, and the setHandleElId()
34
+ * method provides a way to define this.</li>
35
+ * <li>drag element: this represents the element that would be moved along
36
+ * with the cursor during a drag operation. By default, this is the linked
37
+ * element itself as in {@link Ext.dd.DD}. setDragElId() lets you define
38
+ * a separate element that would be moved, as in {@link Ext.dd.DDProxy}.
39
+ * </li>
40
+ * </ul>
41
+ * This class should not be instantiated until the onload event to ensure that
42
+ * the associated elements are available.
43
+ * The following would define a DragDrop obj that would interact with any
44
+ * other DragDrop obj in the "group1" group:
45
+ * <pre>
46
+ * dd = new Ext.dd.DragDrop("div1", "group1");
47
+ * </pre>
48
+ * Since none of the event handlers have been implemented, nothing would
49
+ * actually happen if you were to run the code above. Normally you would
50
+ * override this class or one of the default implementations, but you can
51
+ * also override the methods you want on an instance of the class...
52
+ * <pre>
53
+ * dd.onDragDrop = function(e, id) {
54
+ * &nbsp;&nbsp;alert("dd was dropped on " + id);
55
+ * }
56
+ * </pre>
57
+ * @constructor
58
+ * @param {String} id of the element that is linked to this instance
59
+ * @param {String} sGroup the group of related DragDrop objects
60
+ * @param {object} config an object containing configurable attributes
61
+ * Valid properties for DragDrop:
62
+ * padding, isTarget, maintainOffset, primaryButtonOnly
63
+ */
64
+ Ext.dd.DragDrop = function(id, sGroup, config) {
65
+ if(id) {
66
+ this.init(id, sGroup, config);
67
+ }
68
+ };
69
+
70
+ Ext.dd.DragDrop.prototype = {
71
+
72
+ /**
73
+ * Set to false to enable a DragDrop object to fire drag events while dragging
74
+ * over its own Element. Defaults to true - DragDrop objects do not by default
75
+ * fire drag events to themselves.
76
+ * @property ignoreSelf
77
+ * @type Boolean
78
+ */
79
+
80
+ /**
81
+ * The id of the element associated with this object. This is what we
82
+ * refer to as the "linked element" because the size and position of
83
+ * this element is used to determine when the drag and drop objects have
84
+ * interacted.
85
+ * @property id
86
+ * @type String
87
+ */
88
+ id: null,
89
+
90
+ /**
91
+ * Configuration attributes passed into the constructor
92
+ * @property config
93
+ * @type object
94
+ */
95
+ config: null,
96
+
97
+ /**
98
+ * The id of the element that will be dragged. By default this is same
99
+ * as the linked element , but could be changed to another element. Ex:
100
+ * Ext.dd.DDProxy
101
+ * @property dragElId
102
+ * @type String
103
+ * @private
104
+ */
105
+ dragElId: null,
106
+
107
+ /**
108
+ * The ID of the element that initiates the drag operation. By default
109
+ * this is the linked element, but could be changed to be a child of this
110
+ * element. This lets us do things like only starting the drag when the
111
+ * header element within the linked html element is clicked.
112
+ * @property handleElId
113
+ * @type String
114
+ * @private
115
+ */
116
+ handleElId: null,
117
+
118
+ /**
119
+ * An object who's property names identify HTML tags to be considered invalid as drag handles.
120
+ * A non-null property value identifies the tag as invalid. Defaults to the
121
+ * following value which prevents drag operations from being initiated by &lt;a> elements:<pre><code>
122
+ {
123
+ A: "A"
124
+ }</code></pre>
125
+ * @property invalidHandleTypes
126
+ * @type Object
127
+ */
128
+ invalidHandleTypes: null,
129
+
130
+ /**
131
+ * An object who's property names identify the IDs of elements to be considered invalid as drag handles.
132
+ * A non-null property value identifies the ID as invalid. For example, to prevent
133
+ * dragging from being initiated on element ID "foo", use:<pre><code>
134
+ {
135
+ foo: true
136
+ }</code></pre>
137
+ * @property invalidHandleIds
138
+ * @type Object
139
+ */
140
+ invalidHandleIds: null,
141
+
142
+ /**
143
+ * An Array of CSS class names for elements to be considered in valid as drag handles.
144
+ * @property invalidHandleClasses
145
+ * @type Array
146
+ */
147
+ invalidHandleClasses: null,
148
+
149
+ /**
150
+ * The linked element's absolute X position at the time the drag was
151
+ * started
152
+ * @property startPageX
153
+ * @type int
154
+ * @private
155
+ */
156
+ startPageX: 0,
157
+
158
+ /**
159
+ * The linked element's absolute X position at the time the drag was
160
+ * started
161
+ * @property startPageY
162
+ * @type int
163
+ * @private
164
+ */
165
+ startPageY: 0,
166
+
167
+ /**
168
+ * The group defines a logical collection of DragDrop objects that are
169
+ * related. Instances only get events when interacting with other
170
+ * DragDrop object in the same group. This lets us define multiple
171
+ * groups using a single DragDrop subclass if we want.
172
+ * @property groups
173
+ * @type object An object in the format {'group1':true, 'group2':true}
174
+ */
175
+ groups: null,
176
+
177
+ /**
178
+ * Individual drag/drop instances can be locked. This will prevent
179
+ * onmousedown start drag.
180
+ * @property locked
181
+ * @type boolean
182
+ * @private
183
+ */
184
+ locked: false,
185
+
186
+ /**
187
+ * Lock this instance
188
+ * @method lock
189
+ */
190
+ lock: function() { this.locked = true; },
191
+
192
+ /**
193
+ * When set to true, other DD objects in cooperating DDGroups do not receive
194
+ * notification events when this DD object is dragged over them. Defaults to false.
195
+ * @property moveOnly
196
+ * @type boolean
197
+ */
198
+ moveOnly: false,
199
+
200
+ /**
201
+ * Unlock this instace
202
+ * @method unlock
203
+ */
204
+ unlock: function() { this.locked = false; },
205
+
206
+ /**
207
+ * By default, all instances can be a drop target. This can be disabled by
208
+ * setting isTarget to false.
209
+ * @property isTarget
210
+ * @type boolean
211
+ */
212
+ isTarget: true,
213
+
214
+ /**
215
+ * The padding configured for this drag and drop object for calculating
216
+ * the drop zone intersection with this object.
217
+ * @property padding
218
+ * @type int[] An array containing the 4 padding values: [top, right, bottom, left]
219
+ */
220
+ padding: null,
221
+
222
+ /**
223
+ * Cached reference to the linked element
224
+ * @property _domRef
225
+ * @private
226
+ */
227
+ _domRef: null,
228
+
229
+ /**
230
+ * Internal typeof flag
231
+ * @property __ygDragDrop
232
+ * @private
233
+ */
234
+ __ygDragDrop: true,
235
+
236
+ /**
237
+ * Set to true when horizontal contraints are applied
238
+ * @property constrainX
239
+ * @type boolean
240
+ * @private
241
+ */
242
+ constrainX: false,
243
+
244
+ /**
245
+ * Set to true when vertical contraints are applied
246
+ * @property constrainY
247
+ * @type boolean
248
+ * @private
249
+ */
250
+ constrainY: false,
251
+
252
+ /**
253
+ * The left constraint
254
+ * @property minX
255
+ * @type int
256
+ * @private
257
+ */
258
+ minX: 0,
259
+
260
+ /**
261
+ * The right constraint
262
+ * @property maxX
263
+ * @type int
264
+ * @private
265
+ */
266
+ maxX: 0,
267
+
268
+ /**
269
+ * The up constraint
270
+ * @property minY
271
+ * @type int
272
+ * @type int
273
+ * @private
274
+ */
275
+ minY: 0,
276
+
277
+ /**
278
+ * The down constraint
279
+ * @property maxY
280
+ * @type int
281
+ * @private
282
+ */
283
+ maxY: 0,
284
+
285
+ /**
286
+ * Maintain offsets when we resetconstraints. Set to true when you want
287
+ * the position of the element relative to its parent to stay the same
288
+ * when the page changes
289
+ *
290
+ * @property maintainOffset
291
+ * @type boolean
292
+ */
293
+ maintainOffset: false,
294
+
295
+ /**
296
+ * Array of pixel locations the element will snap to if we specified a
297
+ * horizontal graduation/interval. This array is generated automatically
298
+ * when you define a tick interval.
299
+ * @property xTicks
300
+ * @type int[]
301
+ */
302
+ xTicks: null,
303
+
304
+ /**
305
+ * Array of pixel locations the element will snap to if we specified a
306
+ * vertical graduation/interval. This array is generated automatically
307
+ * when you define a tick interval.
308
+ * @property yTicks
309
+ * @type int[]
310
+ */
311
+ yTicks: null,
312
+
313
+ /**
314
+ * By default the drag and drop instance will only respond to the primary
315
+ * button click (left button for a right-handed mouse). Set to true to
316
+ * allow drag and drop to start with any mouse click that is propogated
317
+ * by the browser
318
+ * @property primaryButtonOnly
319
+ * @type boolean
320
+ */
321
+ primaryButtonOnly: true,
322
+
323
+ /**
324
+ * The availabe property is false until the linked dom element is accessible.
325
+ * @property available
326
+ * @type boolean
327
+ */
328
+ available: false,
329
+
330
+ /**
331
+ * By default, drags can only be initiated if the mousedown occurs in the
332
+ * region the linked element is. This is done in part to work around a
333
+ * bug in some browsers that mis-report the mousedown if the previous
334
+ * mouseup happened outside of the window. This property is set to true
335
+ * if outer handles are defined.
336
+ *
337
+ * @property hasOuterHandles
338
+ * @type boolean
339
+ * @default false
340
+ */
341
+ hasOuterHandles: false,
342
+
343
+ /**
344
+ * Code that executes immediately before the startDrag event
345
+ * @method b4StartDrag
346
+ * @private
347
+ */
348
+ b4StartDrag: function(x, y) { },
349
+
350
+ /**
351
+ * Abstract method called after a drag/drop object is clicked
352
+ * and the drag or mousedown time thresholds have beeen met.
353
+ * @method startDrag
354
+ * @param {int} X click location
355
+ * @param {int} Y click location
356
+ */
357
+ startDrag: function(x, y) { /* override this */ },
358
+
359
+ /**
360
+ * Code that executes immediately before the onDrag event
361
+ * @method b4Drag
362
+ * @private
363
+ */
364
+ b4Drag: function(e) { },
365
+
366
+ /**
367
+ * Abstract method called during the onMouseMove event while dragging an
368
+ * object.
369
+ * @method onDrag
370
+ * @param {Event} e the mousemove event
371
+ */
372
+ onDrag: function(e) { /* override this */ },
373
+
374
+ /**
375
+ * Abstract method called when this element fist begins hovering over
376
+ * another DragDrop obj
377
+ * @method onDragEnter
378
+ * @param {Event} e the mousemove event
379
+ * @param {String|DragDrop[]} id In POINT mode, the element
380
+ * id this is hovering over. In INTERSECT mode, an array of one or more
381
+ * dragdrop items being hovered over.
382
+ */
383
+ onDragEnter: function(e, id) { /* override this */ },
384
+
385
+ /**
386
+ * Code that executes immediately before the onDragOver event
387
+ * @method b4DragOver
388
+ * @private
389
+ */
390
+ b4DragOver: function(e) { },
391
+
392
+ /**
393
+ * Abstract method called when this element is hovering over another
394
+ * DragDrop obj
395
+ * @method onDragOver
396
+ * @param {Event} e the mousemove event
397
+ * @param {String|DragDrop[]} id In POINT mode, the element
398
+ * id this is hovering over. In INTERSECT mode, an array of dd items
399
+ * being hovered over.
400
+ */
401
+ onDragOver: function(e, id) { /* override this */ },
402
+
403
+ /**
404
+ * Code that executes immediately before the onDragOut event
405
+ * @method b4DragOut
406
+ * @private
407
+ */
408
+ b4DragOut: function(e) { },
409
+
410
+ /**
411
+ * Abstract method called when we are no longer hovering over an element
412
+ * @method onDragOut
413
+ * @param {Event} e the mousemove event
414
+ * @param {String|DragDrop[]} id In POINT mode, the element
415
+ * id this was hovering over. In INTERSECT mode, an array of dd items
416
+ * that the mouse is no longer over.
417
+ */
418
+ onDragOut: function(e, id) { /* override this */ },
419
+
420
+ /**
421
+ * Code that executes immediately before the onDragDrop event
422
+ * @method b4DragDrop
423
+ * @private
424
+ */
425
+ b4DragDrop: function(e) { },
426
+
427
+ /**
428
+ * Abstract method called when this item is dropped on another DragDrop
429
+ * obj
430
+ * @method onDragDrop
431
+ * @param {Event} e the mouseup event
432
+ * @param {String|DragDrop[]} id In POINT mode, the element
433
+ * id this was dropped on. In INTERSECT mode, an array of dd items this
434
+ * was dropped on.
435
+ */
436
+ onDragDrop: function(e, id) { /* override this */ },
437
+
438
+ /**
439
+ * Abstract method called when this item is dropped on an area with no
440
+ * drop target
441
+ * @method onInvalidDrop
442
+ * @param {Event} e the mouseup event
443
+ */
444
+ onInvalidDrop: function(e) { /* override this */ },
445
+
446
+ /**
447
+ * Code that executes immediately before the endDrag event
448
+ * @method b4EndDrag
449
+ * @private
450
+ */
451
+ b4EndDrag: function(e) { },
452
+
453
+ /**
454
+ * Fired when we are done dragging the object
455
+ * @method endDrag
456
+ * @param {Event} e the mouseup event
457
+ */
458
+ endDrag: function(e) { /* override this */ },
459
+
460
+ /**
461
+ * Code executed immediately before the onMouseDown event
462
+ * @method b4MouseDown
463
+ * @param {Event} e the mousedown event
464
+ * @private
465
+ */
466
+ b4MouseDown: function(e) { },
467
+
468
+ /**
469
+ * Event handler that fires when a drag/drop obj gets a mousedown
470
+ * @method onMouseDown
471
+ * @param {Event} e the mousedown event
472
+ */
473
+ onMouseDown: function(e) { /* override this */ },
474
+
475
+ /**
476
+ * Event handler that fires when a drag/drop obj gets a mouseup
477
+ * @method onMouseUp
478
+ * @param {Event} e the mouseup event
479
+ */
480
+ onMouseUp: function(e) { /* override this */ },
481
+
482
+ /**
483
+ * Override the onAvailable method to do what is needed after the initial
484
+ * position was determined.
485
+ * @method onAvailable
486
+ */
487
+ onAvailable: function () {
488
+ },
489
+
490
+ /**
491
+ * Provides default constraint padding to "constrainTo" elements (defaults to {left: 0, right:0, top:0, bottom:0}).
492
+ * @type Object
493
+ */
494
+ defaultPadding : {left:0, right:0, top:0, bottom:0},
495
+
496
+ /**
497
+ * Initializes the drag drop object's constraints to restrict movement to a certain element.
498
+ *
499
+ * Usage:
500
+ <pre><code>
501
+ var dd = new Ext.dd.DDProxy("dragDiv1", "proxytest",
502
+ { dragElId: "existingProxyDiv" });
503
+ dd.startDrag = function(){
504
+ this.constrainTo("parent-id");
505
+ };
506
+ </code></pre>
507
+ * Or you can initalize it using the {@link Ext.Element} object:
508
+ <pre><code>
509
+ Ext.get("dragDiv1").initDDProxy("proxytest", {dragElId: "existingProxyDiv"}, {
510
+ startDrag : function(){
511
+ this.constrainTo("parent-id");
512
+ }
513
+ });
514
+ </code></pre>
515
+ * @param {Mixed} constrainTo The element to constrain to.
516
+ * @param {Object/Number} pad (optional) Pad provides a way to specify "padding" of the constraints,
517
+ * and can be either a number for symmetrical padding (4 would be equal to {left:4, right:4, top:4, bottom:4}) or
518
+ * an object containing the sides to pad. For example: {right:10, bottom:10}
519
+ * @param {Boolean} inContent (optional) Constrain the draggable in the content box of the element (inside padding and borders)
520
+ */
521
+ constrainTo : function(constrainTo, pad, inContent){
522
+ if(typeof pad == "number"){
523
+ pad = {left: pad, right:pad, top:pad, bottom:pad};
524
+ }
525
+ pad = pad || this.defaultPadding;
526
+ var b = Ext.get(this.getEl()).getBox();
527
+ var ce = Ext.get(constrainTo);
528
+ var s = ce.getScroll();
529
+ var c, cd = ce.dom;
530
+ if(cd == document.body){
531
+ c = { x: s.left, y: s.top, width: Ext.lib.Dom.getViewWidth(), height: Ext.lib.Dom.getViewHeight()};
532
+ }else{
533
+ var xy = ce.getXY();
534
+ c = {x : xy[0]+s.left, y: xy[1]+s.top, width: cd.clientWidth, height: cd.clientHeight};
535
+ }
536
+
537
+
538
+ var topSpace = b.y - c.y;
539
+ var leftSpace = b.x - c.x;
540
+
541
+ this.resetConstraints();
542
+ this.setXConstraint(leftSpace - (pad.left||0), // left
543
+ c.width - leftSpace - b.width - (pad.right||0), //right
544
+ this.xTickSize
545
+ );
546
+ this.setYConstraint(topSpace - (pad.top||0), //top
547
+ c.height - topSpace - b.height - (pad.bottom||0), //bottom
548
+ this.yTickSize
549
+ );
550
+ },
551
+
552
+ /**
553
+ * Returns a reference to the linked element
554
+ * @method getEl
555
+ * @return {HTMLElement} the html element
556
+ */
557
+ getEl: function() {
558
+ if (!this._domRef) {
559
+ this._domRef = Ext.getDom(this.id);
560
+ }
561
+
562
+ return this._domRef;
563
+ },
564
+
565
+ /**
566
+ * Returns a reference to the actual element to drag. By default this is
567
+ * the same as the html element, but it can be assigned to another
568
+ * element. An example of this can be found in Ext.dd.DDProxy
569
+ * @method getDragEl
570
+ * @return {HTMLElement} the html element
571
+ */
572
+ getDragEl: function() {
573
+ return Ext.getDom(this.dragElId);
574
+ },
575
+
576
+ /**
577
+ * Sets up the DragDrop object. Must be called in the constructor of any
578
+ * Ext.dd.DragDrop subclass
579
+ * @method init
580
+ * @param id the id of the linked element
581
+ * @param {String} sGroup the group of related items
582
+ * @param {object} config configuration attributes
583
+ */
584
+ init: function(id, sGroup, config) {
585
+ this.initTarget(id, sGroup, config);
586
+ Event.on(this.id, "mousedown", this.handleMouseDown, this);
587
+ // Event.on(this.id, "selectstart", Event.preventDefault);
588
+ },
589
+
590
+ /**
591
+ * Initializes Targeting functionality only... the object does not
592
+ * get a mousedown handler.
593
+ * @method initTarget
594
+ * @param id the id of the linked element
595
+ * @param {String} sGroup the group of related items
596
+ * @param {object} config configuration attributes
597
+ */
598
+ initTarget: function(id, sGroup, config) {
599
+
600
+ // configuration attributes
601
+ this.config = config || {};
602
+
603
+ // create a local reference to the drag and drop manager
604
+ this.DDM = Ext.dd.DDM;
605
+ // initialize the groups array
606
+ this.groups = {};
607
+
608
+ // assume that we have an element reference instead of an id if the
609
+ // parameter is not a string
610
+ if (typeof id !== "string") {
611
+ id = Ext.id(id);
612
+ }
613
+
614
+ // set the id
615
+ this.id = id;
616
+
617
+ // add to an interaction group
618
+ this.addToGroup((sGroup) ? sGroup : "default");
619
+
620
+ // We don't want to register this as the handle with the manager
621
+ // so we just set the id rather than calling the setter.
622
+ this.handleElId = id;
623
+
624
+ // the linked element is the element that gets dragged by default
625
+ this.setDragElId(id);
626
+
627
+ // by default, clicked anchors will not start drag operations.
628
+ this.invalidHandleTypes = { A: "A" };
629
+ this.invalidHandleIds = {};
630
+ this.invalidHandleClasses = [];
631
+
632
+ this.applyConfig();
633
+
634
+ this.handleOnAvailable();
635
+ },
636
+
637
+ /**
638
+ * Applies the configuration parameters that were passed into the constructor.
639
+ * This is supposed to happen at each level through the inheritance chain. So
640
+ * a DDProxy implentation will execute apply config on DDProxy, DD, and
641
+ * DragDrop in order to get all of the parameters that are available in
642
+ * each object.
643
+ * @method applyConfig
644
+ */
645
+ applyConfig: function() {
646
+
647
+ // configurable properties:
648
+ // padding, isTarget, maintainOffset, primaryButtonOnly
649
+ this.padding = this.config.padding || [0, 0, 0, 0];
650
+ this.isTarget = (this.config.isTarget !== false);
651
+ this.maintainOffset = (this.config.maintainOffset);
652
+ this.primaryButtonOnly = (this.config.primaryButtonOnly !== false);
653
+
654
+ },
655
+
656
+ /**
657
+ * Executed when the linked element is available
658
+ * @method handleOnAvailable
659
+ * @private
660
+ */
661
+ handleOnAvailable: function() {
662
+ this.available = true;
663
+ this.resetConstraints();
664
+ this.onAvailable();
665
+ },
666
+
667
+ /**
668
+ * Configures the padding for the target zone in px. Effectively expands
669
+ * (or reduces) the virtual object size for targeting calculations.
670
+ * Supports css-style shorthand; if only one parameter is passed, all sides
671
+ * will have that padding, and if only two are passed, the top and bottom
672
+ * will have the first param, the left and right the second.
673
+ * @method setPadding
674
+ * @param {int} iTop Top pad
675
+ * @param {int} iRight Right pad
676
+ * @param {int} iBot Bot pad
677
+ * @param {int} iLeft Left pad
678
+ */
679
+ setPadding: function(iTop, iRight, iBot, iLeft) {
680
+ // this.padding = [iLeft, iRight, iTop, iBot];
681
+ if (!iRight && 0 !== iRight) {
682
+ this.padding = [iTop, iTop, iTop, iTop];
683
+ } else if (!iBot && 0 !== iBot) {
684
+ this.padding = [iTop, iRight, iTop, iRight];
685
+ } else {
686
+ this.padding = [iTop, iRight, iBot, iLeft];
687
+ }
688
+ },
689
+
690
+ /**
691
+ * Stores the initial placement of the linked element.
692
+ * @method setInitPosition
693
+ * @param {int} diffX the X offset, default 0
694
+ * @param {int} diffY the Y offset, default 0
695
+ */
696
+ setInitPosition: function(diffX, diffY) {
697
+ var el = this.getEl();
698
+
699
+ if (!this.DDM.verifyEl(el)) {
700
+ return;
701
+ }
702
+
703
+ var dx = diffX || 0;
704
+ var dy = diffY || 0;
705
+
706
+ var p = Dom.getXY( el );
707
+
708
+ this.initPageX = p[0] - dx;
709
+ this.initPageY = p[1] - dy;
710
+
711
+ this.lastPageX = p[0];
712
+ this.lastPageY = p[1];
713
+
714
+
715
+ this.setStartPosition(p);
716
+ },
717
+
718
+ /**
719
+ * Sets the start position of the element. This is set when the obj
720
+ * is initialized, the reset when a drag is started.
721
+ * @method setStartPosition
722
+ * @param pos current position (from previous lookup)
723
+ * @private
724
+ */
725
+ setStartPosition: function(pos) {
726
+ var p = pos || Dom.getXY( this.getEl() );
727
+ this.deltaSetXY = null;
728
+
729
+ this.startPageX = p[0];
730
+ this.startPageY = p[1];
731
+ },
732
+
733
+ /**
734
+ * Add this instance to a group of related drag/drop objects. All
735
+ * instances belong to at least one group, and can belong to as many
736
+ * groups as needed.
737
+ * @method addToGroup
738
+ * @param sGroup {string} the name of the group
739
+ */
740
+ addToGroup: function(sGroup) {
741
+ this.groups[sGroup] = true;
742
+ this.DDM.regDragDrop(this, sGroup);
743
+ },
744
+
745
+ /**
746
+ * Remove's this instance from the supplied interaction group
747
+ * @method removeFromGroup
748
+ * @param {string} sGroup The group to drop
749
+ */
750
+ removeFromGroup: function(sGroup) {
751
+ if (this.groups[sGroup]) {
752
+ delete this.groups[sGroup];
753
+ }
754
+
755
+ this.DDM.removeDDFromGroup(this, sGroup);
756
+ },
757
+
758
+ /**
759
+ * Allows you to specify that an element other than the linked element
760
+ * will be moved with the cursor during a drag
761
+ * @method setDragElId
762
+ * @param id {string} the id of the element that will be used to initiate the drag
763
+ */
764
+ setDragElId: function(id) {
765
+ this.dragElId = id;
766
+ },
767
+
768
+ /**
769
+ * Allows you to specify a child of the linked element that should be
770
+ * used to initiate the drag operation. An example of this would be if
771
+ * you have a content div with text and links. Clicking anywhere in the
772
+ * content area would normally start the drag operation. Use this method
773
+ * to specify that an element inside of the content div is the element
774
+ * that starts the drag operation.
775
+ * @method setHandleElId
776
+ * @param id {string} the id of the element that will be used to
777
+ * initiate the drag.
778
+ */
779
+ setHandleElId: function(id) {
780
+ if (typeof id !== "string") {
781
+ id = Ext.id(id);
782
+ }
783
+ this.handleElId = id;
784
+ this.DDM.regHandle(this.id, id);
785
+ },
786
+
787
+ /**
788
+ * Allows you to set an element outside of the linked element as a drag
789
+ * handle
790
+ * @method setOuterHandleElId
791
+ * @param id the id of the element that will be used to initiate the drag
792
+ */
793
+ setOuterHandleElId: function(id) {
794
+ if (typeof id !== "string") {
795
+ id = Ext.id(id);
796
+ }
797
+ Event.on(id, "mousedown",
798
+ this.handleMouseDown, this);
799
+ this.setHandleElId(id);
800
+
801
+ this.hasOuterHandles = true;
802
+ },
803
+
804
+ /**
805
+ * Remove all drag and drop hooks for this element
806
+ * @method unreg
807
+ */
808
+ unreg: function() {
809
+ Event.un(this.id, "mousedown",
810
+ this.handleMouseDown);
811
+ this._domRef = null;
812
+ this.DDM._remove(this);
813
+ },
814
+
815
+ destroy : function(){
816
+ this.unreg();
817
+ },
818
+
819
+ /**
820
+ * Returns true if this instance is locked, or the drag drop mgr is locked
821
+ * (meaning that all drag/drop is disabled on the page.)
822
+ * @method isLocked
823
+ * @return {boolean} true if this obj or all drag/drop is locked, else
824
+ * false
825
+ */
826
+ isLocked: function() {
827
+ return (this.DDM.isLocked() || this.locked);
828
+ },
829
+
830
+ /**
831
+ * Fired when this object is clicked
832
+ * @method handleMouseDown
833
+ * @param {Event} e
834
+ * @param {Ext.dd.DragDrop} oDD the clicked dd object (this dd obj)
835
+ * @private
836
+ */
837
+ handleMouseDown: function(e, oDD){
838
+ if (this.primaryButtonOnly && e.button != 0) {
839
+ return;
840
+ }
841
+
842
+ if (this.isLocked()) {
843
+ return;
844
+ }
845
+
846
+ this.DDM.refreshCache(this.groups);
847
+
848
+ var pt = new Ext.lib.Point(Ext.lib.Event.getPageX(e), Ext.lib.Event.getPageY(e));
849
+ if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) ) {
850
+ } else {
851
+ if (this.clickValidator(e)) {
852
+
853
+ // set the initial element position
854
+ this.setStartPosition();
855
+
856
+
857
+ this.b4MouseDown(e);
858
+ this.onMouseDown(e);
859
+
860
+ this.DDM.handleMouseDown(e, this);
861
+
862
+ this.DDM.stopEvent(e);
863
+ } else {
864
+
865
+
866
+ }
867
+ }
868
+ },
869
+
870
+ clickValidator: function(e) {
871
+ var target = e.getTarget();
872
+ return ( this.isValidHandleChild(target) &&
873
+ (this.id == this.handleElId ||
874
+ this.DDM.handleWasClicked(target, this.id)) );
875
+ },
876
+
877
+ /**
878
+ * Allows you to specify a tag name that should not start a drag operation
879
+ * when clicked. This is designed to facilitate embedding links within a
880
+ * drag handle that do something other than start the drag.
881
+ * @method addInvalidHandleType
882
+ * @param {string} tagName the type of element to exclude
883
+ */
884
+ addInvalidHandleType: function(tagName) {
885
+ var type = tagName.toUpperCase();
886
+ this.invalidHandleTypes[type] = type;
887
+ },
888
+
889
+ /**
890
+ * Lets you to specify an element id for a child of a drag handle
891
+ * that should not initiate a drag
892
+ * @method addInvalidHandleId
893
+ * @param {string} id the element id of the element you wish to ignore
894
+ */
895
+ addInvalidHandleId: function(id) {
896
+ if (typeof id !== "string") {
897
+ id = Ext.id(id);
898
+ }
899
+ this.invalidHandleIds[id] = id;
900
+ },
901
+
902
+ /**
903
+ * Lets you specify a css class of elements that will not initiate a drag
904
+ * @method addInvalidHandleClass
905
+ * @param {string} cssClass the class of the elements you wish to ignore
906
+ */
907
+ addInvalidHandleClass: function(cssClass) {
908
+ this.invalidHandleClasses.push(cssClass);
909
+ },
910
+
911
+ /**
912
+ * Unsets an excluded tag name set by addInvalidHandleType
913
+ * @method removeInvalidHandleType
914
+ * @param {string} tagName the type of element to unexclude
915
+ */
916
+ removeInvalidHandleType: function(tagName) {
917
+ var type = tagName.toUpperCase();
918
+ // this.invalidHandleTypes[type] = null;
919
+ delete this.invalidHandleTypes[type];
920
+ },
921
+
922
+ /**
923
+ * Unsets an invalid handle id
924
+ * @method removeInvalidHandleId
925
+ * @param {string} id the id of the element to re-enable
926
+ */
927
+ removeInvalidHandleId: function(id) {
928
+ if (typeof id !== "string") {
929
+ id = Ext.id(id);
930
+ }
931
+ delete this.invalidHandleIds[id];
932
+ },
933
+
934
+ /**
935
+ * Unsets an invalid css class
936
+ * @method removeInvalidHandleClass
937
+ * @param {string} cssClass the class of the element(s) you wish to
938
+ * re-enable
939
+ */
940
+ removeInvalidHandleClass: function(cssClass) {
941
+ for (var i=0, len=this.invalidHandleClasses.length; i<len; ++i) {
942
+ if (this.invalidHandleClasses[i] == cssClass) {
943
+ delete this.invalidHandleClasses[i];
944
+ }
945
+ }
946
+ },
947
+
948
+ /**
949
+ * Checks the tag exclusion list to see if this click should be ignored
950
+ * @method isValidHandleChild
951
+ * @param {HTMLElement} node the HTMLElement to evaluate
952
+ * @return {boolean} true if this is a valid tag type, false if not
953
+ */
954
+ isValidHandleChild: function(node) {
955
+
956
+ var valid = true;
957
+ // var n = (node.nodeName == "#text") ? node.parentNode : node;
958
+ var nodeName;
959
+ try {
960
+ nodeName = node.nodeName.toUpperCase();
961
+ } catch(e) {
962
+ nodeName = node.nodeName;
963
+ }
964
+ valid = valid && !this.invalidHandleTypes[nodeName];
965
+ valid = valid && !this.invalidHandleIds[node.id];
966
+
967
+ for (var i=0, len=this.invalidHandleClasses.length; valid && i<len; ++i) {
968
+ valid = !Ext.fly(node).hasClass(this.invalidHandleClasses[i]);
969
+ }
970
+
971
+
972
+ return valid;
973
+
974
+ },
975
+
976
+ /**
977
+ * Create the array of horizontal tick marks if an interval was specified
978
+ * in setXConstraint().
979
+ * @method setXTicks
980
+ * @private
981
+ */
982
+ setXTicks: function(iStartX, iTickSize) {
983
+ this.xTicks = [];
984
+ this.xTickSize = iTickSize;
985
+
986
+ var tickMap = {};
987
+
988
+ for (var i = this.initPageX; i >= this.minX; i = i - iTickSize) {
989
+ if (!tickMap[i]) {
990
+ this.xTicks[this.xTicks.length] = i;
991
+ tickMap[i] = true;
992
+ }
993
+ }
994
+
995
+ for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) {
996
+ if (!tickMap[i]) {
997
+ this.xTicks[this.xTicks.length] = i;
998
+ tickMap[i] = true;
999
+ }
1000
+ }
1001
+
1002
+ this.xTicks.sort(this.DDM.numericSort) ;
1003
+ },
1004
+
1005
+ /**
1006
+ * Create the array of vertical tick marks if an interval was specified in
1007
+ * setYConstraint().
1008
+ * @method setYTicks
1009
+ * @private
1010
+ */
1011
+ setYTicks: function(iStartY, iTickSize) {
1012
+ this.yTicks = [];
1013
+ this.yTickSize = iTickSize;
1014
+
1015
+ var tickMap = {};
1016
+
1017
+ for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) {
1018
+ if (!tickMap[i]) {
1019
+ this.yTicks[this.yTicks.length] = i;
1020
+ tickMap[i] = true;
1021
+ }
1022
+ }
1023
+
1024
+ for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) {
1025
+ if (!tickMap[i]) {
1026
+ this.yTicks[this.yTicks.length] = i;
1027
+ tickMap[i] = true;
1028
+ }
1029
+ }
1030
+
1031
+ this.yTicks.sort(this.DDM.numericSort) ;
1032
+ },
1033
+
1034
+ /**
1035
+ * By default, the element can be dragged any place on the screen. Use
1036
+ * this method to limit the horizontal travel of the element. Pass in
1037
+ * 0,0 for the parameters if you want to lock the drag to the y axis.
1038
+ * @method setXConstraint
1039
+ * @param {int} iLeft the number of pixels the element can move to the left
1040
+ * @param {int} iRight the number of pixels the element can move to the
1041
+ * right
1042
+ * @param {int} iTickSize optional parameter for specifying that the
1043
+ * element
1044
+ * should move iTickSize pixels at a time.
1045
+ */
1046
+ setXConstraint: function(iLeft, iRight, iTickSize) {
1047
+ this.leftConstraint = iLeft;
1048
+ this.rightConstraint = iRight;
1049
+
1050
+ this.minX = this.initPageX - iLeft;
1051
+ this.maxX = this.initPageX + iRight;
1052
+ if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }
1053
+
1054
+ this.constrainX = true;
1055
+ },
1056
+
1057
+ /**
1058
+ * Clears any constraints applied to this instance. Also clears ticks
1059
+ * since they can't exist independent of a constraint at this time.
1060
+ * @method clearConstraints
1061
+ */
1062
+ clearConstraints: function() {
1063
+ this.constrainX = false;
1064
+ this.constrainY = false;
1065
+ this.clearTicks();
1066
+ },
1067
+
1068
+ /**
1069
+ * Clears any tick interval defined for this instance
1070
+ * @method clearTicks
1071
+ */
1072
+ clearTicks: function() {
1073
+ this.xTicks = null;
1074
+ this.yTicks = null;
1075
+ this.xTickSize = 0;
1076
+ this.yTickSize = 0;
1077
+ },
1078
+
1079
+ /**
1080
+ * By default, the element can be dragged any place on the screen. Set
1081
+ * this to limit the vertical travel of the element. Pass in 0,0 for the
1082
+ * parameters if you want to lock the drag to the x axis.
1083
+ * @method setYConstraint
1084
+ * @param {int} iUp the number of pixels the element can move up
1085
+ * @param {int} iDown the number of pixels the element can move down
1086
+ * @param {int} iTickSize optional parameter for specifying that the
1087
+ * element should move iTickSize pixels at a time.
1088
+ */
1089
+ setYConstraint: function(iUp, iDown, iTickSize) {
1090
+ this.topConstraint = iUp;
1091
+ this.bottomConstraint = iDown;
1092
+
1093
+ this.minY = this.initPageY - iUp;
1094
+ this.maxY = this.initPageY + iDown;
1095
+ if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }
1096
+
1097
+ this.constrainY = true;
1098
+
1099
+ },
1100
+
1101
+ /**
1102
+ * resetConstraints must be called if you manually reposition a dd element.
1103
+ * @method resetConstraints
1104
+ * @param {boolean} maintainOffset
1105
+ */
1106
+ resetConstraints: function() {
1107
+
1108
+
1109
+ // Maintain offsets if necessary
1110
+ if (this.initPageX || this.initPageX === 0) {
1111
+ // figure out how much this thing has moved
1112
+ var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0;
1113
+ var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0;
1114
+
1115
+ this.setInitPosition(dx, dy);
1116
+
1117
+ // This is the first time we have detected the element's position
1118
+ } else {
1119
+ this.setInitPosition();
1120
+ }
1121
+
1122
+ if (this.constrainX) {
1123
+ this.setXConstraint( this.leftConstraint,
1124
+ this.rightConstraint,
1125
+ this.xTickSize );
1126
+ }
1127
+
1128
+ if (this.constrainY) {
1129
+ this.setYConstraint( this.topConstraint,
1130
+ this.bottomConstraint,
1131
+ this.yTickSize );
1132
+ }
1133
+ },
1134
+
1135
+ /**
1136
+ * Normally the drag element is moved pixel by pixel, but we can specify
1137
+ * that it move a number of pixels at a time. This method resolves the
1138
+ * location when we have it set up like this.
1139
+ * @method getTick
1140
+ * @param {int} val where we want to place the object
1141
+ * @param {int[]} tickArray sorted array of valid points
1142
+ * @return {int} the closest tick
1143
+ * @private
1144
+ */
1145
+ getTick: function(val, tickArray) {
1146
+
1147
+ if (!tickArray) {
1148
+ // If tick interval is not defined, it is effectively 1 pixel,
1149
+ // so we return the value passed to us.
1150
+ return val;
1151
+ } else if (tickArray[0] >= val) {
1152
+ // The value is lower than the first tick, so we return the first
1153
+ // tick.
1154
+ return tickArray[0];
1155
+ } else {
1156
+ for (var i=0, len=tickArray.length; i<len; ++i) {
1157
+ var next = i + 1;
1158
+ if (tickArray[next] && tickArray[next] >= val) {
1159
+ var diff1 = val - tickArray[i];
1160
+ var diff2 = tickArray[next] - val;
1161
+ return (diff2 > diff1) ? tickArray[i] : tickArray[next];
1162
+ }
1163
+ }
1164
+
1165
+ // The value is larger than the last tick, so we return the last
1166
+ // tick.
1167
+ return tickArray[tickArray.length - 1];
1168
+ }
1169
+ },
1170
+
1171
+ /**
1172
+ * toString method
1173
+ * @method toString
1174
+ * @return {string} string representation of the dd obj
1175
+ */
1176
+ toString: function() {
1177
+ return ("DragDrop " + this.id);
1178
+ }
1179
+
1180
+ };
1181
+
1182
+ })();
1183
+ /**
1184
+ * The drag and drop utility provides a framework for building drag and drop
1185
+ * applications. In addition to enabling drag and drop for specific elements,
1186
+ * the drag and drop elements are tracked by the manager class, and the
1187
+ * interactions between the various elements are tracked during the drag and
1188
+ * the implementing code is notified about these important moments.
1189
+ */
1190
+
1191
+ // Only load the library once. Rewriting the manager class would orphan
1192
+ // existing drag and drop instances.
1193
+ if (!Ext.dd.DragDropMgr) {
1194
+
1195
+ /**
1196
+ * @class Ext.dd.DragDropMgr
1197
+ * DragDropMgr is a singleton that tracks the element interaction for
1198
+ * all DragDrop items in the window. Generally, you will not call
1199
+ * this class directly, but it does have helper methods that could
1200
+ * be useful in your DragDrop implementations.
1201
+ * @singleton
1202
+ */
1203
+ Ext.dd.DragDropMgr = function() {
1204
+
1205
+ var Event = Ext.EventManager;
1206
+
1207
+ return {
1208
+
1209
+ /**
1210
+ * Two dimensional Array of registered DragDrop objects. The first
1211
+ * dimension is the DragDrop item group, the second the DragDrop
1212
+ * object.
1213
+ * @property ids
1214
+ * @type {string: string}
1215
+ * @private
1216
+ * @static
1217
+ */
1218
+ ids: {},
1219
+
1220
+ /**
1221
+ * Array of element ids defined as drag handles. Used to determine
1222
+ * if the element that generated the mousedown event is actually the
1223
+ * handle and not the html element itself.
1224
+ * @property handleIds
1225
+ * @type {string: string}
1226
+ * @private
1227
+ * @static
1228
+ */
1229
+ handleIds: {},
1230
+
1231
+ /**
1232
+ * the DragDrop object that is currently being dragged
1233
+ * @property dragCurrent
1234
+ * @type DragDrop
1235
+ * @private
1236
+ * @static
1237
+ **/
1238
+ dragCurrent: null,
1239
+
1240
+ /**
1241
+ * the DragDrop object(s) that are being hovered over
1242
+ * @property dragOvers
1243
+ * @type Array
1244
+ * @private
1245
+ * @static
1246
+ */
1247
+ dragOvers: {},
1248
+
1249
+ /**
1250
+ * the X distance between the cursor and the object being dragged
1251
+ * @property deltaX
1252
+ * @type int
1253
+ * @private
1254
+ * @static
1255
+ */
1256
+ deltaX: 0,
1257
+
1258
+ /**
1259
+ * the Y distance between the cursor and the object being dragged
1260
+ * @property deltaY
1261
+ * @type int
1262
+ * @private
1263
+ * @static
1264
+ */
1265
+ deltaY: 0,
1266
+
1267
+ /**
1268
+ * Flag to determine if we should prevent the default behavior of the
1269
+ * events we define. By default this is true, but this can be set to
1270
+ * false if you need the default behavior (not recommended)
1271
+ * @property preventDefault
1272
+ * @type boolean
1273
+ * @static
1274
+ */
1275
+ preventDefault: true,
1276
+
1277
+ /**
1278
+ * Flag to determine if we should stop the propagation of the events
1279
+ * we generate. This is true by default but you may want to set it to
1280
+ * false if the html element contains other features that require the
1281
+ * mouse click.
1282
+ * @property stopPropagation
1283
+ * @type boolean
1284
+ * @static
1285
+ */
1286
+ stopPropagation: true,
1287
+
1288
+ /**
1289
+ * Internal flag that is set to true when drag and drop has been
1290
+ * intialized
1291
+ * @property initialized
1292
+ * @private
1293
+ * @static
1294
+ */
1295
+ initialized: false,
1296
+
1297
+ /**
1298
+ * All drag and drop can be disabled.
1299
+ * @property locked
1300
+ * @private
1301
+ * @static
1302
+ */
1303
+ locked: false,
1304
+
1305
+ /**
1306
+ * Called the first time an element is registered.
1307
+ * @method init
1308
+ * @private
1309
+ * @static
1310
+ */
1311
+ init: function() {
1312
+ this.initialized = true;
1313
+ },
1314
+
1315
+ /**
1316
+ * In point mode, drag and drop interaction is defined by the
1317
+ * location of the cursor during the drag/drop
1318
+ * @property POINT
1319
+ * @type int
1320
+ * @static
1321
+ */
1322
+ POINT: 0,
1323
+
1324
+ /**
1325
+ * In intersect mode, drag and drop interaction is defined by the
1326
+ * overlap of two or more drag and drop objects.
1327
+ * @property INTERSECT
1328
+ * @type int
1329
+ * @static
1330
+ */
1331
+ INTERSECT: 1,
1332
+
1333
+ /**
1334
+ * The current drag and drop mode. Default: POINT
1335
+ * @property mode
1336
+ * @type int
1337
+ * @static
1338
+ */
1339
+ mode: 0,
1340
+
1341
+ /**
1342
+ * Runs method on all drag and drop objects
1343
+ * @method _execOnAll
1344
+ * @private
1345
+ * @static
1346
+ */
1347
+ _execOnAll: function(sMethod, args) {
1348
+ for (var i in this.ids) {
1349
+ for (var j in this.ids[i]) {
1350
+ var oDD = this.ids[i][j];
1351
+ if (! this.isTypeOfDD(oDD)) {
1352
+ continue;
1353
+ }
1354
+ oDD[sMethod].apply(oDD, args);
1355
+ }
1356
+ }
1357
+ },
1358
+
1359
+ /**
1360
+ * Drag and drop initialization. Sets up the global event handlers
1361
+ * @method _onLoad
1362
+ * @private
1363
+ * @static
1364
+ */
1365
+ _onLoad: function() {
1366
+
1367
+ this.init();
1368
+
1369
+
1370
+ Event.on(document, "mouseup", this.handleMouseUp, this, true);
1371
+ Event.on(document, "mousemove", this.handleMouseMove, this, true);
1372
+ Event.on(window, "unload", this._onUnload, this, true);
1373
+ Event.on(window, "resize", this._onResize, this, true);
1374
+ // Event.on(window, "mouseout", this._test);
1375
+
1376
+ },
1377
+
1378
+ /**
1379
+ * Reset constraints on all drag and drop objs
1380
+ * @method _onResize
1381
+ * @private
1382
+ * @static
1383
+ */
1384
+ _onResize: function(e) {
1385
+ this._execOnAll("resetConstraints", []);
1386
+ },
1387
+
1388
+ /**
1389
+ * Lock all drag and drop functionality
1390
+ * @method lock
1391
+ * @static
1392
+ */
1393
+ lock: function() { this.locked = true; },
1394
+
1395
+ /**
1396
+ * Unlock all drag and drop functionality
1397
+ * @method unlock
1398
+ * @static
1399
+ */
1400
+ unlock: function() { this.locked = false; },
1401
+
1402
+ /**
1403
+ * Is drag and drop locked?
1404
+ * @method isLocked
1405
+ * @return {boolean} True if drag and drop is locked, false otherwise.
1406
+ * @static
1407
+ */
1408
+ isLocked: function() { return this.locked; },
1409
+
1410
+ /**
1411
+ * Location cache that is set for all drag drop objects when a drag is
1412
+ * initiated, cleared when the drag is finished.
1413
+ * @property locationCache
1414
+ * @private
1415
+ * @static
1416
+ */
1417
+ locationCache: {},
1418
+
1419
+ /**
1420
+ * Set useCache to false if you want to force object the lookup of each
1421
+ * drag and drop linked element constantly during a drag.
1422
+ * @property useCache
1423
+ * @type boolean
1424
+ * @static
1425
+ */
1426
+ useCache: true,
1427
+
1428
+ /**
1429
+ * The number of pixels that the mouse needs to move after the
1430
+ * mousedown before the drag is initiated. Default=3;
1431
+ * @property clickPixelThresh
1432
+ * @type int
1433
+ * @static
1434
+ */
1435
+ clickPixelThresh: 3,
1436
+
1437
+ /**
1438
+ * The number of milliseconds after the mousedown event to initiate the
1439
+ * drag if we don't get a mouseup event. Default=1000
1440
+ * @property clickTimeThresh
1441
+ * @type int
1442
+ * @static
1443
+ */
1444
+ clickTimeThresh: 350,
1445
+
1446
+ /**
1447
+ * Flag that indicates that either the drag pixel threshold or the
1448
+ * mousdown time threshold has been met
1449
+ * @property dragThreshMet
1450
+ * @type boolean
1451
+ * @private
1452
+ * @static
1453
+ */
1454
+ dragThreshMet: false,
1455
+
1456
+ /**
1457
+ * Timeout used for the click time threshold
1458
+ * @property clickTimeout
1459
+ * @type Object
1460
+ * @private
1461
+ * @static
1462
+ */
1463
+ clickTimeout: null,
1464
+
1465
+ /**
1466
+ * The X position of the mousedown event stored for later use when a
1467
+ * drag threshold is met.
1468
+ * @property startX
1469
+ * @type int
1470
+ * @private
1471
+ * @static
1472
+ */
1473
+ startX: 0,
1474
+
1475
+ /**
1476
+ * The Y position of the mousedown event stored for later use when a
1477
+ * drag threshold is met.
1478
+ * @property startY
1479
+ * @type int
1480
+ * @private
1481
+ * @static
1482
+ */
1483
+ startY: 0,
1484
+
1485
+ /**
1486
+ * Each DragDrop instance must be registered with the DragDropMgr.
1487
+ * This is executed in DragDrop.init()
1488
+ * @method regDragDrop
1489
+ * @param {DragDrop} oDD the DragDrop object to register
1490
+ * @param {String} sGroup the name of the group this element belongs to
1491
+ * @static
1492
+ */
1493
+ regDragDrop: function(oDD, sGroup) {
1494
+ if (!this.initialized) { this.init(); }
1495
+
1496
+ if (!this.ids[sGroup]) {
1497
+ this.ids[sGroup] = {};
1498
+ }
1499
+ this.ids[sGroup][oDD.id] = oDD;
1500
+ },
1501
+
1502
+ /**
1503
+ * Removes the supplied dd instance from the supplied group. Executed
1504
+ * by DragDrop.removeFromGroup, so don't call this function directly.
1505
+ * @method removeDDFromGroup
1506
+ * @private
1507
+ * @static
1508
+ */
1509
+ removeDDFromGroup: function(oDD, sGroup) {
1510
+ if (!this.ids[sGroup]) {
1511
+ this.ids[sGroup] = {};
1512
+ }
1513
+
1514
+ var obj = this.ids[sGroup];
1515
+ if (obj && obj[oDD.id]) {
1516
+ delete obj[oDD.id];
1517
+ }
1518
+ },
1519
+
1520
+ /**
1521
+ * Unregisters a drag and drop item. This is executed in
1522
+ * DragDrop.unreg, use that method instead of calling this directly.
1523
+ * @method _remove
1524
+ * @private
1525
+ * @static
1526
+ */
1527
+ _remove: function(oDD) {
1528
+ for (var g in oDD.groups) {
1529
+ if (g && this.ids[g] && this.ids[g][oDD.id]) {
1530
+ delete this.ids[g][oDD.id];
1531
+ }
1532
+ }
1533
+ delete this.handleIds[oDD.id];
1534
+ },
1535
+
1536
+ /**
1537
+ * Each DragDrop handle element must be registered. This is done
1538
+ * automatically when executing DragDrop.setHandleElId()
1539
+ * @method regHandle
1540
+ * @param {String} sDDId the DragDrop id this element is a handle for
1541
+ * @param {String} sHandleId the id of the element that is the drag
1542
+ * handle
1543
+ * @static
1544
+ */
1545
+ regHandle: function(sDDId, sHandleId) {
1546
+ if (!this.handleIds[sDDId]) {
1547
+ this.handleIds[sDDId] = {};
1548
+ }
1549
+ this.handleIds[sDDId][sHandleId] = sHandleId;
1550
+ },
1551
+
1552
+ /**
1553
+ * Utility function to determine if a given element has been
1554
+ * registered as a drag drop item.
1555
+ * @method isDragDrop
1556
+ * @param {String} id the element id to check
1557
+ * @return {boolean} true if this element is a DragDrop item,
1558
+ * false otherwise
1559
+ * @static
1560
+ */
1561
+ isDragDrop: function(id) {
1562
+ return ( this.getDDById(id) ) ? true : false;
1563
+ },
1564
+
1565
+ /**
1566
+ * Returns the drag and drop instances that are in all groups the
1567
+ * passed in instance belongs to.
1568
+ * @method getRelated
1569
+ * @param {DragDrop} p_oDD the obj to get related data for
1570
+ * @param {boolean} bTargetsOnly if true, only return targetable objs
1571
+ * @return {DragDrop[]} the related instances
1572
+ * @static
1573
+ */
1574
+ getRelated: function(p_oDD, bTargetsOnly) {
1575
+ var oDDs = [];
1576
+ for (var i in p_oDD.groups) {
1577
+ for (var j in this.ids[i]) {
1578
+ var dd = this.ids[i][j];
1579
+ if (! this.isTypeOfDD(dd)) {
1580
+ continue;
1581
+ }
1582
+ if (!bTargetsOnly || dd.isTarget) {
1583
+ oDDs[oDDs.length] = dd;
1584
+ }
1585
+ }
1586
+ }
1587
+
1588
+ return oDDs;
1589
+ },
1590
+
1591
+ /**
1592
+ * Returns true if the specified dd target is a legal target for
1593
+ * the specifice drag obj
1594
+ * @method isLegalTarget
1595
+ * @param {DragDrop} the drag obj
1596
+ * @param {DragDrop} the target
1597
+ * @return {boolean} true if the target is a legal target for the
1598
+ * dd obj
1599
+ * @static
1600
+ */
1601
+ isLegalTarget: function (oDD, oTargetDD) {
1602
+ var targets = this.getRelated(oDD, true);
1603
+ for (var i=0, len=targets.length;i<len;++i) {
1604
+ if (targets[i].id == oTargetDD.id) {
1605
+ return true;
1606
+ }
1607
+ }
1608
+
1609
+ return false;
1610
+ },
1611
+
1612
+ /**
1613
+ * My goal is to be able to transparently determine if an object is
1614
+ * typeof DragDrop, and the exact subclass of DragDrop. typeof
1615
+ * returns "object", oDD.constructor.toString() always returns
1616
+ * "DragDrop" and not the name of the subclass. So for now it just
1617
+ * evaluates a well-known variable in DragDrop.
1618
+ * @method isTypeOfDD
1619
+ * @param {Object} the object to evaluate
1620
+ * @return {boolean} true if typeof oDD = DragDrop
1621
+ * @static
1622
+ */
1623
+ isTypeOfDD: function (oDD) {
1624
+ return (oDD && oDD.__ygDragDrop);
1625
+ },
1626
+
1627
+ /**
1628
+ * Utility function to determine if a given element has been
1629
+ * registered as a drag drop handle for the given Drag Drop object.
1630
+ * @method isHandle
1631
+ * @param {String} id the element id to check
1632
+ * @return {boolean} true if this element is a DragDrop handle, false
1633
+ * otherwise
1634
+ * @static
1635
+ */
1636
+ isHandle: function(sDDId, sHandleId) {
1637
+ return ( this.handleIds[sDDId] &&
1638
+ this.handleIds[sDDId][sHandleId] );
1639
+ },
1640
+
1641
+ /**
1642
+ * Returns the DragDrop instance for a given id
1643
+ * @method getDDById
1644
+ * @param {String} id the id of the DragDrop object
1645
+ * @return {DragDrop} the drag drop object, null if it is not found
1646
+ * @static
1647
+ */
1648
+ getDDById: function(id) {
1649
+ for (var i in this.ids) {
1650
+ if (this.ids[i][id]) {
1651
+ return this.ids[i][id];
1652
+ }
1653
+ }
1654
+ return null;
1655
+ },
1656
+
1657
+ /**
1658
+ * Fired after a registered DragDrop object gets the mousedown event.
1659
+ * Sets up the events required to track the object being dragged
1660
+ * @method handleMouseDown
1661
+ * @param {Event} e the event
1662
+ * @param oDD the DragDrop object being dragged
1663
+ * @private
1664
+ * @static
1665
+ */
1666
+ handleMouseDown: function(e, oDD) {
1667
+ if(Ext.QuickTips){
1668
+ Ext.QuickTips.disable();
1669
+ }
1670
+ if(this.dragCurrent){
1671
+ // the original browser mouseup wasn't handled (e.g. outside FF browser window)
1672
+ // so clean up first to avoid breaking the next drag
1673
+ this.handleMouseUp(e);
1674
+ }
1675
+
1676
+ this.currentTarget = e.getTarget();
1677
+ this.dragCurrent = oDD;
1678
+
1679
+ var el = oDD.getEl();
1680
+
1681
+ // track start position
1682
+ this.startX = e.getPageX();
1683
+ this.startY = e.getPageY();
1684
+
1685
+ this.deltaX = this.startX - el.offsetLeft;
1686
+ this.deltaY = this.startY - el.offsetTop;
1687
+
1688
+ this.dragThreshMet = false;
1689
+
1690
+ this.clickTimeout = setTimeout(
1691
+ function() {
1692
+ var DDM = Ext.dd.DDM;
1693
+ DDM.startDrag(DDM.startX, DDM.startY);
1694
+ },
1695
+ this.clickTimeThresh );
1696
+ },
1697
+
1698
+ /**
1699
+ * Fired when either the drag pixel threshol or the mousedown hold
1700
+ * time threshold has been met.
1701
+ * @method startDrag
1702
+ * @param x {int} the X position of the original mousedown
1703
+ * @param y {int} the Y position of the original mousedown
1704
+ * @static
1705
+ */
1706
+ startDrag: function(x, y) {
1707
+ clearTimeout(this.clickTimeout);
1708
+ if (this.dragCurrent) {
1709
+ this.dragCurrent.b4StartDrag(x, y);
1710
+ this.dragCurrent.startDrag(x, y);
1711
+ }
1712
+ this.dragThreshMet = true;
1713
+ },
1714
+
1715
+ /**
1716
+ * Internal function to handle the mouseup event. Will be invoked
1717
+ * from the context of the document.
1718
+ * @method handleMouseUp
1719
+ * @param {Event} e the event
1720
+ * @private
1721
+ * @static
1722
+ */
1723
+ handleMouseUp: function(e) {
1724
+
1725
+ if(Ext.QuickTips){
1726
+ Ext.QuickTips.enable();
1727
+ }
1728
+ if (! this.dragCurrent) {
1729
+ return;
1730
+ }
1731
+
1732
+ clearTimeout(this.clickTimeout);
1733
+
1734
+ if (this.dragThreshMet) {
1735
+ this.fireEvents(e, true);
1736
+ } else {
1737
+ }
1738
+
1739
+ this.stopDrag(e);
1740
+
1741
+ this.stopEvent(e);
1742
+ },
1743
+
1744
+ /**
1745
+ * Utility to stop event propagation and event default, if these
1746
+ * features are turned on.
1747
+ * @method stopEvent
1748
+ * @param {Event} e the event as returned by this.getEvent()
1749
+ * @static
1750
+ */
1751
+ stopEvent: function(e){
1752
+ if(this.stopPropagation) {
1753
+ e.stopPropagation();
1754
+ }
1755
+
1756
+ if (this.preventDefault) {
1757
+ e.preventDefault();
1758
+ }
1759
+ },
1760
+
1761
+ /**
1762
+ * Internal function to clean up event handlers after the drag
1763
+ * operation is complete
1764
+ * @method stopDrag
1765
+ * @param {Event} e the event
1766
+ * @private
1767
+ * @static
1768
+ */
1769
+ stopDrag: function(e) {
1770
+ // Fire the drag end event for the item that was dragged
1771
+ if (this.dragCurrent) {
1772
+ if (this.dragThreshMet) {
1773
+ this.dragCurrent.b4EndDrag(e);
1774
+ this.dragCurrent.endDrag(e);
1775
+ }
1776
+
1777
+ this.dragCurrent.onMouseUp(e);
1778
+ }
1779
+
1780
+ this.dragCurrent = null;
1781
+ this.dragOvers = {};
1782
+ },
1783
+
1784
+ /**
1785
+ * Internal function to handle the mousemove event. Will be invoked
1786
+ * from the context of the html element.
1787
+ *
1788
+ * @TODO figure out what we can do about mouse events lost when the
1789
+ * user drags objects beyond the window boundary. Currently we can
1790
+ * detect this in internet explorer by verifying that the mouse is
1791
+ * down during the mousemove event. Firefox doesn't give us the
1792
+ * button state on the mousemove event.
1793
+ * @method handleMouseMove
1794
+ * @param {Event} e the event
1795
+ * @private
1796
+ * @static
1797
+ */
1798
+ handleMouseMove: function(e) {
1799
+ if (! this.dragCurrent) {
1800
+ return true;
1801
+ }
1802
+ // var button = e.which || e.button;
1803
+
1804
+ // check for IE mouseup outside of page boundary
1805
+ if (Ext.isIE && (e.button !== 0 && e.button !== 1 && e.button !== 2)) {
1806
+ this.stopEvent(e);
1807
+ return this.handleMouseUp(e);
1808
+ }
1809
+
1810
+ if (!this.dragThreshMet) {
1811
+ var diffX = Math.abs(this.startX - e.getPageX());
1812
+ var diffY = Math.abs(this.startY - e.getPageY());
1813
+ if (diffX > this.clickPixelThresh ||
1814
+ diffY > this.clickPixelThresh) {
1815
+ this.startDrag(this.startX, this.startY);
1816
+ }
1817
+ }
1818
+
1819
+ if (this.dragThreshMet) {
1820
+ this.dragCurrent.b4Drag(e);
1821
+ this.dragCurrent.onDrag(e);
1822
+ if(!this.dragCurrent.moveOnly){
1823
+ this.fireEvents(e, false);
1824
+ }
1825
+ }
1826
+
1827
+ this.stopEvent(e);
1828
+
1829
+ return true;
1830
+ },
1831
+
1832
+ /**
1833
+ * Iterates over all of the DragDrop elements to find ones we are
1834
+ * hovering over or dropping on
1835
+ * @method fireEvents
1836
+ * @param {Event} e the event
1837
+ * @param {boolean} isDrop is this a drop op or a mouseover op?
1838
+ * @private
1839
+ * @static
1840
+ */
1841
+ fireEvents: function(e, isDrop) {
1842
+ var dc = this.dragCurrent;
1843
+
1844
+ // If the user did the mouse up outside of the window, we could
1845
+ // get here even though we have ended the drag.
1846
+ if (!dc || dc.isLocked()) {
1847
+ return;
1848
+ }
1849
+
1850
+ var pt = e.getPoint();
1851
+
1852
+ // cache the previous dragOver array
1853
+ var oldOvers = [];
1854
+
1855
+ var outEvts = [];
1856
+ var overEvts = [];
1857
+ var dropEvts = [];
1858
+ var enterEvts = [];
1859
+
1860
+ // Check to see if the object(s) we were hovering over is no longer
1861
+ // being hovered over so we can fire the onDragOut event
1862
+ for (var i in this.dragOvers) {
1863
+
1864
+ var ddo = this.dragOvers[i];
1865
+
1866
+ if (! this.isTypeOfDD(ddo)) {
1867
+ continue;
1868
+ }
1869
+
1870
+ if (! this.isOverTarget(pt, ddo, this.mode)) {
1871
+ outEvts.push( ddo );
1872
+ }
1873
+
1874
+ oldOvers[i] = true;
1875
+ delete this.dragOvers[i];
1876
+ }
1877
+
1878
+ for (var sGroup in dc.groups) {
1879
+
1880
+ if ("string" != typeof sGroup) {
1881
+ continue;
1882
+ }
1883
+
1884
+ for (i in this.ids[sGroup]) {
1885
+ var oDD = this.ids[sGroup][i];
1886
+ if (! this.isTypeOfDD(oDD)) {
1887
+ continue;
1888
+ }
1889
+
1890
+ if (oDD.isTarget && !oDD.isLocked() && ((oDD != dc) || (dc.ignoreSelf === false))) {
1891
+ if (this.isOverTarget(pt, oDD, this.mode)) {
1892
+ // look for drop interactions
1893
+ if (isDrop) {
1894
+ dropEvts.push( oDD );
1895
+ // look for drag enter and drag over interactions
1896
+ } else {
1897
+
1898
+ // initial drag over: dragEnter fires
1899
+ if (!oldOvers[oDD.id]) {
1900
+ enterEvts.push( oDD );
1901
+ // subsequent drag overs: dragOver fires
1902
+ } else {
1903
+ overEvts.push( oDD );
1904
+ }
1905
+
1906
+ this.dragOvers[oDD.id] = oDD;
1907
+ }
1908
+ }
1909
+ }
1910
+ }
1911
+ }
1912
+
1913
+ if (this.mode) {
1914
+ if (outEvts.length) {
1915
+ dc.b4DragOut(e, outEvts);
1916
+ dc.onDragOut(e, outEvts);
1917
+ }
1918
+
1919
+ if (enterEvts.length) {
1920
+ dc.onDragEnter(e, enterEvts);
1921
+ }
1922
+
1923
+ if (overEvts.length) {
1924
+ dc.b4DragOver(e, overEvts);
1925
+ dc.onDragOver(e, overEvts);
1926
+ }
1927
+
1928
+ if (dropEvts.length) {
1929
+ dc.b4DragDrop(e, dropEvts);
1930
+ dc.onDragDrop(e, dropEvts);
1931
+ }
1932
+
1933
+ } else {
1934
+ // fire dragout events
1935
+ var len = 0;
1936
+ for (i=0, len=outEvts.length; i<len; ++i) {
1937
+ dc.b4DragOut(e, outEvts[i].id);
1938
+ dc.onDragOut(e, outEvts[i].id);
1939
+ }
1940
+
1941
+ // fire enter events
1942
+ for (i=0,len=enterEvts.length; i<len; ++i) {
1943
+ // dc.b4DragEnter(e, oDD.id);
1944
+ dc.onDragEnter(e, enterEvts[i].id);
1945
+ }
1946
+
1947
+ // fire over events
1948
+ for (i=0,len=overEvts.length; i<len; ++i) {
1949
+ dc.b4DragOver(e, overEvts[i].id);
1950
+ dc.onDragOver(e, overEvts[i].id);
1951
+ }
1952
+
1953
+ // fire drop events
1954
+ for (i=0, len=dropEvts.length; i<len; ++i) {
1955
+ dc.b4DragDrop(e, dropEvts[i].id);
1956
+ dc.onDragDrop(e, dropEvts[i].id);
1957
+ }
1958
+
1959
+ }
1960
+
1961
+ // notify about a drop that did not find a target
1962
+ if (isDrop && !dropEvts.length) {
1963
+ dc.onInvalidDrop(e);
1964
+ }
1965
+
1966
+ },
1967
+
1968
+ /**
1969
+ * Helper function for getting the best match from the list of drag
1970
+ * and drop objects returned by the drag and drop events when we are
1971
+ * in INTERSECT mode. It returns either the first object that the
1972
+ * cursor is over, or the object that has the greatest overlap with
1973
+ * the dragged element.
1974
+ * @method getBestMatch
1975
+ * @param {DragDrop[]} dds The array of drag and drop objects
1976
+ * targeted
1977
+ * @return {DragDrop} The best single match
1978
+ * @static
1979
+ */
1980
+ getBestMatch: function(dds) {
1981
+ var winner = null;
1982
+ // Return null if the input is not what we expect
1983
+ //if (!dds || !dds.length || dds.length == 0) {
1984
+ // winner = null;
1985
+ // If there is only one item, it wins
1986
+ //} else if (dds.length == 1) {
1987
+
1988
+ var len = dds.length;
1989
+
1990
+ if (len == 1) {
1991
+ winner = dds[0];
1992
+ } else {
1993
+ // Loop through the targeted items
1994
+ for (var i=0; i<len; ++i) {
1995
+ var dd = dds[i];
1996
+ // If the cursor is over the object, it wins. If the
1997
+ // cursor is over multiple matches, the first one we come
1998
+ // to wins.
1999
+ if (dd.cursorIsOver) {
2000
+ winner = dd;
2001
+ break;
2002
+ // Otherwise the object with the most overlap wins
2003
+ } else {
2004
+ if (!winner ||
2005
+ winner.overlap.getArea() < dd.overlap.getArea()) {
2006
+ winner = dd;
2007
+ }
2008
+ }
2009
+ }
2010
+ }
2011
+
2012
+ return winner;
2013
+ },
2014
+
2015
+ /**
2016
+ * Refreshes the cache of the top-left and bottom-right points of the
2017
+ * drag and drop objects in the specified group(s). This is in the
2018
+ * format that is stored in the drag and drop instance, so typical
2019
+ * usage is:
2020
+ * <code>
2021
+ * Ext.dd.DragDropMgr.refreshCache(ddinstance.groups);
2022
+ * </code>
2023
+ * Alternatively:
2024
+ * <code>
2025
+ * Ext.dd.DragDropMgr.refreshCache({group1:true, group2:true});
2026
+ * </code>
2027
+ * @TODO this really should be an indexed array. Alternatively this
2028
+ * method could accept both.
2029
+ * @method refreshCache
2030
+ * @param {Object} groups an associative array of groups to refresh
2031
+ * @static
2032
+ */
2033
+ refreshCache: function(groups) {
2034
+ for (var sGroup in groups) {
2035
+ if ("string" != typeof sGroup) {
2036
+ continue;
2037
+ }
2038
+ for (var i in this.ids[sGroup]) {
2039
+ var oDD = this.ids[sGroup][i];
2040
+
2041
+ if (this.isTypeOfDD(oDD)) {
2042
+ // if (this.isTypeOfDD(oDD) && oDD.isTarget) {
2043
+ var loc = this.getLocation(oDD);
2044
+ if (loc) {
2045
+ this.locationCache[oDD.id] = loc;
2046
+ } else {
2047
+ delete this.locationCache[oDD.id];
2048
+ // this will unregister the drag and drop object if
2049
+ // the element is not in a usable state
2050
+ // oDD.unreg();
2051
+ }
2052
+ }
2053
+ }
2054
+ }
2055
+ },
2056
+
2057
+ /**
2058
+ * This checks to make sure an element exists and is in the DOM. The
2059
+ * main purpose is to handle cases where innerHTML is used to remove
2060
+ * drag and drop objects from the DOM. IE provides an 'unspecified
2061
+ * error' when trying to access the offsetParent of such an element
2062
+ * @method verifyEl
2063
+ * @param {HTMLElement} el the element to check
2064
+ * @return {boolean} true if the element looks usable
2065
+ * @static
2066
+ */
2067
+ verifyEl: function(el) {
2068
+ if (el) {
2069
+ var parent;
2070
+ if(Ext.isIE){
2071
+ try{
2072
+ parent = el.offsetParent;
2073
+ }catch(e){}
2074
+ }else{
2075
+ parent = el.offsetParent;
2076
+ }
2077
+ if (parent) {
2078
+ return true;
2079
+ }
2080
+ }
2081
+
2082
+ return false;
2083
+ },
2084
+
2085
+ /**
2086
+ * Returns a Region object containing the drag and drop element's position
2087
+ * and size, including the padding configured for it
2088
+ * @method getLocation
2089
+ * @param {DragDrop} oDD the drag and drop object to get the
2090
+ * location for
2091
+ * @return {Ext.lib.Region} a Region object representing the total area
2092
+ * the element occupies, including any padding
2093
+ * the instance is configured for.
2094
+ * @static
2095
+ */
2096
+ getLocation: function(oDD) {
2097
+ if (! this.isTypeOfDD(oDD)) {
2098
+ return null;
2099
+ }
2100
+
2101
+ var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l;
2102
+
2103
+ try {
2104
+ pos= Ext.lib.Dom.getXY(el);
2105
+ } catch (e) { }
2106
+
2107
+ if (!pos) {
2108
+ return null;
2109
+ }
2110
+
2111
+ x1 = pos[0];
2112
+ x2 = x1 + el.offsetWidth;
2113
+ y1 = pos[1];
2114
+ y2 = y1 + el.offsetHeight;
2115
+
2116
+ t = y1 - oDD.padding[0];
2117
+ r = x2 + oDD.padding[1];
2118
+ b = y2 + oDD.padding[2];
2119
+ l = x1 - oDD.padding[3];
2120
+
2121
+ return new Ext.lib.Region( t, r, b, l );
2122
+ },
2123
+
2124
+ /**
2125
+ * Checks the cursor location to see if it over the target
2126
+ * @method isOverTarget
2127
+ * @param {Ext.lib.Point} pt The point to evaluate
2128
+ * @param {DragDrop} oTarget the DragDrop object we are inspecting
2129
+ * @return {boolean} true if the mouse is over the target
2130
+ * @private
2131
+ * @static
2132
+ */
2133
+ isOverTarget: function(pt, oTarget, intersect) {
2134
+ // use cache if available
2135
+ var loc = this.locationCache[oTarget.id];
2136
+ if (!loc || !this.useCache) {
2137
+ loc = this.getLocation(oTarget);
2138
+ this.locationCache[oTarget.id] = loc;
2139
+
2140
+ }
2141
+
2142
+ if (!loc) {
2143
+ return false;
2144
+ }
2145
+
2146
+ oTarget.cursorIsOver = loc.contains( pt );
2147
+
2148
+ // DragDrop is using this as a sanity check for the initial mousedown
2149
+ // in this case we are done. In POINT mode, if the drag obj has no
2150
+ // contraints, we are also done. Otherwise we need to evaluate the
2151
+ // location of the target as related to the actual location of the
2152
+ // dragged element.
2153
+ var dc = this.dragCurrent;
2154
+ if (!dc || !dc.getTargetCoord ||
2155
+ (!intersect && !dc.constrainX && !dc.constrainY)) {
2156
+ return oTarget.cursorIsOver;
2157
+ }
2158
+
2159
+ oTarget.overlap = null;
2160
+
2161
+ // Get the current location of the drag element, this is the
2162
+ // location of the mouse event less the delta that represents
2163
+ // where the original mousedown happened on the element. We
2164
+ // need to consider constraints and ticks as well.
2165
+ var pos = dc.getTargetCoord(pt.x, pt.y);
2166
+
2167
+ var el = dc.getDragEl();
2168
+ var curRegion = new Ext.lib.Region( pos.y,
2169
+ pos.x + el.offsetWidth,
2170
+ pos.y + el.offsetHeight,
2171
+ pos.x );
2172
+
2173
+ var overlap = curRegion.intersect(loc);
2174
+
2175
+ if (overlap) {
2176
+ oTarget.overlap = overlap;
2177
+ return (intersect) ? true : oTarget.cursorIsOver;
2178
+ } else {
2179
+ return false;
2180
+ }
2181
+ },
2182
+
2183
+ /**
2184
+ * unload event handler
2185
+ * @method _onUnload
2186
+ * @private
2187
+ * @static
2188
+ */
2189
+ _onUnload: function(e, me) {
2190
+ Ext.dd.DragDropMgr.unregAll();
2191
+ },
2192
+
2193
+ /**
2194
+ * Cleans up the drag and drop events and objects.
2195
+ * @method unregAll
2196
+ * @private
2197
+ * @static
2198
+ */
2199
+ unregAll: function() {
2200
+
2201
+ if (this.dragCurrent) {
2202
+ this.stopDrag();
2203
+ this.dragCurrent = null;
2204
+ }
2205
+
2206
+ this._execOnAll("unreg", []);
2207
+
2208
+ for (var i in this.elementCache) {
2209
+ delete this.elementCache[i];
2210
+ }
2211
+
2212
+ this.elementCache = {};
2213
+ this.ids = {};
2214
+ },
2215
+
2216
+ /**
2217
+ * A cache of DOM elements
2218
+ * @property elementCache
2219
+ * @private
2220
+ * @static
2221
+ */
2222
+ elementCache: {},
2223
+
2224
+ /**
2225
+ * Get the wrapper for the DOM element specified
2226
+ * @method getElWrapper
2227
+ * @param {String} id the id of the element to get
2228
+ * @return {Ext.dd.DDM.ElementWrapper} the wrapped element
2229
+ * @private
2230
+ * @deprecated This wrapper isn't that useful
2231
+ * @static
2232
+ */
2233
+ getElWrapper: function(id) {
2234
+ var oWrapper = this.elementCache[id];
2235
+ if (!oWrapper || !oWrapper.el) {
2236
+ oWrapper = this.elementCache[id] =
2237
+ new this.ElementWrapper(Ext.getDom(id));
2238
+ }
2239
+ return oWrapper;
2240
+ },
2241
+
2242
+ /**
2243
+ * Returns the actual DOM element
2244
+ * @method getElement
2245
+ * @param {String} id the id of the elment to get
2246
+ * @return {Object} The element
2247
+ * @deprecated use Ext.lib.Ext.getDom instead
2248
+ * @static
2249
+ */
2250
+ getElement: function(id) {
2251
+ return Ext.getDom(id);
2252
+ },
2253
+
2254
+ /**
2255
+ * Returns the style property for the DOM element (i.e.,
2256
+ * document.getElById(id).style)
2257
+ * @method getCss
2258
+ * @param {String} id the id of the elment to get
2259
+ * @return {Object} The style property of the element
2260
+ * @deprecated use Ext.lib.Dom instead
2261
+ * @static
2262
+ */
2263
+ getCss: function(id) {
2264
+ var el = Ext.getDom(id);
2265
+ return (el) ? el.style : null;
2266
+ },
2267
+
2268
+ /**
2269
+ * Inner class for cached elements
2270
+ * @class DragDropMgr.ElementWrapper
2271
+ * @for DragDropMgr
2272
+ * @private
2273
+ * @deprecated
2274
+ */
2275
+ ElementWrapper: function(el) {
2276
+ /**
2277
+ * The element
2278
+ * @property el
2279
+ */
2280
+ this.el = el || null;
2281
+ /**
2282
+ * The element id
2283
+ * @property id
2284
+ */
2285
+ this.id = this.el && el.id;
2286
+ /**
2287
+ * A reference to the style property
2288
+ * @property css
2289
+ */
2290
+ this.css = this.el && el.style;
2291
+ },
2292
+
2293
+ /**
2294
+ * Returns the X position of an html element
2295
+ * @method getPosX
2296
+ * @param el the element for which to get the position
2297
+ * @return {int} the X coordinate
2298
+ * @for DragDropMgr
2299
+ * @deprecated use Ext.lib.Dom.getX instead
2300
+ * @static
2301
+ */
2302
+ getPosX: function(el) {
2303
+ return Ext.lib.Dom.getX(el);
2304
+ },
2305
+
2306
+ /**
2307
+ * Returns the Y position of an html element
2308
+ * @method getPosY
2309
+ * @param el the element for which to get the position
2310
+ * @return {int} the Y coordinate
2311
+ * @deprecated use Ext.lib.Dom.getY instead
2312
+ * @static
2313
+ */
2314
+ getPosY: function(el) {
2315
+ return Ext.lib.Dom.getY(el);
2316
+ },
2317
+
2318
+ /**
2319
+ * Swap two nodes. In IE, we use the native method, for others we
2320
+ * emulate the IE behavior
2321
+ * @method swapNode
2322
+ * @param n1 the first node to swap
2323
+ * @param n2 the other node to swap
2324
+ * @static
2325
+ */
2326
+ swapNode: function(n1, n2) {
2327
+ if (n1.swapNode) {
2328
+ n1.swapNode(n2);
2329
+ } else {
2330
+ var p = n2.parentNode;
2331
+ var s = n2.nextSibling;
2332
+
2333
+ if (s == n1) {
2334
+ p.insertBefore(n1, n2);
2335
+ } else if (n2 == n1.nextSibling) {
2336
+ p.insertBefore(n2, n1);
2337
+ } else {
2338
+ n1.parentNode.replaceChild(n2, n1);
2339
+ p.insertBefore(n1, s);
2340
+ }
2341
+ }
2342
+ },
2343
+
2344
+ /**
2345
+ * Returns the current scroll position
2346
+ * @method getScroll
2347
+ * @private
2348
+ * @static
2349
+ */
2350
+ getScroll: function () {
2351
+ var t, l, dde=document.documentElement, db=document.body;
2352
+ if (dde && (dde.scrollTop || dde.scrollLeft)) {
2353
+ t = dde.scrollTop;
2354
+ l = dde.scrollLeft;
2355
+ } else if (db) {
2356
+ t = db.scrollTop;
2357
+ l = db.scrollLeft;
2358
+ } else {
2359
+
2360
+ }
2361
+ return { top: t, left: l };
2362
+ },
2363
+
2364
+ /**
2365
+ * Returns the specified element style property
2366
+ * @method getStyle
2367
+ * @param {HTMLElement} el the element
2368
+ * @param {string} styleProp the style property
2369
+ * @return {string} The value of the style property
2370
+ * @deprecated use Ext.lib.Dom.getStyle
2371
+ * @static
2372
+ */
2373
+ getStyle: function(el, styleProp) {
2374
+ return Ext.fly(el).getStyle(styleProp);
2375
+ },
2376
+
2377
+ /**
2378
+ * Gets the scrollTop
2379
+ * @method getScrollTop
2380
+ * @return {int} the document's scrollTop
2381
+ * @static
2382
+ */
2383
+ getScrollTop: function () { return this.getScroll().top; },
2384
+
2385
+ /**
2386
+ * Gets the scrollLeft
2387
+ * @method getScrollLeft
2388
+ * @return {int} the document's scrollTop
2389
+ * @static
2390
+ */
2391
+ getScrollLeft: function () { return this.getScroll().left; },
2392
+
2393
+ /**
2394
+ * Sets the x/y position of an element to the location of the
2395
+ * target element.
2396
+ * @method moveToEl
2397
+ * @param {HTMLElement} moveEl The element to move
2398
+ * @param {HTMLElement} targetEl The position reference element
2399
+ * @static
2400
+ */
2401
+ moveToEl: function (moveEl, targetEl) {
2402
+ var aCoord = Ext.lib.Dom.getXY(targetEl);
2403
+ Ext.lib.Dom.setXY(moveEl, aCoord);
2404
+ },
2405
+
2406
+ /**
2407
+ * Numeric array sort function
2408
+ * @method numericSort
2409
+ * @static
2410
+ */
2411
+ numericSort: function(a, b) { return (a - b); },
2412
+
2413
+ /**
2414
+ * Internal counter
2415
+ * @property _timeoutCount
2416
+ * @private
2417
+ * @static
2418
+ */
2419
+ _timeoutCount: 0,
2420
+
2421
+ /**
2422
+ * Trying to make the load order less important. Without this we get
2423
+ * an error if this file is loaded before the Event Utility.
2424
+ * @method _addListeners
2425
+ * @private
2426
+ * @static
2427
+ */
2428
+ _addListeners: function() {
2429
+ var DDM = Ext.dd.DDM;
2430
+ if ( Ext.lib.Event && document ) {
2431
+ DDM._onLoad();
2432
+ } else {
2433
+ if (DDM._timeoutCount > 2000) {
2434
+ } else {
2435
+ setTimeout(DDM._addListeners, 10);
2436
+ if (document && document.body) {
2437
+ DDM._timeoutCount += 1;
2438
+ }
2439
+ }
2440
+ }
2441
+ },
2442
+
2443
+ /**
2444
+ * Recursively searches the immediate parent and all child nodes for
2445
+ * the handle element in order to determine wheter or not it was
2446
+ * clicked.
2447
+ * @method handleWasClicked
2448
+ * @param node the html element to inspect
2449
+ * @static
2450
+ */
2451
+ handleWasClicked: function(node, id) {
2452
+ if (this.isHandle(id, node.id)) {
2453
+ return true;
2454
+ } else {
2455
+ // check to see if this is a text node child of the one we want
2456
+ var p = node.parentNode;
2457
+
2458
+ while (p) {
2459
+ if (this.isHandle(id, p.id)) {
2460
+ return true;
2461
+ } else {
2462
+ p = p.parentNode;
2463
+ }
2464
+ }
2465
+ }
2466
+
2467
+ return false;
2468
+ }
2469
+
2470
+ };
2471
+
2472
+ }();
2473
+
2474
+ // shorter alias, save a few bytes
2475
+ Ext.dd.DDM = Ext.dd.DragDropMgr;
2476
+ Ext.dd.DDM._addListeners();
2477
+
2478
+ }
2479
+
2480
+ /**
2481
+ * @class Ext.dd.DD
2482
+ * A DragDrop implementation where the linked element follows the
2483
+ * mouse cursor during a drag.
2484
+ * @extends Ext.dd.DragDrop
2485
+ * @constructor
2486
+ * @param {String} id the id of the linked element
2487
+ * @param {String} sGroup the group of related DragDrop items
2488
+ * @param {object} config an object containing configurable attributes
2489
+ * Valid properties for DD:
2490
+ * scroll
2491
+ */
2492
+ Ext.dd.DD = function(id, sGroup, config) {
2493
+ if (id) {
2494
+ this.init(id, sGroup, config);
2495
+ }
2496
+ };
2497
+
2498
+ Ext.extend(Ext.dd.DD, Ext.dd.DragDrop, {
2499
+
2500
+ /**
2501
+ * When set to true, the utility automatically tries to scroll the browser
2502
+ * window when a drag and drop element is dragged near the viewport boundary.
2503
+ * Defaults to true.
2504
+ * @property scroll
2505
+ * @type boolean
2506
+ */
2507
+ scroll: true,
2508
+
2509
+ /**
2510
+ * Sets the pointer offset to the distance between the linked element's top
2511
+ * left corner and the location the element was clicked
2512
+ * @method autoOffset
2513
+ * @param {int} iPageX the X coordinate of the click
2514
+ * @param {int} iPageY the Y coordinate of the click
2515
+ */
2516
+ autoOffset: function(iPageX, iPageY) {
2517
+ var x = iPageX - this.startPageX;
2518
+ var y = iPageY - this.startPageY;
2519
+ this.setDelta(x, y);
2520
+ },
2521
+
2522
+ /**
2523
+ * Sets the pointer offset. You can call this directly to force the
2524
+ * offset to be in a particular location (e.g., pass in 0,0 to set it
2525
+ * to the center of the object)
2526
+ * @method setDelta
2527
+ * @param {int} iDeltaX the distance from the left
2528
+ * @param {int} iDeltaY the distance from the top
2529
+ */
2530
+ setDelta: function(iDeltaX, iDeltaY) {
2531
+ this.deltaX = iDeltaX;
2532
+ this.deltaY = iDeltaY;
2533
+ },
2534
+
2535
+ /**
2536
+ * Sets the drag element to the location of the mousedown or click event,
2537
+ * maintaining the cursor location relative to the location on the element
2538
+ * that was clicked. Override this if you want to place the element in a
2539
+ * location other than where the cursor is.
2540
+ * @method setDragElPos
2541
+ * @param {int} iPageX the X coordinate of the mousedown or drag event
2542
+ * @param {int} iPageY the Y coordinate of the mousedown or drag event
2543
+ */
2544
+ setDragElPos: function(iPageX, iPageY) {
2545
+ // the first time we do this, we are going to check to make sure
2546
+ // the element has css positioning
2547
+
2548
+ var el = this.getDragEl();
2549
+ this.alignElWithMouse(el, iPageX, iPageY);
2550
+ },
2551
+
2552
+ /**
2553
+ * Sets the element to the location of the mousedown or click event,
2554
+ * maintaining the cursor location relative to the location on the element
2555
+ * that was clicked. Override this if you want to place the element in a
2556
+ * location other than where the cursor is.
2557
+ * @method alignElWithMouse
2558
+ * @param {HTMLElement} el the element to move
2559
+ * @param {int} iPageX the X coordinate of the mousedown or drag event
2560
+ * @param {int} iPageY the Y coordinate of the mousedown or drag event
2561
+ */
2562
+ alignElWithMouse: function(el, iPageX, iPageY) {
2563
+ var oCoord = this.getTargetCoord(iPageX, iPageY);
2564
+ var fly = el.dom ? el : Ext.fly(el, '_dd');
2565
+ if (!this.deltaSetXY) {
2566
+ var aCoord = [oCoord.x, oCoord.y];
2567
+ fly.setXY(aCoord);
2568
+ var newLeft = fly.getLeft(true);
2569
+ var newTop = fly.getTop(true);
2570
+ this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ];
2571
+ } else {
2572
+ fly.setLeftTop(oCoord.x + this.deltaSetXY[0], oCoord.y + this.deltaSetXY[1]);
2573
+ }
2574
+
2575
+ this.cachePosition(oCoord.x, oCoord.y);
2576
+ this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
2577
+ return oCoord;
2578
+ },
2579
+
2580
+ /**
2581
+ * Saves the most recent position so that we can reset the constraints and
2582
+ * tick marks on-demand. We need to know this so that we can calculate the
2583
+ * number of pixels the element is offset from its original position.
2584
+ * @method cachePosition
2585
+ * @param iPageX the current x position (optional, this just makes it so we
2586
+ * don't have to look it up again)
2587
+ * @param iPageY the current y position (optional, this just makes it so we
2588
+ * don't have to look it up again)
2589
+ */
2590
+ cachePosition: function(iPageX, iPageY) {
2591
+ if (iPageX) {
2592
+ this.lastPageX = iPageX;
2593
+ this.lastPageY = iPageY;
2594
+ } else {
2595
+ var aCoord = Ext.lib.Dom.getXY(this.getEl());
2596
+ this.lastPageX = aCoord[0];
2597
+ this.lastPageY = aCoord[1];
2598
+ }
2599
+ },
2600
+
2601
+ /**
2602
+ * Auto-scroll the window if the dragged object has been moved beyond the
2603
+ * visible window boundary.
2604
+ * @method autoScroll
2605
+ * @param {int} x the drag element's x position
2606
+ * @param {int} y the drag element's y position
2607
+ * @param {int} h the height of the drag element
2608
+ * @param {int} w the width of the drag element
2609
+ * @private
2610
+ */
2611
+ autoScroll: function(x, y, h, w) {
2612
+
2613
+ if (this.scroll) {
2614
+ // The client height
2615
+ var clientH = Ext.lib.Dom.getViewHeight();
2616
+
2617
+ // The client width
2618
+ var clientW = Ext.lib.Dom.getViewWidth();
2619
+
2620
+ // The amt scrolled down
2621
+ var st = this.DDM.getScrollTop();
2622
+
2623
+ // The amt scrolled right
2624
+ var sl = this.DDM.getScrollLeft();
2625
+
2626
+ // Location of the bottom of the element
2627
+ var bot = h + y;
2628
+
2629
+ // Location of the right of the element
2630
+ var right = w + x;
2631
+
2632
+ // The distance from the cursor to the bottom of the visible area,
2633
+ // adjusted so that we don't scroll if the cursor is beyond the
2634
+ // element drag constraints
2635
+ var toBot = (clientH + st - y - this.deltaY);
2636
+
2637
+ // The distance from the cursor to the right of the visible area
2638
+ var toRight = (clientW + sl - x - this.deltaX);
2639
+
2640
+
2641
+ // How close to the edge the cursor must be before we scroll
2642
+ // var thresh = (document.all) ? 100 : 40;
2643
+ var thresh = 40;
2644
+
2645
+ // How many pixels to scroll per autoscroll op. This helps to reduce
2646
+ // clunky scrolling. IE is more sensitive about this ... it needs this
2647
+ // value to be higher.
2648
+ var scrAmt = (document.all) ? 80 : 30;
2649
+
2650
+ // Scroll down if we are near the bottom of the visible page and the
2651
+ // obj extends below the crease
2652
+ if ( bot > clientH && toBot < thresh ) {
2653
+ window.scrollTo(sl, st + scrAmt);
2654
+ }
2655
+
2656
+ // Scroll up if the window is scrolled down and the top of the object
2657
+ // goes above the top border
2658
+ if ( y < st && st > 0 && y - st < thresh ) {
2659
+ window.scrollTo(sl, st - scrAmt);
2660
+ }
2661
+
2662
+ // Scroll right if the obj is beyond the right border and the cursor is
2663
+ // near the border.
2664
+ if ( right > clientW && toRight < thresh ) {
2665
+ window.scrollTo(sl + scrAmt, st);
2666
+ }
2667
+
2668
+ // Scroll left if the window has been scrolled to the right and the obj
2669
+ // extends past the left border
2670
+ if ( x < sl && sl > 0 && x - sl < thresh ) {
2671
+ window.scrollTo(sl - scrAmt, st);
2672
+ }
2673
+ }
2674
+ },
2675
+
2676
+ /**
2677
+ * Finds the location the element should be placed if we want to move
2678
+ * it to where the mouse location less the click offset would place us.
2679
+ * @method getTargetCoord
2680
+ * @param {int} iPageX the X coordinate of the click
2681
+ * @param {int} iPageY the Y coordinate of the click
2682
+ * @return an object that contains the coordinates (Object.x and Object.y)
2683
+ * @private
2684
+ */
2685
+ getTargetCoord: function(iPageX, iPageY) {
2686
+
2687
+
2688
+ var x = iPageX - this.deltaX;
2689
+ var y = iPageY - this.deltaY;
2690
+
2691
+ if (this.constrainX) {
2692
+ if (x < this.minX) { x = this.minX; }
2693
+ if (x > this.maxX) { x = this.maxX; }
2694
+ }
2695
+
2696
+ if (this.constrainY) {
2697
+ if (y < this.minY) { y = this.minY; }
2698
+ if (y > this.maxY) { y = this.maxY; }
2699
+ }
2700
+
2701
+ x = this.getTick(x, this.xTicks);
2702
+ y = this.getTick(y, this.yTicks);
2703
+
2704
+
2705
+ return {x:x, y:y};
2706
+ },
2707
+
2708
+ /**
2709
+ * Sets up config options specific to this class. Overrides
2710
+ * Ext.dd.DragDrop, but all versions of this method through the
2711
+ * inheritance chain are called
2712
+ */
2713
+ applyConfig: function() {
2714
+ Ext.dd.DD.superclass.applyConfig.call(this);
2715
+ this.scroll = (this.config.scroll !== false);
2716
+ },
2717
+
2718
+ /**
2719
+ * Event that fires prior to the onMouseDown event. Overrides
2720
+ * Ext.dd.DragDrop.
2721
+ */
2722
+ b4MouseDown: function(e) {
2723
+ // this.resetConstraints();
2724
+ this.autoOffset(e.getPageX(),
2725
+ e.getPageY());
2726
+ },
2727
+
2728
+ /**
2729
+ * Event that fires prior to the onDrag event. Overrides
2730
+ * Ext.dd.DragDrop.
2731
+ */
2732
+ b4Drag: function(e) {
2733
+ this.setDragElPos(e.getPageX(),
2734
+ e.getPageY());
2735
+ },
2736
+
2737
+ toString: function() {
2738
+ return ("DD " + this.id);
2739
+ }
2740
+
2741
+ //////////////////////////////////////////////////////////////////////////
2742
+ // Debugging ygDragDrop events that can be overridden
2743
+ //////////////////////////////////////////////////////////////////////////
2744
+ /*
2745
+ startDrag: function(x, y) {
2746
+ },
2747
+
2748
+ onDrag: function(e) {
2749
+ },
2750
+
2751
+ onDragEnter: function(e, id) {
2752
+ },
2753
+
2754
+ onDragOver: function(e, id) {
2755
+ },
2756
+
2757
+ onDragOut: function(e, id) {
2758
+ },
2759
+
2760
+ onDragDrop: function(e, id) {
2761
+ },
2762
+
2763
+ endDrag: function(e) {
2764
+ }
2765
+
2766
+ */
2767
+
2768
+ });
2769
+ /**
2770
+ * @class Ext.dd.DDProxy
2771
+ * A DragDrop implementation that inserts an empty, bordered div into
2772
+ * the document that follows the cursor during drag operations. At the time of
2773
+ * the click, the frame div is resized to the dimensions of the linked html
2774
+ * element, and moved to the exact location of the linked element.
2775
+ *
2776
+ * References to the "frame" element refer to the single proxy element that
2777
+ * was created to be dragged in place of all DDProxy elements on the
2778
+ * page.
2779
+ *
2780
+ * @extends Ext.dd.DD
2781
+ * @constructor
2782
+ * @param {String} id the id of the linked html element
2783
+ * @param {String} sGroup the group of related DragDrop objects
2784
+ * @param {object} config an object containing configurable attributes
2785
+ * Valid properties for DDProxy in addition to those in DragDrop:
2786
+ * resizeFrame, centerFrame, dragElId
2787
+ */
2788
+ Ext.dd.DDProxy = function(id, sGroup, config) {
2789
+ if (id) {
2790
+ this.init(id, sGroup, config);
2791
+ this.initFrame();
2792
+ }
2793
+ };
2794
+
2795
+ /**
2796
+ * The default drag frame div id
2797
+ * @property Ext.dd.DDProxy.dragElId
2798
+ * @type String
2799
+ * @static
2800
+ */
2801
+ Ext.dd.DDProxy.dragElId = "ygddfdiv";
2802
+
2803
+ Ext.extend(Ext.dd.DDProxy, Ext.dd.DD, {
2804
+
2805
+ /**
2806
+ * By default we resize the drag frame to be the same size as the element
2807
+ * we want to drag (this is to get the frame effect). We can turn it off
2808
+ * if we want a different behavior.
2809
+ * @property resizeFrame
2810
+ * @type boolean
2811
+ */
2812
+ resizeFrame: true,
2813
+
2814
+ /**
2815
+ * By default the frame is positioned exactly where the drag element is, so
2816
+ * we use the cursor offset provided by Ext.dd.DD. Another option that works only if
2817
+ * you do not have constraints on the obj is to have the drag frame centered
2818
+ * around the cursor. Set centerFrame to true for this effect.
2819
+ * @property centerFrame
2820
+ * @type boolean
2821
+ */
2822
+ centerFrame: false,
2823
+
2824
+ /**
2825
+ * Creates the proxy element if it does not yet exist
2826
+ * @method createFrame
2827
+ */
2828
+ createFrame: function() {
2829
+ var self = this;
2830
+ var body = document.body;
2831
+
2832
+ if (!body || !body.firstChild) {
2833
+ setTimeout( function() { self.createFrame(); }, 50 );
2834
+ return;
2835
+ }
2836
+
2837
+ var div = this.getDragEl();
2838
+
2839
+ if (!div) {
2840
+ div = document.createElement("div");
2841
+ div.id = this.dragElId;
2842
+ var s = div.style;
2843
+
2844
+ s.position = "absolute";
2845
+ s.visibility = "hidden";
2846
+ s.cursor = "move";
2847
+ s.border = "2px solid #aaa";
2848
+ s.zIndex = 999;
2849
+
2850
+ // appendChild can blow up IE if invoked prior to the window load event
2851
+ // while rendering a table. It is possible there are other scenarios
2852
+ // that would cause this to happen as well.
2853
+ body.insertBefore(div, body.firstChild);
2854
+ }
2855
+ },
2856
+
2857
+ /**
2858
+ * Initialization for the drag frame element. Must be called in the
2859
+ * constructor of all subclasses
2860
+ * @method initFrame
2861
+ */
2862
+ initFrame: function() {
2863
+ this.createFrame();
2864
+ },
2865
+
2866
+ applyConfig: function() {
2867
+ Ext.dd.DDProxy.superclass.applyConfig.call(this);
2868
+
2869
+ this.resizeFrame = (this.config.resizeFrame !== false);
2870
+ this.centerFrame = (this.config.centerFrame);
2871
+ this.setDragElId(this.config.dragElId || Ext.dd.DDProxy.dragElId);
2872
+ },
2873
+
2874
+ /**
2875
+ * Resizes the drag frame to the dimensions of the clicked object, positions
2876
+ * it over the object, and finally displays it
2877
+ * @method showFrame
2878
+ * @param {int} iPageX X click position
2879
+ * @param {int} iPageY Y click position
2880
+ * @private
2881
+ */
2882
+ showFrame: function(iPageX, iPageY) {
2883
+ var el = this.getEl();
2884
+ var dragEl = this.getDragEl();
2885
+ var s = dragEl.style;
2886
+
2887
+ this._resizeProxy();
2888
+
2889
+ if (this.centerFrame) {
2890
+ this.setDelta( Math.round(parseInt(s.width, 10)/2),
2891
+ Math.round(parseInt(s.height, 10)/2) );
2892
+ }
2893
+
2894
+ this.setDragElPos(iPageX, iPageY);
2895
+
2896
+ Ext.fly(dragEl).show();
2897
+ },
2898
+
2899
+ /**
2900
+ * The proxy is automatically resized to the dimensions of the linked
2901
+ * element when a drag is initiated, unless resizeFrame is set to false
2902
+ * @method _resizeProxy
2903
+ * @private
2904
+ */
2905
+ _resizeProxy: function() {
2906
+ if (this.resizeFrame) {
2907
+ var el = this.getEl();
2908
+ Ext.fly(this.getDragEl()).setSize(el.offsetWidth, el.offsetHeight);
2909
+ }
2910
+ },
2911
+
2912
+ // overrides Ext.dd.DragDrop
2913
+ b4MouseDown: function(e) {
2914
+ var x = e.getPageX();
2915
+ var y = e.getPageY();
2916
+ this.autoOffset(x, y);
2917
+ this.setDragElPos(x, y);
2918
+ },
2919
+
2920
+ // overrides Ext.dd.DragDrop
2921
+ b4StartDrag: function(x, y) {
2922
+ // show the drag frame
2923
+ this.showFrame(x, y);
2924
+ },
2925
+
2926
+ // overrides Ext.dd.DragDrop
2927
+ b4EndDrag: function(e) {
2928
+ Ext.fly(this.getDragEl()).hide();
2929
+ },
2930
+
2931
+ // overrides Ext.dd.DragDrop
2932
+ // By default we try to move the element to the last location of the frame.
2933
+ // This is so that the default behavior mirrors that of Ext.dd.DD.
2934
+ endDrag: function(e) {
2935
+
2936
+ var lel = this.getEl();
2937
+ var del = this.getDragEl();
2938
+
2939
+ // Show the drag frame briefly so we can get its position
2940
+ del.style.visibility = "";
2941
+
2942
+ this.beforeMove();
2943
+ // Hide the linked element before the move to get around a Safari
2944
+ // rendering bug.
2945
+ lel.style.visibility = "hidden";
2946
+ Ext.dd.DDM.moveToEl(lel, del);
2947
+ del.style.visibility = "hidden";
2948
+ lel.style.visibility = "";
2949
+
2950
+ this.afterDrag();
2951
+ },
2952
+
2953
+ beforeMove : function(){
2954
+
2955
+ },
2956
+
2957
+ afterDrag : function(){
2958
+
2959
+ },
2960
+
2961
+ toString: function() {
2962
+ return ("DDProxy " + this.id);
2963
+ }
2964
+
2965
+ });
2966
+ /**
2967
+ * @class Ext.dd.DDTarget
2968
+ * A DragDrop implementation that does not move, but can be a drop
2969
+ * target. You would get the same result by simply omitting implementation
2970
+ * for the event callbacks, but this way we reduce the processing cost of the
2971
+ * event listener and the callbacks.
2972
+ * @extends Ext.dd.DragDrop
2973
+ * @constructor
2974
+ * @param {String} id the id of the element that is a drop target
2975
+ * @param {String} sGroup the group of related DragDrop objects
2976
+ * @param {object} config an object containing configurable attributes
2977
+ * Valid properties for DDTarget in addition to those in
2978
+ * DragDrop:
2979
+ * none
2980
+ */
2981
+ Ext.dd.DDTarget = function(id, sGroup, config) {
2982
+ if (id) {
2983
+ this.initTarget(id, sGroup, config);
2984
+ }
2985
+ };
2986
+
2987
+ // Ext.dd.DDTarget.prototype = new Ext.dd.DragDrop();
2988
+ Ext.extend(Ext.dd.DDTarget, Ext.dd.DragDrop, {
2989
+ toString: function() {
2990
+ return ("DDTarget " + this.id);
2991
+ }
2992
+ });
2993
+ /**
2994
+ * @class Ext.dd.DragTracker
2995
+ * @extends Ext.util.Observable
2996
+ */
2997
+ Ext.dd.DragTracker = function(config){
2998
+ Ext.apply(this, config);
2999
+ this.addEvents(
3000
+ /**
3001
+ * @event mousedown
3002
+ * @param {Object} this
3003
+ * @param {Object} e event object
3004
+ */
3005
+ 'mousedown',
3006
+ /**
3007
+ * @event mouseup
3008
+ * @param {Object} this
3009
+ * @param {Object} e event object
3010
+ */
3011
+ 'mouseup',
3012
+ /**
3013
+ * @event mousemove
3014
+ * @param {Object} this
3015
+ * @param {Object} e event object
3016
+ */
3017
+ 'mousemove',
3018
+ /**
3019
+ * @event dragstart
3020
+ * @param {Object} this
3021
+ * @param {Object} startXY the page coordinates of the event
3022
+ */
3023
+ 'dragstart',
3024
+ /**
3025
+ * @event dragend
3026
+ * @param {Object} this
3027
+ * @param {Object} e event object
3028
+ */
3029
+ 'dragend',
3030
+ /**
3031
+ * @event drag
3032
+ * @param {Object} this
3033
+ * @param {Object} e event object
3034
+ */
3035
+ 'drag'
3036
+ );
3037
+
3038
+ this.dragRegion = new Ext.lib.Region(0,0,0,0);
3039
+
3040
+ if(this.el){
3041
+ this.initEl(this.el);
3042
+ }
3043
+ }
3044
+
3045
+ Ext.extend(Ext.dd.DragTracker, Ext.util.Observable, {
3046
+ /**
3047
+ * @cfg {Boolean} active
3048
+ * Defaults to <tt>false</tt>.
3049
+ */
3050
+ active: false,
3051
+ /**
3052
+ * @cfg {Number} tolerance
3053
+ * Defaults to <tt>5</tt>.
3054
+ */
3055
+ tolerance: 5,
3056
+ /**
3057
+ * @cfg {Boolean/Number} autoStart
3058
+ * Defaults to <tt>false</tt>. Specify <tt>true</tt> to defer trigger start by 1000 ms.
3059
+ * Specify a Number for the number of milliseconds to defer trigger start.
3060
+ */
3061
+ autoStart: false,
3062
+
3063
+ initEl: function(el){
3064
+ this.el = Ext.get(el);
3065
+ el.on('mousedown', this.onMouseDown, this,
3066
+ this.delegate ? {delegate: this.delegate} : undefined);
3067
+ },
3068
+
3069
+ destroy : function(){
3070
+ this.el.un('mousedown', this.onMouseDown, this);
3071
+ },
3072
+
3073
+ onMouseDown: function(e, target){
3074
+ if(this.fireEvent('mousedown', this, e) !== false && this.onBeforeStart(e) !== false){
3075
+ this.startXY = this.lastXY = e.getXY();
3076
+ this.dragTarget = this.delegate ? target : this.el.dom;
3077
+ if(this.preventDefault !== false){
3078
+ e.preventDefault();
3079
+ }
3080
+ var doc = Ext.getDoc();
3081
+ doc.on('mouseup', this.onMouseUp, this);
3082
+ doc.on('mousemove', this.onMouseMove, this);
3083
+ doc.on('selectstart', this.stopSelect, this);
3084
+ if(this.autoStart){
3085
+ this.timer = this.triggerStart.defer(this.autoStart === true ? 1000 : this.autoStart, this);
3086
+ }
3087
+ }
3088
+ },
3089
+
3090
+ onMouseMove: function(e, target){
3091
+ // HACK: IE hack to see if button was released outside of window. */
3092
+ if(this.active && Ext.isIE && !e.browserEvent.button){
3093
+ e.preventDefault();
3094
+ this.onMouseUp(e);
3095
+ return;
3096
+ }
3097
+
3098
+ e.preventDefault();
3099
+ var xy = e.getXY(), s = this.startXY;
3100
+ this.lastXY = xy;
3101
+ if(!this.active){
3102
+ if(Math.abs(s[0]-xy[0]) > this.tolerance || Math.abs(s[1]-xy[1]) > this.tolerance){
3103
+ this.triggerStart();
3104
+ }else{
3105
+ return;
3106
+ }
3107
+ }
3108
+ this.fireEvent('mousemove', this, e);
3109
+ this.onDrag(e);
3110
+ this.fireEvent('drag', this, e);
3111
+ },
3112
+
3113
+ onMouseUp: function(e){
3114
+ var doc = Ext.getDoc();
3115
+ doc.un('mousemove', this.onMouseMove, this);
3116
+ doc.un('mouseup', this.onMouseUp, this);
3117
+ doc.un('selectstart', this.stopSelect, this);
3118
+ e.preventDefault();
3119
+ this.clearStart();
3120
+ var wasActive = this.active;
3121
+ this.active = false;
3122
+ delete this.elRegion;
3123
+ this.fireEvent('mouseup', this, e);
3124
+ if(wasActive){
3125
+ this.onEnd(e);
3126
+ this.fireEvent('dragend', this, e);
3127
+ }
3128
+ },
3129
+
3130
+ triggerStart: function(isTimer){
3131
+ this.clearStart();
3132
+ this.active = true;
3133
+ this.onStart(this.startXY);
3134
+ this.fireEvent('dragstart', this, this.startXY);
3135
+ },
3136
+
3137
+ clearStart : function(){
3138
+ if(this.timer){
3139
+ clearTimeout(this.timer);
3140
+ delete this.timer;
3141
+ }
3142
+ },
3143
+
3144
+ stopSelect : function(e){
3145
+ e.stopEvent();
3146
+ return false;
3147
+ },
3148
+
3149
+ onBeforeStart : function(e){
3150
+
3151
+ },
3152
+
3153
+ onStart : function(xy){
3154
+
3155
+ },
3156
+
3157
+ onDrag : function(e){
3158
+
3159
+ },
3160
+
3161
+ onEnd : function(e){
3162
+
3163
+ },
3164
+
3165
+ getDragTarget : function(){
3166
+ return this.dragTarget;
3167
+ },
3168
+
3169
+ getDragCt : function(){
3170
+ return this.el;
3171
+ },
3172
+
3173
+ getXY : function(constrain){
3174
+ return constrain ?
3175
+ this.constrainModes[constrain].call(this, this.lastXY) : this.lastXY;
3176
+ },
3177
+
3178
+ getOffset : function(constrain){
3179
+ var xy = this.getXY(constrain);
3180
+ var s = this.startXY;
3181
+ return [s[0]-xy[0], s[1]-xy[1]];
3182
+ },
3183
+
3184
+ constrainModes: {
3185
+ 'point' : function(xy){
3186
+
3187
+ if(!this.elRegion){
3188
+ this.elRegion = this.getDragCt().getRegion();
3189
+ }
3190
+
3191
+ var dr = this.dragRegion;
3192
+
3193
+ dr.left = xy[0];
3194
+ dr.top = xy[1];
3195
+ dr.right = xy[0];
3196
+ dr.bottom = xy[1];
3197
+
3198
+ dr.constrainTo(this.elRegion);
3199
+
3200
+ return [dr.left, dr.top];
3201
+ }
3202
+ }
3203
+ });/**
3204
+ * @class Ext.dd.ScrollManager
3205
+ * <p>Provides automatic scrolling of overflow regions in the page during drag operations.</p>
3206
+ * <p>The ScrollManager configs will be used as the defaults for any scroll container registered with it,
3207
+ * but you can also override most of the configs per scroll container by adding a
3208
+ * <tt>ddScrollConfig</tt> object to the target element that contains these properties: {@link #hthresh},
3209
+ * {@link #vthresh}, {@link #increment} and {@link #frequency}. Example usage:
3210
+ * <pre><code>
3211
+ var el = Ext.get('scroll-ct');
3212
+ el.ddScrollConfig = {
3213
+ vthresh: 50,
3214
+ hthresh: -1,
3215
+ frequency: 100,
3216
+ increment: 200
3217
+ };
3218
+ Ext.dd.ScrollManager.register(el);
3219
+ </code></pre>
3220
+ * <b>Note: This class uses "Point Mode" and is untested in "Intersect Mode".</b>
3221
+ * @singleton
3222
+ */
3223
+ Ext.dd.ScrollManager = function(){
3224
+ var ddm = Ext.dd.DragDropMgr;
3225
+ var els = {};
3226
+ var dragEl = null;
3227
+ var proc = {};
3228
+
3229
+ var onStop = function(e){
3230
+ dragEl = null;
3231
+ clearProc();
3232
+ };
3233
+
3234
+ var triggerRefresh = function(){
3235
+ if(ddm.dragCurrent){
3236
+ ddm.refreshCache(ddm.dragCurrent.groups);
3237
+ }
3238
+ };
3239
+
3240
+ var doScroll = function(){
3241
+ if(ddm.dragCurrent){
3242
+ var dds = Ext.dd.ScrollManager;
3243
+ var inc = proc.el.ddScrollConfig ?
3244
+ proc.el.ddScrollConfig.increment : dds.increment;
3245
+ if(!dds.animate){
3246
+ if(proc.el.scroll(proc.dir, inc)){
3247
+ triggerRefresh();
3248
+ }
3249
+ }else{
3250
+ proc.el.scroll(proc.dir, inc, true, dds.animDuration, triggerRefresh);
3251
+ }
3252
+ }
3253
+ };
3254
+
3255
+ var clearProc = function(){
3256
+ if(proc.id){
3257
+ clearInterval(proc.id);
3258
+ }
3259
+ proc.id = 0;
3260
+ proc.el = null;
3261
+ proc.dir = "";
3262
+ };
3263
+
3264
+ var startProc = function(el, dir){
3265
+ clearProc();
3266
+ proc.el = el;
3267
+ proc.dir = dir;
3268
+ var freq = (el.ddScrollConfig && el.ddScrollConfig.frequency) ?
3269
+ el.ddScrollConfig.frequency : Ext.dd.ScrollManager.frequency;
3270
+ proc.id = setInterval(doScroll, freq);
3271
+ };
3272
+
3273
+ var onFire = function(e, isDrop){
3274
+ if(isDrop || !ddm.dragCurrent){ return; }
3275
+ var dds = Ext.dd.ScrollManager;
3276
+ if(!dragEl || dragEl != ddm.dragCurrent){
3277
+ dragEl = ddm.dragCurrent;
3278
+ // refresh regions on drag start
3279
+ dds.refreshCache();
3280
+ }
3281
+
3282
+ var xy = Ext.lib.Event.getXY(e);
3283
+ var pt = new Ext.lib.Point(xy[0], xy[1]);
3284
+ for(var id in els){
3285
+ var el = els[id], r = el._region;
3286
+ var c = el.ddScrollConfig ? el.ddScrollConfig : dds;
3287
+ if(r && r.contains(pt) && el.isScrollable()){
3288
+ if(r.bottom - pt.y <= c.vthresh){
3289
+ if(proc.el != el){
3290
+ startProc(el, "down");
3291
+ }
3292
+ return;
3293
+ }else if(r.right - pt.x <= c.hthresh){
3294
+ if(proc.el != el){
3295
+ startProc(el, "left");
3296
+ }
3297
+ return;
3298
+ }else if(pt.y - r.top <= c.vthresh){
3299
+ if(proc.el != el){
3300
+ startProc(el, "up");
3301
+ }
3302
+ return;
3303
+ }else if(pt.x - r.left <= c.hthresh){
3304
+ if(proc.el != el){
3305
+ startProc(el, "right");
3306
+ }
3307
+ return;
3308
+ }
3309
+ }
3310
+ }
3311
+ clearProc();
3312
+ };
3313
+
3314
+ ddm.fireEvents = ddm.fireEvents.createSequence(onFire, ddm);
3315
+ ddm.stopDrag = ddm.stopDrag.createSequence(onStop, ddm);
3316
+
3317
+ return {
3318
+ /**
3319
+ * Registers new overflow element(s) to auto scroll
3320
+ * @param {Mixed/Array} el The id of or the element to be scrolled or an array of either
3321
+ */
3322
+ register : function(el){
3323
+ if(Ext.isArray(el)){
3324
+ for(var i = 0, len = el.length; i < len; i++) {
3325
+ this.register(el[i]);
3326
+ }
3327
+ }else{
3328
+ el = Ext.get(el);
3329
+ els[el.id] = el;
3330
+ }
3331
+ },
3332
+
3333
+ /**
3334
+ * Unregisters overflow element(s) so they are no longer scrolled
3335
+ * @param {Mixed/Array} el The id of or the element to be removed or an array of either
3336
+ */
3337
+ unregister : function(el){
3338
+ if(Ext.isArray(el)){
3339
+ for(var i = 0, len = el.length; i < len; i++) {
3340
+ this.unregister(el[i]);
3341
+ }
3342
+ }else{
3343
+ el = Ext.get(el);
3344
+ delete els[el.id];
3345
+ }
3346
+ },
3347
+
3348
+ /**
3349
+ * The number of pixels from the top or bottom edge of a container the pointer needs to be to
3350
+ * trigger scrolling (defaults to 25)
3351
+ * @type Number
3352
+ */
3353
+ vthresh : 25,
3354
+ /**
3355
+ * The number of pixels from the right or left edge of a container the pointer needs to be to
3356
+ * trigger scrolling (defaults to 25)
3357
+ * @type Number
3358
+ */
3359
+ hthresh : 25,
3360
+
3361
+ /**
3362
+ * The number of pixels to scroll in each scroll increment (defaults to 50)
3363
+ * @type Number
3364
+ */
3365
+ increment : 100,
3366
+
3367
+ /**
3368
+ * The frequency of scrolls in milliseconds (defaults to 500)
3369
+ * @type Number
3370
+ */
3371
+ frequency : 500,
3372
+
3373
+ /**
3374
+ * True to animate the scroll (defaults to true)
3375
+ * @type Boolean
3376
+ */
3377
+ animate: true,
3378
+
3379
+ /**
3380
+ * The animation duration in seconds -
3381
+ * MUST BE less than Ext.dd.ScrollManager.frequency! (defaults to .4)
3382
+ * @type Number
3383
+ */
3384
+ animDuration: .4,
3385
+
3386
+ /**
3387
+ * Manually trigger a cache refresh.
3388
+ */
3389
+ refreshCache : function(){
3390
+ for(var id in els){
3391
+ if(typeof els[id] == 'object'){ // for people extending the object prototype
3392
+ els[id]._region = els[id].getRegion();
3393
+ }
3394
+ }
3395
+ }
3396
+ };
3397
+ }();/**
3398
+ * @class Ext.dd.Registry
3399
+ * Provides easy access to all drag drop components that are registered on a page. Items can be retrieved either
3400
+ * directly by DOM node id, or by passing in the drag drop event that occurred and looking up the event target.
3401
+ * @singleton
3402
+ */
3403
+ Ext.dd.Registry = function(){
3404
+ var elements = {};
3405
+ var handles = {};
3406
+ var autoIdSeed = 0;
3407
+
3408
+ var getId = function(el, autogen){
3409
+ if(typeof el == "string"){
3410
+ return el;
3411
+ }
3412
+ var id = el.id;
3413
+ if(!id && autogen !== false){
3414
+ id = "extdd-" + (++autoIdSeed);
3415
+ el.id = id;
3416
+ }
3417
+ return id;
3418
+ };
3419
+
3420
+ return {
3421
+ /**
3422
+ * Resgister a drag drop element
3423
+ * @param {String/HTMLElement) element The id or DOM node to register
3424
+ * @param {Object} data (optional) An custom data object that will be passed between the elements that are involved
3425
+ * in drag drop operations. You can populate this object with any arbitrary properties that your own code
3426
+ * knows how to interpret, plus there are some specific properties known to the Registry that should be
3427
+ * populated in the data object (if applicable):
3428
+ * <pre>
3429
+ Value Description<br />
3430
+ --------- ------------------------------------------<br />
3431
+ handles Array of DOM nodes that trigger dragging<br />
3432
+ for the element being registered<br />
3433
+ isHandle True if the element passed in triggers<br />
3434
+ dragging itself, else false
3435
+ </pre>
3436
+ */
3437
+ register : function(el, data){
3438
+ data = data || {};
3439
+ if(typeof el == "string"){
3440
+ el = document.getElementById(el);
3441
+ }
3442
+ data.ddel = el;
3443
+ elements[getId(el)] = data;
3444
+ if(data.isHandle !== false){
3445
+ handles[data.ddel.id] = data;
3446
+ }
3447
+ if(data.handles){
3448
+ var hs = data.handles;
3449
+ for(var i = 0, len = hs.length; i < len; i++){
3450
+ handles[getId(hs[i])] = data;
3451
+ }
3452
+ }
3453
+ },
3454
+
3455
+ /**
3456
+ * Unregister a drag drop element
3457
+ * @param {String/HTMLElement) element The id or DOM node to unregister
3458
+ */
3459
+ unregister : function(el){
3460
+ var id = getId(el, false);
3461
+ var data = elements[id];
3462
+ if(data){
3463
+ delete elements[id];
3464
+ if(data.handles){
3465
+ var hs = data.handles;
3466
+ for(var i = 0, len = hs.length; i < len; i++){
3467
+ delete handles[getId(hs[i], false)];
3468
+ }
3469
+ }
3470
+ }
3471
+ },
3472
+
3473
+ /**
3474
+ * Returns the handle registered for a DOM Node by id
3475
+ * @param {String/HTMLElement} id The DOM node or id to look up
3476
+ * @return {Object} handle The custom handle data
3477
+ */
3478
+ getHandle : function(id){
3479
+ if(typeof id != "string"){ // must be element?
3480
+ id = id.id;
3481
+ }
3482
+ return handles[id];
3483
+ },
3484
+
3485
+ /**
3486
+ * Returns the handle that is registered for the DOM node that is the target of the event
3487
+ * @param {Event} e The event
3488
+ * @return {Object} handle The custom handle data
3489
+ */
3490
+ getHandleFromEvent : function(e){
3491
+ var t = Ext.lib.Event.getTarget(e);
3492
+ return t ? handles[t.id] : null;
3493
+ },
3494
+
3495
+ /**
3496
+ * Returns a custom data object that is registered for a DOM node by id
3497
+ * @param {String/HTMLElement} id The DOM node or id to look up
3498
+ * @return {Object} data The custom data
3499
+ */
3500
+ getTarget : function(id){
3501
+ if(typeof id != "string"){ // must be element?
3502
+ id = id.id;
3503
+ }
3504
+ return elements[id];
3505
+ },
3506
+
3507
+ /**
3508
+ * Returns a custom data object that is registered for the DOM node that is the target of the event
3509
+ * @param {Event} e The event
3510
+ * @return {Object} data The custom data
3511
+ */
3512
+ getTargetFromEvent : function(e){
3513
+ var t = Ext.lib.Event.getTarget(e);
3514
+ return t ? elements[t.id] || handles[t.id] : null;
3515
+ }
3516
+ };
3517
+ }();/**
3518
+ * @class Ext.dd.StatusProxy
3519
+ * A specialized drag proxy that supports a drop status icon, {@link Ext.Layer} styles and auto-repair. This is the
3520
+ * default drag proxy used by all Ext.dd components.
3521
+ * @constructor
3522
+ * @param {Object} config
3523
+ */
3524
+ Ext.dd.StatusProxy = function(config){
3525
+ Ext.apply(this, config);
3526
+ this.id = this.id || Ext.id();
3527
+ this.el = new Ext.Layer({
3528
+ dh: {
3529
+ id: this.id, tag: "div", cls: "x-dd-drag-proxy "+this.dropNotAllowed, children: [
3530
+ {tag: "div", cls: "x-dd-drop-icon"},
3531
+ {tag: "div", cls: "x-dd-drag-ghost"}
3532
+ ]
3533
+ },
3534
+ shadow: !config || config.shadow !== false
3535
+ });
3536
+ this.ghost = Ext.get(this.el.dom.childNodes[1]);
3537
+ this.dropStatus = this.dropNotAllowed;
3538
+ };
3539
+
3540
+ Ext.dd.StatusProxy.prototype = {
3541
+ /**
3542
+ * @cfg {String} dropAllowed
3543
+ * The CSS class to apply to the status element when drop is allowed (defaults to "x-dd-drop-ok").
3544
+ */
3545
+ dropAllowed : "x-dd-drop-ok",
3546
+ /**
3547
+ * @cfg {String} dropNotAllowed
3548
+ * The CSS class to apply to the status element when drop is not allowed (defaults to "x-dd-drop-nodrop").
3549
+ */
3550
+ dropNotAllowed : "x-dd-drop-nodrop",
3551
+
3552
+ /**
3553
+ * Updates the proxy's visual element to indicate the status of whether or not drop is allowed
3554
+ * over the current target element.
3555
+ * @param {String} cssClass The css class for the new drop status indicator image
3556
+ */
3557
+ setStatus : function(cssClass){
3558
+ cssClass = cssClass || this.dropNotAllowed;
3559
+ if(this.dropStatus != cssClass){
3560
+ this.el.replaceClass(this.dropStatus, cssClass);
3561
+ this.dropStatus = cssClass;
3562
+ }
3563
+ },
3564
+
3565
+ /**
3566
+ * Resets the status indicator to the default dropNotAllowed value
3567
+ * @param {Boolean} clearGhost True to also remove all content from the ghost, false to preserve it
3568
+ */
3569
+ reset : function(clearGhost){
3570
+ this.el.dom.className = "x-dd-drag-proxy " + this.dropNotAllowed;
3571
+ this.dropStatus = this.dropNotAllowed;
3572
+ if(clearGhost){
3573
+ this.ghost.update("");
3574
+ }
3575
+ },
3576
+
3577
+ /**
3578
+ * Updates the contents of the ghost element
3579
+ * @param {String/HTMLElement} html The html that will replace the current innerHTML of the ghost element, or a
3580
+ * DOM node to append as the child of the ghost element (in which case the innerHTML will be cleared first).
3581
+ */
3582
+ update : function(html){
3583
+ if(typeof html == "string"){
3584
+ this.ghost.update(html);
3585
+ }else{
3586
+ this.ghost.update("");
3587
+ html.style.margin = "0";
3588
+ this.ghost.dom.appendChild(html);
3589
+ }
3590
+ var el = this.ghost.dom.firstChild;
3591
+ if(el){
3592
+ Ext.fly(el).setStyle('float', 'none');
3593
+ }
3594
+ },
3595
+
3596
+ /**
3597
+ * Returns the underlying proxy {@link Ext.Layer}
3598
+ * @return {Ext.Layer} el
3599
+ */
3600
+ getEl : function(){
3601
+ return this.el;
3602
+ },
3603
+
3604
+ /**
3605
+ * Returns the ghost element
3606
+ * @return {Ext.Element} el
3607
+ */
3608
+ getGhost : function(){
3609
+ return this.ghost;
3610
+ },
3611
+
3612
+ /**
3613
+ * Hides the proxy
3614
+ * @param {Boolean} clear True to reset the status and clear the ghost contents, false to preserve them
3615
+ */
3616
+ hide : function(clear){
3617
+ this.el.hide();
3618
+ if(clear){
3619
+ this.reset(true);
3620
+ }
3621
+ },
3622
+
3623
+ /**
3624
+ * Stops the repair animation if it's currently running
3625
+ */
3626
+ stop : function(){
3627
+ if(this.anim && this.anim.isAnimated && this.anim.isAnimated()){
3628
+ this.anim.stop();
3629
+ }
3630
+ },
3631
+
3632
+ /**
3633
+ * Displays this proxy
3634
+ */
3635
+ show : function(){
3636
+ this.el.show();
3637
+ },
3638
+
3639
+ /**
3640
+ * Force the Layer to sync its shadow and shim positions to the element
3641
+ */
3642
+ sync : function(){
3643
+ this.el.sync();
3644
+ },
3645
+
3646
+ /**
3647
+ * Causes the proxy to return to its position of origin via an animation. Should be called after an
3648
+ * invalid drop operation by the item being dragged.
3649
+ * @param {Array} xy The XY position of the element ([x, y])
3650
+ * @param {Function} callback The function to call after the repair is complete
3651
+ * @param {Object} scope The scope in which to execute the callback
3652
+ */
3653
+ repair : function(xy, callback, scope){
3654
+ this.callback = callback;
3655
+ this.scope = scope;
3656
+ if(xy && this.animRepair !== false){
3657
+ this.el.addClass("x-dd-drag-repair");
3658
+ this.el.hideUnders(true);
3659
+ this.anim = this.el.shift({
3660
+ duration: this.repairDuration || .5,
3661
+ easing: 'easeOut',
3662
+ xy: xy,
3663
+ stopFx: true,
3664
+ callback: this.afterRepair,
3665
+ scope: this
3666
+ });
3667
+ }else{
3668
+ this.afterRepair();
3669
+ }
3670
+ },
3671
+
3672
+ // private
3673
+ afterRepair : function(){
3674
+ this.hide(true);
3675
+ if(typeof this.callback == "function"){
3676
+ this.callback.call(this.scope || this);
3677
+ }
3678
+ this.callback = null;
3679
+ this.scope = null;
3680
+ }
3681
+ };/**
3682
+ * @class Ext.dd.DragSource
3683
+ * @extends Ext.dd.DDProxy
3684
+ * A simple class that provides the basic implementation needed to make any element draggable.
3685
+ * @constructor
3686
+ * @param {Mixed} el The container element
3687
+ * @param {Object} config
3688
+ */
3689
+ Ext.dd.DragSource = function(el, config){
3690
+ this.el = Ext.get(el);
3691
+ if(!this.dragData){
3692
+ this.dragData = {};
3693
+ }
3694
+
3695
+ Ext.apply(this, config);
3696
+
3697
+ if(!this.proxy){
3698
+ this.proxy = new Ext.dd.StatusProxy();
3699
+ }
3700
+ Ext.dd.DragSource.superclass.constructor.call(this, this.el.dom, this.ddGroup || this.group,
3701
+ {dragElId : this.proxy.id, resizeFrame: false, isTarget: false, scroll: this.scroll === true});
3702
+
3703
+ this.dragging = false;
3704
+ };
3705
+
3706
+ Ext.extend(Ext.dd.DragSource, Ext.dd.DDProxy, {
3707
+ /**
3708
+ * @cfg {String} ddGroup
3709
+ * A named drag drop group to which this object belongs. If a group is specified, then this object will only
3710
+ * interact with other drag drop objects in the same group (defaults to undefined).
3711
+ */
3712
+ /**
3713
+ * @cfg {String} dropAllowed
3714
+ * The CSS class returned to the drag source when drop is allowed (defaults to "x-dd-drop-ok").
3715
+ */
3716
+ dropAllowed : "x-dd-drop-ok",
3717
+ /**
3718
+ * @cfg {String} dropNotAllowed
3719
+ * The CSS class returned to the drag source when drop is not allowed (defaults to "x-dd-drop-nodrop").
3720
+ */
3721
+ dropNotAllowed : "x-dd-drop-nodrop",
3722
+
3723
+ /**
3724
+ * Returns the data object associated with this drag source
3725
+ * @return {Object} data An object containing arbitrary data
3726
+ */
3727
+ getDragData : function(e){
3728
+ return this.dragData;
3729
+ },
3730
+
3731
+ // private
3732
+ onDragEnter : function(e, id){
3733
+ var target = Ext.dd.DragDropMgr.getDDById(id);
3734
+ this.cachedTarget = target;
3735
+ if(this.beforeDragEnter(target, e, id) !== false){
3736
+ if(target.isNotifyTarget){
3737
+ var status = target.notifyEnter(this, e, this.dragData);
3738
+ this.proxy.setStatus(status);
3739
+ }else{
3740
+ this.proxy.setStatus(this.dropAllowed);
3741
+ }
3742
+
3743
+ if(this.afterDragEnter){
3744
+ /**
3745
+ * An empty function by default, but provided so that you can perform a custom action
3746
+ * when the dragged item enters the drop target by providing an implementation.
3747
+ * @param {Ext.dd.DragDrop} target The drop target
3748
+ * @param {Event} e The event object
3749
+ * @param {String} id The id of the dragged element
3750
+ * @method afterDragEnter
3751
+ */
3752
+ this.afterDragEnter(target, e, id);
3753
+ }
3754
+ }
3755
+ },
3756
+
3757
+ /**
3758
+ * An empty function by default, but provided so that you can perform a custom action
3759
+ * before the dragged item enters the drop target and optionally cancel the onDragEnter.
3760
+ * @param {Ext.dd.DragDrop} target The drop target
3761
+ * @param {Event} e The event object
3762
+ * @param {String} id The id of the dragged element
3763
+ * @return {Boolean} isValid True if the drag event is valid, else false to cancel
3764
+ */
3765
+ beforeDragEnter : function(target, e, id){
3766
+ return true;
3767
+ },
3768
+
3769
+ // private
3770
+ alignElWithMouse: function() {
3771
+ Ext.dd.DragSource.superclass.alignElWithMouse.apply(this, arguments);
3772
+ this.proxy.sync();
3773
+ },
3774
+
3775
+ // private
3776
+ onDragOver : function(e, id){
3777
+ var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id);
3778
+ if(this.beforeDragOver(target, e, id) !== false){
3779
+ if(target.isNotifyTarget){
3780
+ var status = target.notifyOver(this, e, this.dragData);
3781
+ this.proxy.setStatus(status);
3782
+ }
3783
+
3784
+ if(this.afterDragOver){
3785
+ /**
3786
+ * An empty function by default, but provided so that you can perform a custom action
3787
+ * while the dragged item is over the drop target by providing an implementation.
3788
+ * @param {Ext.dd.DragDrop} target The drop target
3789
+ * @param {Event} e The event object
3790
+ * @param {String} id The id of the dragged element
3791
+ * @method afterDragOver
3792
+ */
3793
+ this.afterDragOver(target, e, id);
3794
+ }
3795
+ }
3796
+ },
3797
+
3798
+ /**
3799
+ * An empty function by default, but provided so that you can perform a custom action
3800
+ * while the dragged item is over the drop target and optionally cancel the onDragOver.
3801
+ * @param {Ext.dd.DragDrop} target The drop target
3802
+ * @param {Event} e The event object
3803
+ * @param {String} id The id of the dragged element
3804
+ * @return {Boolean} isValid True if the drag event is valid, else false to cancel
3805
+ */
3806
+ beforeDragOver : function(target, e, id){
3807
+ return true;
3808
+ },
3809
+
3810
+ // private
3811
+ onDragOut : function(e, id){
3812
+ var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id);
3813
+ if(this.beforeDragOut(target, e, id) !== false){
3814
+ if(target.isNotifyTarget){
3815
+ target.notifyOut(this, e, this.dragData);
3816
+ }
3817
+ this.proxy.reset();
3818
+ if(this.afterDragOut){
3819
+ /**
3820
+ * An empty function by default, but provided so that you can perform a custom action
3821
+ * after the dragged item is dragged out of the target without dropping.
3822
+ * @param {Ext.dd.DragDrop} target The drop target
3823
+ * @param {Event} e The event object
3824
+ * @param {String} id The id of the dragged element
3825
+ * @method afterDragOut
3826
+ */
3827
+ this.afterDragOut(target, e, id);
3828
+ }
3829
+ }
3830
+ this.cachedTarget = null;
3831
+ },
3832
+
3833
+ /**
3834
+ * An empty function by default, but provided so that you can perform a custom action before the dragged
3835
+ * item is dragged out of the target without dropping, and optionally cancel the onDragOut.
3836
+ * @param {Ext.dd.DragDrop} target The drop target
3837
+ * @param {Event} e The event object
3838
+ * @param {String} id The id of the dragged element
3839
+ * @return {Boolean} isValid True if the drag event is valid, else false to cancel
3840
+ */
3841
+ beforeDragOut : function(target, e, id){
3842
+ return true;
3843
+ },
3844
+
3845
+ // private
3846
+ onDragDrop : function(e, id){
3847
+ var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id);
3848
+ if(this.beforeDragDrop(target, e, id) !== false){
3849
+ if(target.isNotifyTarget){
3850
+ if(target.notifyDrop(this, e, this.dragData)){ // valid drop?
3851
+ this.onValidDrop(target, e, id);
3852
+ }else{
3853
+ this.onInvalidDrop(target, e, id);
3854
+ }
3855
+ }else{
3856
+ this.onValidDrop(target, e, id);
3857
+ }
3858
+
3859
+ if(this.afterDragDrop){
3860
+ /**
3861
+ * An empty function by default, but provided so that you can perform a custom action
3862
+ * after a valid drag drop has occurred by providing an implementation.
3863
+ * @param {Ext.dd.DragDrop} target The drop target
3864
+ * @param {Event} e The event object
3865
+ * @param {String} id The id of the dropped element
3866
+ * @method afterDragDrop
3867
+ */
3868
+ this.afterDragDrop(target, e, id);
3869
+ }
3870
+ }
3871
+ delete this.cachedTarget;
3872
+ },
3873
+
3874
+ /**
3875
+ * An empty function by default, but provided so that you can perform a custom action before the dragged
3876
+ * item is dropped onto the target and optionally cancel the onDragDrop.
3877
+ * @param {Ext.dd.DragDrop} target The drop target
3878
+ * @param {Event} e The event object
3879
+ * @param {String} id The id of the dragged element
3880
+ * @return {Boolean} isValid True if the drag drop event is valid, else false to cancel
3881
+ */
3882
+ beforeDragDrop : function(target, e, id){
3883
+ return true;
3884
+ },
3885
+
3886
+ // private
3887
+ onValidDrop : function(target, e, id){
3888
+ this.hideProxy();
3889
+ if(this.afterValidDrop){
3890
+ /**
3891
+ * An empty function by default, but provided so that you can perform a custom action
3892
+ * after a valid drop has occurred by providing an implementation.
3893
+ * @param {Object} target The target DD
3894
+ * @param {Event} e The event object
3895
+ * @param {String} id The id of the dropped element
3896
+ * @method afterInvalidDrop
3897
+ */
3898
+ this.afterValidDrop(target, e, id);
3899
+ }
3900
+ },
3901
+
3902
+ // private
3903
+ getRepairXY : function(e, data){
3904
+ return this.el.getXY();
3905
+ },
3906
+
3907
+ // private
3908
+ onInvalidDrop : function(target, e, id){
3909
+ this.beforeInvalidDrop(target, e, id);
3910
+ if(this.cachedTarget){
3911
+ if(this.cachedTarget.isNotifyTarget){
3912
+ this.cachedTarget.notifyOut(this, e, this.dragData);
3913
+ }
3914
+ this.cacheTarget = null;
3915
+ }
3916
+ this.proxy.repair(this.getRepairXY(e, this.dragData), this.afterRepair, this);
3917
+
3918
+ if(this.afterInvalidDrop){
3919
+ /**
3920
+ * An empty function by default, but provided so that you can perform a custom action
3921
+ * after an invalid drop has occurred by providing an implementation.
3922
+ * @param {Event} e The event object
3923
+ * @param {String} id The id of the dropped element
3924
+ * @method afterInvalidDrop
3925
+ */
3926
+ this.afterInvalidDrop(e, id);
3927
+ }
3928
+ },
3929
+
3930
+ // private
3931
+ afterRepair : function(){
3932
+ if(Ext.enableFx){
3933
+ this.el.highlight(this.hlColor || "c3daf9");
3934
+ }
3935
+ this.dragging = false;
3936
+ },
3937
+
3938
+ /**
3939
+ * An empty function by default, but provided so that you can perform a custom action after an invalid
3940
+ * drop has occurred.
3941
+ * @param {Ext.dd.DragDrop} target The drop target
3942
+ * @param {Event} e The event object
3943
+ * @param {String} id The id of the dragged element
3944
+ * @return {Boolean} isValid True if the invalid drop should proceed, else false to cancel
3945
+ */
3946
+ beforeInvalidDrop : function(target, e, id){
3947
+ return true;
3948
+ },
3949
+
3950
+ // private
3951
+ handleMouseDown : function(e){
3952
+ if(this.dragging) {
3953
+ return;
3954
+ }
3955
+ var data = this.getDragData(e);
3956
+ if(data && this.onBeforeDrag(data, e) !== false){
3957
+ this.dragData = data;
3958
+ this.proxy.stop();
3959
+ Ext.dd.DragSource.superclass.handleMouseDown.apply(this, arguments);
3960
+ }
3961
+ },
3962
+
3963
+ /**
3964
+ * An empty function by default, but provided so that you can perform a custom action before the initial
3965
+ * drag event begins and optionally cancel it.
3966
+ * @param {Object} data An object containing arbitrary data to be shared with drop targets
3967
+ * @param {Event} e The event object
3968
+ * @return {Boolean} isValid True if the drag event is valid, else false to cancel
3969
+ */
3970
+ onBeforeDrag : function(data, e){
3971
+ return true;
3972
+ },
3973
+
3974
+ /**
3975
+ * An empty function by default, but provided so that you can perform a custom action once the initial
3976
+ * drag event has begun. The drag cannot be canceled from this function.
3977
+ * @param {Number} x The x position of the click on the dragged object
3978
+ * @param {Number} y The y position of the click on the dragged object
3979
+ */
3980
+ onStartDrag : Ext.emptyFn,
3981
+
3982
+ // private override
3983
+ startDrag : function(x, y){
3984
+ this.proxy.reset();
3985
+ this.dragging = true;
3986
+ this.proxy.update("");
3987
+ this.onInitDrag(x, y);
3988
+ this.proxy.show();
3989
+ },
3990
+
3991
+ // private
3992
+ onInitDrag : function(x, y){
3993
+ var clone = this.el.dom.cloneNode(true);
3994
+ clone.id = Ext.id(); // prevent duplicate ids
3995
+ this.proxy.update(clone);
3996
+ this.onStartDrag(x, y);
3997
+ return true;
3998
+ },
3999
+
4000
+ /**
4001
+ * Returns the drag source's underlying {@link Ext.dd.StatusProxy}
4002
+ * @return {Ext.dd.StatusProxy} proxy The StatusProxy
4003
+ */
4004
+ getProxy : function(){
4005
+ return this.proxy;
4006
+ },
4007
+
4008
+ /**
4009
+ * Hides the drag source's {@link Ext.dd.StatusProxy}
4010
+ */
4011
+ hideProxy : function(){
4012
+ this.proxy.hide();
4013
+ this.proxy.reset(true);
4014
+ this.dragging = false;
4015
+ },
4016
+
4017
+ // private
4018
+ triggerCacheRefresh : function(){
4019
+ Ext.dd.DDM.refreshCache(this.groups);
4020
+ },
4021
+
4022
+ // private - override to prevent hiding
4023
+ b4EndDrag: function(e) {
4024
+ },
4025
+
4026
+ // private - override to prevent moving
4027
+ endDrag : function(e){
4028
+ this.onEndDrag(this.dragData, e);
4029
+ },
4030
+
4031
+ // private
4032
+ onEndDrag : function(data, e){
4033
+ },
4034
+
4035
+ // private - pin to cursor
4036
+ autoOffset : function(x, y) {
4037
+ this.setDelta(-12, -20);
4038
+ }
4039
+ });/**
4040
+ * @class Ext.dd.DropTarget
4041
+ * @extends Ext.dd.DDTarget
4042
+ * A simple class that provides the basic implementation needed to make any element a drop target that can have
4043
+ * draggable items dropped onto it. The drop has no effect until an implementation of notifyDrop is provided.
4044
+ * @constructor
4045
+ * @param {Mixed} el The container element
4046
+ * @param {Object} config
4047
+ */
4048
+ Ext.dd.DropTarget = function(el, config){
4049
+ this.el = Ext.get(el);
4050
+
4051
+ Ext.apply(this, config);
4052
+
4053
+ if(this.containerScroll){
4054
+ Ext.dd.ScrollManager.register(this.el);
4055
+ }
4056
+
4057
+ Ext.dd.DropTarget.superclass.constructor.call(this, this.el.dom, this.ddGroup || this.group,
4058
+ {isTarget: true});
4059
+
4060
+ };
4061
+
4062
+ Ext.extend(Ext.dd.DropTarget, Ext.dd.DDTarget, {
4063
+ /**
4064
+ * @cfg {String} ddGroup
4065
+ * A named drag drop group to which this object belongs. If a group is specified, then this object will only
4066
+ * interact with other drag drop objects in the same group (defaults to undefined).
4067
+ */
4068
+ /**
4069
+ * @cfg {String} overClass
4070
+ * The CSS class applied to the drop target element while the drag source is over it (defaults to "").
4071
+ */
4072
+ /**
4073
+ * @cfg {String} dropAllowed
4074
+ * The CSS class returned to the drag source when drop is allowed (defaults to "x-dd-drop-ok").
4075
+ */
4076
+ dropAllowed : "x-dd-drop-ok",
4077
+ /**
4078
+ * @cfg {String} dropNotAllowed
4079
+ * The CSS class returned to the drag source when drop is not allowed (defaults to "x-dd-drop-nodrop").
4080
+ */
4081
+ dropNotAllowed : "x-dd-drop-nodrop",
4082
+
4083
+ // private
4084
+ isTarget : true,
4085
+
4086
+ // private
4087
+ isNotifyTarget : true,
4088
+
4089
+ /**
4090
+ * The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the source is now over the
4091
+ * target. This default implementation adds the CSS class specified by overClass (if any) to the drop element
4092
+ * and returns the dropAllowed config value. This method should be overridden if drop validation is required.
4093
+ * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
4094
+ * @param {Event} e The event
4095
+ * @param {Object} data An object containing arbitrary data supplied by the drag source
4096
+ * @return {String} status The CSS class that communicates the drop status back to the source so that the
4097
+ * underlying {@link Ext.dd.StatusProxy} can be updated
4098
+ */
4099
+ notifyEnter : function(dd, e, data){
4100
+ if(this.overClass){
4101
+ this.el.addClass(this.overClass);
4102
+ }
4103
+ return this.dropAllowed;
4104
+ },
4105
+
4106
+ /**
4107
+ * The function a {@link Ext.dd.DragSource} calls continuously while it is being dragged over the target.
4108
+ * This method will be called on every mouse movement while the drag source is over the drop target.
4109
+ * This default implementation simply returns the dropAllowed config value.
4110
+ * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
4111
+ * @param {Event} e The event
4112
+ * @param {Object} data An object containing arbitrary data supplied by the drag source
4113
+ * @return {String} status The CSS class that communicates the drop status back to the source so that the
4114
+ * underlying {@link Ext.dd.StatusProxy} can be updated
4115
+ */
4116
+ notifyOver : function(dd, e, data){
4117
+ return this.dropAllowed;
4118
+ },
4119
+
4120
+ /**
4121
+ * The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the source has been dragged
4122
+ * out of the target without dropping. This default implementation simply removes the CSS class specified by
4123
+ * overClass (if any) from the drop element.
4124
+ * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
4125
+ * @param {Event} e The event
4126
+ * @param {Object} data An object containing arbitrary data supplied by the drag source
4127
+ */
4128
+ notifyOut : function(dd, e, data){
4129
+ if(this.overClass){
4130
+ this.el.removeClass(this.overClass);
4131
+ }
4132
+ },
4133
+
4134
+ /**
4135
+ * The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the dragged item has
4136
+ * been dropped on it. This method has no default implementation and returns false, so you must provide an
4137
+ * implementation that does something to process the drop event and returns true so that the drag source's
4138
+ * repair action does not run.
4139
+ * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
4140
+ * @param {Event} e The event
4141
+ * @param {Object} data An object containing arbitrary data supplied by the drag source
4142
+ * @return {Boolean} True if the drop was valid, else false
4143
+ */
4144
+ notifyDrop : function(dd, e, data){
4145
+ return false;
4146
+ }
4147
+ });/**
4148
+ * @class Ext.dd.DragZone
4149
+ * @extends Ext.dd.DragSource
4150
+ * <p>This class provides a container DD instance that allows dragging of multiple child source nodes.</p>
4151
+ * <p>This class does not move the drag target nodes, but a proxy element which may contain
4152
+ * any DOM structure you wish. The DOM element to show in the proxy is provided by either a
4153
+ * provided implementation of {@link #getDragData}, or by registered draggables registered with {@link Ext.dd.Registry}</p>
4154
+ * <p>If you wish to provide draggability for an arbitrary number of DOM nodes, each of which represent some
4155
+ * application object (For example nodes in a {@link Ext.DataView DataView}) then use of this class
4156
+ * is the most efficient way to "activate" those nodes.</p>
4157
+ * <p>By default, this class requires that draggable child nodes are registered with {@link Ext.dd.Registry}.
4158
+ * However a simpler way to allow a DragZone to manage any number of draggable elements is to configure
4159
+ * the DragZone with an implementation of the {@link #getDragData} method which interrogates the passed
4160
+ * mouse event to see if it has taken place within an element, or class of elements. This is easily done
4161
+ * by using the event's {@link Ext.EventObject#getTarget getTarget} method to identify a node based on a
4162
+ * {@link Ext.DomQuery} selector. For example, to make the nodes of a DataView draggable, use the following
4163
+ * technique. Knowledge of the use of the DataView is required:</p><pre><code>
4164
+ myDataView.on('render', function() {
4165
+ myDataView.dragZone = new Ext.dd.DragZone(myDataView.getEl(), {
4166
+
4167
+ // On receipt of a mousedown event, see if it is within a DataView node.
4168
+ // Return a drag data object if so.
4169
+ getDragData: function(e) {
4170
+
4171
+ // Use the DataView's own itemSelector (a mandatory property) to
4172
+ // test if the mousedown is within one of the DataView's nodes.
4173
+ var sourceEl = e.getTarget(myDataView.itemSelector, 10);
4174
+
4175
+ // If the mousedown is within a DataView node, clone the node to produce
4176
+ // a ddel element for use by the drag proxy. Also add application data
4177
+ // to the returned data object.
4178
+ if (sourceEl) {
4179
+ d = sourceEl.cloneNode(true);
4180
+ d.id = Ext.id();
4181
+ return {
4182
+ ddel: d,
4183
+ sourceEl: sourceEl,
4184
+ repairXY: Ext.fly(sourceEl).getXY(),
4185
+ sourceStore: myDataView.store,
4186
+ draggedRecord: v.getRecord(sourceEl)
4187
+ }
4188
+ }
4189
+ },
4190
+
4191
+ // Provide coordinates for the proxy to slide back to on failed drag.
4192
+ // This is the original XY coordinates of the draggable element captured
4193
+ // in the getDragData method.
4194
+ getRepairXY: function() {
4195
+ return this.dragData.repairXY;
4196
+ }
4197
+ });
4198
+ });</code></pre>
4199
+ * See the {@link Ext.dd.DropZone DropZone} documentation for details about building a DropZone which
4200
+ * cooperates with this DragZone.
4201
+ * @constructor
4202
+ * @param {Mixed} el The container element
4203
+ * @param {Object} config
4204
+ */
4205
+ Ext.dd.DragZone = function(el, config){
4206
+ Ext.dd.DragZone.superclass.constructor.call(this, el, config);
4207
+ if(this.containerScroll){
4208
+ Ext.dd.ScrollManager.register(this.el);
4209
+ }
4210
+ };
4211
+
4212
+ Ext.extend(Ext.dd.DragZone, Ext.dd.DragSource, {
4213
+ /**
4214
+ * This property contains the data representing the dragged object. This data is set up by the implementation
4215
+ * of the {@link #getDragData} method. It must contain a <tt>ddel</tt> property, but can contain
4216
+ * any other data according to the application's needs.
4217
+ * @type Object
4218
+ * @property dragData
4219
+ */
4220
+ /**
4221
+ * @cfg {Boolean} containerScroll True to register this container with the Scrollmanager
4222
+ * for auto scrolling during drag operations.
4223
+ */
4224
+ /**
4225
+ * @cfg {String} hlColor The color to use when visually highlighting the drag source in the afterRepair
4226
+ * method after a failed drop (defaults to "c3daf9" - light blue)
4227
+ */
4228
+
4229
+ /**
4230
+ * Called when a mousedown occurs in this container. Looks in {@link Ext.dd.Registry}
4231
+ * for a valid target to drag based on the mouse down. Override this method
4232
+ * to provide your own lookup logic (e.g. finding a child by class name). Make sure your returned
4233
+ * object has a "ddel" attribute (with an HTML Element) for other functions to work.
4234
+ * @param {EventObject} e The mouse down event
4235
+ * @return {Object} The dragData
4236
+ */
4237
+ getDragData : function(e){
4238
+ return Ext.dd.Registry.getHandleFromEvent(e);
4239
+ },
4240
+
4241
+ /**
4242
+ * Called once drag threshold has been reached to initialize the proxy element. By default, it clones the
4243
+ * this.dragData.ddel
4244
+ * @param {Number} x The x position of the click on the dragged object
4245
+ * @param {Number} y The y position of the click on the dragged object
4246
+ * @return {Boolean} true to continue the drag, false to cancel
4247
+ */
4248
+ onInitDrag : function(x, y){
4249
+ this.proxy.update(this.dragData.ddel.cloneNode(true));
4250
+ this.onStartDrag(x, y);
4251
+ return true;
4252
+ },
4253
+
4254
+ /**
4255
+ * Called after a repair of an invalid drop. By default, highlights this.dragData.ddel
4256
+ */
4257
+ afterRepair : function(){
4258
+ if(Ext.enableFx){
4259
+ Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor || "c3daf9");
4260
+ }
4261
+ this.dragging = false;
4262
+ },
4263
+
4264
+ /**
4265
+ * Called before a repair of an invalid drop to get the XY to animate to. By default returns
4266
+ * the XY of this.dragData.ddel
4267
+ * @param {EventObject} e The mouse up event
4268
+ * @return {Array} The xy location (e.g. [100, 200])
4269
+ */
4270
+ getRepairXY : function(e){
4271
+ return Ext.Element.fly(this.dragData.ddel).getXY();
4272
+ }
4273
+ });/**
4274
+ * @class Ext.dd.DropZone
4275
+ * @extends Ext.dd.DropTarget
4276
+ * <p>This class provides a container DD instance that allows dropping on multiple child target nodes.</p>
4277
+ * <p>By default, this class requires that child nodes accepting drop are registered with {@link Ext.dd.Registry}.
4278
+ * However a simpler way to allow a DropZone to manage any number of target elements is to configure the
4279
+ * DropZone with an implementation of {@link #getTargetFromEvent} which interrogates the passed
4280
+ * mouse event to see if it has taken place within an element, or class of elements. This is easily done
4281
+ * by using the event's {@link Ext.EventObject#getTarget getTarget} method to identify a node based on a
4282
+ * {@link Ext.DomQuery} selector.</p>
4283
+ * <p>Once the DropZone has detected through calling getTargetFromEvent, that the mouse is over
4284
+ * a drop target, that target is passed as the first parameter to {@link #onNodeEnter}, {@link #onNodeOver},
4285
+ * {@link #onNodeOut}, {@link #onNodeDrop}. You may configure the instance of DropZone with implementations
4286
+ * of these methods to provide application-specific behaviour for these events to update both
4287
+ * application state, and UI state.</p>
4288
+ * <p>For example to make a GridPanel a cooperating target with the example illustrated in
4289
+ * {@link Ext.dd.DragZone DragZone}, the following technique might be used:</p><pre><code>
4290
+ myGridPanel.on('render', function() {
4291
+ myGridPanel.dropZone = new Ext.dd.DropZone(myGridPanel.getView().scroller, {
4292
+
4293
+ // If the mouse is over a grid row, return that node. This is
4294
+ // provided as the "target" parameter in all "onNodeXXXX" node event handling functions
4295
+ getTargetFromEvent: function(e) {
4296
+ return e.getTarget(myGridPanel.getView().rowSelector);
4297
+ },
4298
+
4299
+ // On entry into a target node, highlight that node.
4300
+ onNodeEnter : function(target, dd, e, data){
4301
+ Ext.fly(target).addClass('my-row-highlight-class');
4302
+ },
4303
+
4304
+ // On exit from a target node, unhighlight that node.
4305
+ onNodeOut : function(target, dd, e, data){
4306
+ Ext.fly(target).removeClass('my-row-highlight-class');
4307
+ },
4308
+
4309
+ // While over a target node, return the default drop allowed class which
4310
+ // places a "tick" icon into the drag proxy.
4311
+ onNodeOver : function(target, dd, e, data){
4312
+ return Ext.dd.DropZone.prototype.dropAllowed;
4313
+ },
4314
+
4315
+ // On node drop we can interrogate the target to find the underlying
4316
+ // application object that is the real target of the dragged data.
4317
+ // In this case, it is a Record in the GridPanel's Store.
4318
+ // We can use the data set up by the DragZone's getDragData method to read
4319
+ // any data we decided to attach in the DragZone's getDragData method.
4320
+ onNodeDrop : function(target, dd, e, data){
4321
+ var rowIndex = myGridPanel.getView().findRowIndex(target);
4322
+ var r = myGridPanel.getStore().getAt(rowIndex);
4323
+ Ext.Msg.alert('Drop gesture', 'Dropped Record id ' + data.draggedRecord.id +
4324
+ ' on Record id ' + r.id);
4325
+ return true;
4326
+ }
4327
+ });
4328
+ }
4329
+ </code></pre>
4330
+ * See the {@link Ext.dd.DragZone DragZone} documentation for details about building a DragZone which
4331
+ * cooperates with this DropZone.
4332
+ * @constructor
4333
+ * @param {Mixed} el The container element
4334
+ * @param {Object} config
4335
+ */
4336
+ Ext.dd.DropZone = function(el, config){
4337
+ Ext.dd.DropZone.superclass.constructor.call(this, el, config);
4338
+ };
4339
+
4340
+ Ext.extend(Ext.dd.DropZone, Ext.dd.DropTarget, {
4341
+ /**
4342
+ * Returns a custom data object associated with the DOM node that is the target of the event. By default
4343
+ * this looks up the event target in the {@link Ext.dd.Registry}, although you can override this method to
4344
+ * provide your own custom lookup.
4345
+ * @param {Event} e The event
4346
+ * @return {Object} data The custom data
4347
+ */
4348
+ getTargetFromEvent : function(e){
4349
+ return Ext.dd.Registry.getTargetFromEvent(e);
4350
+ },
4351
+
4352
+ /**
4353
+ * Called when the DropZone determines that a {@link Ext.dd.DragSource} has entered a drop node
4354
+ * that has either been registered or detected by a configured implementation of {@link #getTargetFromEvent}.
4355
+ * This method has no default implementation and should be overridden to provide
4356
+ * node-specific processing if necessary.
4357
+ * @param {Object} nodeData The custom data associated with the drop node (this is the same value returned from
4358
+ * {@link #getTargetFromEvent} for this node)
4359
+ * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
4360
+ * @param {Event} e The event
4361
+ * @param {Object} data An object containing arbitrary data supplied by the drag source
4362
+ */
4363
+ onNodeEnter : function(n, dd, e, data){
4364
+
4365
+ },
4366
+
4367
+ /**
4368
+ * Called while the DropZone determines that a {@link Ext.dd.DragSource} is over a drop node
4369
+ * that has either been registered or detected by a configured implementation of {@link #getTargetFromEvent}.
4370
+ * The default implementation returns this.dropNotAllowed, so it should be
4371
+ * overridden to provide the proper feedback.
4372
+ * @param {Object} nodeData The custom data associated with the drop node (this is the same value returned from
4373
+ * {@link #getTargetFromEvent} for this node)
4374
+ * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
4375
+ * @param {Event} e The event
4376
+ * @param {Object} data An object containing arbitrary data supplied by the drag source
4377
+ * @return {String} status The CSS class that communicates the drop status back to the source so that the
4378
+ * underlying {@link Ext.dd.StatusProxy} can be updated
4379
+ */
4380
+ onNodeOver : function(n, dd, e, data){
4381
+ return this.dropAllowed;
4382
+ },
4383
+
4384
+ /**
4385
+ * Called when the DropZone determines that a {@link Ext.dd.DragSource} has been dragged out of
4386
+ * the drop node without dropping. This method has no default implementation and should be overridden to provide
4387
+ * node-specific processing if necessary.
4388
+ * @param {Object} nodeData The custom data associated with the drop node (this is the same value returned from
4389
+ * {@link #getTargetFromEvent} for this node)
4390
+ * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
4391
+ * @param {Event} e The event
4392
+ * @param {Object} data An object containing arbitrary data supplied by the drag source
4393
+ */
4394
+ onNodeOut : function(n, dd, e, data){
4395
+
4396
+ },
4397
+
4398
+ /**
4399
+ * Called when the DropZone determines that a {@link Ext.dd.DragSource} has been dropped onto
4400
+ * the drop node. The default implementation returns false, so it should be overridden to provide the
4401
+ * appropriate processing of the drop event and return true so that the drag source's repair action does not run.
4402
+ * @param {Object} nodeData The custom data associated with the drop node (this is the same value returned from
4403
+ * {@link #getTargetFromEvent} for this node)
4404
+ * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
4405
+ * @param {Event} e The event
4406
+ * @param {Object} data An object containing arbitrary data supplied by the drag source
4407
+ * @return {Boolean} True if the drop was valid, else false
4408
+ */
4409
+ onNodeDrop : function(n, dd, e, data){
4410
+ return false;
4411
+ },
4412
+
4413
+ /**
4414
+ * Called while the DropZone determines that a {@link Ext.dd.DragSource} is being dragged over it,
4415
+ * but not over any of its registered drop nodes. The default implementation returns this.dropNotAllowed, so
4416
+ * it should be overridden to provide the proper feedback if necessary.
4417
+ * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
4418
+ * @param {Event} e The event
4419
+ * @param {Object} data An object containing arbitrary data supplied by the drag source
4420
+ * @return {String} status The CSS class that communicates the drop status back to the source so that the
4421
+ * underlying {@link Ext.dd.StatusProxy} can be updated
4422
+ */
4423
+ onContainerOver : function(dd, e, data){
4424
+ return this.dropNotAllowed;
4425
+ },
4426
+
4427
+ /**
4428
+ * Called when the DropZone determines that a {@link Ext.dd.DragSource} has been dropped on it,
4429
+ * but not on any of its registered drop nodes. The default implementation returns false, so it should be
4430
+ * overridden to provide the appropriate processing of the drop event if you need the drop zone itself to
4431
+ * be able to accept drops. It should return true when valid so that the drag source's repair action does not run.
4432
+ * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
4433
+ * @param {Event} e The event
4434
+ * @param {Object} data An object containing arbitrary data supplied by the drag source
4435
+ * @return {Boolean} True if the drop was valid, else false
4436
+ */
4437
+ onContainerDrop : function(dd, e, data){
4438
+ return false;
4439
+ },
4440
+
4441
+ /**
4442
+ * The function a {@link Ext.dd.DragSource} calls once to notify this drop zone that the source is now over
4443
+ * the zone. The default implementation returns this.dropNotAllowed and expects that only registered drop
4444
+ * nodes can process drag drop operations, so if you need the drop zone itself to be able to process drops
4445
+ * you should override this method and provide a custom implementation.
4446
+ * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
4447
+ * @param {Event} e The event
4448
+ * @param {Object} data An object containing arbitrary data supplied by the drag source
4449
+ * @return {String} status The CSS class that communicates the drop status back to the source so that the
4450
+ * underlying {@link Ext.dd.StatusProxy} can be updated
4451
+ */
4452
+ notifyEnter : function(dd, e, data){
4453
+ return this.dropNotAllowed;
4454
+ },
4455
+
4456
+ /**
4457
+ * The function a {@link Ext.dd.DragSource} calls continuously while it is being dragged over the drop zone.
4458
+ * This method will be called on every mouse movement while the drag source is over the drop zone.
4459
+ * It will call {@link #onNodeOver} while the drag source is over a registered node, and will also automatically
4460
+ * delegate to the appropriate node-specific methods as necessary when the drag source enters and exits
4461
+ * registered nodes ({@link #onNodeEnter}, {@link #onNodeOut}). If the drag source is not currently over a
4462
+ * registered node, it will call {@link #onContainerOver}.
4463
+ * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
4464
+ * @param {Event} e The event
4465
+ * @param {Object} data An object containing arbitrary data supplied by the drag source
4466
+ * @return {String} status The CSS class that communicates the drop status back to the source so that the
4467
+ * underlying {@link Ext.dd.StatusProxy} can be updated
4468
+ */
4469
+ notifyOver : function(dd, e, data){
4470
+ var n = this.getTargetFromEvent(e);
4471
+ if(!n){ // not over valid drop target
4472
+ if(this.lastOverNode){
4473
+ this.onNodeOut(this.lastOverNode, dd, e, data);
4474
+ this.lastOverNode = null;
4475
+ }
4476
+ return this.onContainerOver(dd, e, data);
4477
+ }
4478
+ if(this.lastOverNode != n){
4479
+ if(this.lastOverNode){
4480
+ this.onNodeOut(this.lastOverNode, dd, e, data);
4481
+ }
4482
+ this.onNodeEnter(n, dd, e, data);
4483
+ this.lastOverNode = n;
4484
+ }
4485
+ return this.onNodeOver(n, dd, e, data);
4486
+ },
4487
+
4488
+ /**
4489
+ * The function a {@link Ext.dd.DragSource} calls once to notify this drop zone that the source has been dragged
4490
+ * out of the zone without dropping. If the drag source is currently over a registered node, the notification
4491
+ * will be delegated to {@link #onNodeOut} for node-specific handling, otherwise it will be ignored.
4492
+ * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target
4493
+ * @param {Event} e The event
4494
+ * @param {Object} data An object containing arbitrary data supplied by the drag zone
4495
+ */
4496
+ notifyOut : function(dd, e, data){
4497
+ if(this.lastOverNode){
4498
+ this.onNodeOut(this.lastOverNode, dd, e, data);
4499
+ this.lastOverNode = null;
4500
+ }
4501
+ },
4502
+
4503
+ /**
4504
+ * The function a {@link Ext.dd.DragSource} calls once to notify this drop zone that the dragged item has
4505
+ * been dropped on it. The drag zone will look up the target node based on the event passed in, and if there
4506
+ * is a node registered for that event, it will delegate to {@link #onNodeDrop} for node-specific handling,
4507
+ * otherwise it will call {@link #onContainerDrop}.
4508
+ * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone
4509
+ * @param {Event} e The event
4510
+ * @param {Object} data An object containing arbitrary data supplied by the drag source
4511
+ * @return {Boolean} True if the drop was valid, else false
4512
+ */
4513
+ notifyDrop : function(dd, e, data){
4514
+ if(this.lastOverNode){
4515
+ this.onNodeOut(this.lastOverNode, dd, e, data);
4516
+ this.lastOverNode = null;
4517
+ }
4518
+ var n = this.getTargetFromEvent(e);
4519
+ return n ?
4520
+ this.onNodeDrop(n, dd, e, data) :
4521
+ this.onContainerDrop(dd, e, data);
4522
+ },
4523
+
4524
+ // private
4525
+ triggerCacheRefresh : function(){
4526
+ Ext.dd.DDM.refreshCache(this.groups);
4527
+ }
4528
+ });/**
4529
+ * @class Ext.Element
4530
+ */
4531
+ Ext.Element.addMethods({
4532
+ /**
4533
+ * Initializes a {@link Ext.dd.DD} drag drop object for this element.
4534
+ * @param {String} group The group the DD object is member of
4535
+ * @param {Object} config The DD config object
4536
+ * @param {Object} overrides An object containing methods to override/implement on the DD object
4537
+ * @return {Ext.dd.DD} The DD object
4538
+ */
4539
+ initDD : function(group, config, overrides){
4540
+ var dd = new Ext.dd.DD(Ext.id(this.dom), group, config);
4541
+ return Ext.apply(dd, overrides);
4542
+ },
4543
+
4544
+ /**
4545
+ * Initializes a {@link Ext.dd.DDProxy} object for this element.
4546
+ * @param {String} group The group the DDProxy object is member of
4547
+ * @param {Object} config The DDProxy config object
4548
+ * @param {Object} overrides An object containing methods to override/implement on the DDProxy object
4549
+ * @return {Ext.dd.DDProxy} The DDProxy object
4550
+ */
4551
+ initDDProxy : function(group, config, overrides){
4552
+ var dd = new Ext.dd.DDProxy(Ext.id(this.dom), group, config);
4553
+ return Ext.apply(dd, overrides);
4554
+ },
4555
+
4556
+ /**
4557
+ * Initializes a {@link Ext.dd.DDTarget} object for this element.
4558
+ * @param {String} group The group the DDTarget object is member of
4559
+ * @param {Object} config The DDTarget config object
4560
+ * @param {Object} overrides An object containing methods to override/implement on the DDTarget object
4561
+ * @return {Ext.dd.DDTarget} The DDTarget object
4562
+ */
4563
+ initDDTarget : function(group, config, overrides){
4564
+ var dd = new Ext.dd.DDTarget(Ext.id(this.dom), group, config);
4565
+ return Ext.apply(dd, overrides);
4566
+ }
4567
+ });