yui-rails-asset 2.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (398) hide show
  1. data/LICENSE +21 -0
  2. data/README +17 -0
  3. data/lib/yui/rails.rb +29 -0
  4. data/lib/yui/rails/engine.rb +10 -0
  5. data/lib/yui/rails/version.rb +6 -0
  6. data/vendor/assets/javascripts/yui-2.8.1/build/animation/animation-debug.js +1396 -0
  7. data/vendor/assets/javascripts/yui-2.8.1/build/animation/animation-min.js +23 -0
  8. data/vendor/assets/javascripts/yui-2.8.1/build/animation/animation.js +1392 -0
  9. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/ajax-loader.gif +0 -0
  10. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/asc.gif +0 -0
  11. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/autocomplete.css +7 -0
  12. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/back-h.png +0 -0
  13. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/back-v.png +0 -0
  14. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/bar-h.png +0 -0
  15. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/bar-v.png +0 -0
  16. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/bg-h.gif +0 -0
  17. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/bg-v.gif +0 -0
  18. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/blankimage.png +0 -0
  19. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/button.css +7 -0
  20. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/calendar.css +8 -0
  21. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/carousel.css +7 -0
  22. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/check0.gif +0 -0
  23. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/check1.gif +0 -0
  24. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/check2.gif +0 -0
  25. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/colorpicker.css +7 -0
  26. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/container.css +7 -0
  27. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/datatable.css +8 -0
  28. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/desc.gif +0 -0
  29. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/dt-arrow-dn.png +0 -0
  30. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/dt-arrow-up.png +0 -0
  31. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/editor-knob.gif +0 -0
  32. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/editor-sprite-active.gif +0 -0
  33. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/editor-sprite.gif +0 -0
  34. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/editor.css +10 -0
  35. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/header_background.png +0 -0
  36. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/hue_bg.png +0 -0
  37. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/imagecropper.css +7 -0
  38. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/layout.css +7 -0
  39. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/layout_sprite.png +0 -0
  40. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/loading.gif +0 -0
  41. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/logger.css +7 -0
  42. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menu-button-arrow-disabled.png +0 -0
  43. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menu-button-arrow.png +0 -0
  44. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menu.css +7 -0
  45. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menubaritem_submenuindicator.png +0 -0
  46. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menubaritem_submenuindicator_disabled.png +0 -0
  47. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menuitem_checkbox.png +0 -0
  48. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menuitem_checkbox_disabled.png +0 -0
  49. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menuitem_submenuindicator.png +0 -0
  50. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/menuitem_submenuindicator_disabled.png +0 -0
  51. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/paginator.css +7 -0
  52. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/picker_mask.png +0 -0
  53. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/profilerviewer.css +7 -0
  54. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/progressbar.css +7 -0
  55. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/resize.css +7 -0
  56. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/simpleeditor.css +10 -0
  57. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/skin.css +36 -0
  58. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/slider.css +7 -0
  59. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/split-button-arrow-active.png +0 -0
  60. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/split-button-arrow-disabled.png +0 -0
  61. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/split-button-arrow-focus.png +0 -0
  62. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/split-button-arrow-hover.png +0 -0
  63. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/split-button-arrow.png +0 -0
  64. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/sprite.png +0 -0
  65. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/sprite.psd +0 -0
  66. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/tabview.css +8 -0
  67. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/treeview-loading.gif +0 -0
  68. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/treeview-sprite.gif +0 -0
  69. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/treeview.css +7 -0
  70. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/wait.gif +0 -0
  71. data/vendor/assets/javascripts/yui-2.8.1/build/assets/skins/sam/yuitest.css +7 -0
  72. data/vendor/assets/javascripts/yui-2.8.1/build/autocomplete/assets/autocomplete-core.css +7 -0
  73. data/vendor/assets/javascripts/yui-2.8.1/build/autocomplete/assets/skins/sam/autocomplete-skin.css +57 -0
  74. data/vendor/assets/javascripts/yui-2.8.1/build/autocomplete/assets/skins/sam/autocomplete.css +7 -0
  75. data/vendor/assets/javascripts/yui-2.8.1/build/autocomplete/autocomplete-debug.js +3009 -0
  76. data/vendor/assets/javascripts/yui-2.8.1/build/autocomplete/autocomplete-min.js +12 -0
  77. data/vendor/assets/javascripts/yui-2.8.1/build/autocomplete/autocomplete.js +2966 -0
  78. data/vendor/assets/javascripts/yui-2.8.1/build/base/base-min.css +7 -0
  79. data/vendor/assets/javascripts/yui-2.8.1/build/base/base.css +131 -0
  80. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/button-core.css +44 -0
  81. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/button-skin.css +219 -0
  82. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/button.css +7 -0
  83. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/menu-button-arrow-disabled.png +0 -0
  84. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/menu-button-arrow.png +0 -0
  85. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/split-button-arrow-active.png +0 -0
  86. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/split-button-arrow-disabled.png +0 -0
  87. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/split-button-arrow-focus.png +0 -0
  88. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/split-button-arrow-hover.png +0 -0
  89. data/vendor/assets/javascripts/yui-2.8.1/build/button/assets/skins/sam/split-button-arrow.png +0 -0
  90. data/vendor/assets/javascripts/yui-2.8.1/build/button/button-debug.js +4694 -0
  91. data/vendor/assets/javascripts/yui-2.8.1/build/button/button-min.js +11 -0
  92. data/vendor/assets/javascripts/yui-2.8.1/build/button/button.js +4633 -0
  93. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/calendar-core.css +132 -0
  94. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/calendar.css +320 -0
  95. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/calgrad.png +0 -0
  96. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/callt.gif +0 -0
  97. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/calrt.gif +0 -0
  98. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/calx.gif +0 -0
  99. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/skins/sam/calendar-skin.css +361 -0
  100. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/assets/skins/sam/calendar.css +8 -0
  101. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/calendar-debug.js +7324 -0
  102. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/calendar-min.js +18 -0
  103. data/vendor/assets/javascripts/yui-2.8.1/build/calendar/calendar.js +7294 -0
  104. data/vendor/assets/javascripts/yui-2.8.1/build/carousel/assets/ajax-loader.gif +0 -0
  105. data/vendor/assets/javascripts/yui-2.8.1/build/carousel/assets/carousel-core.css +88 -0
  106. data/vendor/assets/javascripts/yui-2.8.1/build/carousel/assets/skins/sam/ajax-loader.gif +0 -0
  107. data/vendor/assets/javascripts/yui-2.8.1/build/carousel/assets/skins/sam/carousel-skin.css +142 -0
  108. data/vendor/assets/javascripts/yui-2.8.1/build/carousel/assets/skins/sam/carousel.css +7 -0
  109. data/vendor/assets/javascripts/yui-2.8.1/build/carousel/carousel-debug.js +4390 -0
  110. data/vendor/assets/javascripts/yui-2.8.1/build/carousel/carousel-min.js +12 -0
  111. data/vendor/assets/javascripts/yui-2.8.1/build/carousel/carousel.js +4349 -0
  112. data/vendor/assets/javascripts/yui-2.8.1/build/charts/assets/charts.swf +0 -0
  113. data/vendor/assets/javascripts/yui-2.8.1/build/charts/charts-debug.js +2061 -0
  114. data/vendor/assets/javascripts/yui-2.8.1/build/charts/charts-min.js +9 -0
  115. data/vendor/assets/javascripts/yui-2.8.1/build/charts/charts.js +2060 -0
  116. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/colorpicker-core.css +6 -0
  117. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/hue_thumb.png +0 -0
  118. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/picker_mask.png +0 -0
  119. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/picker_thumb.png +0 -0
  120. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/skins/sam/colorpicker-skin.css +105 -0
  121. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/skins/sam/colorpicker.css +7 -0
  122. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/skins/sam/hue_bg.png +0 -0
  123. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/assets/skins/sam/picker_mask.png +0 -0
  124. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/colorpicker-debug.js +1783 -0
  125. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/colorpicker-min.js +9 -0
  126. data/vendor/assets/javascripts/yui-2.8.1/build/colorpicker/colorpicker.js +1763 -0
  127. data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection-debug.js +1576 -0
  128. data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection-min.js +9 -0
  129. data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection.js +1546 -0
  130. data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection.swf +0 -0
  131. data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection_core-debug.js +980 -0
  132. data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection_core-min.js +8 -0
  133. data/vendor/assets/javascripts/yui-2.8.1/build/connection/connection_core.js +957 -0
  134. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/alrt16_1.gif +0 -0
  135. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/blck16_1.gif +0 -0
  136. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/close12_1.gif +0 -0
  137. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/container-core.css +176 -0
  138. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/container.css +324 -0
  139. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/hlp16_1.gif +0 -0
  140. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/info16_1.gif +0 -0
  141. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/skins/sam/container-skin.css +242 -0
  142. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/skins/sam/container.css +7 -0
  143. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/tip16_1.gif +0 -0
  144. data/vendor/assets/javascripts/yui-2.8.1/build/container/assets/warn16_1.gif +0 -0
  145. data/vendor/assets/javascripts/yui-2.8.1/build/container/container-debug.js +9076 -0
  146. data/vendor/assets/javascripts/yui-2.8.1/build/container/container-min.js +19 -0
  147. data/vendor/assets/javascripts/yui-2.8.1/build/container/container.js +9052 -0
  148. data/vendor/assets/javascripts/yui-2.8.1/build/container/container_core-debug.js +5136 -0
  149. data/vendor/assets/javascripts/yui-2.8.1/build/container/container_core-min.js +14 -0
  150. data/vendor/assets/javascripts/yui-2.8.1/build/container/container_core.js +5126 -0
  151. data/vendor/assets/javascripts/yui-2.8.1/build/cookie/cookie-debug.js +482 -0
  152. data/vendor/assets/javascripts/yui-2.8.1/build/cookie/cookie-min.js +7 -0
  153. data/vendor/assets/javascripts/yui-2.8.1/build/cookie/cookie.js +482 -0
  154. data/vendor/assets/javascripts/yui-2.8.1/build/datasource/datasource-debug.js +3067 -0
  155. data/vendor/assets/javascripts/yui-2.8.1/build/datasource/datasource-min.js +12 -0
  156. data/vendor/assets/javascripts/yui-2.8.1/build/datasource/datasource.js +2996 -0
  157. data/vendor/assets/javascripts/yui-2.8.1/build/datatable/assets/datatable-core.css +93 -0
  158. data/vendor/assets/javascripts/yui-2.8.1/build/datatable/assets/datatable.css +49 -0
  159. data/vendor/assets/javascripts/yui-2.8.1/build/datatable/assets/skins/sam/datatable-skin.css +240 -0
  160. data/vendor/assets/javascripts/yui-2.8.1/build/datatable/assets/skins/sam/datatable.css +8 -0
  161. data/vendor/assets/javascripts/yui-2.8.1/build/datatable/assets/skins/sam/dt-arrow-dn.png +0 -0
  162. data/vendor/assets/javascripts/yui-2.8.1/build/datatable/assets/skins/sam/dt-arrow-up.png +0 -0
  163. data/vendor/assets/javascripts/yui-2.8.1/build/datatable/datatable-debug.js +17360 -0
  164. data/vendor/assets/javascripts/yui-2.8.1/build/datatable/datatable-min.js +29 -0
  165. data/vendor/assets/javascripts/yui-2.8.1/build/datatable/datatable.js +17122 -0
  166. data/vendor/assets/javascripts/yui-2.8.1/build/datemath/datemath-debug.js +408 -0
  167. data/vendor/assets/javascripts/yui-2.8.1/build/datemath/datemath-min.js +7 -0
  168. data/vendor/assets/javascripts/yui-2.8.1/build/datemath/datemath.js +408 -0
  169. data/vendor/assets/javascripts/yui-2.8.1/build/dom/dom-debug.js +1872 -0
  170. data/vendor/assets/javascripts/yui-2.8.1/build/dom/dom-min.js +9 -0
  171. data/vendor/assets/javascripts/yui-2.8.1/build/dom/dom.js +1832 -0
  172. data/vendor/assets/javascripts/yui-2.8.1/build/dragdrop/dragdrop-debug.js +3710 -0
  173. data/vendor/assets/javascripts/yui-2.8.1/build/dragdrop/dragdrop-min.js +10 -0
  174. data/vendor/assets/javascripts/yui-2.8.1/build/dragdrop/dragdrop.js +3601 -0
  175. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/editor-core.css +602 -0
  176. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/simpleeditor-core.css +602 -0
  177. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/blankimage.png +0 -0
  178. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/editor-knob.gif +0 -0
  179. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/editor-skin.css +711 -0
  180. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/editor-sprite-active.gif +0 -0
  181. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/editor-sprite.gif +0 -0
  182. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/editor.css +10 -0
  183. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/simpleeditor-skin.css +711 -0
  184. data/vendor/assets/javascripts/yui-2.8.1/build/editor/assets/skins/sam/simpleeditor.css +10 -0
  185. data/vendor/assets/javascripts/yui-2.8.1/build/editor/editor-debug.js +9557 -0
  186. data/vendor/assets/javascripts/yui-2.8.1/build/editor/editor-min.js +30 -0
  187. data/vendor/assets/javascripts/yui-2.8.1/build/editor/editor.js +9447 -0
  188. data/vendor/assets/javascripts/yui-2.8.1/build/editor/simpleeditor-debug.js +7493 -0
  189. data/vendor/assets/javascripts/yui-2.8.1/build/editor/simpleeditor-min.js +24 -0
  190. data/vendor/assets/javascripts/yui-2.8.1/build/editor/simpleeditor.js +7406 -0
  191. data/vendor/assets/javascripts/yui-2.8.1/build/element-delegate/element-delegate-debug.js +141 -0
  192. data/vendor/assets/javascripts/yui-2.8.1/build/element-delegate/element-delegate-min.js +7 -0
  193. data/vendor/assets/javascripts/yui-2.8.1/build/element-delegate/element-delegate.js +138 -0
  194. data/vendor/assets/javascripts/yui-2.8.1/build/element/element-debug.js +1106 -0
  195. data/vendor/assets/javascripts/yui-2.8.1/build/element/element-min.js +8 -0
  196. data/vendor/assets/javascripts/yui-2.8.1/build/element/element.js +1090 -0
  197. data/vendor/assets/javascripts/yui-2.8.1/build/event-delegate/event-delegate-debug.js +283 -0
  198. data/vendor/assets/javascripts/yui-2.8.1/build/event-delegate/event-delegate-min.js +7 -0
  199. data/vendor/assets/javascripts/yui-2.8.1/build/event-delegate/event-delegate.js +281 -0
  200. data/vendor/assets/javascripts/yui-2.8.1/build/event-mouseenter/event-mouseenter-debug.js +219 -0
  201. data/vendor/assets/javascripts/yui-2.8.1/build/event-mouseenter/event-mouseenter-min.js +7 -0
  202. data/vendor/assets/javascripts/yui-2.8.1/build/event-mouseenter/event-mouseenter.js +219 -0
  203. data/vendor/assets/javascripts/yui-2.8.1/build/event-simulate/event-simulate-debug.js +622 -0
  204. data/vendor/assets/javascripts/yui-2.8.1/build/event-simulate/event-simulate-min.js +7 -0
  205. data/vendor/assets/javascripts/yui-2.8.1/build/event-simulate/event-simulate.js +622 -0
  206. data/vendor/assets/javascripts/yui-2.8.1/build/event/event-debug.js +2524 -0
  207. data/vendor/assets/javascripts/yui-2.8.1/build/event/event-min.js +11 -0
  208. data/vendor/assets/javascripts/yui-2.8.1/build/event/event.js +2500 -0
  209. data/vendor/assets/javascripts/yui-2.8.1/build/fonts/fonts-min.css +7 -0
  210. data/vendor/assets/javascripts/yui-2.8.1/build/fonts/fonts.css +56 -0
  211. data/vendor/assets/javascripts/yui-2.8.1/build/get/get-debug.js +773 -0
  212. data/vendor/assets/javascripts/yui-2.8.1/build/get/get-min.js +7 -0
  213. data/vendor/assets/javascripts/yui-2.8.1/build/get/get.js +755 -0
  214. data/vendor/assets/javascripts/yui-2.8.1/build/grids/grids-min.css +7 -0
  215. data/vendor/assets/javascripts/yui-2.8.1/build/grids/grids.css +467 -0
  216. data/vendor/assets/javascripts/yui-2.8.1/build/history/assets/blank.html +1 -0
  217. data/vendor/assets/javascripts/yui-2.8.1/build/history/history-debug.js +808 -0
  218. data/vendor/assets/javascripts/yui-2.8.1/build/history/history-min.js +7 -0
  219. data/vendor/assets/javascripts/yui-2.8.1/build/history/history.js +808 -0
  220. data/vendor/assets/javascripts/yui-2.8.1/build/imagecropper/assets/imagecropper-core.css +33 -0
  221. data/vendor/assets/javascripts/yui-2.8.1/build/imagecropper/assets/skins/sam/imagecropper-skin.css +16 -0
  222. data/vendor/assets/javascripts/yui-2.8.1/build/imagecropper/assets/skins/sam/imagecropper.css +7 -0
  223. data/vendor/assets/javascripts/yui-2.8.1/build/imagecropper/imagecropper-debug.js +907 -0
  224. data/vendor/assets/javascripts/yui-2.8.1/build/imagecropper/imagecropper-min.js +8 -0
  225. data/vendor/assets/javascripts/yui-2.8.1/build/imagecropper/imagecropper.js +889 -0
  226. data/vendor/assets/javascripts/yui-2.8.1/build/imageloader/imageloader-debug.js +487 -0
  227. data/vendor/assets/javascripts/yui-2.8.1/build/imageloader/imageloader-min.js +7 -0
  228. data/vendor/assets/javascripts/yui-2.8.1/build/imageloader/imageloader.js +481 -0
  229. data/vendor/assets/javascripts/yui-2.8.1/build/json/json-debug.js +538 -0
  230. data/vendor/assets/javascripts/yui-2.8.1/build/json/json-min.js +7 -0
  231. data/vendor/assets/javascripts/yui-2.8.1/build/json/json.js +538 -0
  232. data/vendor/assets/javascripts/yui-2.8.1/build/layout/assets/layout-core.css +158 -0
  233. data/vendor/assets/javascripts/yui-2.8.1/build/layout/assets/skins/sam/layout-skin.css +207 -0
  234. data/vendor/assets/javascripts/yui-2.8.1/build/layout/assets/skins/sam/layout.css +7 -0
  235. data/vendor/assets/javascripts/yui-2.8.1/build/layout/assets/skins/sam/layout_sprite.png +0 -0
  236. data/vendor/assets/javascripts/yui-2.8.1/build/layout/layout-debug.js +2305 -0
  237. data/vendor/assets/javascripts/yui-2.8.1/build/layout/layout-min.js +11 -0
  238. data/vendor/assets/javascripts/yui-2.8.1/build/layout/layout.js +2290 -0
  239. data/vendor/assets/javascripts/yui-2.8.1/build/logger/assets/logger-core.css +7 -0
  240. data/vendor/assets/javascripts/yui-2.8.1/build/logger/assets/logger.css +57 -0
  241. data/vendor/assets/javascripts/yui-2.8.1/build/logger/assets/skins/sam/logger-skin.css +55 -0
  242. data/vendor/assets/javascripts/yui-2.8.1/build/logger/assets/skins/sam/logger.css +7 -0
  243. data/vendor/assets/javascripts/yui-2.8.1/build/logger/logger-debug.js +2104 -0
  244. data/vendor/assets/javascripts/yui-2.8.1/build/logger/logger-min.js +9 -0
  245. data/vendor/assets/javascripts/yui-2.8.1/build/logger/logger.js +2104 -0
  246. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menu-core.css +242 -0
  247. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menu.css +503 -0
  248. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menu_down_arrow.png +0 -0
  249. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menu_down_arrow_disabled.png +0 -0
  250. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menu_up_arrow.png +0 -0
  251. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menu_up_arrow_disabled.png +0 -0
  252. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menubaritem_submenuindicator.png +0 -0
  253. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menubaritem_submenuindicator_disabled.png +0 -0
  254. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menubaritem_submenuindicator_selected.png +0 -0
  255. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menuitem_checkbox.png +0 -0
  256. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menuitem_checkbox_disabled.png +0 -0
  257. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menuitem_checkbox_selected.png +0 -0
  258. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menuitem_submenuindicator.png +0 -0
  259. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menuitem_submenuindicator_disabled.png +0 -0
  260. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/menuitem_submenuindicator_selected.png +0 -0
  261. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menu-skin.css +339 -0
  262. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menu.css +7 -0
  263. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menubaritem_submenuindicator.png +0 -0
  264. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menubaritem_submenuindicator_disabled.png +0 -0
  265. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menuitem_checkbox.png +0 -0
  266. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menuitem_checkbox_disabled.png +0 -0
  267. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menuitem_submenuindicator.png +0 -0
  268. data/vendor/assets/javascripts/yui-2.8.1/build/menu/assets/skins/sam/menuitem_submenuindicator_disabled.png +0 -0
  269. data/vendor/assets/javascripts/yui-2.8.1/build/menu/menu-debug.js +9870 -0
  270. data/vendor/assets/javascripts/yui-2.8.1/build/menu/menu-min.js +16 -0
  271. data/vendor/assets/javascripts/yui-2.8.1/build/menu/menu.js +9823 -0
  272. data/vendor/assets/javascripts/yui-2.8.1/build/paginator/assets/paginator-core.css +6 -0
  273. data/vendor/assets/javascripts/yui-2.8.1/build/paginator/assets/skins/sam/paginator-skin.css +78 -0
  274. data/vendor/assets/javascripts/yui-2.8.1/build/paginator/assets/skins/sam/paginator.css +7 -0
  275. data/vendor/assets/javascripts/yui-2.8.1/build/paginator/paginator-debug.js +2393 -0
  276. data/vendor/assets/javascripts/yui-2.8.1/build/paginator/paginator-min.js +10 -0
  277. data/vendor/assets/javascripts/yui-2.8.1/build/paginator/paginator.js +2393 -0
  278. data/vendor/assets/javascripts/yui-2.8.1/build/profiler/profiler-debug.js +557 -0
  279. data/vendor/assets/javascripts/yui-2.8.1/build/profiler/profiler-min.js +7 -0
  280. data/vendor/assets/javascripts/yui-2.8.1/build/profiler/profiler.js +557 -0
  281. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/profilerviewer-core.css +6 -0
  282. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/skins/sam/asc.gif +0 -0
  283. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/skins/sam/desc.gif +0 -0
  284. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/skins/sam/header_background.png +0 -0
  285. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/skins/sam/profilerviewer-skin.css +167 -0
  286. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/skins/sam/profilerviewer.css +7 -0
  287. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/assets/skins/sam/wait.gif +0 -0
  288. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/profilerviewer-debug.js +1229 -0
  289. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/profilerviewer-min.js +9 -0
  290. data/vendor/assets/javascripts/yui-2.8.1/build/profilerviewer/profilerviewer.js +1192 -0
  291. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/progressbar-core.css +85 -0
  292. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/skins/sam/back-h.png +0 -0
  293. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/skins/sam/back-v.png +0 -0
  294. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/skins/sam/bar-h.png +0 -0
  295. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/skins/sam/bar-v.png +0 -0
  296. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/skins/sam/progressbar-skin.css +56 -0
  297. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/assets/skins/sam/progressbar.css +7 -0
  298. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/progressbar-debug.js +691 -0
  299. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/progressbar-min.js +8 -0
  300. data/vendor/assets/javascripts/yui-2.8.1/build/progressbar/progressbar.js +677 -0
  301. data/vendor/assets/javascripts/yui-2.8.1/build/reset-fonts-grids/reset-fonts-grids.css +7 -0
  302. data/vendor/assets/javascripts/yui-2.8.1/build/reset-fonts/reset-fonts.css +7 -0
  303. data/vendor/assets/javascripts/yui-2.8.1/build/reset/reset-min.css +7 -0
  304. data/vendor/assets/javascripts/yui-2.8.1/build/reset/reset.css +142 -0
  305. data/vendor/assets/javascripts/yui-2.8.1/build/resize/assets/resize-core.css +173 -0
  306. data/vendor/assets/javascripts/yui-2.8.1/build/resize/assets/skins/sam/layout_sprite.png +0 -0
  307. data/vendor/assets/javascripts/yui-2.8.1/build/resize/assets/skins/sam/resize-skin.css +142 -0
  308. data/vendor/assets/javascripts/yui-2.8.1/build/resize/assets/skins/sam/resize.css +7 -0
  309. data/vendor/assets/javascripts/yui-2.8.1/build/resize/resize-debug.js +1749 -0
  310. data/vendor/assets/javascripts/yui-2.8.1/build/resize/resize-min.js +10 -0
  311. data/vendor/assets/javascripts/yui-2.8.1/build/resize/resize.js +1689 -0
  312. data/vendor/assets/javascripts/yui-2.8.1/build/selector/selector-debug.js +651 -0
  313. data/vendor/assets/javascripts/yui-2.8.1/build/selector/selector-min.js +8 -0
  314. data/vendor/assets/javascripts/yui-2.8.1/build/selector/selector.js +644 -0
  315. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/bg-fader.gif +0 -0
  316. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/bg-h.gif +0 -0
  317. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/bg-v-e.gif +0 -0
  318. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/bg-v.gif +0 -0
  319. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/left-thumb.png +0 -0
  320. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/right-thumb.png +0 -0
  321. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/skins/sam/bg-h.gif +0 -0
  322. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/skins/sam/bg-v.gif +0 -0
  323. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/skins/sam/slider-skin.css +24 -0
  324. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/skins/sam/slider.css +7 -0
  325. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/slider-core.css +17 -0
  326. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/slider-skin.css +20 -0
  327. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/thumb-bar.gif +0 -0
  328. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/thumb-e.gif +0 -0
  329. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/thumb-fader.gif +0 -0
  330. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/thumb-n.gif +0 -0
  331. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/thumb-s.gif +0 -0
  332. data/vendor/assets/javascripts/yui-2.8.1/build/slider/assets/thumb-w.gif +0 -0
  333. data/vendor/assets/javascripts/yui-2.8.1/build/slider/slider-debug.js +2114 -0
  334. data/vendor/assets/javascripts/yui-2.8.1/build/slider/slider-min.js +9 -0
  335. data/vendor/assets/javascripts/yui-2.8.1/build/slider/slider.js +2068 -0
  336. data/vendor/assets/javascripts/yui-2.8.1/build/storage/storage-debug.js +1185 -0
  337. data/vendor/assets/javascripts/yui-2.8.1/build/storage/storage-min.js +8 -0
  338. data/vendor/assets/javascripts/yui-2.8.1/build/storage/storage.js +1183 -0
  339. data/vendor/assets/javascripts/yui-2.8.1/build/stylesheet/stylesheet-debug.js +648 -0
  340. data/vendor/assets/javascripts/yui-2.8.1/build/stylesheet/stylesheet-min.js +7 -0
  341. data/vendor/assets/javascripts/yui-2.8.1/build/stylesheet/stylesheet.js +645 -0
  342. data/vendor/assets/javascripts/yui-2.8.1/build/swf/swf-debug.js +269 -0
  343. data/vendor/assets/javascripts/yui-2.8.1/build/swf/swf-min.js +7 -0
  344. data/vendor/assets/javascripts/yui-2.8.1/build/swf/swf.js +268 -0
  345. data/vendor/assets/javascripts/yui-2.8.1/build/swfdetect/swfdetect-debug.js +93 -0
  346. data/vendor/assets/javascripts/yui-2.8.1/build/swfdetect/swfdetect-min.js +7 -0
  347. data/vendor/assets/javascripts/yui-2.8.1/build/swfdetect/swfdetect.js +93 -0
  348. data/vendor/assets/javascripts/yui-2.8.1/build/swfstore/swf.js +238 -0
  349. data/vendor/assets/javascripts/yui-2.8.1/build/swfstore/swfstore-debug.js +470 -0
  350. data/vendor/assets/javascripts/yui-2.8.1/build/swfstore/swfstore-min.js +7 -0
  351. data/vendor/assets/javascripts/yui-2.8.1/build/swfstore/swfstore.js +453 -0
  352. data/vendor/assets/javascripts/yui-2.8.1/build/swfstore/swfstore.swf +0 -0
  353. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/border_tabs.css +54 -0
  354. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/loading.gif +0 -0
  355. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/skin-sam.css +77 -0
  356. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/skins/sam/tabview-skin.css +186 -0
  357. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/skins/sam/tabview.css +8 -0
  358. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/tabview-core.css +133 -0
  359. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/assets/tabview.css +77 -0
  360. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/tabview-debug.js +995 -0
  361. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/tabview-min.js +8 -0
  362. data/vendor/assets/javascripts/yui-2.8.1/build/tabview/tabview.js +987 -0
  363. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/check0.gif +0 -0
  364. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/check1.gif +0 -0
  365. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/check2.gif +0 -0
  366. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/loading.gif +0 -0
  367. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/treeview-loading.gif +0 -0
  368. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/treeview-skin.css +249 -0
  369. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/treeview-sprite.gif +0 -0
  370. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/skins/sam/treeview.css +7 -0
  371. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/assets/treeview-core.css +6 -0
  372. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/treeview-debug.js +4058 -0
  373. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/treeview-min.js +12 -0
  374. data/vendor/assets/javascripts/yui-2.8.1/build/treeview/treeview.js +3989 -0
  375. data/vendor/assets/javascripts/yui-2.8.1/build/uploader/assets/uploader.swf +0 -0
  376. data/vendor/assets/javascripts/yui-2.8.1/build/uploader/uploader-debug.js +1072 -0
  377. data/vendor/assets/javascripts/yui-2.8.1/build/uploader/uploader-min.js +15 -0
  378. data/vendor/assets/javascripts/yui-2.8.1/build/uploader/uploader.js +1069 -0
  379. data/vendor/assets/javascripts/yui-2.8.1/build/utilities/utilities.js +39 -0
  380. data/vendor/assets/javascripts/yui-2.8.1/build/yahoo-dom-event/yahoo-dom-event.js +14 -0
  381. data/vendor/assets/javascripts/yui-2.8.1/build/yahoo/yahoo-debug.js +1075 -0
  382. data/vendor/assets/javascripts/yui-2.8.1/build/yahoo/yahoo-min.js +7 -0
  383. data/vendor/assets/javascripts/yui-2.8.1/build/yahoo/yahoo.js +1075 -0
  384. data/vendor/assets/javascripts/yui-2.8.1/build/yuiloader-dom-event/yuiloader-dom-event.js +17 -0
  385. data/vendor/assets/javascripts/yui-2.8.1/build/yuiloader/yuiloader-debug.js +3879 -0
  386. data/vendor/assets/javascripts/yui-2.8.1/build/yuiloader/yuiloader-min.js +10 -0
  387. data/vendor/assets/javascripts/yui-2.8.1/build/yuiloader/yuiloader.js +3879 -0
  388. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/assets/skins/sam/yuitest-skin.css +7 -0
  389. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/assets/skins/sam/yuitest.css +7 -0
  390. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/assets/testlogger.css +7 -0
  391. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/assets/yuitest-core.css +7 -0
  392. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/yuitest-debug.js +2741 -0
  393. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/yuitest-min.js +10 -0
  394. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/yuitest.js +2741 -0
  395. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/yuitest_core-debug.js +1976 -0
  396. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/yuitest_core-min.js +9 -0
  397. data/vendor/assets/javascripts/yui-2.8.1/build/yuitest/yuitest_core.js +1976 -0
  398. metadata +470 -0
@@ -0,0 +1,10 @@
1
+ /*
2
+ Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3
+ Code licensed under the BSD License:
4
+ http://developer.yahoo.com/yui/license.html
5
+ version: 2.8.1
6
+ */
7
+ (function(){var D=YAHOO.util.Dom,F=YAHOO.lang,B=F.isObject,E=F.isFunction,C=F.isArray,A=F.isString;function G(K){var N=G.VALUE_UNLIMITED,L,H,I,J,M;K=B(K)?K:{};this.initConfig();this.initEvents();this.set("rowsPerPage",K.rowsPerPage,true);if(G.isNumeric(K.totalRecords)){this.set("totalRecords",K.totalRecords,true);}this.initUIComponents();for(L in K){if(K.hasOwnProperty(L)){this.set(L,K[L],true);}}H=this.get("initialPage");I=this.get("totalRecords");J=this.get("rowsPerPage");if(H>1&&J!==N){M=(H-1)*J;if(I===N||M<I){this.set("recordOffset",M,true);}}}F.augmentObject(G,{id:0,ID_BASE:"yui-pg",VALUE_UNLIMITED:-1,TEMPLATE_DEFAULT:"{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}",TEMPLATE_ROWS_PER_PAGE:"{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}",ui:{},isNumeric:function(H){return isFinite(+H);},toNumber:function(H){return isFinite(+H)?+H:null;}},true);G.prototype={_containers:[],_batch:false,_pageChanged:false,_state:null,initConfig:function(){var H=G.VALUE_UNLIMITED;this.setAttributeConfig("rowsPerPage",{value:0,validator:G.isNumeric,setter:G.toNumber});this.setAttributeConfig("containers",{value:null,validator:function(K){if(!C(K)){K=[K];}for(var J=0,I=K.length;J<I;++J){if(A(K[J])||(B(K[J])&&K[J].nodeType===1)){continue;}return false;}return true;},method:function(I){I=D.get(I);if(!C(I)){I=[I];}this._containers=I;}});this.setAttributeConfig("totalRecords",{value:0,validator:G.isNumeric,setter:G.toNumber});this.setAttributeConfig("recordOffset",{value:0,validator:function(J){var I=this.get("totalRecords");if(G.isNumeric(J)){J=+J;return I===H||I>J||(I===0&&J===0);}return false;},setter:G.toNumber});this.setAttributeConfig("initialPage",{value:1,validator:G.isNumeric,setter:G.toNumber});this.setAttributeConfig("template",{value:G.TEMPLATE_DEFAULT,validator:A});this.setAttributeConfig("containerClass",{value:"yui-pg-container",validator:A});this.setAttributeConfig("alwaysVisible",{value:true,validator:F.isBoolean});this.setAttributeConfig("updateOnChange",{value:false,validator:F.isBoolean});this.setAttributeConfig("id",{value:G.id++,readOnly:true});this.setAttributeConfig("rendered",{value:false,readOnly:true});},initUIComponents:function(){var J=G.ui,I,H;for(I in J){if(J.hasOwnProperty(I)){H=J[I];if(B(H)&&E(H.init)){H.init(this);}}}},initEvents:function(){this.createEvent("render");this.createEvent("rendered");this.createEvent("changeRequest");this.createEvent("pageChange");this.createEvent("beforeDestroy");this.createEvent("destroy");this._selfSubscribe();},_selfSubscribe:function(){this.subscribe("totalRecordsChange",this.updateVisibility,this,true);this.subscribe("alwaysVisibleChange",this.updateVisibility,this,true);this.subscribe("totalRecordsChange",this._handleStateChange,this,true);this.subscribe("recordOffsetChange",this._handleStateChange,this,true);this.subscribe("rowsPerPageChange",this._handleStateChange,this,true);this.subscribe("totalRecordsChange",this._syncRecordOffset,this,true);},_syncRecordOffset:function(K){var H=K.newValue,J,I;if(K.prevValue!==H){if(H!==G.VALUE_UNLIMITED){J=this.get("rowsPerPage");if(J&&this.get("recordOffset")>=H){I=this.getState({totalRecords:K.prevValue,recordOffset:this.get("recordOffset")});this.set("recordOffset",I.before.recordOffset);this._firePageChange(I);}}}},_handleStateChange:function(I){if(I.prevValue!==I.newValue){var J=this._state||{},H;J[I.type.replace(/Change$/,"")]=I.prevValue;H=this.getState(J);if(H.page!==H.before.page){if(this._batch){this._pageChanged=true;}else{this._firePageChange(H);}}}},_firePageChange:function(H){if(B(H)){var I=H.before;delete H.before;this.fireEvent("pageChange",{type:"pageChange",prevValue:H.page,newValue:I.page,prevState:H,newState:I});}},render:function(){if(this.get("rendered")){return this;}var K=this.get("template"),L=this.getState(),J=G.ID_BASE+this.get("id")+"-",I,H;for(I=0,H=this._containers.length;I<H;++I){this._renderTemplate(this._containers[I],K,J+I,true);}this.updateVisibility();if(this._containers.length){this.setAttributeConfig("rendered",{value:true});this.fireEvent("render",L);this.fireEvent("rendered",L);}return this;},_renderTemplate:function(I,M,L,K){var O=this.get("containerClass"),N,J,H;if(!I){return;}D.setStyle(I,"display","none");D.addClass(I,O);I.innerHTML=M.replace(/\{([a-z0-9_ \-]+)\}/gi,'<span class="yui-pg-ui yui-pg-ui-$1"></span>');N=D.getElementsByClassName("yui-pg-ui","span",I);for(J=0,H=N.length;J<H;++J){this.renderUIComponent(N[J],L);}if(!K){D.setStyle(I,"display","");}},renderUIComponent:function(H,M){var L=H.parentNode,K=/yui-pg-ui-(\w+)/.exec(H.className),J=K&&G.ui[K[1]],I;if(E(J)){I=new J(this);if(E(I.render)){L.replaceChild(I.render(M),H);}}},destroy:function(){this.fireEvent("beforeDestroy");this.fireEvent("destroy");this.setAttributeConfig("rendered",{value:false});this.unsubscribeAll();},updateVisibility:function(M){var I=this.get("alwaysVisible"),O,N,K,L,J,H;if(!M||M.type==="alwaysVisibleChange"||!I){O=this.get("totalRecords");N=true;K=this.get("rowsPerPage");L=this.get("rowsPerPageOptions");if(C(L)){for(J=0,H=L.length;J<H;++J){K=Math.min(K,L[J]);}}if(O!==G.VALUE_UNLIMITED&&O<=K){N=false;}N=N||I;for(J=0,H=this._containers.length;J<H;++J){D.setStyle(this._containers[J],"display",N?"":"none");}}},getContainerNodes:function(){return this._containers;},getTotalPages:function(){var H=this.get("totalRecords"),I=this.get("rowsPerPage");if(!I){return null;}if(H===G.VALUE_UNLIMITED){return G.VALUE_UNLIMITED;}return Math.ceil(H/I);},hasPage:function(I){if(!F.isNumber(I)||I<1){return false;}var H=this.getTotalPages();return(H===G.VALUE_UNLIMITED||H>=I);},getCurrentPage:function(){var H=this.get("rowsPerPage");if(!H||!this.get("totalRecords")){return 0;}return Math.floor(this.get("recordOffset")/H)+1;},hasNextPage:function(){var H=this.getCurrentPage(),I=this.getTotalPages();return H&&(I===G.VALUE_UNLIMITED||H<I);},getNextPage:function(){return this.hasNextPage()?this.getCurrentPage()+1:null;},hasPreviousPage:function(){return(this.getCurrentPage()>1);
8
+ },getPreviousPage:function(){return(this.hasPreviousPage()?this.getCurrentPage()-1:1);},getPageRecords:function(K){if(!F.isNumber(K)){K=this.getCurrentPage();}var J=this.get("rowsPerPage"),I=this.get("totalRecords"),L,H;if(!K||!J){return null;}L=(K-1)*J;if(I!==G.VALUE_UNLIMITED){if(L>=I){return null;}H=Math.min(L+J,I)-1;}else{H=L+J-1;}return[L,H];},setPage:function(I,H){if(this.hasPage(I)&&I!==this.getCurrentPage()){if(this.get("updateOnChange")||H){this.set("recordOffset",(I-1)*this.get("rowsPerPage"));}else{this.fireEvent("changeRequest",this.getState({"page":I}));}}},getRowsPerPage:function(){return this.get("rowsPerPage");},setRowsPerPage:function(I,H){if(G.isNumeric(I)&&+I>0&&+I!==this.get("rowsPerPage")){if(this.get("updateOnChange")||H){this.set("rowsPerPage",I);}else{this.fireEvent("changeRequest",this.getState({"rowsPerPage":+I}));}}},getTotalRecords:function(){return this.get("totalRecords");},setTotalRecords:function(I,H){if(G.isNumeric(I)&&+I>=0&&+I!==this.get("totalRecords")){if(this.get("updateOnChange")||H){this.set("totalRecords",I);}else{this.fireEvent("changeRequest",this.getState({"totalRecords":+I}));}}},getStartIndex:function(){return this.get("recordOffset");},setStartIndex:function(I,H){if(G.isNumeric(I)&&+I>=0&&+I!==this.get("recordOffset")){if(this.get("updateOnChange")||H){this.set("recordOffset",I);}else{this.fireEvent("changeRequest",this.getState({"recordOffset":+I}));}}},getState:function(O){var Q=G.VALUE_UNLIMITED,L=Math,N=L.max,P=L.ceil,J,H,K;function I(S,M,R){if(S<=0||M===0){return 0;}if(M===Q||M>S){return S-(S%R);}return M-(M%R||R);}J={paginator:this,totalRecords:this.get("totalRecords"),rowsPerPage:this.get("rowsPerPage"),records:this.getPageRecords()};J.recordOffset=I(this.get("recordOffset"),J.totalRecords,J.rowsPerPage);J.page=P(J.recordOffset/J.rowsPerPage)+1;if(!O){return J;}H={paginator:this,before:J,rowsPerPage:O.rowsPerPage||J.rowsPerPage,totalRecords:(G.isNumeric(O.totalRecords)?N(O.totalRecords,Q):+J.totalRecords)};if(H.totalRecords===0){H.recordOffset=H.page=0;}else{K=G.isNumeric(O.page)?(O.page-1)*H.rowsPerPage:G.isNumeric(O.recordOffset)?+O.recordOffset:J.recordOffset;H.recordOffset=I(K,H.totalRecords,H.rowsPerPage);H.page=P(H.recordOffset/H.rowsPerPage)+1;}H.records=[H.recordOffset,H.recordOffset+H.rowsPerPage-1];if(H.totalRecords!==Q&&H.recordOffset<H.totalRecords&&H.records&&H.records[1]>H.totalRecords-1){H.records[1]=H.totalRecords-1;}return H;},setState:function(I){if(B(I)){this._state=this.getState({});I={page:I.page,rowsPerPage:I.rowsPerPage,totalRecords:I.totalRecords,recordOffset:I.recordOffset};if(I.page&&I.recordOffset===undefined){I.recordOffset=(I.page-1)*(I.rowsPerPage||this.get("rowsPerPage"));}this._batch=true;this._pageChanged=false;for(var H in I){if(I.hasOwnProperty(H)&&this._configs.hasOwnProperty(H)){this.set(H,I[H]);}}this._batch=false;if(this._pageChanged){this._pageChanged=false;this._firePageChange(this.getState(this._state));}}}};F.augmentProto(G,YAHOO.util.AttributeProvider);YAHOO.widget.Paginator=G;})();(function(){var B=YAHOO.widget.Paginator,A=YAHOO.lang;B.ui.CurrentPageReport=function(C){this.paginator=C;C.subscribe("recordOffsetChange",this.update,this,true);C.subscribe("rowsPerPageChange",this.update,this,true);C.subscribe("totalRecordsChange",this.update,this,true);C.subscribe("pageReportTemplateChange",this.update,this,true);C.subscribe("destroy",this.destroy,this,true);C.subscribe("pageReportClassChange",this.update,this,true);};B.ui.CurrentPageReport.init=function(C){C.setAttributeConfig("pageReportClass",{value:"yui-pg-current",validator:A.isString});C.setAttributeConfig("pageReportTemplate",{value:"({currentPage} of {totalPages})",validator:A.isString});C.setAttributeConfig("pageReportValueGenerator",{value:function(F){var E=F.getCurrentPage(),D=F.getPageRecords();return{"currentPage":D?E:0,"totalPages":F.getTotalPages(),"startIndex":D?D[0]:0,"endIndex":D?D[1]:0,"startRecord":D?D[0]+1:0,"endRecord":D?D[1]+1:0,"totalRecords":F.get("totalRecords")};},validator:A.isFunction});};B.ui.CurrentPageReport.sprintf=function(D,C){return D.replace(/\{([\w\s\-]+)\}/g,function(E,F){return(F in C)?C[F]:"";});};B.ui.CurrentPageReport.prototype={span:null,render:function(C){this.span=document.createElement("span");this.span.id=C+"-page-report";this.span.className=this.paginator.get("pageReportClass");this.update();return this.span;},update:function(C){if(C&&C.prevValue===C.newValue){return;}this.span.innerHTML=B.ui.CurrentPageReport.sprintf(this.paginator.get("pageReportTemplate"),this.paginator.get("pageReportValueGenerator")(this.paginator));},destroy:function(){this.span.parentNode.removeChild(this.span);this.span=null;}};})();(function(){var B=YAHOO.widget.Paginator,A=YAHOO.lang;B.ui.PageLinks=function(C){this.paginator=C;C.subscribe("recordOffsetChange",this.update,this,true);C.subscribe("rowsPerPageChange",this.update,this,true);C.subscribe("totalRecordsChange",this.update,this,true);C.subscribe("pageLinksChange",this.rebuild,this,true);C.subscribe("pageLinkClassChange",this.rebuild,this,true);C.subscribe("currentPageClassChange",this.rebuild,this,true);C.subscribe("destroy",this.destroy,this,true);C.subscribe("pageLinksContainerClassChange",this.rebuild,this,true);};B.ui.PageLinks.init=function(C){C.setAttributeConfig("pageLinkClass",{value:"yui-pg-page",validator:A.isString});C.setAttributeConfig("currentPageClass",{value:"yui-pg-current-page",validator:A.isString});C.setAttributeConfig("pageLinksContainerClass",{value:"yui-pg-pages",validator:A.isString});C.setAttributeConfig("pageLinks",{value:10,validator:B.isNumeric});C.setAttributeConfig("pageLabelBuilder",{value:function(D,E){return D;},validator:A.isFunction});};B.ui.PageLinks.calculateRange=function(E,F,D){var I=B.VALUE_UNLIMITED,H,C,G;if(!E||D===0||F===0||(F===I&&D===I)){return[0,-1];}if(F!==I){D=D===I?F:Math.min(D,F);}H=Math.max(1,Math.ceil(E-(D/2)));if(F===I){C=H+D-1;}else{C=Math.min(F,H+D-1);}G=D-(C-H+1);H=Math.max(1,H-G);return[H,C];};B.ui.PageLinks.prototype={current:0,container:null,render:function(C){var D=this.paginator;
9
+ this.container=document.createElement("span");this.container.id=C+"-pages";this.container.className=D.get("pageLinksContainerClass");YAHOO.util.Event.on(this.container,"click",this.onClick,this,true);this.update({newValue:null,rebuild:true});return this.container;},update:function(J){if(J&&J.prevValue===J.newValue){return;}var E=this.paginator,I=E.getCurrentPage();if(this.current!==I||!I||J.rebuild){var L=E.get("pageLabelBuilder"),H=B.ui.PageLinks.calculateRange(I,E.getTotalPages(),E.get("pageLinks")),D=H[0],F=H[1],K="",C,G;C='<a href="#" class="'+E.get("pageLinkClass")+'" page="';for(G=D;G<=F;++G){if(G===I){K+='<span class="'+E.get("currentPageClass")+" "+E.get("pageLinkClass")+'">'+L(G,E)+"</span>";}else{K+=C+G+'">'+L(G,E)+"</a>";}}this.container.innerHTML=K;}},rebuild:function(C){C.rebuild=true;this.update(C);},destroy:function(){YAHOO.util.Event.purgeElement(this.container,true);this.container.parentNode.removeChild(this.container);this.container=null;},onClick:function(D){var C=YAHOO.util.Event.getTarget(D);if(C&&YAHOO.util.Dom.hasClass(C,this.paginator.get("pageLinkClass"))){YAHOO.util.Event.stopEvent(D);this.paginator.setPage(parseInt(C.getAttribute("page"),10));}}};})();(function(){var B=YAHOO.widget.Paginator,A=YAHOO.lang;B.ui.FirstPageLink=function(C){this.paginator=C;C.subscribe("recordOffsetChange",this.update,this,true);C.subscribe("rowsPerPageChange",this.update,this,true);C.subscribe("totalRecordsChange",this.update,this,true);C.subscribe("destroy",this.destroy,this,true);C.subscribe("firstPageLinkLabelChange",this.update,this,true);C.subscribe("firstPageLinkClassChange",this.update,this,true);};B.ui.FirstPageLink.init=function(C){C.setAttributeConfig("firstPageLinkLabel",{value:"&lt;&lt; first",validator:A.isString});C.setAttributeConfig("firstPageLinkClass",{value:"yui-pg-first",validator:A.isString});};B.ui.FirstPageLink.prototype={current:null,link:null,span:null,render:function(D){var E=this.paginator,F=E.get("firstPageLinkClass"),C=E.get("firstPageLinkLabel");this.link=document.createElement("a");this.span=document.createElement("span");this.link.id=D+"-first-link";this.link.href="#";this.link.className=F;this.link.innerHTML=C;YAHOO.util.Event.on(this.link,"click",this.onClick,this,true);this.span.id=D+"-first-span";this.span.className=F;this.span.innerHTML=C;this.current=E.getCurrentPage()>1?this.link:this.span;return this.current;},update:function(D){if(D&&D.prevValue===D.newValue){return;}var C=this.current?this.current.parentNode:null;if(this.paginator.getCurrentPage()>1){if(C&&this.current===this.span){C.replaceChild(this.link,this.current);this.current=this.link;}}else{if(C&&this.current===this.link){C.replaceChild(this.span,this.current);this.current=this.span;}}},destroy:function(){YAHOO.util.Event.purgeElement(this.link);this.current.parentNode.removeChild(this.current);this.link=this.span=null;},onClick:function(C){YAHOO.util.Event.stopEvent(C);this.paginator.setPage(1);}};})();(function(){var B=YAHOO.widget.Paginator,A=YAHOO.lang;B.ui.LastPageLink=function(C){this.paginator=C;C.subscribe("recordOffsetChange",this.update,this,true);C.subscribe("rowsPerPageChange",this.update,this,true);C.subscribe("totalRecordsChange",this.update,this,true);C.subscribe("destroy",this.destroy,this,true);C.subscribe("lastPageLinkLabelChange",this.update,this,true);C.subscribe("lastPageLinkClassChange",this.update,this,true);};B.ui.LastPageLink.init=function(C){C.setAttributeConfig("lastPageLinkLabel",{value:"last &gt;&gt;",validator:A.isString});C.setAttributeConfig("lastPageLinkClass",{value:"yui-pg-last",validator:A.isString});};B.ui.LastPageLink.prototype={current:null,link:null,span:null,na:null,render:function(D){var F=this.paginator,G=F.get("lastPageLinkClass"),C=F.get("lastPageLinkLabel"),E=F.getTotalPages();this.link=document.createElement("a");this.span=document.createElement("span");this.na=this.span.cloneNode(false);this.link.id=D+"-last-link";this.link.href="#";this.link.className=G;this.link.innerHTML=C;YAHOO.util.Event.on(this.link,"click",this.onClick,this,true);this.span.id=D+"-last-span";this.span.className=G;this.span.innerHTML=C;this.na.id=D+"-last-na";switch(E){case B.VALUE_UNLIMITED:this.current=this.na;break;case F.getCurrentPage():this.current=this.span;break;default:this.current=this.link;}return this.current;},update:function(D){if(D&&D.prevValue===D.newValue){return;}var C=this.current?this.current.parentNode:null,E=this.link;if(C){switch(this.paginator.getTotalPages()){case B.VALUE_UNLIMITED:E=this.na;break;case this.paginator.getCurrentPage():E=this.span;break;}if(this.current!==E){C.replaceChild(E,this.current);this.current=E;}}},destroy:function(){YAHOO.util.Event.purgeElement(this.link);this.current.parentNode.removeChild(this.current);this.link=this.span=null;},onClick:function(C){YAHOO.util.Event.stopEvent(C);this.paginator.setPage(this.paginator.getTotalPages());}};})();(function(){var B=YAHOO.widget.Paginator,A=YAHOO.lang;B.ui.NextPageLink=function(C){this.paginator=C;C.subscribe("recordOffsetChange",this.update,this,true);C.subscribe("rowsPerPageChange",this.update,this,true);C.subscribe("totalRecordsChange",this.update,this,true);C.subscribe("destroy",this.destroy,this,true);C.subscribe("nextPageLinkLabelChange",this.update,this,true);C.subscribe("nextPageLinkClassChange",this.update,this,true);};B.ui.NextPageLink.init=function(C){C.setAttributeConfig("nextPageLinkLabel",{value:"next &gt;",validator:A.isString});C.setAttributeConfig("nextPageLinkClass",{value:"yui-pg-next",validator:A.isString});};B.ui.NextPageLink.prototype={current:null,link:null,span:null,render:function(D){var F=this.paginator,G=F.get("nextPageLinkClass"),C=F.get("nextPageLinkLabel"),E=F.getTotalPages();this.link=document.createElement("a");this.span=document.createElement("span");this.link.id=D+"-next-link";this.link.href="#";this.link.className=G;this.link.innerHTML=C;YAHOO.util.Event.on(this.link,"click",this.onClick,this,true);this.span.id=D+"-next-span";this.span.className=G;
10
+ this.span.innerHTML=C;this.current=F.getCurrentPage()===E?this.span:this.link;return this.current;},update:function(E){if(E&&E.prevValue===E.newValue){return;}var D=this.paginator.getTotalPages(),C=this.current?this.current.parentNode:null;if(this.paginator.getCurrentPage()!==D){if(C&&this.current===this.span){C.replaceChild(this.link,this.current);this.current=this.link;}}else{if(this.current===this.link){if(C){C.replaceChild(this.span,this.current);this.current=this.span;}}}},destroy:function(){YAHOO.util.Event.purgeElement(this.link);this.current.parentNode.removeChild(this.current);this.link=this.span=null;},onClick:function(C){YAHOO.util.Event.stopEvent(C);this.paginator.setPage(this.paginator.getNextPage());}};})();(function(){var B=YAHOO.widget.Paginator,A=YAHOO.lang;B.ui.PreviousPageLink=function(C){this.paginator=C;C.subscribe("recordOffsetChange",this.update,this,true);C.subscribe("rowsPerPageChange",this.update,this,true);C.subscribe("totalRecordsChange",this.update,this,true);C.subscribe("destroy",this.destroy,this,true);C.subscribe("previousPageLinkLabelChange",this.update,this,true);C.subscribe("previousPageLinkClassChange",this.update,this,true);};B.ui.PreviousPageLink.init=function(C){C.setAttributeConfig("previousPageLinkLabel",{value:"&lt; prev",validator:A.isString});C.setAttributeConfig("previousPageLinkClass",{value:"yui-pg-previous",validator:A.isString});};B.ui.PreviousPageLink.prototype={current:null,link:null,span:null,render:function(D){var E=this.paginator,F=E.get("previousPageLinkClass"),C=E.get("previousPageLinkLabel");this.link=document.createElement("a");this.span=document.createElement("span");this.link.id=D+"-prev-link";this.link.href="#";this.link.className=F;this.link.innerHTML=C;YAHOO.util.Event.on(this.link,"click",this.onClick,this,true);this.span.id=D+"-prev-span";this.span.className=F;this.span.innerHTML=C;this.current=E.getCurrentPage()>1?this.link:this.span;return this.current;},update:function(D){if(D&&D.prevValue===D.newValue){return;}var C=this.current?this.current.parentNode:null;if(this.paginator.getCurrentPage()>1){if(C&&this.current===this.span){C.replaceChild(this.link,this.current);this.current=this.link;}}else{if(C&&this.current===this.link){C.replaceChild(this.span,this.current);this.current=this.span;}}},destroy:function(){YAHOO.util.Event.purgeElement(this.link);this.current.parentNode.removeChild(this.current);this.link=this.span=null;},onClick:function(C){YAHOO.util.Event.stopEvent(C);this.paginator.setPage(this.paginator.getPreviousPage());}};})();(function(){var B=YAHOO.widget.Paginator,A=YAHOO.lang;B.ui.RowsPerPageDropdown=function(C){this.paginator=C;C.subscribe("rowsPerPageChange",this.update,this,true);C.subscribe("rowsPerPageOptionsChange",this.rebuild,this,true);C.subscribe("totalRecordsChange",this._handleTotalRecordsChange,this,true);C.subscribe("destroy",this.destroy,this,true);C.subscribe("rowsPerPageDropdownClassChange",this.rebuild,this,true);};B.ui.RowsPerPageDropdown.init=function(C){C.setAttributeConfig("rowsPerPageOptions",{value:[],validator:A.isArray});C.setAttributeConfig("rowsPerPageDropdownClass",{value:"yui-pg-rpp-options",validator:A.isString});};B.ui.RowsPerPageDropdown.prototype={select:null,all:null,render:function(C){this.select=document.createElement("select");this.select.id=C+"-rpp";this.select.className=this.paginator.get("rowsPerPageDropdownClass");this.select.title="Rows per page";YAHOO.util.Event.on(this.select,"change",this.onChange,this,true);this.rebuild();return this.select;},rebuild:function(J){var C=this.paginator,E=this.select,K=C.get("rowsPerPageOptions"),D,I,F,G,H;this.all=null;for(G=0,H=K.length;G<H;++G){I=K[G];D=E.options[G]||E.appendChild(document.createElement("option"));F=A.isValue(I.value)?I.value:I;D.innerHTML=A.isValue(I.text)?I.text:I;if(A.isString(F)&&F.toLowerCase()==="all"){this.all=D;D.value=C.get("totalRecords");}else{D.value=F;}}while(E.options.length>K.length){E.removeChild(E.firstChild);}this.update();},update:function(G){if(G&&G.prevValue===G.newValue){return;}var F=this.paginator.get("rowsPerPage")+"",D=this.select.options,E,C;for(E=0,C=D.length;E<C;++E){if(D[E].value===F){D[E].selected=true;break;}}},onChange:function(C){this.paginator.setRowsPerPage(parseInt(this.select.options[this.select.selectedIndex].value,10));},_handleTotalRecordsChange:function(C){if(!this.all||(C&&C.prevValue===C.newValue)){return;}this.all.value=C.newValue;if(this.all.selected){this.paginator.set("rowsPerPage",C.newValue);}},destroy:function(){YAHOO.util.Event.purgeElement(this.select);this.select.parentNode.removeChild(this.select);this.select=null;}};})();YAHOO.register("paginator",YAHOO.widget.Paginator,{version:"2.8.1",build:"19"});
@@ -0,0 +1,2393 @@
1
+ /*
2
+ Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3
+ Code licensed under the BSD License:
4
+ http://developer.yahoo.com/yui/license.html
5
+ version: 2.8.1
6
+ */
7
+ (function () {
8
+ /**
9
+ * The Paginator widget provides a set of controls to navigate through paged
10
+ * data.
11
+ *
12
+ * @module paginator
13
+ * @uses YAHOO.util.EventProvider
14
+ * @uses YAHOO.util.AttributeProvider
15
+ */
16
+
17
+ var Dom = YAHOO.util.Dom,
18
+ lang = YAHOO.lang,
19
+ isObject = lang.isObject,
20
+ isFunction = lang.isFunction,
21
+ isArray = lang.isArray,
22
+ isString = lang.isString;
23
+
24
+ /**
25
+ * Instantiate a Paginator, passing a configuration object to the contructor.
26
+ * The configuration object should contain the following properties:
27
+ * <ul>
28
+ * <li>rowsPerPage : <em>n</em> (int)</li>
29
+ * <li>totalRecords : <em>n</em> (int or Paginator.VALUE_UNLIMITED)</li>
30
+ * <li>containers : <em>id | el | arr</em> (HTMLElement reference, its id, or an array of either)</li>
31
+ * </ul>
32
+ *
33
+ * @namespace YAHOO.widget
34
+ * @class Paginator
35
+ * @constructor
36
+ * @param config {Object} Object literal to set instance and ui component
37
+ * configuration.
38
+ */
39
+ function Paginator(config) {
40
+ var UNLIMITED = Paginator.VALUE_UNLIMITED,
41
+ attrib, initialPage, records, perPage, startIndex;
42
+
43
+ config = isObject(config) ? config : {};
44
+
45
+ this.initConfig();
46
+
47
+ this.initEvents();
48
+
49
+ // Set the basic config keys first
50
+ this.set('rowsPerPage',config.rowsPerPage,true);
51
+ if (Paginator.isNumeric(config.totalRecords)) {
52
+ this.set('totalRecords',config.totalRecords,true);
53
+ }
54
+
55
+ this.initUIComponents();
56
+
57
+ // Update the other config values
58
+ for (attrib in config) {
59
+ if (config.hasOwnProperty(attrib)) {
60
+ this.set(attrib,config[attrib],true);
61
+ }
62
+ }
63
+
64
+ // Calculate the initial record offset
65
+ initialPage = this.get('initialPage');
66
+ records = this.get('totalRecords');
67
+ perPage = this.get('rowsPerPage');
68
+ if (initialPage > 1 && perPage !== UNLIMITED) {
69
+ startIndex = (initialPage - 1) * perPage;
70
+ if (records === UNLIMITED || startIndex < records) {
71
+ this.set('recordOffset',startIndex,true);
72
+ }
73
+ }
74
+ }
75
+
76
+
77
+ // Static members
78
+ lang.augmentObject(Paginator, {
79
+ /**
80
+ * Incrementing index used to give instances unique ids.
81
+ * @static
82
+ * @property Paginator.id
83
+ * @type number
84
+ * @private
85
+ */
86
+ id : 0,
87
+
88
+ /**
89
+ * Base of id strings used for ui components.
90
+ * @static
91
+ * @property Paginator.ID_BASE
92
+ * @type string
93
+ * @private
94
+ */
95
+ ID_BASE : 'yui-pg',
96
+
97
+ /**
98
+ * Used to identify unset, optional configurations, or used explicitly in
99
+ * the case of totalRecords to indicate unlimited pagination.
100
+ * @static
101
+ * @property Paginator.VALUE_UNLIMITED
102
+ * @type number
103
+ * @final
104
+ */
105
+ VALUE_UNLIMITED : -1,
106
+
107
+ /**
108
+ * Default template used by Paginator instances. Update this if you want
109
+ * all new Paginators to use a different default template.
110
+ * @static
111
+ * @property Paginator.TEMPLATE_DEFAULT
112
+ * @type string
113
+ */
114
+ TEMPLATE_DEFAULT : "{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}",
115
+
116
+ /**
117
+ * Common alternate pagination format, including page links, links for
118
+ * previous, next, first and last pages as well as a rows-per-page
119
+ * dropdown. Offered as a convenience.
120
+ * @static
121
+ * @property Paginator.TEMPLATE_ROWS_PER_PAGE
122
+ * @type string
123
+ */
124
+ TEMPLATE_ROWS_PER_PAGE : "{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}",
125
+
126
+ /**
127
+ * Storage object for UI Components
128
+ * @static
129
+ * @property Paginator.ui
130
+ */
131
+ ui : {},
132
+
133
+ /**
134
+ * Similar to YAHOO.lang.isNumber, but allows numeric strings. This is
135
+ * is used for attribute validation in conjunction with getters that return
136
+ * numbers.
137
+ *
138
+ * @method Paginator.isNumeric
139
+ * @param v {Number|String} value to be checked for number or numeric string
140
+ * @returns {Boolean} true if the input is coercable into a finite number
141
+ * @static
142
+ */
143
+ isNumeric : function (v) {
144
+ return isFinite(+v);
145
+ },
146
+
147
+ /**
148
+ * Return a number or null from input
149
+ *
150
+ * @method Paginator.toNumber
151
+ * @param n {Number|String} a number or numeric string
152
+ * @return Number
153
+ * @static
154
+ */
155
+ toNumber : function (n) {
156
+ return isFinite(+n) ? +n : null;
157
+ }
158
+
159
+ },true);
160
+
161
+
162
+ // Instance members and methods
163
+ Paginator.prototype = {
164
+
165
+ // Instance members
166
+
167
+ /**
168
+ * Array of nodes in which to render pagination controls. This is set via
169
+ * the &quot;containers&quot; attribute.
170
+ * @property _containers
171
+ * @type Array(HTMLElement)
172
+ * @private
173
+ */
174
+ _containers : [],
175
+
176
+ /**
177
+ * Flag used to indicate multiple attributes are being updated via setState
178
+ * @property _batch
179
+ * @type boolean
180
+ * @protected
181
+ */
182
+ _batch : false,
183
+
184
+ /**
185
+ * Used by setState to indicate when a page change has occurred
186
+ * @property _pageChanged
187
+ * @type boolean
188
+ * @protected
189
+ */
190
+ _pageChanged : false,
191
+
192
+ /**
193
+ * Temporary state cache used by setState to keep track of the previous
194
+ * state for eventual pageChange event firing
195
+ * @property _state
196
+ * @type Object
197
+ * @protected
198
+ */
199
+ _state : null,
200
+
201
+
202
+ // Instance methods
203
+
204
+ /**
205
+ * Initialize the Paginator's attributes (see YAHOO.util.Element class
206
+ * AttributeProvider).
207
+ * @method initConfig
208
+ * @private
209
+ */
210
+ initConfig : function () {
211
+
212
+ var UNLIMITED = Paginator.VALUE_UNLIMITED;
213
+
214
+ /**
215
+ * REQUIRED. Number of records constituting a &quot;page&quot;
216
+ * @attribute rowsPerPage
217
+ * @type integer
218
+ */
219
+ this.setAttributeConfig('rowsPerPage', {
220
+ value : 0,
221
+ validator : Paginator.isNumeric,
222
+ setter : Paginator.toNumber
223
+ });
224
+
225
+ /**
226
+ * REQUIRED. Node references or ids of nodes in which to render the
227
+ * pagination controls.
228
+ * @attribute containers
229
+ * @type {string|HTMLElement|Array(string|HTMLElement)}
230
+ */
231
+ this.setAttributeConfig('containers', {
232
+ value : null,
233
+ validator : function (val) {
234
+ if (!isArray(val)) {
235
+ val = [val];
236
+ }
237
+ for (var i = 0, len = val.length; i < len; ++i) {
238
+ if (isString(val[i]) ||
239
+ (isObject(val[i]) && val[i].nodeType === 1)) {
240
+ continue;
241
+ }
242
+ return false;
243
+ }
244
+ return true;
245
+ },
246
+ method : function (val) {
247
+ val = Dom.get(val);
248
+ if (!isArray(val)) {
249
+ val = [val];
250
+ }
251
+ this._containers = val;
252
+ }
253
+ });
254
+
255
+ /**
256
+ * Total number of records to paginate through
257
+ * @attribute totalRecords
258
+ * @type integer
259
+ * @default 0
260
+ */
261
+ this.setAttributeConfig('totalRecords', {
262
+ value : 0,
263
+ validator : Paginator.isNumeric,
264
+ setter : Paginator.toNumber
265
+ });
266
+
267
+ /**
268
+ * Zero based index of the record considered first on the current page.
269
+ * For page based interactions, don't modify this attribute directly;
270
+ * use setPage(n).
271
+ * @attribute recordOffset
272
+ * @type integer
273
+ * @default 0
274
+ */
275
+ this.setAttributeConfig('recordOffset', {
276
+ value : 0,
277
+ validator : function (val) {
278
+ var total = this.get('totalRecords');
279
+ if (Paginator.isNumeric(val)) {
280
+ val = +val;
281
+ return total === UNLIMITED || total > val ||
282
+ (total === 0 && val === 0);
283
+ }
284
+
285
+ return false;
286
+ },
287
+ setter : Paginator.toNumber
288
+ });
289
+
290
+ /**
291
+ * Page to display on initial paint
292
+ * @attribute initialPage
293
+ * @type integer
294
+ * @default 1
295
+ */
296
+ this.setAttributeConfig('initialPage', {
297
+ value : 1,
298
+ validator : Paginator.isNumeric,
299
+ setter : Paginator.toNumber
300
+ });
301
+
302
+ /**
303
+ * Template used to render controls. The string will be used as
304
+ * innerHTML on all specified container nodes. Bracketed keys
305
+ * (e.g. {pageLinks}) in the string will be replaced with an instance
306
+ * of the so named ui component.
307
+ * @see Paginator.TEMPLATE_DEFAULT
308
+ * @see Paginator.TEMPLATE_ROWS_PER_PAGE
309
+ * @attribute template
310
+ * @type string
311
+ */
312
+ this.setAttributeConfig('template', {
313
+ value : Paginator.TEMPLATE_DEFAULT,
314
+ validator : isString
315
+ });
316
+
317
+ /**
318
+ * Class assigned to the element(s) containing pagination controls.
319
+ * @attribute containerClass
320
+ * @type string
321
+ * @default 'yui-pg-container'
322
+ */
323
+ this.setAttributeConfig('containerClass', {
324
+ value : 'yui-pg-container',
325
+ validator : isString
326
+ });
327
+
328
+ /**
329
+ * Display pagination controls even when there is only one page. Set
330
+ * to false to forgo rendering and/or hide the containers when there
331
+ * is only one page of data. Note if you are using the rowsPerPage
332
+ * dropdown ui component, visibility will be maintained as long as the
333
+ * number of records exceeds the smallest page size.
334
+ * @attribute alwaysVisible
335
+ * @type boolean
336
+ * @default true
337
+ */
338
+ this.setAttributeConfig('alwaysVisible', {
339
+ value : true,
340
+ validator : lang.isBoolean
341
+ });
342
+
343
+ /**
344
+ * Update the UI immediately upon interaction. If false, changeRequest
345
+ * subscribers or other external code will need to explicitly set the
346
+ * new values in the paginator to trigger repaint.
347
+ * @attribute updateOnChange
348
+ * @type boolean
349
+ * @default false
350
+ * @deprecated use changeRequest listener that calls setState
351
+ */
352
+ this.setAttributeConfig('updateOnChange', {
353
+ value : false,
354
+ validator : lang.isBoolean
355
+ });
356
+
357
+
358
+
359
+ // Read only attributes
360
+
361
+ /**
362
+ * Unique id assigned to this instance
363
+ * @attribute id
364
+ * @type integer
365
+ * @final
366
+ */
367
+ this.setAttributeConfig('id', {
368
+ value : Paginator.id++,
369
+ readOnly : true
370
+ });
371
+
372
+ /**
373
+ * Indicator of whether the DOM nodes have been initially created
374
+ * @attribute rendered
375
+ * @type boolean
376
+ * @final
377
+ */
378
+ this.setAttributeConfig('rendered', {
379
+ value : false,
380
+ readOnly : true
381
+ });
382
+
383
+ },
384
+
385
+ /**
386
+ * Initialize registered ui components onto this instance.
387
+ * @method initUIComponents
388
+ * @private
389
+ */
390
+ initUIComponents : function () {
391
+ var ui = Paginator.ui,
392
+ name,UIComp;
393
+ for (name in ui) {
394
+ if (ui.hasOwnProperty(name)) {
395
+ UIComp = ui[name];
396
+ if (isObject(UIComp) && isFunction(UIComp.init)) {
397
+ UIComp.init(this);
398
+ }
399
+ }
400
+ }
401
+ },
402
+
403
+ /**
404
+ * Initialize this instance's CustomEvents.
405
+ * @method initEvents
406
+ * @private
407
+ */
408
+ initEvents : function () {
409
+ /**
410
+ * Event fired when the Paginator is initially rendered
411
+ * @event render
412
+ */
413
+ this.createEvent('render');
414
+
415
+ /**
416
+ * Event fired when the Paginator is initially rendered
417
+ * @event rendered
418
+ * @deprecated use render event
419
+ */
420
+ this.createEvent('rendered'); // backward compatibility
421
+
422
+ /**
423
+ * Event fired when a change in pagination values is requested,
424
+ * either by interacting with the various ui components or via the
425
+ * setStartIndex(n) etc APIs.
426
+ * Subscribers will receive the proposed state as the first parameter.
427
+ * The proposed state object will contain the following keys:
428
+ * <ul>
429
+ * <li>paginator - the Paginator instance</li>
430
+ * <li>page</li>
431
+ * <li>totalRecords</li>
432
+ * <li>recordOffset - index of the first record on the new page</li>
433
+ * <li>rowsPerPage</li>
434
+ * <li>records - array containing [start index, end index] for the records on the new page</li>
435
+ * <li>before - object literal with all these keys for the current state</li>
436
+ * </ul>
437
+ * @event changeRequest
438
+ */
439
+ this.createEvent('changeRequest');
440
+
441
+ /**
442
+ * Event fired when attribute changes have resulted in the calculated
443
+ * current page changing.
444
+ * @event pageChange
445
+ */
446
+ this.createEvent('pageChange');
447
+
448
+ /**
449
+ * Event that fires before the destroy event.
450
+ * @event beforeDestroy
451
+ */
452
+ this.createEvent('beforeDestroy');
453
+
454
+ /**
455
+ * Event used to trigger cleanup of ui components
456
+ * @event destroy
457
+ */
458
+ this.createEvent('destroy');
459
+
460
+ this._selfSubscribe();
461
+ },
462
+
463
+ /**
464
+ * Subscribes to instance attribute change events to automate certain
465
+ * behaviors.
466
+ * @method _selfSubscribe
467
+ * @protected
468
+ */
469
+ _selfSubscribe : function () {
470
+ // Listen for changes to totalRecords and alwaysVisible
471
+ this.subscribe('totalRecordsChange',this.updateVisibility,this,true);
472
+ this.subscribe('alwaysVisibleChange',this.updateVisibility,this,true);
473
+
474
+ // Fire the pageChange event when appropriate
475
+ this.subscribe('totalRecordsChange',this._handleStateChange,this,true);
476
+ this.subscribe('recordOffsetChange',this._handleStateChange,this,true);
477
+ this.subscribe('rowsPerPageChange',this._handleStateChange,this,true);
478
+
479
+ // Update recordOffset when totalRecords is reduced below
480
+ this.subscribe('totalRecordsChange',this._syncRecordOffset,this,true);
481
+ },
482
+
483
+ /**
484
+ * Sets recordOffset to the starting index of the previous page when
485
+ * totalRecords is reduced below the current recordOffset.
486
+ * @method _syncRecordOffset
487
+ * @param e {Event} totalRecordsChange event
488
+ * @protected
489
+ */
490
+ _syncRecordOffset : function (e) {
491
+ var v = e.newValue,rpp,state;
492
+ if (e.prevValue !== v) {
493
+ if (v !== Paginator.VALUE_UNLIMITED) {
494
+ rpp = this.get('rowsPerPage');
495
+
496
+ if (rpp && this.get('recordOffset') >= v) {
497
+ state = this.getState({
498
+ totalRecords : e.prevValue,
499
+ recordOffset : this.get('recordOffset')
500
+ });
501
+
502
+ this.set('recordOffset', state.before.recordOffset);
503
+ this._firePageChange(state);
504
+ }
505
+ }
506
+ }
507
+ },
508
+
509
+ /**
510
+ * Fires the pageChange event when the state attributes have changed in
511
+ * such a way as to locate the current recordOffset on a new page.
512
+ * @method _handleStateChange
513
+ * @param e {Event} the attribute change event
514
+ * @protected
515
+ */
516
+ _handleStateChange : function (e) {
517
+ if (e.prevValue !== e.newValue) {
518
+ var change = this._state || {},
519
+ state;
520
+
521
+ change[e.type.replace(/Change$/,'')] = e.prevValue;
522
+ state = this.getState(change);
523
+
524
+ if (state.page !== state.before.page) {
525
+ if (this._batch) {
526
+ this._pageChanged = true;
527
+ } else {
528
+ this._firePageChange(state);
529
+ }
530
+ }
531
+ }
532
+ },
533
+
534
+ /**
535
+ * Fires a pageChange event in the form of a standard attribute change
536
+ * event with additional properties prevState and newState.
537
+ * @method _firePageChange
538
+ * @param state {Object} the result of getState(oldState)
539
+ * @protected
540
+ */
541
+ _firePageChange : function (state) {
542
+ if (isObject(state)) {
543
+ var current = state.before;
544
+ delete state.before;
545
+ this.fireEvent('pageChange',{
546
+ type : 'pageChange',
547
+ prevValue : state.page,
548
+ newValue : current.page,
549
+ prevState : state,
550
+ newState : current
551
+ });
552
+ }
553
+ },
554
+
555
+ /**
556
+ * Render the pagination controls per the format attribute into the
557
+ * specified container nodes.
558
+ * @method render
559
+ * @return the Paginator instance
560
+ * @chainable
561
+ */
562
+ render : function () {
563
+ if (this.get('rendered')) {
564
+ return this;
565
+ }
566
+
567
+ var template = this.get('template'),
568
+ state = this.getState(),
569
+ // ex. yui-pg0-1 (first paginator, second container)
570
+ id_base = Paginator.ID_BASE + this.get('id') + '-',
571
+ i, len;
572
+
573
+ // Assemble the containers, keeping them hidden
574
+ for (i = 0, len = this._containers.length; i < len; ++i) {
575
+ this._renderTemplate(this._containers[i],template,id_base+i,true);
576
+ }
577
+
578
+ // Show the containers if appropriate
579
+ this.updateVisibility();
580
+
581
+ // Set render attribute manually to support its readOnly contract
582
+ if (this._containers.length) {
583
+ this.setAttributeConfig('rendered', { value: true });
584
+
585
+ this.fireEvent('render', state);
586
+ // For backward compatibility
587
+ this.fireEvent('rendered', state);
588
+ }
589
+
590
+ return this;
591
+ },
592
+
593
+ /**
594
+ * Creates the individual ui components and renders them into a container.
595
+ *
596
+ * @method _renderTemplate
597
+ * @param container {HTMLElement} where to add the ui components
598
+ * @param template {String} the template to use as a guide for rendering
599
+ * @param id_base {String} id base for the container's ui components
600
+ * @param hide {Boolean} leave the container hidden after assembly
601
+ * @protected
602
+ */
603
+ _renderTemplate : function (container, template, id_base, hide) {
604
+ var containerClass = this.get('containerClass'),
605
+ markers, i, len;
606
+
607
+ if (!container) {
608
+ return;
609
+ }
610
+
611
+ // Hide the container while its contents are rendered
612
+ Dom.setStyle(container,'display','none');
613
+
614
+ Dom.addClass(container, containerClass);
615
+
616
+ // Place the template innerHTML, adding marker spans to the template
617
+ // html to indicate drop zones for ui components
618
+ container.innerHTML = template.replace(/\{([a-z0-9_ \-]+)\}/gi,
619
+ '<span class="yui-pg-ui yui-pg-ui-$1"></span>');
620
+
621
+ // Replace each marker with the ui component's render() output
622
+ markers = Dom.getElementsByClassName('yui-pg-ui','span',container);
623
+
624
+ for (i = 0, len = markers.length; i < len; ++i) {
625
+ this.renderUIComponent(markers[i], id_base);
626
+ }
627
+
628
+ if (!hide) {
629
+ // Show the container allowing page reflow
630
+ Dom.setStyle(container,'display','');
631
+ }
632
+ },
633
+
634
+ /**
635
+ * Replaces a marker node with a rendered UI component, determined by the
636
+ * yui-pg-ui-(UI component class name) in the marker's className. e.g.
637
+ * yui-pg-ui-PageLinks => new YAHOO.widget.Paginator.ui.PageLinks(this)
638
+ *
639
+ * @method renderUIComponent
640
+ * @param marker {HTMLElement} the marker node to replace
641
+ * @param id_base {String} string base the component's generated id
642
+ */
643
+ renderUIComponent : function (marker, id_base) {
644
+ var par = marker.parentNode,
645
+ name = /yui-pg-ui-(\w+)/.exec(marker.className),
646
+ UIComp = name && Paginator.ui[name[1]],
647
+ comp;
648
+
649
+ if (isFunction(UIComp)) {
650
+ comp = new UIComp(this);
651
+ if (isFunction(comp.render)) {
652
+ par.replaceChild(comp.render(id_base),marker);
653
+ }
654
+ }
655
+ },
656
+
657
+ /**
658
+ * Removes controls from the page and unhooks events.
659
+ * @method destroy
660
+ */
661
+ destroy : function () {
662
+ this.fireEvent('beforeDestroy');
663
+ this.fireEvent('destroy');
664
+
665
+ this.setAttributeConfig('rendered',{value:false});
666
+ this.unsubscribeAll();
667
+ },
668
+
669
+ /**
670
+ * Hides the containers if there is only one page of data and attribute
671
+ * alwaysVisible is false. Conversely, it displays the containers if either
672
+ * there is more than one page worth of data or alwaysVisible is turned on.
673
+ * @method updateVisibility
674
+ */
675
+ updateVisibility : function (e) {
676
+ var alwaysVisible = this.get('alwaysVisible'),
677
+ totalRecords,visible,rpp,rppOptions,i,len;
678
+
679
+ if (!e || e.type === 'alwaysVisibleChange' || !alwaysVisible) {
680
+ totalRecords = this.get('totalRecords');
681
+ visible = true;
682
+ rpp = this.get('rowsPerPage');
683
+ rppOptions = this.get('rowsPerPageOptions');
684
+
685
+ if (isArray(rppOptions)) {
686
+ for (i = 0, len = rppOptions.length; i < len; ++i) {
687
+ rpp = Math.min(rpp,rppOptions[i]);
688
+ }
689
+ }
690
+
691
+ if (totalRecords !== Paginator.VALUE_UNLIMITED &&
692
+ totalRecords <= rpp) {
693
+ visible = false;
694
+ }
695
+
696
+ visible = visible || alwaysVisible;
697
+
698
+ for (i = 0, len = this._containers.length; i < len; ++i) {
699
+ Dom.setStyle(this._containers[i],'display',
700
+ visible ? '' : 'none');
701
+ }
702
+ }
703
+ },
704
+
705
+
706
+
707
+
708
+ /**
709
+ * Get the configured container nodes
710
+ * @method getContainerNodes
711
+ * @return {Array} array of HTMLElement nodes
712
+ */
713
+ getContainerNodes : function () {
714
+ return this._containers;
715
+ },
716
+
717
+ /**
718
+ * Get the total number of pages in the data set according to the current
719
+ * rowsPerPage and totalRecords values. If totalRecords is not set, or
720
+ * set to YAHOO.widget.Paginator.VALUE_UNLIMITED, returns
721
+ * YAHOO.widget.Paginator.VALUE_UNLIMITED.
722
+ * @method getTotalPages
723
+ * @return {number}
724
+ */
725
+ getTotalPages : function () {
726
+ var records = this.get('totalRecords'),
727
+ perPage = this.get('rowsPerPage');
728
+
729
+ // rowsPerPage not set. Can't calculate
730
+ if (!perPage) {
731
+ return null;
732
+ }
733
+
734
+ if (records === Paginator.VALUE_UNLIMITED) {
735
+ return Paginator.VALUE_UNLIMITED;
736
+ }
737
+
738
+ return Math.ceil(records/perPage);
739
+ },
740
+
741
+ /**
742
+ * Does the requested page have any records?
743
+ * @method hasPage
744
+ * @param page {number} the page in question
745
+ * @return {boolean}
746
+ */
747
+ hasPage : function (page) {
748
+ if (!lang.isNumber(page) || page < 1) {
749
+ return false;
750
+ }
751
+
752
+ var totalPages = this.getTotalPages();
753
+
754
+ return (totalPages === Paginator.VALUE_UNLIMITED || totalPages >= page);
755
+ },
756
+
757
+ /**
758
+ * Get the page number corresponding to the current record offset.
759
+ * @method getCurrentPage
760
+ * @return {number}
761
+ */
762
+ getCurrentPage : function () {
763
+ var perPage = this.get('rowsPerPage');
764
+ if (!perPage || !this.get('totalRecords')) {
765
+ return 0;
766
+ }
767
+ return Math.floor(this.get('recordOffset') / perPage) + 1;
768
+ },
769
+
770
+ /**
771
+ * Are there records on the next page?
772
+ * @method hasNextPage
773
+ * @return {boolean}
774
+ */
775
+ hasNextPage : function () {
776
+ var currentPage = this.getCurrentPage(),
777
+ totalPages = this.getTotalPages();
778
+
779
+ return currentPage && (totalPages === Paginator.VALUE_UNLIMITED || currentPage < totalPages);
780
+ },
781
+
782
+ /**
783
+ * Get the page number of the next page, or null if the current page is the
784
+ * last page.
785
+ * @method getNextPage
786
+ * @return {number}
787
+ */
788
+ getNextPage : function () {
789
+ return this.hasNextPage() ? this.getCurrentPage() + 1 : null;
790
+ },
791
+
792
+ /**
793
+ * Is there a page before the current page?
794
+ * @method hasPreviousPage
795
+ * @return {boolean}
796
+ */
797
+ hasPreviousPage : function () {
798
+ return (this.getCurrentPage() > 1);
799
+ },
800
+
801
+ /**
802
+ * Get the page number of the previous page, or null if the current page
803
+ * is the first page.
804
+ * @method getPreviousPage
805
+ * @return {number}
806
+ */
807
+ getPreviousPage : function () {
808
+ return (this.hasPreviousPage() ? this.getCurrentPage() - 1 : 1);
809
+ },
810
+
811
+ /**
812
+ * Get the start and end record indexes of the specified page.
813
+ * @method getPageRecords
814
+ * @param page {number} (optional) The page (current page if not specified)
815
+ * @return {Array} [start_index, end_index]
816
+ */
817
+ getPageRecords : function (page) {
818
+ if (!lang.isNumber(page)) {
819
+ page = this.getCurrentPage();
820
+ }
821
+
822
+ var perPage = this.get('rowsPerPage'),
823
+ records = this.get('totalRecords'),
824
+ start, end;
825
+
826
+ if (!page || !perPage) {
827
+ return null;
828
+ }
829
+
830
+ start = (page - 1) * perPage;
831
+ if (records !== Paginator.VALUE_UNLIMITED) {
832
+ if (start >= records) {
833
+ return null;
834
+ }
835
+ end = Math.min(start + perPage, records) - 1;
836
+ } else {
837
+ end = start + perPage - 1;
838
+ }
839
+
840
+ return [start,end];
841
+ },
842
+
843
+ /**
844
+ * Set the current page to the provided page number if possible.
845
+ * @method setPage
846
+ * @param newPage {number} the new page number
847
+ * @param silent {boolean} whether to forcibly avoid firing the
848
+ * changeRequest event
849
+ */
850
+ setPage : function (page,silent) {
851
+ if (this.hasPage(page) && page !== this.getCurrentPage()) {
852
+ if (this.get('updateOnChange') || silent) {
853
+ this.set('recordOffset', (page - 1) * this.get('rowsPerPage'));
854
+ } else {
855
+ this.fireEvent('changeRequest',this.getState({'page':page}));
856
+ }
857
+ }
858
+ },
859
+
860
+ /**
861
+ * Get the number of rows per page.
862
+ * @method getRowsPerPage
863
+ * @return {number} the current setting of the rowsPerPage attribute
864
+ */
865
+ getRowsPerPage : function () {
866
+ return this.get('rowsPerPage');
867
+ },
868
+
869
+ /**
870
+ * Set the number of rows per page.
871
+ * @method setRowsPerPage
872
+ * @param rpp {number} the new number of rows per page
873
+ * @param silent {boolean} whether to forcibly avoid firing the
874
+ * changeRequest event
875
+ */
876
+ setRowsPerPage : function (rpp,silent) {
877
+ if (Paginator.isNumeric(rpp) && +rpp > 0 &&
878
+ +rpp !== this.get('rowsPerPage')) {
879
+ if (this.get('updateOnChange') || silent) {
880
+ this.set('rowsPerPage',rpp);
881
+ } else {
882
+ this.fireEvent('changeRequest',
883
+ this.getState({'rowsPerPage':+rpp}));
884
+ }
885
+ }
886
+ },
887
+
888
+ /**
889
+ * Get the total number of records.
890
+ * @method getTotalRecords
891
+ * @return {number} the current setting of totalRecords attribute
892
+ */
893
+ getTotalRecords : function () {
894
+ return this.get('totalRecords');
895
+ },
896
+
897
+ /**
898
+ * Set the total number of records.
899
+ * @method setTotalRecords
900
+ * @param total {number} the new total number of records
901
+ * @param silent {boolean} whether to forcibly avoid firing the changeRequest event
902
+ */
903
+ setTotalRecords : function (total,silent) {
904
+ if (Paginator.isNumeric(total) && +total >= 0 &&
905
+ +total !== this.get('totalRecords')) {
906
+ if (this.get('updateOnChange') || silent) {
907
+ this.set('totalRecords',total);
908
+ } else {
909
+ this.fireEvent('changeRequest',
910
+ this.getState({'totalRecords':+total}));
911
+ }
912
+ }
913
+ },
914
+
915
+ /**
916
+ * Get the index of the first record on the current page
917
+ * @method getStartIndex
918
+ * @return {number} the index of the first record on the current page
919
+ */
920
+ getStartIndex : function () {
921
+ return this.get('recordOffset');
922
+ },
923
+
924
+ /**
925
+ * Move the record offset to a new starting index. This will likely cause
926
+ * the calculated current page to change. You should probably use setPage.
927
+ * @method setStartIndex
928
+ * @param offset {number} the new record offset
929
+ * @param silent {boolean} whether to forcibly avoid firing the changeRequest event
930
+ */
931
+ setStartIndex : function (offset,silent) {
932
+ if (Paginator.isNumeric(offset) && +offset >= 0 &&
933
+ +offset !== this.get('recordOffset')) {
934
+ if (this.get('updateOnChange') || silent) {
935
+ this.set('recordOffset',offset);
936
+ } else {
937
+ this.fireEvent('changeRequest',
938
+ this.getState({'recordOffset':+offset}));
939
+ }
940
+ }
941
+ },
942
+
943
+ /**
944
+ * Get an object literal describing the current state of the paginator. If
945
+ * an object literal of proposed values is passed, the proposed state will
946
+ * be returned as an object literal with the following keys:
947
+ * <ul>
948
+ * <li>paginator - instance of the Paginator</li>
949
+ * <li>page - number</li>
950
+ * <li>totalRecords - number</li>
951
+ * <li>recordOffset - number</li>
952
+ * <li>rowsPerPage - number</li>
953
+ * <li>records - [ start_index, end_index ]</li>
954
+ * <li>before - (OPTIONAL) { state object literal for current state }</li>
955
+ * </ul>
956
+ * @method getState
957
+ * @return {object}
958
+ * @param changes {object} OPTIONAL object literal with proposed values
959
+ * Supported change keys include:
960
+ * <ul>
961
+ * <li>rowsPerPage</li>
962
+ * <li>totalRecords</li>
963
+ * <li>recordOffset OR</li>
964
+ * <li>page</li>
965
+ * </ul>
966
+ */
967
+ getState : function (changes) {
968
+ var UNLIMITED = Paginator.VALUE_UNLIMITED,
969
+ M = Math, max = M.max, ceil = M.ceil,
970
+ currentState, state, offset;
971
+
972
+ function normalizeOffset(offset,total,rpp) {
973
+ if (offset <= 0 || total === 0) {
974
+ return 0;
975
+ }
976
+ if (total === UNLIMITED || total > offset) {
977
+ return offset - (offset % rpp);
978
+ }
979
+ return total - (total % rpp || rpp);
980
+ }
981
+
982
+ currentState = {
983
+ paginator : this,
984
+ totalRecords : this.get('totalRecords'),
985
+ rowsPerPage : this.get('rowsPerPage'),
986
+ records : this.getPageRecords()
987
+ };
988
+ currentState.recordOffset = normalizeOffset(
989
+ this.get('recordOffset'),
990
+ currentState.totalRecords,
991
+ currentState.rowsPerPage);
992
+ currentState.page = ceil(currentState.recordOffset /
993
+ currentState.rowsPerPage) + 1;
994
+
995
+ if (!changes) {
996
+ return currentState;
997
+ }
998
+
999
+ state = {
1000
+ paginator : this,
1001
+ before : currentState,
1002
+
1003
+ rowsPerPage : changes.rowsPerPage || currentState.rowsPerPage,
1004
+ totalRecords : (Paginator.isNumeric(changes.totalRecords) ?
1005
+ max(changes.totalRecords,UNLIMITED) :
1006
+ +currentState.totalRecords)
1007
+ };
1008
+
1009
+ if (state.totalRecords === 0) {
1010
+ state.recordOffset =
1011
+ state.page = 0;
1012
+ } else {
1013
+ offset = Paginator.isNumeric(changes.page) ?
1014
+ (changes.page - 1) * state.rowsPerPage :
1015
+ Paginator.isNumeric(changes.recordOffset) ?
1016
+ +changes.recordOffset :
1017
+ currentState.recordOffset;
1018
+
1019
+ state.recordOffset = normalizeOffset(offset,
1020
+ state.totalRecords,
1021
+ state.rowsPerPage);
1022
+
1023
+ state.page = ceil(state.recordOffset / state.rowsPerPage) + 1;
1024
+ }
1025
+
1026
+ state.records = [ state.recordOffset,
1027
+ state.recordOffset + state.rowsPerPage - 1 ];
1028
+
1029
+ // limit upper index to totalRecords - 1
1030
+ if (state.totalRecords !== UNLIMITED &&
1031
+ state.recordOffset < state.totalRecords && state.records &&
1032
+ state.records[1] > state.totalRecords - 1) {
1033
+ state.records[1] = state.totalRecords - 1;
1034
+ }
1035
+
1036
+ return state;
1037
+ },
1038
+
1039
+ /**
1040
+ * Convenience method to facilitate setting state attributes rowsPerPage,
1041
+ * totalRecords, recordOffset in batch. Also supports calculating
1042
+ * recordOffset from state.page if state.recordOffset is not provided.
1043
+ * Fires only a single pageChange event, if appropriate.
1044
+ * This will not fire a changeRequest event.
1045
+ * @method setState
1046
+ * @param state {Object} Object literal of attribute:value pairs to set
1047
+ */
1048
+ setState : function (state) {
1049
+ if (isObject(state)) {
1050
+ // get flux state based on current state with before state as well
1051
+ this._state = this.getState({});
1052
+
1053
+ // use just the state props from the input obj
1054
+ state = {
1055
+ page : state.page,
1056
+ rowsPerPage : state.rowsPerPage,
1057
+ totalRecords : state.totalRecords,
1058
+ recordOffset : state.recordOffset
1059
+ };
1060
+
1061
+ // calculate recordOffset from page if recordOffset not specified.
1062
+ // not using lang.isNumber for support of numeric strings
1063
+ if (state.page && state.recordOffset === undefined) {
1064
+ state.recordOffset = (state.page - 1) *
1065
+ (state.rowsPerPage || this.get('rowsPerPage'));
1066
+ }
1067
+
1068
+ this._batch = true;
1069
+ this._pageChanged = false;
1070
+
1071
+ for (var k in state) {
1072
+ if (state.hasOwnProperty(k) && this._configs.hasOwnProperty(k)) {
1073
+ this.set(k,state[k]);
1074
+ }
1075
+ }
1076
+
1077
+ this._batch = false;
1078
+
1079
+ if (this._pageChanged) {
1080
+ this._pageChanged = false;
1081
+
1082
+ this._firePageChange(this.getState(this._state));
1083
+ }
1084
+ }
1085
+ }
1086
+ };
1087
+
1088
+ lang.augmentProto(Paginator, YAHOO.util.AttributeProvider);
1089
+
1090
+ YAHOO.widget.Paginator = Paginator;
1091
+ })();
1092
+ (function () {
1093
+
1094
+ var Paginator = YAHOO.widget.Paginator,
1095
+ l = YAHOO.lang;
1096
+
1097
+ /**
1098
+ * ui Component to generate the textual report of current pagination status.
1099
+ * E.g. "Now viewing page 1 of 13".
1100
+ *
1101
+ * @namespace YAHOO.widget.Paginator.ui
1102
+ * @class CurrentPageReport
1103
+ * @for YAHOO.widget.Paginator
1104
+ *
1105
+ * @constructor
1106
+ * @param p {Pagintor} Paginator instance to attach to
1107
+ */
1108
+ Paginator.ui.CurrentPageReport = function (p) {
1109
+ this.paginator = p;
1110
+
1111
+ p.subscribe('recordOffsetChange', this.update,this,true);
1112
+ p.subscribe('rowsPerPageChange', this.update,this,true);
1113
+ p.subscribe('totalRecordsChange',this.update,this,true);
1114
+ p.subscribe('pageReportTemplateChange', this.update,this,true);
1115
+ p.subscribe('destroy',this.destroy,this,true);
1116
+
1117
+ //TODO: make this work
1118
+ p.subscribe('pageReportClassChange', this.update,this,true);
1119
+ };
1120
+
1121
+ /**
1122
+ * Decorates Paginator instances with new attributes. Called during
1123
+ * Paginator instantiation.
1124
+ * @method init
1125
+ * @param p {Paginator} Paginator instance to decorate
1126
+ * @static
1127
+ */
1128
+ Paginator.ui.CurrentPageReport.init = function (p) {
1129
+
1130
+ /**
1131
+ * CSS class assigned to the span containing the info.
1132
+ * @attribute pageReportClass
1133
+ * @default 'yui-pg-current'
1134
+ */
1135
+ p.setAttributeConfig('pageReportClass', {
1136
+ value : 'yui-pg-current',
1137
+ validator : l.isString
1138
+ });
1139
+
1140
+ /**
1141
+ * Used as innerHTML for the span. Place holders in the form of {name}
1142
+ * will be replaced with the so named value from the key:value map
1143
+ * generated by the function held in the pageReportValueGenerator attribute.
1144
+ * @attribute pageReportTemplate
1145
+ * @default '({currentPage} of {totalPages})'
1146
+ * @see pageReportValueGenerator attribute
1147
+ */
1148
+ p.setAttributeConfig('pageReportTemplate', {
1149
+ value : '({currentPage} of {totalPages})',
1150
+ validator : l.isString
1151
+ });
1152
+
1153
+ /**
1154
+ * Function to generate the value map used to populate the
1155
+ * pageReportTemplate. The function is passed the Paginator instance as a
1156
+ * parameter. The default function returns a map with the following keys:
1157
+ * <ul>
1158
+ * <li>currentPage</li>
1159
+ * <li>totalPages</li>
1160
+ * <li>startIndex</li>
1161
+ * <li>endIndex</li>
1162
+ * <li>startRecord</li>
1163
+ * <li>endRecord</li>
1164
+ * <li>totalRecords</li>
1165
+ * </ul>
1166
+ * @attribute pageReportValueGenarator
1167
+ */
1168
+ p.setAttributeConfig('pageReportValueGenerator', {
1169
+ value : function (paginator) {
1170
+ var curPage = paginator.getCurrentPage(),
1171
+ records = paginator.getPageRecords();
1172
+
1173
+ return {
1174
+ 'currentPage' : records ? curPage : 0,
1175
+ 'totalPages' : paginator.getTotalPages(),
1176
+ 'startIndex' : records ? records[0] : 0,
1177
+ 'endIndex' : records ? records[1] : 0,
1178
+ 'startRecord' : records ? records[0] + 1 : 0,
1179
+ 'endRecord' : records ? records[1] + 1 : 0,
1180
+ 'totalRecords': paginator.get('totalRecords')
1181
+ };
1182
+ },
1183
+ validator : l.isFunction
1184
+ });
1185
+ };
1186
+
1187
+ /**
1188
+ * Replace place holders in a string with the named values found in an
1189
+ * object literal.
1190
+ * @static
1191
+ * @method sprintf
1192
+ * @param template {string} The content string containing place holders
1193
+ * @param values {object} The key:value pairs used to replace the place holders
1194
+ * @return {string}
1195
+ */
1196
+ Paginator.ui.CurrentPageReport.sprintf = function (template, values) {
1197
+ return template.replace(/\{([\w\s\-]+)\}/g, function (x,key) {
1198
+ return (key in values) ? values[key] : '';
1199
+ });
1200
+ };
1201
+
1202
+ Paginator.ui.CurrentPageReport.prototype = {
1203
+
1204
+ /**
1205
+ * Span node containing the formatted info
1206
+ * @property span
1207
+ * @type HTMLElement
1208
+ * @private
1209
+ */
1210
+ span : null,
1211
+
1212
+
1213
+ /**
1214
+ * Generate the span containing info formatted per the pageReportTemplate
1215
+ * attribute.
1216
+ * @method render
1217
+ * @param id_base {string} used to create unique ids for generated nodes
1218
+ * @return {HTMLElement}
1219
+ */
1220
+ render : function (id_base) {
1221
+ this.span = document.createElement('span');
1222
+ this.span.id = id_base + '-page-report';
1223
+ this.span.className = this.paginator.get('pageReportClass');
1224
+ this.update();
1225
+
1226
+ return this.span;
1227
+ },
1228
+
1229
+ /**
1230
+ * Regenerate the content of the span if appropriate. Calls
1231
+ * CurrentPageReport.sprintf with the value of the pageReportTemplate
1232
+ * attribute and the value map returned from pageReportValueGenerator
1233
+ * function.
1234
+ * @method update
1235
+ * @param e {CustomEvent} The calling change event
1236
+ */
1237
+ update : function (e) {
1238
+ if (e && e.prevValue === e.newValue) {
1239
+ return;
1240
+ }
1241
+
1242
+ this.span.innerHTML = Paginator.ui.CurrentPageReport.sprintf(
1243
+ this.paginator.get('pageReportTemplate'),
1244
+ this.paginator.get('pageReportValueGenerator')(this.paginator));
1245
+ },
1246
+
1247
+ /**
1248
+ * Removes the link/span node and clears event listeners
1249
+ * removal.
1250
+ * @method destroy
1251
+ * @private
1252
+ */
1253
+ destroy : function () {
1254
+ this.span.parentNode.removeChild(this.span);
1255
+ this.span = null;
1256
+ }
1257
+
1258
+ };
1259
+
1260
+ })();
1261
+ (function () {
1262
+
1263
+ var Paginator = YAHOO.widget.Paginator,
1264
+ l = YAHOO.lang;
1265
+
1266
+ /**
1267
+ * ui Component to generate the page links
1268
+ *
1269
+ * @namespace YAHOO.widget.Paginator.ui
1270
+ * @class PageLinks
1271
+ * @for YAHOO.widget.Paginator
1272
+ *
1273
+ * @constructor
1274
+ * @param p {Pagintor} Paginator instance to attach to
1275
+ */
1276
+ Paginator.ui.PageLinks = function (p) {
1277
+ this.paginator = p;
1278
+
1279
+ p.subscribe('recordOffsetChange',this.update,this,true);
1280
+ p.subscribe('rowsPerPageChange',this.update,this,true);
1281
+ p.subscribe('totalRecordsChange',this.update,this,true);
1282
+ p.subscribe('pageLinksChange', this.rebuild,this,true);
1283
+ p.subscribe('pageLinkClassChange', this.rebuild,this,true);
1284
+ p.subscribe('currentPageClassChange', this.rebuild,this,true);
1285
+ p.subscribe('destroy',this.destroy,this,true);
1286
+
1287
+ //TODO: Make this work
1288
+ p.subscribe('pageLinksContainerClassChange', this.rebuild,this,true);
1289
+ };
1290
+
1291
+ /**
1292
+ * Decorates Paginator instances with new attributes. Called during
1293
+ * Paginator instantiation.
1294
+ * @method init
1295
+ * @param p {Paginator} Paginator instance to decorate
1296
+ * @static
1297
+ */
1298
+ Paginator.ui.PageLinks.init = function (p) {
1299
+
1300
+ /**
1301
+ * CSS class assigned to each page link/span.
1302
+ * @attribute pageLinkClass
1303
+ * @default 'yui-pg-page'
1304
+ */
1305
+ p.setAttributeConfig('pageLinkClass', {
1306
+ value : 'yui-pg-page',
1307
+ validator : l.isString
1308
+ });
1309
+
1310
+ /**
1311
+ * CSS class assigned to the current page span.
1312
+ * @attribute currentPageClass
1313
+ * @default 'yui-pg-current-page'
1314
+ */
1315
+ p.setAttributeConfig('currentPageClass', {
1316
+ value : 'yui-pg-current-page',
1317
+ validator : l.isString
1318
+ });
1319
+
1320
+ /**
1321
+ * CSS class assigned to the span containing the page links.
1322
+ * @attribute pageLinksContainerClass
1323
+ * @default 'yui-pg-pages'
1324
+ */
1325
+ p.setAttributeConfig('pageLinksContainerClass', {
1326
+ value : 'yui-pg-pages',
1327
+ validator : l.isString
1328
+ });
1329
+
1330
+ /**
1331
+ * Maximum number of page links to display at one time.
1332
+ * @attribute pageLinks
1333
+ * @default 10
1334
+ */
1335
+ p.setAttributeConfig('pageLinks', {
1336
+ value : 10,
1337
+ validator : Paginator.isNumeric
1338
+ });
1339
+
1340
+ /**
1341
+ * Function used generate the innerHTML for each page link/span. The
1342
+ * function receives as parameters the page number and a reference to the
1343
+ * paginator object.
1344
+ * @attribute pageLabelBuilder
1345
+ * @default function (page, paginator) { return page; }
1346
+ */
1347
+ p.setAttributeConfig('pageLabelBuilder', {
1348
+ value : function (page, paginator) { return page; },
1349
+ validator : l.isFunction
1350
+ });
1351
+ };
1352
+
1353
+ /**
1354
+ * Calculates start and end page numbers given a current page, attempting
1355
+ * to keep the current page in the middle
1356
+ * @static
1357
+ * @method calculateRange
1358
+ * @param {int} currentPage The current page
1359
+ * @param {int} totalPages (optional) Maximum number of pages
1360
+ * @param {int} numPages (optional) Preferred number of pages in range
1361
+ * @return {Array} [start_page_number, end_page_number]
1362
+ */
1363
+ Paginator.ui.PageLinks.calculateRange = function (currentPage,totalPages,numPages) {
1364
+ var UNLIMITED = Paginator.VALUE_UNLIMITED,
1365
+ start, end, delta;
1366
+
1367
+ // Either has no pages, or unlimited pages. Show none.
1368
+ if (!currentPage || numPages === 0 || totalPages === 0 ||
1369
+ (totalPages === UNLIMITED && numPages === UNLIMITED)) {
1370
+ return [0,-1];
1371
+ }
1372
+
1373
+ // Limit requested pageLinks if there are fewer totalPages
1374
+ if (totalPages !== UNLIMITED) {
1375
+ numPages = numPages === UNLIMITED ?
1376
+ totalPages :
1377
+ Math.min(numPages,totalPages);
1378
+ }
1379
+
1380
+ // Determine start and end, trying to keep current in the middle
1381
+ start = Math.max(1,Math.ceil(currentPage - (numPages/2)));
1382
+ if (totalPages === UNLIMITED) {
1383
+ end = start + numPages - 1;
1384
+ } else {
1385
+ end = Math.min(totalPages, start + numPages - 1);
1386
+ }
1387
+
1388
+ // Adjust the start index when approaching the last page
1389
+ delta = numPages - (end - start + 1);
1390
+ start = Math.max(1, start - delta);
1391
+
1392
+ return [start,end];
1393
+ };
1394
+
1395
+
1396
+ Paginator.ui.PageLinks.prototype = {
1397
+
1398
+ /**
1399
+ * Current page
1400
+ * @property current
1401
+ * @type number
1402
+ * @private
1403
+ */
1404
+ current : 0,
1405
+
1406
+ /**
1407
+ * Span node containing the page links
1408
+ * @property container
1409
+ * @type HTMLElement
1410
+ * @private
1411
+ */
1412
+ container : null,
1413
+
1414
+
1415
+ /**
1416
+ * Generate the nodes and return the container node containing page links
1417
+ * appropriate to the current pagination state.
1418
+ * @method render
1419
+ * @param id_base {string} used to create unique ids for generated nodes
1420
+ * @return {HTMLElement}
1421
+ */
1422
+ render : function (id_base) {
1423
+ var p = this.paginator;
1424
+
1425
+ // Set up container
1426
+ this.container = document.createElement('span');
1427
+ this.container.id = id_base + '-pages';
1428
+ this.container.className = p.get('pageLinksContainerClass');
1429
+ YAHOO.util.Event.on(this.container,'click',this.onClick,this,true);
1430
+
1431
+ // Call update, flagging a need to rebuild
1432
+ this.update({newValue : null, rebuild : true});
1433
+
1434
+ return this.container;
1435
+ },
1436
+
1437
+ /**
1438
+ * Update the links if appropriate
1439
+ * @method update
1440
+ * @param e {CustomEvent} The calling change event
1441
+ */
1442
+ update : function (e) {
1443
+ if (e && e.prevValue === e.newValue) {
1444
+ return;
1445
+ }
1446
+
1447
+ var p = this.paginator,
1448
+ currentPage = p.getCurrentPage();
1449
+
1450
+ // Replace content if there's been a change
1451
+ if (this.current !== currentPage || !currentPage || e.rebuild) {
1452
+ var labelBuilder = p.get('pageLabelBuilder'),
1453
+ range = Paginator.ui.PageLinks.calculateRange(
1454
+ currentPage,
1455
+ p.getTotalPages(),
1456
+ p.get('pageLinks')),
1457
+ start = range[0],
1458
+ end = range[1],
1459
+ content = '',
1460
+ linkTemplate,i;
1461
+
1462
+ linkTemplate = '<a href="#" class="' + p.get('pageLinkClass') +
1463
+ '" page="';
1464
+ for (i = start; i <= end; ++i) {
1465
+ if (i === currentPage) {
1466
+ content +=
1467
+ '<span class="' + p.get('currentPageClass') + ' ' +
1468
+ p.get('pageLinkClass') + '">' +
1469
+ labelBuilder(i,p) + '</span>';
1470
+ } else {
1471
+ content +=
1472
+ linkTemplate + i + '">' + labelBuilder(i,p) + '</a>';
1473
+ }
1474
+ }
1475
+
1476
+ this.container.innerHTML = content;
1477
+ }
1478
+ },
1479
+
1480
+ /**
1481
+ * Force a rebuild of the page links.
1482
+ * @method rebuild
1483
+ * @param e {CustomEvent} The calling change event
1484
+ */
1485
+ rebuild : function (e) {
1486
+ e.rebuild = true;
1487
+ this.update(e);
1488
+ },
1489
+
1490
+ /**
1491
+ * Removes the page links container node and clears event listeners
1492
+ * @method destroy
1493
+ * @private
1494
+ */
1495
+ destroy : function () {
1496
+ YAHOO.util.Event.purgeElement(this.container,true);
1497
+ this.container.parentNode.removeChild(this.container);
1498
+ this.container = null;
1499
+ },
1500
+
1501
+ /**
1502
+ * Listener for the container's onclick event. Looks for qualifying link
1503
+ * clicks, and pulls the page number from the link's page attribute.
1504
+ * Sends link's page attribute to the Paginator's setPage method.
1505
+ * @method onClick
1506
+ * @param e {DOMEvent} The click event
1507
+ */
1508
+ onClick : function (e) {
1509
+ var t = YAHOO.util.Event.getTarget(e);
1510
+ if (t && YAHOO.util.Dom.hasClass(t,
1511
+ this.paginator.get('pageLinkClass'))) {
1512
+
1513
+ YAHOO.util.Event.stopEvent(e);
1514
+
1515
+ this.paginator.setPage(parseInt(t.getAttribute('page'),10));
1516
+ }
1517
+ }
1518
+
1519
+ };
1520
+
1521
+ })();
1522
+ (function () {
1523
+
1524
+ var Paginator = YAHOO.widget.Paginator,
1525
+ l = YAHOO.lang;
1526
+
1527
+ /**
1528
+ * ui Component to generate the link to jump to the first page.
1529
+ *
1530
+ * @namespace YAHOO.widget.Paginator.ui
1531
+ * @class FirstPageLink
1532
+ * @for YAHOO.widget.Paginator
1533
+ *
1534
+ * @constructor
1535
+ * @param p {Pagintor} Paginator instance to attach to
1536
+ */
1537
+ Paginator.ui.FirstPageLink = function (p) {
1538
+ this.paginator = p;
1539
+
1540
+ p.subscribe('recordOffsetChange',this.update,this,true);
1541
+ p.subscribe('rowsPerPageChange',this.update,this,true);
1542
+ p.subscribe('totalRecordsChange',this.update,this,true);
1543
+ p.subscribe('destroy',this.destroy,this,true);
1544
+
1545
+ // TODO: make this work
1546
+ p.subscribe('firstPageLinkLabelChange',this.update,this,true);
1547
+ p.subscribe('firstPageLinkClassChange',this.update,this,true);
1548
+ };
1549
+
1550
+ /**
1551
+ * Decorates Paginator instances with new attributes. Called during
1552
+ * Paginator instantiation.
1553
+ * @method init
1554
+ * @param p {Paginator} Paginator instance to decorate
1555
+ * @static
1556
+ */
1557
+ Paginator.ui.FirstPageLink.init = function (p) {
1558
+
1559
+ /**
1560
+ * Used as innerHTML for the first page link/span.
1561
+ * @attribute firstPageLinkLabel
1562
+ * @default '&lt;&lt; first'
1563
+ */
1564
+ p.setAttributeConfig('firstPageLinkLabel', {
1565
+ value : '&lt;&lt; first',
1566
+ validator : l.isString
1567
+ });
1568
+
1569
+ /**
1570
+ * CSS class assigned to the link/span
1571
+ * @attribute firstPageLinkClass
1572
+ * @default 'yui-pg-first'
1573
+ */
1574
+ p.setAttributeConfig('firstPageLinkClass', {
1575
+ value : 'yui-pg-first',
1576
+ validator : l.isString
1577
+ });
1578
+ };
1579
+
1580
+ // Instance members and methods
1581
+ Paginator.ui.FirstPageLink.prototype = {
1582
+
1583
+ /**
1584
+ * The currently placed HTMLElement node
1585
+ * @property current
1586
+ * @type HTMLElement
1587
+ * @private
1588
+ */
1589
+ current : null,
1590
+
1591
+ /**
1592
+ * Link node
1593
+ * @property link
1594
+ * @type HTMLElement
1595
+ * @private
1596
+ */
1597
+ link : null,
1598
+
1599
+ /**
1600
+ * Span node (inactive link)
1601
+ * @property span
1602
+ * @type HTMLElement
1603
+ * @private
1604
+ */
1605
+ span : null,
1606
+
1607
+ /**
1608
+ * Generate the nodes and return the appropriate node given the current
1609
+ * pagination state.
1610
+ * @method render
1611
+ * @param id_base {string} used to create unique ids for generated nodes
1612
+ * @return {HTMLElement}
1613
+ */
1614
+ render : function (id_base) {
1615
+ var p = this.paginator,
1616
+ c = p.get('firstPageLinkClass'),
1617
+ label = p.get('firstPageLinkLabel');
1618
+
1619
+ this.link = document.createElement('a');
1620
+ this.span = document.createElement('span');
1621
+
1622
+ this.link.id = id_base + '-first-link';
1623
+ this.link.href = '#';
1624
+ this.link.className = c;
1625
+ this.link.innerHTML = label;
1626
+ YAHOO.util.Event.on(this.link,'click',this.onClick,this,true);
1627
+
1628
+ this.span.id = id_base + '-first-span';
1629
+ this.span.className = c;
1630
+ this.span.innerHTML = label;
1631
+
1632
+ this.current = p.getCurrentPage() > 1 ? this.link : this.span;
1633
+ return this.current;
1634
+ },
1635
+
1636
+ /**
1637
+ * Swap the link and span nodes if appropriate.
1638
+ * @method update
1639
+ * @param e {CustomEvent} The calling change event
1640
+ */
1641
+ update : function (e) {
1642
+ if (e && e.prevValue === e.newValue) {
1643
+ return;
1644
+ }
1645
+
1646
+ var par = this.current ? this.current.parentNode : null;
1647
+ if (this.paginator.getCurrentPage() > 1) {
1648
+ if (par && this.current === this.span) {
1649
+ par.replaceChild(this.link,this.current);
1650
+ this.current = this.link;
1651
+ }
1652
+ } else {
1653
+ if (par && this.current === this.link) {
1654
+ par.replaceChild(this.span,this.current);
1655
+ this.current = this.span;
1656
+ }
1657
+ }
1658
+ },
1659
+
1660
+ /**
1661
+ * Removes the link/span node and clears event listeners
1662
+ * removal.
1663
+ * @method destroy
1664
+ * @private
1665
+ */
1666
+ destroy : function () {
1667
+ YAHOO.util.Event.purgeElement(this.link);
1668
+ this.current.parentNode.removeChild(this.current);
1669
+ this.link = this.span = null;
1670
+ },
1671
+
1672
+ /**
1673
+ * Listener for the link's onclick event. Pass new value to setPage method.
1674
+ * @method onClick
1675
+ * @param e {DOMEvent} The click event
1676
+ */
1677
+ onClick : function (e) {
1678
+ YAHOO.util.Event.stopEvent(e);
1679
+ this.paginator.setPage(1);
1680
+ }
1681
+ };
1682
+
1683
+ })();
1684
+ (function () {
1685
+
1686
+ var Paginator = YAHOO.widget.Paginator,
1687
+ l = YAHOO.lang;
1688
+
1689
+ /**
1690
+ * ui Component to generate the link to jump to the last page.
1691
+ *
1692
+ * @namespace YAHOO.widget.Paginator.ui
1693
+ * @class LastPageLink
1694
+ * @for YAHOO.widget.Paginator
1695
+ *
1696
+ * @constructor
1697
+ * @param p {Pagintor} Paginator instance to attach to
1698
+ */
1699
+ Paginator.ui.LastPageLink = function (p) {
1700
+ this.paginator = p;
1701
+
1702
+ p.subscribe('recordOffsetChange',this.update,this,true);
1703
+ p.subscribe('rowsPerPageChange',this.update,this,true);
1704
+ p.subscribe('totalRecordsChange',this.update,this,true);
1705
+ p.subscribe('destroy',this.destroy,this,true);
1706
+
1707
+ // TODO: make this work
1708
+ p.subscribe('lastPageLinkLabelChange',this.update,this,true);
1709
+ p.subscribe('lastPageLinkClassChange', this.update,this,true);
1710
+ };
1711
+
1712
+ /**
1713
+ * Decorates Paginator instances with new attributes. Called during
1714
+ * Paginator instantiation.
1715
+ * @method init
1716
+ * @param paginator {Paginator} Paginator instance to decorate
1717
+ * @static
1718
+ */
1719
+ Paginator.ui.LastPageLink.init = function (p) {
1720
+
1721
+ /**
1722
+ * Used as innerHTML for the last page link/span.
1723
+ * @attribute lastPageLinkLabel
1724
+ * @default 'last &gt;&gt;'
1725
+ */
1726
+ p.setAttributeConfig('lastPageLinkLabel', {
1727
+ value : 'last &gt;&gt;',
1728
+ validator : l.isString
1729
+ });
1730
+
1731
+ /**
1732
+ * CSS class assigned to the link/span
1733
+ * @attribute lastPageLinkClass
1734
+ * @default 'yui-pg-last'
1735
+ */
1736
+ p.setAttributeConfig('lastPageLinkClass', {
1737
+ value : 'yui-pg-last',
1738
+ validator : l.isString
1739
+ });
1740
+ };
1741
+
1742
+ Paginator.ui.LastPageLink.prototype = {
1743
+
1744
+ /**
1745
+ * Currently placed HTMLElement node
1746
+ * @property current
1747
+ * @type HTMLElement
1748
+ * @private
1749
+ */
1750
+ current : null,
1751
+
1752
+ /**
1753
+ * Link HTMLElement node
1754
+ * @property link
1755
+ * @type HTMLElement
1756
+ * @private
1757
+ */
1758
+ link : null,
1759
+
1760
+ /**
1761
+ * Span node (inactive link)
1762
+ * @property span
1763
+ * @type HTMLElement
1764
+ * @private
1765
+ */
1766
+ span : null,
1767
+
1768
+ /**
1769
+ * Empty place holder node for when the last page link is inappropriate to
1770
+ * display in any form (unlimited paging).
1771
+ * @property na
1772
+ * @type HTMLElement
1773
+ * @private
1774
+ */
1775
+ na : null,
1776
+
1777
+
1778
+ /**
1779
+ * Generate the nodes and return the appropriate node given the current
1780
+ * pagination state.
1781
+ * @method render
1782
+ * @param id_base {string} used to create unique ids for generated nodes
1783
+ * @return {HTMLElement}
1784
+ */
1785
+ render : function (id_base) {
1786
+ var p = this.paginator,
1787
+ c = p.get('lastPageLinkClass'),
1788
+ label = p.get('lastPageLinkLabel'),
1789
+ last = p.getTotalPages();
1790
+
1791
+ this.link = document.createElement('a');
1792
+ this.span = document.createElement('span');
1793
+ this.na = this.span.cloneNode(false);
1794
+
1795
+ this.link.id = id_base + '-last-link';
1796
+ this.link.href = '#';
1797
+ this.link.className = c;
1798
+ this.link.innerHTML = label;
1799
+ YAHOO.util.Event.on(this.link,'click',this.onClick,this,true);
1800
+
1801
+ this.span.id = id_base + '-last-span';
1802
+ this.span.className = c;
1803
+ this.span.innerHTML = label;
1804
+
1805
+ this.na.id = id_base + '-last-na';
1806
+
1807
+ switch (last) {
1808
+ case Paginator.VALUE_UNLIMITED :
1809
+ this.current = this.na; break;
1810
+ case p.getCurrentPage() :
1811
+ this.current = this.span; break;
1812
+ default :
1813
+ this.current = this.link;
1814
+ }
1815
+
1816
+ return this.current;
1817
+ },
1818
+
1819
+ /**
1820
+ * Swap the link, span, and na nodes if appropriate.
1821
+ * @method update
1822
+ * @param e {CustomEvent} The calling change event (ignored)
1823
+ */
1824
+ update : function (e) {
1825
+ if (e && e.prevValue === e.newValue) {
1826
+ return;
1827
+ }
1828
+
1829
+ var par = this.current ? this.current.parentNode : null,
1830
+ after = this.link;
1831
+
1832
+ if (par) {
1833
+ switch (this.paginator.getTotalPages()) {
1834
+ case Paginator.VALUE_UNLIMITED :
1835
+ after = this.na; break;
1836
+ case this.paginator.getCurrentPage() :
1837
+ after = this.span; break;
1838
+ }
1839
+
1840
+ if (this.current !== after) {
1841
+ par.replaceChild(after,this.current);
1842
+ this.current = after;
1843
+ }
1844
+ }
1845
+ },
1846
+
1847
+ /**
1848
+ * Removes the link/span node and clears event listeners
1849
+ * @method destroy
1850
+ * @private
1851
+ */
1852
+ destroy : function () {
1853
+ YAHOO.util.Event.purgeElement(this.link);
1854
+ this.current.parentNode.removeChild(this.current);
1855
+ this.link = this.span = null;
1856
+ },
1857
+
1858
+ /**
1859
+ * Listener for the link's onclick event. Passes to setPage method.
1860
+ * @method onClick
1861
+ * @param e {DOMEvent} The click event
1862
+ */
1863
+ onClick : function (e) {
1864
+ YAHOO.util.Event.stopEvent(e);
1865
+ this.paginator.setPage(this.paginator.getTotalPages());
1866
+ }
1867
+ };
1868
+
1869
+ })();
1870
+ (function () {
1871
+
1872
+ var Paginator = YAHOO.widget.Paginator,
1873
+ l = YAHOO.lang;
1874
+
1875
+ /**
1876
+ * ui Component to generate the link to jump to the next page.
1877
+ *
1878
+ * @namespace YAHOO.widget.Paginator.ui
1879
+ * @class NextPageLink
1880
+ * @for YAHOO.widget.Paginator
1881
+ *
1882
+ * @constructor
1883
+ * @param p {Pagintor} Paginator instance to attach to
1884
+ */
1885
+ Paginator.ui.NextPageLink = function (p) {
1886
+ this.paginator = p;
1887
+
1888
+ p.subscribe('recordOffsetChange', this.update,this,true);
1889
+ p.subscribe('rowsPerPageChange', this.update,this,true);
1890
+ p.subscribe('totalRecordsChange', this.update,this,true);
1891
+ p.subscribe('destroy',this.destroy,this,true);
1892
+
1893
+ // TODO: make this work
1894
+ p.subscribe('nextPageLinkLabelChange', this.update,this,true);
1895
+ p.subscribe('nextPageLinkClassChange', this.update,this,true);
1896
+ };
1897
+
1898
+ /**
1899
+ * Decorates Paginator instances with new attributes. Called during
1900
+ * Paginator instantiation.
1901
+ * @method init
1902
+ * @param p {Paginator} Paginator instance to decorate
1903
+ * @static
1904
+ */
1905
+ Paginator.ui.NextPageLink.init = function (p) {
1906
+
1907
+ /**
1908
+ * Used as innerHTML for the next page link/span.
1909
+ * @attribute nextPageLinkLabel
1910
+ * @default 'next &gt;'
1911
+ */
1912
+ p.setAttributeConfig('nextPageLinkLabel', {
1913
+ value : 'next &gt;',
1914
+ validator : l.isString
1915
+ });
1916
+
1917
+ /**
1918
+ * CSS class assigned to the link/span
1919
+ * @attribute nextPageLinkClass
1920
+ * @default 'yui-pg-next'
1921
+ */
1922
+ p.setAttributeConfig('nextPageLinkClass', {
1923
+ value : 'yui-pg-next',
1924
+ validator : l.isString
1925
+ });
1926
+ };
1927
+
1928
+ Paginator.ui.NextPageLink.prototype = {
1929
+
1930
+ /**
1931
+ * Currently placed HTMLElement node
1932
+ * @property current
1933
+ * @type HTMLElement
1934
+ * @private
1935
+ */
1936
+ current : null,
1937
+
1938
+ /**
1939
+ * Link node
1940
+ * @property link
1941
+ * @type HTMLElement
1942
+ * @private
1943
+ */
1944
+ link : null,
1945
+
1946
+ /**
1947
+ * Span node (inactive link)
1948
+ * @property span
1949
+ * @type HTMLElement
1950
+ * @private
1951
+ */
1952
+ span : null,
1953
+
1954
+
1955
+ /**
1956
+ * Generate the nodes and return the appropriate node given the current
1957
+ * pagination state.
1958
+ * @method render
1959
+ * @param id_base {string} used to create unique ids for generated nodes
1960
+ * @return {HTMLElement}
1961
+ */
1962
+ render : function (id_base) {
1963
+ var p = this.paginator,
1964
+ c = p.get('nextPageLinkClass'),
1965
+ label = p.get('nextPageLinkLabel'),
1966
+ last = p.getTotalPages();
1967
+
1968
+ this.link = document.createElement('a');
1969
+ this.span = document.createElement('span');
1970
+
1971
+ this.link.id = id_base + '-next-link';
1972
+ this.link.href = '#';
1973
+ this.link.className = c;
1974
+ this.link.innerHTML = label;
1975
+ YAHOO.util.Event.on(this.link,'click',this.onClick,this,true);
1976
+
1977
+ this.span.id = id_base + '-next-span';
1978
+ this.span.className = c;
1979
+ this.span.innerHTML = label;
1980
+
1981
+ this.current = p.getCurrentPage() === last ? this.span : this.link;
1982
+
1983
+ return this.current;
1984
+ },
1985
+
1986
+ /**
1987
+ * Swap the link and span nodes if appropriate.
1988
+ * @method update
1989
+ * @param e {CustomEvent} The calling change event
1990
+ */
1991
+ update : function (e) {
1992
+ if (e && e.prevValue === e.newValue) {
1993
+ return;
1994
+ }
1995
+
1996
+ var last = this.paginator.getTotalPages(),
1997
+ par = this.current ? this.current.parentNode : null;
1998
+
1999
+ if (this.paginator.getCurrentPage() !== last) {
2000
+ if (par && this.current === this.span) {
2001
+ par.replaceChild(this.link,this.current);
2002
+ this.current = this.link;
2003
+ }
2004
+ } else if (this.current === this.link) {
2005
+ if (par) {
2006
+ par.replaceChild(this.span,this.current);
2007
+ this.current = this.span;
2008
+ }
2009
+ }
2010
+ },
2011
+
2012
+ /**
2013
+ * Removes the link/span node and clears event listeners
2014
+ * @method destroy
2015
+ * @private
2016
+ */
2017
+ destroy : function () {
2018
+ YAHOO.util.Event.purgeElement(this.link);
2019
+ this.current.parentNode.removeChild(this.current);
2020
+ this.link = this.span = null;
2021
+ },
2022
+
2023
+ /**
2024
+ * Listener for the link's onclick event. Passes to setPage method.
2025
+ * @method onClick
2026
+ * @param e {DOMEvent} The click event
2027
+ */
2028
+ onClick : function (e) {
2029
+ YAHOO.util.Event.stopEvent(e);
2030
+ this.paginator.setPage(this.paginator.getNextPage());
2031
+ }
2032
+ };
2033
+
2034
+ })();
2035
+ (function () {
2036
+
2037
+ var Paginator = YAHOO.widget.Paginator,
2038
+ l = YAHOO.lang;
2039
+
2040
+ /**
2041
+ * ui Component to generate the link to jump to the previous page.
2042
+ *
2043
+ * @namespace YAHOO.widget.Paginator.ui
2044
+ * @class PreviousPageLink
2045
+ * @for YAHOO.widget.Paginator
2046
+ *
2047
+ * @constructor
2048
+ * @param p {Pagintor} Paginator instance to attach to
2049
+ */
2050
+ Paginator.ui.PreviousPageLink = function (p) {
2051
+ this.paginator = p;
2052
+
2053
+ p.subscribe('recordOffsetChange',this.update,this,true);
2054
+ p.subscribe('rowsPerPageChange',this.update,this,true);
2055
+ p.subscribe('totalRecordsChange',this.update,this,true);
2056
+ p.subscribe('destroy',this.destroy,this,true);
2057
+
2058
+ // TODO: make this work
2059
+ p.subscribe('previousPageLinkLabelChange',this.update,this,true);
2060
+ p.subscribe('previousPageLinkClassChange',this.update,this,true);
2061
+ };
2062
+
2063
+ /**
2064
+ * Decorates Paginator instances with new attributes. Called during
2065
+ * Paginator instantiation.
2066
+ * @method init
2067
+ * @param p {Paginator} Paginator instance to decorate
2068
+ * @static
2069
+ */
2070
+ Paginator.ui.PreviousPageLink.init = function (p) {
2071
+
2072
+ /**
2073
+ * Used as innerHTML for the previous page link/span.
2074
+ * @attribute previousPageLinkLabel
2075
+ * @default '&lt; prev'
2076
+ */
2077
+ p.setAttributeConfig('previousPageLinkLabel', {
2078
+ value : '&lt; prev',
2079
+ validator : l.isString
2080
+ });
2081
+
2082
+ /**
2083
+ * CSS class assigned to the link/span
2084
+ * @attribute previousPageLinkClass
2085
+ * @default 'yui-pg-previous'
2086
+ */
2087
+ p.setAttributeConfig('previousPageLinkClass', {
2088
+ value : 'yui-pg-previous',
2089
+ validator : l.isString
2090
+ });
2091
+ };
2092
+
2093
+ Paginator.ui.PreviousPageLink.prototype = {
2094
+
2095
+ /**
2096
+ * Currently placed HTMLElement node
2097
+ * @property current
2098
+ * @type HTMLElement
2099
+ * @private
2100
+ */
2101
+ current : null,
2102
+
2103
+ /**
2104
+ * Link node
2105
+ * @property link
2106
+ * @type HTMLElement
2107
+ * @private
2108
+ */
2109
+ link : null,
2110
+
2111
+ /**
2112
+ * Span node (inactive link)
2113
+ * @property span
2114
+ * @type HTMLElement
2115
+ * @private
2116
+ */
2117
+ span : null,
2118
+
2119
+
2120
+ /**
2121
+ * Generate the nodes and return the appropriate node given the current
2122
+ * pagination state.
2123
+ * @method render
2124
+ * @param id_base {string} used to create unique ids for generated nodes
2125
+ * @return {HTMLElement}
2126
+ */
2127
+ render : function (id_base) {
2128
+ var p = this.paginator,
2129
+ c = p.get('previousPageLinkClass'),
2130
+ label = p.get('previousPageLinkLabel');
2131
+
2132
+ this.link = document.createElement('a');
2133
+ this.span = document.createElement('span');
2134
+
2135
+ this.link.id = id_base + '-prev-link';
2136
+ this.link.href = '#';
2137
+ this.link.className = c;
2138
+ this.link.innerHTML = label;
2139
+ YAHOO.util.Event.on(this.link,'click',this.onClick,this,true);
2140
+
2141
+ this.span.id = id_base + '-prev-span';
2142
+ this.span.className = c;
2143
+ this.span.innerHTML = label;
2144
+
2145
+ this.current = p.getCurrentPage() > 1 ? this.link : this.span;
2146
+ return this.current;
2147
+ },
2148
+
2149
+ /**
2150
+ * Swap the link and span nodes if appropriate.
2151
+ * @method update
2152
+ * @param e {CustomEvent} The calling change event
2153
+ */
2154
+ update : function (e) {
2155
+ if (e && e.prevValue === e.newValue) {
2156
+ return;
2157
+ }
2158
+
2159
+ var par = this.current ? this.current.parentNode : null;
2160
+ if (this.paginator.getCurrentPage() > 1) {
2161
+ if (par && this.current === this.span) {
2162
+ par.replaceChild(this.link,this.current);
2163
+ this.current = this.link;
2164
+ }
2165
+ } else {
2166
+ if (par && this.current === this.link) {
2167
+ par.replaceChild(this.span,this.current);
2168
+ this.current = this.span;
2169
+ }
2170
+ }
2171
+ },
2172
+
2173
+ /**
2174
+ * Removes the link/span node and clears event listeners
2175
+ * @method destroy
2176
+ * @private
2177
+ */
2178
+ destroy : function () {
2179
+ YAHOO.util.Event.purgeElement(this.link);
2180
+ this.current.parentNode.removeChild(this.current);
2181
+ this.link = this.span = null;
2182
+ },
2183
+
2184
+ /**
2185
+ * Listener for the link's onclick event. Passes to setPage method.
2186
+ * @method onClick
2187
+ * @param e {DOMEvent} The click event
2188
+ */
2189
+ onClick : function (e) {
2190
+ YAHOO.util.Event.stopEvent(e);
2191
+ this.paginator.setPage(this.paginator.getPreviousPage());
2192
+ }
2193
+ };
2194
+
2195
+ })();
2196
+ (function () {
2197
+
2198
+ var Paginator = YAHOO.widget.Paginator,
2199
+ l = YAHOO.lang;
2200
+
2201
+ /**
2202
+ * ui Component to generate the rows-per-page dropdown
2203
+ *
2204
+ * @namespace YAHOO.widget.Paginator.ui
2205
+ * @class RowsPerPageDropdown
2206
+ * @for YAHOO.widget.Paginator
2207
+ *
2208
+ * @constructor
2209
+ * @param p {Pagintor} Paginator instance to attach to
2210
+ */
2211
+ Paginator.ui.RowsPerPageDropdown = function (p) {
2212
+ this.paginator = p;
2213
+
2214
+ p.subscribe('rowsPerPageChange',this.update,this,true);
2215
+ p.subscribe('rowsPerPageOptionsChange',this.rebuild,this,true);
2216
+ p.subscribe('totalRecordsChange',this._handleTotalRecordsChange,this,true);
2217
+ p.subscribe('destroy',this.destroy,this,true);
2218
+
2219
+ // TODO: make this work
2220
+ p.subscribe('rowsPerPageDropdownClassChange',this.rebuild,this,true);
2221
+ };
2222
+
2223
+ /**
2224
+ * Decorates Paginator instances with new attributes. Called during
2225
+ * Paginator instantiation.
2226
+ * @method init
2227
+ * @param p {Paginator} Paginator instance to decorate
2228
+ * @static
2229
+ */
2230
+ Paginator.ui.RowsPerPageDropdown.init = function (p) {
2231
+
2232
+ /**
2233
+ * Array of available rows-per-page sizes. Converted into select options.
2234
+ * Array values may be positive integers or object literals in the form<br>
2235
+ * { value : NUMBER, text : STRING }
2236
+ * @attribute rowsPerPageOptions
2237
+ * @default []
2238
+ */
2239
+ p.setAttributeConfig('rowsPerPageOptions', {
2240
+ value : [],
2241
+ validator : l.isArray
2242
+ });
2243
+
2244
+ /**
2245
+ * CSS class assigned to the select node
2246
+ * @attribute rowsPerPageDropdownClass
2247
+ * @default 'yui-pg-rpp-options'
2248
+ */
2249
+ p.setAttributeConfig('rowsPerPageDropdownClass', {
2250
+ value : 'yui-pg-rpp-options',
2251
+ validator : l.isString
2252
+ });
2253
+ };
2254
+
2255
+ Paginator.ui.RowsPerPageDropdown.prototype = {
2256
+
2257
+ /**
2258
+ * select node
2259
+ * @property select
2260
+ * @type HTMLElement
2261
+ * @private
2262
+ */
2263
+ select : null,
2264
+
2265
+
2266
+ /**
2267
+ * option node for the optional All value
2268
+ *
2269
+ * @property all
2270
+ * @type HTMLElement
2271
+ * @protected
2272
+ */
2273
+ all : null,
2274
+
2275
+ /**
2276
+ * Generate the select and option nodes and returns the select node.
2277
+ * @method render
2278
+ * @param id_base {string} used to create unique ids for generated nodes
2279
+ * @return {HTMLElement}
2280
+ */
2281
+ render : function (id_base) {
2282
+ this.select = document.createElement('select');
2283
+ this.select.id = id_base + '-rpp';
2284
+ this.select.className = this.paginator.get('rowsPerPageDropdownClass');
2285
+ this.select.title = 'Rows per page';
2286
+
2287
+ YAHOO.util.Event.on(this.select,'change',this.onChange,this,true);
2288
+
2289
+ this.rebuild();
2290
+
2291
+ return this.select;
2292
+ },
2293
+
2294
+ /**
2295
+ * (Re)generate the select options.
2296
+ * @method rebuild
2297
+ */
2298
+ rebuild : function (e) {
2299
+ var p = this.paginator,
2300
+ sel = this.select,
2301
+ options = p.get('rowsPerPageOptions'),
2302
+ opt,cfg,val,i,len;
2303
+
2304
+ this.all = null;
2305
+
2306
+ for (i = 0, len = options.length; i < len; ++i) {
2307
+ cfg = options[i];
2308
+ opt = sel.options[i] ||
2309
+ sel.appendChild(document.createElement('option'));
2310
+ val = l.isValue(cfg.value) ? cfg.value : cfg;
2311
+ opt.innerHTML = l.isValue(cfg.text) ? cfg.text : cfg;
2312
+
2313
+ if (l.isString(val) && val.toLowerCase() === 'all') {
2314
+ this.all = opt;
2315
+ opt.value = p.get('totalRecords');
2316
+ } else{
2317
+ opt.value = val;
2318
+ }
2319
+
2320
+ }
2321
+
2322
+ while (sel.options.length > options.length) {
2323
+ sel.removeChild(sel.firstChild);
2324
+ }
2325
+
2326
+ this.update();
2327
+ },
2328
+
2329
+ /**
2330
+ * Select the appropriate option if changed.
2331
+ * @method update
2332
+ * @param e {CustomEvent} The calling change event
2333
+ */
2334
+ update : function (e) {
2335
+ if (e && e.prevValue === e.newValue) {
2336
+ return;
2337
+ }
2338
+
2339
+ var rpp = this.paginator.get('rowsPerPage')+'',
2340
+ options = this.select.options,
2341
+ i,len;
2342
+
2343
+ for (i = 0, len = options.length; i < len; ++i) {
2344
+ if (options[i].value === rpp) {
2345
+ options[i].selected = true;
2346
+ break;
2347
+ }
2348
+ }
2349
+ },
2350
+
2351
+ /**
2352
+ * Listener for the select's onchange event. Sent to setRowsPerPage method.
2353
+ * @method onChange
2354
+ * @param e {DOMEvent} The change event
2355
+ */
2356
+ onChange : function (e) {
2357
+ this.paginator.setRowsPerPage(
2358
+ parseInt(this.select.options[this.select.selectedIndex].value,10));
2359
+ },
2360
+
2361
+ /**
2362
+ * Updates the all option value (and Paginator's rowsPerPage attribute if
2363
+ * necessary) in response to a change in the Paginator's totalRecords.
2364
+ *
2365
+ * @method _handleTotalRecordsChange
2366
+ * @param e {Event} attribute change event
2367
+ * @protected
2368
+ */
2369
+ _handleTotalRecordsChange : function (e) {
2370
+ if (!this.all || (e && e.prevValue === e.newValue)) {
2371
+ return;
2372
+ }
2373
+
2374
+ this.all.value = e.newValue;
2375
+ if (this.all.selected) {
2376
+ this.paginator.set('rowsPerPage',e.newValue);
2377
+ }
2378
+ },
2379
+
2380
+ /**
2381
+ * Removes the select node and clears event listeners
2382
+ * @method destroy
2383
+ * @private
2384
+ */
2385
+ destroy : function () {
2386
+ YAHOO.util.Event.purgeElement(this.select);
2387
+ this.select.parentNode.removeChild(this.select);
2388
+ this.select = null;
2389
+ }
2390
+ };
2391
+
2392
+ })();
2393
+ YAHOO.register("paginator", YAHOO.widget.Paginator, {version: "2.8.1", build: "19"});