rbbt-views 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (551) hide show
  1. data/LICENSE +20 -0
  2. data/lib/rbbt/workflow/rest/auth.rb +69 -0
  3. data/lib/rbbt/workflow/rest/client.rb +162 -0
  4. data/lib/rbbt/workflow/rest/entity.rb +77 -0
  5. data/lib/rbbt/workflow/rest/render.rb +209 -0
  6. data/lib/rbbt/workflow/rest/util.rb +329 -0
  7. data/lib/rbbt/workflow/rest.rb +437 -0
  8. data/share/views/compass/_base.sass +19 -0
  9. data/share/views/compass/app.sass +103 -0
  10. data/share/views/compass/compass.config +33 -0
  11. data/share/views/compass/form.sass +23 -0
  12. data/share/views/compass/layout.sass +0 -0
  13. data/share/views/compass/main.sass +161 -0
  14. data/share/views/compass/screen.sass +8 -0
  15. data/share/views/dependencies.haml +7 -0
  16. data/share/views/entity/Gene.haml +6 -0
  17. data/share/views/error.haml +2 -0
  18. data/share/views/files.haml +5 -0
  19. data/share/views/form.haml +66 -0
  20. data/share/views/info.haml +19 -0
  21. data/share/views/job_list.haml +5 -0
  22. data/share/views/js/app.js +221 -0
  23. data/share/views/layout.haml +89 -0
  24. data/share/views/partials/_context_control.haml +14 -0
  25. data/share/views/partials/_job_control.haml +17 -0
  26. data/share/views/partials/_result_table.haml +43 -0
  27. data/share/views/partials/_result_table_controls.haml +47 -0
  28. data/share/views/public/plugins/jqgrid/css/ellipsis-xbl.xml +13 -0
  29. data/share/views/public/plugins/jqgrid/css/ui.jqgrid.css +140 -0
  30. data/share/views/public/plugins/jqgrid/js/Changes.txt +1160 -0
  31. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-ar.js +126 -0
  32. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-bg.js +132 -0
  33. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-bg1251.js +132 -0
  34. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-cat.js +128 -0
  35. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-cn.js +132 -0
  36. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-cs.js +128 -0
  37. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-da.js +128 -0
  38. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-de.js +133 -0
  39. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-el.js +126 -0
  40. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-en.js +128 -0
  41. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-es.js +128 -0
  42. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-fa.js +145 -0
  43. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-fi.js +128 -0
  44. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-fr.js +126 -0
  45. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-gl.js +126 -0
  46. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-he.js +127 -0
  47. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-hu.js +129 -0
  48. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-is.js +126 -0
  49. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-it.js +1 -0
  50. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-ja.js +155 -0
  51. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-lt.js +128 -0
  52. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-mne.js +128 -0
  53. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-nl.js +149 -0
  54. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-no.js +1 -0
  55. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-pl.js +127 -0
  56. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-pt-br.js +127 -0
  57. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-pt.js +125 -0
  58. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-ro.js +139 -0
  59. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-ru.js +127 -0
  60. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-sk.js +127 -0
  61. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-sr.js +128 -0
  62. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-sv.js +127 -0
  63. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-th.js +128 -0
  64. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-tr.js +126 -0
  65. data/share/views/public/plugins/jqgrid/js/i18n/grid.locale-ua.js +127 -0
  66. data/share/views/public/plugins/jqgrid/js/install.txt +43 -0
  67. data/share/views/public/plugins/jqgrid/js/jquery-1.5.2.min.js +16 -0
  68. data/share/views/public/plugins/jqgrid/js/jquery.jqGrid.min.js +464 -0
  69. data/share/views/public/plugins/jqgrid/js/jquery.jqGrid.src.js +10977 -0
  70. data/share/views/public/plugins/jqgrid/plugins/grid.addons.js +704 -0
  71. data/share/views/public/plugins/jqgrid/plugins/grid.postext.js +64 -0
  72. data/share/views/public/plugins/jqgrid/plugins/grid.setcolumns.js +126 -0
  73. data/share/views/public/plugins/jqgrid/plugins/jquery.contextmenu.js +144 -0
  74. data/share/views/public/plugins/jqgrid/plugins/jquery.searchFilter.js +716 -0
  75. data/share/views/public/plugins/jqgrid/plugins/jquery.tablednd.js +383 -0
  76. data/share/views/public/plugins/jqgrid/plugins/ui.multiselect.css +30 -0
  77. data/share/views/public/plugins/jqgrid/plugins/ui.multiselect.js +314 -0
  78. data/share/views/public/plugins/jqgrid/src/JsonXml.js +338 -0
  79. data/share/views/public/plugins/jqgrid/src/css/ellipsis-xbl.xml +13 -0
  80. data/share/views/public/plugins/jqgrid/src/css/ui.jqgrid.css +140 -0
  81. data/share/views/public/plugins/jqgrid/src/css/ui.multiselect.css +30 -0
  82. data/share/views/public/plugins/jqgrid/src/grid.base.js +3279 -0
  83. data/share/views/public/plugins/jqgrid/src/grid.celledit.js +488 -0
  84. data/share/views/public/plugins/jqgrid/src/grid.common.js +668 -0
  85. data/share/views/public/plugins/jqgrid/src/grid.custom.js +440 -0
  86. data/share/views/public/plugins/jqgrid/src/grid.filter.js +713 -0
  87. data/share/views/public/plugins/jqgrid/src/grid.formedit.js +1964 -0
  88. data/share/views/public/plugins/jqgrid/src/grid.grouping.js +292 -0
  89. data/share/views/public/plugins/jqgrid/src/grid.import.js +201 -0
  90. data/share/views/public/plugins/jqgrid/src/grid.inlinedit.js +311 -0
  91. data/share/views/public/plugins/jqgrid/src/grid.jqueryui.js +504 -0
  92. data/share/views/public/plugins/jqgrid/src/grid.loader.js +50 -0
  93. data/share/views/public/plugins/jqgrid/src/grid.subgrid.js +292 -0
  94. data/share/views/public/plugins/jqgrid/src/grid.tbltogrid.js +106 -0
  95. data/share/views/public/plugins/jqgrid/src/grid.treegrid.js +666 -0
  96. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-ar.js +126 -0
  97. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-bg.js +132 -0
  98. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-bg1251.js +132 -0
  99. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-cat.js +128 -0
  100. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-cn.js +132 -0
  101. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-cs.js +128 -0
  102. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-da.js +128 -0
  103. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-de.js +133 -0
  104. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-dk.js +128 -0
  105. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-el.js +126 -0
  106. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-en.js +128 -0
  107. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-es.js +128 -0
  108. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-fa.js +145 -0
  109. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-fi.js +128 -0
  110. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-fr.js +126 -0
  111. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-gl.js +126 -0
  112. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-he.js +127 -0
  113. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-hu.js +129 -0
  114. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-is.js +126 -0
  115. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-it.js +1 -0
  116. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-ja.js +155 -0
  117. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-lt.js +128 -0
  118. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-mne.js +128 -0
  119. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-nl.js +149 -0
  120. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-no.js +1 -0
  121. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-pl.js +127 -0
  122. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-pt-br.js +127 -0
  123. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-pt.js +125 -0
  124. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-ro.js +139 -0
  125. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-ru.js +127 -0
  126. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-sk.js +127 -0
  127. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-sr.js +128 -0
  128. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-sv.js +127 -0
  129. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-th.js +128 -0
  130. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-tr.js +126 -0
  131. data/share/views/public/plugins/jqgrid/src/i18n/grid.locale-ua.js +127 -0
  132. data/share/views/public/plugins/jqgrid/src/jqDnR.js +71 -0
  133. data/share/views/public/plugins/jqgrid/src/jqModal.js +69 -0
  134. data/share/views/public/plugins/jqgrid/src/jquery.fmatter.js +583 -0
  135. data/share/views/public/plugins/jquery/js/jquery-1.6.2.min.js +18 -0
  136. data/share/views/public/plugins/jquery-ui/css/custom-theme/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  137. data/share/views/public/plugins/jquery-ui/css/custom-theme/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  138. data/share/views/public/plugins/jquery-ui/css/custom-theme/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  139. data/share/views/public/plugins/jquery-ui/css/custom-theme/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  140. data/share/views/public/plugins/jquery-ui/css/custom-theme/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  141. data/share/views/public/plugins/jquery-ui/css/custom-theme/images/ui-bg_glass_75_ffffff_1x400.png +0 -0
  142. data/share/views/public/plugins/jquery-ui/css/custom-theme/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  143. data/share/views/public/plugins/jquery-ui/css/custom-theme/images/ui-bg_inset-soft_95_fef1ec_1x100.png +0 -0
  144. data/share/views/public/plugins/jquery-ui/css/custom-theme/images/ui-icons_222222_256x240.png +0 -0
  145. data/share/views/public/plugins/jquery-ui/css/custom-theme/images/ui-icons_2e83ff_256x240.png +0 -0
  146. data/share/views/public/plugins/jquery-ui/css/custom-theme/images/ui-icons_454545_256x240.png +0 -0
  147. data/share/views/public/plugins/jquery-ui/css/custom-theme/images/ui-icons_888888_256x240.png +0 -0
  148. data/share/views/public/plugins/jquery-ui/css/custom-theme/images/ui-icons_cd0a0a_256x240.png +0 -0
  149. data/share/views/public/plugins/jquery-ui/css/custom-theme/jquery-ui-1.8.14.custom.css +568 -0
  150. data/share/views/public/plugins/jquery-ui/development-bundle/AUTHORS.txt +30 -0
  151. data/share/views/public/plugins/jquery-ui/development-bundle/GPL-LICENSE.txt +278 -0
  152. data/share/views/public/plugins/jquery-ui/development-bundle/MIT-LICENSE.txt +25 -0
  153. data/share/views/public/plugins/jquery-ui/development-bundle/demos/accordion/collapsible.html +57 -0
  154. data/share/views/public/plugins/jquery-ui/development-bundle/demos/accordion/custom-icons.html +69 -0
  155. data/share/views/public/plugins/jquery-ui/development-bundle/demos/accordion/default.html +85 -0
  156. data/share/views/public/plugins/jquery-ui/development-bundle/demos/accordion/fillspace.html +76 -0
  157. data/share/views/public/plugins/jquery-ui/development-bundle/demos/accordion/hoverintent.html +134 -0
  158. data/share/views/public/plugins/jquery-ui/development-bundle/demos/accordion/index.html +25 -0
  159. data/share/views/public/plugins/jquery-ui/development-bundle/demos/accordion/mouseover.html +57 -0
  160. data/share/views/public/plugins/jquery-ui/development-bundle/demos/accordion/no-auto-height.html +60 -0
  161. data/share/views/public/plugins/jquery-ui/development-bundle/demos/accordion/sortable.html +83 -0
  162. data/share/views/public/plugins/jquery-ui/development-bundle/demos/addClass/default.html +52 -0
  163. data/share/views/public/plugins/jquery-ui/development-bundle/demos/addClass/index.html +18 -0
  164. data/share/views/public/plugins/jquery-ui/development-bundle/demos/animate/default.html +61 -0
  165. data/share/views/public/plugins/jquery-ui/development-bundle/demos/animate/index.html +18 -0
  166. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/categories.html +71 -0
  167. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/combobox.html +174 -0
  168. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/custom-data.html +95 -0
  169. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/default.html +64 -0
  170. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/folding.html +62 -0
  171. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/images/jquery_32x32.png +0 -0
  172. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/images/jqueryui_32x32.png +0 -0
  173. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/images/sizzlejs_32x32.png +0 -0
  174. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/images/transparent_1x1.png +0 -0
  175. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/images/ui-anim_basic_16x16.gif +0 -0
  176. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/index.html +27 -0
  177. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/london.xml +114 -0
  178. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/maxheight.html +79 -0
  179. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/multiple-remote.html +84 -0
  180. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/multiple.html +99 -0
  181. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/remote-jsonp.html +86 -0
  182. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/remote-with-cache.html +59 -0
  183. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/remote.html +59 -0
  184. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/search.php +640 -0
  185. data/share/views/public/plugins/jquery-ui/development-bundle/demos/autocomplete/xml.html +72 -0
  186. data/share/views/public/plugins/jquery-ui/development-bundle/demos/button/checkbox.html +44 -0
  187. data/share/views/public/plugins/jquery-ui/development-bundle/demos/button/default.html +38 -0
  188. data/share/views/public/plugins/jquery-ui/development-bundle/demos/button/icons.html +56 -0
  189. data/share/views/public/plugins/jquery-ui/development-bundle/demos/button/index.html +23 -0
  190. data/share/views/public/plugins/jquery-ui/development-bundle/demos/button/radio.html +39 -0
  191. data/share/views/public/plugins/jquery-ui/development-bundle/demos/button/splitbutton.html +55 -0
  192. data/share/views/public/plugins/jquery-ui/development-bundle/demos/button/toolbar.html +120 -0
  193. data/share/views/public/plugins/jquery-ui/development-bundle/demos/datepicker/alt-field.html +36 -0
  194. data/share/views/public/plugins/jquery-ui/development-bundle/demos/datepicker/animation.html +58 -0
  195. data/share/views/public/plugins/jquery-ui/development-bundle/demos/datepicker/buttonbar.html +35 -0
  196. data/share/views/public/plugins/jquery-ui/development-bundle/demos/datepicker/date-formats.html +47 -0
  197. data/share/views/public/plugins/jquery-ui/development-bundle/demos/datepicker/date-range.html +49 -0
  198. data/share/views/public/plugins/jquery-ui/development-bundle/demos/datepicker/default.html +33 -0
  199. data/share/views/public/plugins/jquery-ui/development-bundle/demos/datepicker/dropdown-month-year.html +36 -0
  200. data/share/views/public/plugins/jquery-ui/development-bundle/demos/datepicker/icon-trigger.html +37 -0
  201. data/share/views/public/plugins/jquery-ui/development-bundle/demos/datepicker/images/calendar.gif +0 -0
  202. data/share/views/public/plugins/jquery-ui/development-bundle/demos/datepicker/index.html +31 -0
  203. data/share/views/public/plugins/jquery-ui/development-bundle/demos/datepicker/inline.html +33 -0
  204. data/share/views/public/plugins/jquery-ui/development-bundle/demos/datepicker/localization.html +162 -0
  205. data/share/views/public/plugins/jquery-ui/development-bundle/demos/datepicker/min-max.html +33 -0
  206. data/share/views/public/plugins/jquery-ui/development-bundle/demos/datepicker/multiple-calendars.html +36 -0
  207. data/share/views/public/plugins/jquery-ui/development-bundle/demos/datepicker/other-months.html +37 -0
  208. data/share/views/public/plugins/jquery-ui/development-bundle/demos/datepicker/show-week.html +39 -0
  209. data/share/views/public/plugins/jquery-ui/development-bundle/demos/demos.css +334 -0
  210. data/share/views/public/plugins/jquery-ui/development-bundle/demos/dialog/animated.html +56 -0
  211. data/share/views/public/plugins/jquery-ui/development-bundle/demos/dialog/default.html +54 -0
  212. data/share/views/public/plugins/jquery-ui/development-bundle/demos/dialog/index.html +23 -0
  213. data/share/views/public/plugins/jquery-ui/development-bundle/demos/dialog/modal-confirmation.html +69 -0
  214. data/share/views/public/plugins/jquery-ui/development-bundle/demos/dialog/modal-form.html +167 -0
  215. data/share/views/public/plugins/jquery-ui/development-bundle/demos/dialog/modal-message.html +71 -0
  216. data/share/views/public/plugins/jquery-ui/development-bundle/demos/dialog/modal.html +60 -0
  217. data/share/views/public/plugins/jquery-ui/development-bundle/demos/draggable/constrain-movement.html +69 -0
  218. data/share/views/public/plugins/jquery-ui/development-bundle/demos/draggable/cursor-style.html +49 -0
  219. data/share/views/public/plugins/jquery-ui/development-bundle/demos/draggable/default.html +39 -0
  220. data/share/views/public/plugins/jquery-ui/development-bundle/demos/draggable/delay-start.html +45 -0
  221. data/share/views/public/plugins/jquery-ui/development-bundle/demos/draggable/events.html +77 -0
  222. data/share/views/public/plugins/jquery-ui/development-bundle/demos/draggable/handle.html +50 -0
  223. data/share/views/public/plugins/jquery-ui/development-bundle/demos/draggable/index.html +28 -0
  224. data/share/views/public/plugins/jquery-ui/development-bundle/demos/draggable/revert.html +44 -0
  225. data/share/views/public/plugins/jquery-ui/development-bundle/demos/draggable/scroll.html +51 -0
  226. data/share/views/public/plugins/jquery-ui/development-bundle/demos/draggable/snap-to.html +68 -0
  227. data/share/views/public/plugins/jquery-ui/development-bundle/demos/draggable/sortable.html +57 -0
  228. data/share/views/public/plugins/jquery-ui/development-bundle/demos/draggable/visual-feedback.html +77 -0
  229. data/share/views/public/plugins/jquery-ui/development-bundle/demos/droppable/accepted-elements.html +60 -0
  230. data/share/views/public/plugins/jquery-ui/development-bundle/demos/droppable/default.html +53 -0
  231. data/share/views/public/plugins/jquery-ui/development-bundle/demos/droppable/images/high_tatras.jpg +0 -0
  232. data/share/views/public/plugins/jquery-ui/development-bundle/demos/droppable/images/high_tatras2.jpg +0 -0
  233. data/share/views/public/plugins/jquery-ui/development-bundle/demos/droppable/images/high_tatras2_min.jpg +0 -0
  234. data/share/views/public/plugins/jquery-ui/development-bundle/demos/droppable/images/high_tatras3.jpg +0 -0
  235. data/share/views/public/plugins/jquery-ui/development-bundle/demos/droppable/images/high_tatras3_min.jpg +0 -0
  236. data/share/views/public/plugins/jquery-ui/development-bundle/demos/droppable/images/high_tatras4.jpg +0 -0
  237. data/share/views/public/plugins/jquery-ui/development-bundle/demos/droppable/images/high_tatras4_min.jpg +0 -0
  238. data/share/views/public/plugins/jquery-ui/development-bundle/demos/droppable/images/high_tatras_min.jpg +0 -0
  239. data/share/views/public/plugins/jquery-ui/development-bundle/demos/droppable/index.html +24 -0
  240. data/share/views/public/plugins/jquery-ui/development-bundle/demos/droppable/photo-manager.html +184 -0
  241. data/share/views/public/plugins/jquery-ui/development-bundle/demos/droppable/propagation.html +80 -0
  242. data/share/views/public/plugins/jquery-ui/development-bundle/demos/droppable/revert.html +61 -0
  243. data/share/views/public/plugins/jquery-ui/development-bundle/demos/droppable/shopping-cart.html +101 -0
  244. data/share/views/public/plugins/jquery-ui/development-bundle/demos/droppable/visual-feedback.html +78 -0
  245. data/share/views/public/plugins/jquery-ui/development-bundle/demos/effect/default.html +109 -0
  246. data/share/views/public/plugins/jquery-ui/development-bundle/demos/effect/easing.html +108 -0
  247. data/share/views/public/plugins/jquery-ui/development-bundle/demos/effect/index.html +19 -0
  248. data/share/views/public/plugins/jquery-ui/development-bundle/demos/hide/default.html +102 -0
  249. data/share/views/public/plugins/jquery-ui/development-bundle/demos/hide/index.html +18 -0
  250. data/share/views/public/plugins/jquery-ui/development-bundle/demos/images/calendar.gif +0 -0
  251. data/share/views/public/plugins/jquery-ui/development-bundle/demos/images/demo-config-on-tile.gif +0 -0
  252. data/share/views/public/plugins/jquery-ui/development-bundle/demos/images/demo-config-on.gif +0 -0
  253. data/share/views/public/plugins/jquery-ui/development-bundle/demos/images/demo-spindown-closed.gif +0 -0
  254. data/share/views/public/plugins/jquery-ui/development-bundle/demos/images/demo-spindown-open.gif +0 -0
  255. data/share/views/public/plugins/jquery-ui/development-bundle/demos/images/icon-docs-info.gif +0 -0
  256. data/share/views/public/plugins/jquery-ui/development-bundle/demos/images/pbar-ani.gif +0 -0
  257. data/share/views/public/plugins/jquery-ui/development-bundle/demos/index.html +321 -0
  258. data/share/views/public/plugins/jquery-ui/development-bundle/demos/position/cycler.html +122 -0
  259. data/share/views/public/plugins/jquery-ui/development-bundle/demos/position/default.html +153 -0
  260. data/share/views/public/plugins/jquery-ui/development-bundle/demos/position/images/earth.jpg +0 -0
  261. data/share/views/public/plugins/jquery-ui/development-bundle/demos/position/images/flight.jpg +0 -0
  262. data/share/views/public/plugins/jquery-ui/development-bundle/demos/position/images/rocket.jpg +0 -0
  263. data/share/views/public/plugins/jquery-ui/development-bundle/demos/position/index.html +19 -0
  264. data/share/views/public/plugins/jquery-ui/development-bundle/demos/progressbar/animated.html +44 -0
  265. data/share/views/public/plugins/jquery-ui/development-bundle/demos/progressbar/default.html +35 -0
  266. data/share/views/public/plugins/jquery-ui/development-bundle/demos/progressbar/images/pbar-ani.gif +0 -0
  267. data/share/views/public/plugins/jquery-ui/development-bundle/demos/progressbar/index.html +20 -0
  268. data/share/views/public/plugins/jquery-ui/development-bundle/demos/progressbar/resize.html +40 -0
  269. data/share/views/public/plugins/jquery-ui/development-bundle/demos/removeClass/default.html +52 -0
  270. data/share/views/public/plugins/jquery-ui/development-bundle/demos/removeClass/index.html +18 -0
  271. data/share/views/public/plugins/jquery-ui/development-bundle/demos/resizable/animate.html +43 -0
  272. data/share/views/public/plugins/jquery-ui/development-bundle/demos/resizable/aspect-ratio.html +42 -0
  273. data/share/views/public/plugins/jquery-ui/development-bundle/demos/resizable/constrain-area.html +47 -0
  274. data/share/views/public/plugins/jquery-ui/development-bundle/demos/resizable/default.html +40 -0
  275. data/share/views/public/plugins/jquery-ui/development-bundle/demos/resizable/delay-start.html +52 -0
  276. data/share/views/public/plugins/jquery-ui/development-bundle/demos/resizable/helper.html +43 -0
  277. data/share/views/public/plugins/jquery-ui/development-bundle/demos/resizable/index.html +28 -0
  278. data/share/views/public/plugins/jquery-ui/development-bundle/demos/resizable/max-min.html +45 -0
  279. data/share/views/public/plugins/jquery-ui/development-bundle/demos/resizable/snap-to-grid.html +42 -0
  280. data/share/views/public/plugins/jquery-ui/development-bundle/demos/resizable/synchronous-resize.html +49 -0
  281. data/share/views/public/plugins/jquery-ui/development-bundle/demos/resizable/textarea.html +41 -0
  282. data/share/views/public/plugins/jquery-ui/development-bundle/demos/resizable/visual-feedback.html +43 -0
  283. data/share/views/public/plugins/jquery-ui/development-bundle/demos/selectable/default.html +50 -0
  284. data/share/views/public/plugins/jquery-ui/development-bundle/demos/selectable/display-grid.html +55 -0
  285. data/share/views/public/plugins/jquery-ui/development-bundle/demos/selectable/index.html +20 -0
  286. data/share/views/public/plugins/jquery-ui/development-bundle/demos/selectable/serialize.html +61 -0
  287. data/share/views/public/plugins/jquery-ui/development-bundle/demos/show/default.html +104 -0
  288. data/share/views/public/plugins/jquery-ui/development-bundle/demos/show/index.html +18 -0
  289. data/share/views/public/plugins/jquery-ui/development-bundle/demos/slider/colorpicker.html +95 -0
  290. data/share/views/public/plugins/jquery-ui/development-bundle/demos/slider/default.html +37 -0
  291. data/share/views/public/plugins/jquery-ui/development-bundle/demos/slider/hotelrooms.html +59 -0
  292. data/share/views/public/plugins/jquery-ui/development-bundle/demos/slider/index.html +29 -0
  293. data/share/views/public/plugins/jquery-ui/development-bundle/demos/slider/multiple-vertical.html +77 -0
  294. data/share/views/public/plugins/jquery-ui/development-bundle/demos/slider/range-vertical.html +51 -0
  295. data/share/views/public/plugins/jquery-ui/development-bundle/demos/slider/range.html +52 -0
  296. data/share/views/public/plugins/jquery-ui/development-bundle/demos/slider/rangemax.html +50 -0
  297. data/share/views/public/plugins/jquery-ui/development-bundle/demos/slider/rangemin.html +51 -0
  298. data/share/views/public/plugins/jquery-ui/development-bundle/demos/slider/side-scroll.html +140 -0
  299. data/share/views/public/plugins/jquery-ui/development-bundle/demos/slider/slider-vertical.html +52 -0
  300. data/share/views/public/plugins/jquery-ui/development-bundle/demos/slider/steps.html +51 -0
  301. data/share/views/public/plugins/jquery-ui/development-bundle/demos/slider/tabs.html +67 -0
  302. data/share/views/public/plugins/jquery-ui/development-bundle/demos/sortable/connect-lists-through-tabs.html +78 -0
  303. data/share/views/public/plugins/jquery-ui/development-bundle/demos/sortable/connect-lists.html +58 -0
  304. data/share/views/public/plugins/jquery-ui/development-bundle/demos/sortable/default.html +51 -0
  305. data/share/views/public/plugins/jquery-ui/development-bundle/demos/sortable/delay-start.html +67 -0
  306. data/share/views/public/plugins/jquery-ui/development-bundle/demos/sortable/display-grid.html +54 -0
  307. data/share/views/public/plugins/jquery-ui/development-bundle/demos/sortable/empty-lists.html +69 -0
  308. data/share/views/public/plugins/jquery-ui/development-bundle/demos/sortable/index.html +26 -0
  309. data/share/views/public/plugins/jquery-ui/development-bundle/demos/sortable/items.html +70 -0
  310. data/share/views/public/plugins/jquery-ui/development-bundle/demos/sortable/placeholder.html +56 -0
  311. data/share/views/public/plugins/jquery-ui/development-bundle/demos/sortable/portlets.html +96 -0
  312. data/share/views/public/plugins/jquery-ui/development-bundle/demos/switchClass/default.html +47 -0
  313. data/share/views/public/plugins/jquery-ui/development-bundle/demos/switchClass/index.html +18 -0
  314. data/share/views/public/plugins/jquery-ui/development-bundle/demos/tabs/ajax/content1.html +4 -0
  315. data/share/views/public/plugins/jquery-ui/development-bundle/demos/tabs/ajax/content2.html +4 -0
  316. data/share/views/public/plugins/jquery-ui/development-bundle/demos/tabs/ajax/content3-slow.php +7 -0
  317. data/share/views/public/plugins/jquery-ui/development-bundle/demos/tabs/ajax/content4-broken.php +3 -0
  318. data/share/views/public/plugins/jquery-ui/development-bundle/demos/tabs/ajax.html +53 -0
  319. data/share/views/public/plugins/jquery-ui/development-bundle/demos/tabs/bottom.html +60 -0
  320. data/share/views/public/plugins/jquery-ui/development-bundle/demos/tabs/collapsible.html +55 -0
  321. data/share/views/public/plugins/jquery-ui/development-bundle/demos/tabs/cookie.html +57 -0
  322. data/share/views/public/plugins/jquery-ui/development-bundle/demos/tabs/default.html +49 -0
  323. data/share/views/public/plugins/jquery-ui/development-bundle/demos/tabs/index.html +25 -0
  324. data/share/views/public/plugins/jquery-ui/development-bundle/demos/tabs/manipulation.html +124 -0
  325. data/share/views/public/plugins/jquery-ui/development-bundle/demos/tabs/mouseover.html +53 -0
  326. data/share/views/public/plugins/jquery-ui/development-bundle/demos/tabs/sortable.html +58 -0
  327. data/share/views/public/plugins/jquery-ui/development-bundle/demos/tabs/vertical.html +61 -0
  328. data/share/views/public/plugins/jquery-ui/development-bundle/demos/toggle/default.html +94 -0
  329. data/share/views/public/plugins/jquery-ui/development-bundle/demos/toggle/index.html +18 -0
  330. data/share/views/public/plugins/jquery-ui/development-bundle/demos/toggleClass/default.html +46 -0
  331. data/share/views/public/plugins/jquery-ui/development-bundle/demos/toggleClass/index.html +18 -0
  332. data/share/views/public/plugins/jquery-ui/development-bundle/docs/accordion.html +1017 -0
  333. data/share/views/public/plugins/jquery-ui/development-bundle/docs/addClass.html +109 -0
  334. data/share/views/public/plugins/jquery-ui/development-bundle/docs/animate.html +78 -0
  335. data/share/views/public/plugins/jquery-ui/development-bundle/docs/autocomplete.html +875 -0
  336. data/share/views/public/plugins/jquery-ui/development-bundle/docs/button.html +500 -0
  337. data/share/views/public/plugins/jquery-ui/development-bundle/docs/datepicker.html +2570 -0
  338. data/share/views/public/plugins/jquery-ui/development-bundle/docs/dialog.html +1698 -0
  339. data/share/views/public/plugins/jquery-ui/development-bundle/docs/draggable.html +1577 -0
  340. data/share/views/public/plugins/jquery-ui/development-bundle/docs/droppable.html +829 -0
  341. data/share/views/public/plugins/jquery-ui/development-bundle/docs/effect.html +143 -0
  342. data/share/views/public/plugins/jquery-ui/development-bundle/docs/hide.html +144 -0
  343. data/share/views/public/plugins/jquery-ui/development-bundle/docs/position.html +227 -0
  344. data/share/views/public/plugins/jquery-ui/development-bundle/docs/progressbar.html +460 -0
  345. data/share/views/public/plugins/jquery-ui/development-bundle/docs/removeClass.html +113 -0
  346. data/share/views/public/plugins/jquery-ui/development-bundle/docs/resizable.html +1201 -0
  347. data/share/views/public/plugins/jquery-ui/development-bundle/docs/selectable.html +848 -0
  348. data/share/views/public/plugins/jquery-ui/development-bundle/docs/show.html +144 -0
  349. data/share/views/public/plugins/jquery-ui/development-bundle/docs/slider.html +860 -0
  350. data/share/views/public/plugins/jquery-ui/development-bundle/docs/sortable.html +1953 -0
  351. data/share/views/public/plugins/jquery-ui/development-bundle/docs/switchClass.html +129 -0
  352. data/share/views/public/plugins/jquery-ui/development-bundle/docs/tabs.html +1549 -0
  353. data/share/views/public/plugins/jquery-ui/development-bundle/docs/toggle.html +144 -0
  354. data/share/views/public/plugins/jquery-ui/development-bundle/docs/toggleClass.html +111 -0
  355. data/share/views/public/plugins/jquery-ui/development-bundle/external/jquery.bgiframe-2.1.2.js +39 -0
  356. data/share/views/public/plugins/jquery-ui/development-bundle/external/jquery.cookie.js +89 -0
  357. data/share/views/public/plugins/jquery-ui/development-bundle/external/jquery.metadata.js +122 -0
  358. data/share/views/public/plugins/jquery-ui/development-bundle/external/qunit.css +153 -0
  359. data/share/views/public/plugins/jquery-ui/development-bundle/external/qunit.js +1261 -0
  360. data/share/views/public/plugins/jquery-ui/development-bundle/jquery-1.5.1.js +8316 -0
  361. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  362. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  363. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  364. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  365. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  366. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  367. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  368. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  369. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/images/ui-icons_222222_256x240.png +0 -0
  370. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/images/ui-icons_2e83ff_256x240.png +0 -0
  371. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/images/ui-icons_454545_256x240.png +0 -0
  372. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/images/ui-icons_888888_256x240.png +0 -0
  373. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/images/ui-icons_cd0a0a_256x240.png +0 -0
  374. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/jquery.ui.accordion.css +19 -0
  375. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/jquery.ui.all.css +11 -0
  376. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/jquery.ui.autocomplete.css +53 -0
  377. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/jquery.ui.base.css +11 -0
  378. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/jquery.ui.button.css +38 -0
  379. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/jquery.ui.core.css +41 -0
  380. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/jquery.ui.datepicker.css +68 -0
  381. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/jquery.ui.dialog.css +21 -0
  382. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/jquery.ui.progressbar.css +11 -0
  383. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/jquery.ui.resizable.css +20 -0
  384. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/jquery.ui.selectable.css +10 -0
  385. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/jquery.ui.slider.css +24 -0
  386. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/jquery.ui.tabs.css +18 -0
  387. data/share/views/public/plugins/jquery-ui/development-bundle/themes/base/jquery.ui.theme.css +247 -0
  388. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  389. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  390. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  391. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  392. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  393. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/images/ui-bg_glass_75_ffffff_1x400.png +0 -0
  394. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  395. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/images/ui-bg_inset-soft_95_fef1ec_1x100.png +0 -0
  396. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/images/ui-icons_222222_256x240.png +0 -0
  397. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/images/ui-icons_2e83ff_256x240.png +0 -0
  398. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/images/ui-icons_454545_256x240.png +0 -0
  399. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/images/ui-icons_888888_256x240.png +0 -0
  400. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/images/ui-icons_cd0a0a_256x240.png +0 -0
  401. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/jquery-ui-1.8.14.custom.css +568 -0
  402. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/jquery.ui.accordion.css +19 -0
  403. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/jquery.ui.all.css +11 -0
  404. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/jquery.ui.autocomplete.css +53 -0
  405. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/jquery.ui.base.css +11 -0
  406. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/jquery.ui.button.css +38 -0
  407. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/jquery.ui.core.css +41 -0
  408. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/jquery.ui.datepicker.css +68 -0
  409. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/jquery.ui.dialog.css +21 -0
  410. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/jquery.ui.progressbar.css +11 -0
  411. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/jquery.ui.resizable.css +20 -0
  412. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/jquery.ui.selectable.css +10 -0
  413. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/jquery.ui.slider.css +24 -0
  414. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/jquery.ui.tabs.css +18 -0
  415. data/share/views/public/plugins/jquery-ui/development-bundle/themes/custom-theme/jquery.ui.theme.css +249 -0
  416. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery-ui-i18n.js +1379 -0
  417. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-af.js +23 -0
  418. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-ar-DZ.js +23 -0
  419. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-ar.js +23 -0
  420. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-az.js +23 -0
  421. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-bg.js +24 -0
  422. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-bs.js +23 -0
  423. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-ca.js +23 -0
  424. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-cs.js +23 -0
  425. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-da.js +23 -0
  426. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-de.js +23 -0
  427. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-el.js +23 -0
  428. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-en-AU.js +23 -0
  429. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-en-GB.js +23 -0
  430. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-en-NZ.js +23 -0
  431. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-eo.js +23 -0
  432. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-es.js +23 -0
  433. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-et.js +23 -0
  434. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-eu.js +23 -0
  435. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-fa.js +23 -0
  436. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-fi.js +23 -0
  437. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-fo.js +23 -0
  438. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-fr-CH.js +23 -0
  439. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-fr.js +25 -0
  440. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-gl.js +23 -0
  441. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-he.js +23 -0
  442. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-hr.js +23 -0
  443. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-hu.js +23 -0
  444. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-hy.js +23 -0
  445. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-id.js +23 -0
  446. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-is.js +23 -0
  447. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-it.js +23 -0
  448. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-ja.js +23 -0
  449. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-ko.js +23 -0
  450. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-kz.js +23 -0
  451. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-lt.js +23 -0
  452. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-lv.js +23 -0
  453. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-ml.js +23 -0
  454. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-ms.js +23 -0
  455. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-nl.js +23 -0
  456. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-no.js +23 -0
  457. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-pl.js +23 -0
  458. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-pt-BR.js +23 -0
  459. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-pt.js +22 -0
  460. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-rm.js +21 -0
  461. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-ro.js +26 -0
  462. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-ru.js +23 -0
  463. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-sk.js +23 -0
  464. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-sl.js +24 -0
  465. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-sq.js +23 -0
  466. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-sr-SR.js +23 -0
  467. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-sr.js +23 -0
  468. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-sv.js +23 -0
  469. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-ta.js +23 -0
  470. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-th.js +23 -0
  471. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-tj.js +23 -0
  472. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-tr.js +23 -0
  473. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-uk.js +23 -0
  474. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-vi.js +23 -0
  475. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-zh-CN.js +23 -0
  476. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-zh-HK.js +23 -0
  477. data/share/views/public/plugins/jquery-ui/development-bundle/ui/i18n/jquery.ui.datepicker-zh-TW.js +23 -0
  478. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery-ui-1.8.14.custom.js +11729 -0
  479. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.effects.blind.js +49 -0
  480. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.effects.bounce.js +78 -0
  481. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.effects.clip.js +54 -0
  482. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.effects.core.js +746 -0
  483. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.effects.drop.js +50 -0
  484. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.effects.explode.js +79 -0
  485. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.effects.fade.js +32 -0
  486. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.effects.fold.js +56 -0
  487. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.effects.highlight.js +50 -0
  488. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.effects.pulsate.js +51 -0
  489. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.effects.scale.js +178 -0
  490. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.effects.shake.js +57 -0
  491. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.effects.slide.js +50 -0
  492. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.effects.transfer.js +45 -0
  493. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.ui.accordion.js +611 -0
  494. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.ui.autocomplete.js +612 -0
  495. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.ui.button.js +416 -0
  496. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.ui.core.js +312 -0
  497. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.ui.datepicker.js +1814 -0
  498. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.ui.dialog.js +878 -0
  499. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.ui.draggable.js +823 -0
  500. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.ui.droppable.js +296 -0
  501. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.ui.mouse.js +160 -0
  502. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.ui.position.js +252 -0
  503. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.ui.progressbar.js +109 -0
  504. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.ui.resizable.js +842 -0
  505. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.ui.selectable.js +266 -0
  506. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.ui.slider.js +666 -0
  507. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.ui.sortable.js +1077 -0
  508. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.ui.tabs.js +758 -0
  509. data/share/views/public/plugins/jquery-ui/development-bundle/ui/jquery.ui.widget.js +262 -0
  510. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.effects.blind.min.js +14 -0
  511. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.effects.bounce.min.js +15 -0
  512. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.effects.clip.min.js +14 -0
  513. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.effects.core.min.js +30 -0
  514. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.effects.drop.min.js +14 -0
  515. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.effects.explode.min.js +15 -0
  516. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.effects.fade.min.js +13 -0
  517. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.effects.fold.min.js +14 -0
  518. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.effects.highlight.min.js +14 -0
  519. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.effects.pulsate.min.js +14 -0
  520. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.effects.scale.min.js +20 -0
  521. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.effects.shake.min.js +14 -0
  522. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.effects.slide.min.js +14 -0
  523. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.effects.transfer.min.js +14 -0
  524. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.ui.accordion.min.js +30 -0
  525. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.ui.autocomplete.min.js +32 -0
  526. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.ui.button.min.js +27 -0
  527. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.ui.core.min.js +17 -0
  528. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.ui.datepicker.min.js +83 -0
  529. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.ui.dialog.min.js +40 -0
  530. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.ui.draggable.min.js +50 -0
  531. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.ui.droppable.min.js +27 -0
  532. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.ui.mouse.min.js +17 -0
  533. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.ui.position.min.js +16 -0
  534. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.ui.progressbar.min.js +16 -0
  535. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.ui.resizable.min.js +49 -0
  536. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.ui.selectable.min.js +22 -0
  537. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.ui.slider.min.js +33 -0
  538. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.ui.sortable.min.js +60 -0
  539. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.ui.tabs.min.js +35 -0
  540. data/share/views/public/plugins/jquery-ui/development-bundle/ui/minified/jquery.ui.widget.min.js +15 -0
  541. data/share/views/public/plugins/jquery-ui/development-bundle/version.txt +1 -0
  542. data/share/views/public/plugins/jquery-ui/index.html +367 -0
  543. data/share/views/public/plugins/jquery-ui/js/jquery-1.5.1.min.js +16 -0
  544. data/share/views/public/plugins/jquery-ui/js/jquery-ui-1.8.14.custom.min.js +789 -0
  545. data/share/views/result.haml +38 -0
  546. data/share/views/task_list.haml +7 -0
  547. data/share/views/wait.haml +2 -0
  548. data/share/views/workflow_list.haml +5 -0
  549. data/test/rbbt/workflow/rest/test_client.rb +29 -0
  550. data/test/test_helper.rb +4 -0
  551. metadata +686 -0
@@ -0,0 +1,3279 @@
1
+ // ==ClosureCompiler==
2
+ // @compilation_level SIMPLE_OPTIMIZATIONS
3
+
4
+ /**
5
+ * @license jqGrid 4.1.1 - jQuery Grid
6
+ * Copyright (c) 2008, Tony Tomov, tony@trirand.com
7
+ * Dual licensed under the MIT and GPL licenses
8
+ * http://www.opensource.org/licenses/mit-license.php
9
+ * http://www.gnu.org/licenses/gpl-2.0.html
10
+ * Date: 2011-06-19
11
+ */
12
+ //jsHint options
13
+ /*global document, window, jQuery, DOMParser, ActiveXObject $ */
14
+
15
+ (function ($) {
16
+
17
+ $.jgrid = $.jgrid || {};
18
+ $.extend($.jgrid,{
19
+ htmlDecode : function(value){
20
+ if(value && (value==' ' || value==' ' || (value.length==1 && value.charCodeAt(0)==160))) { return "";}
21
+ return !value ? value : String(value).replace(/&amp;/g, "&").replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&quot;/g, '"');
22
+ },
23
+ htmlEncode : function (value){
24
+ return !value ? value : String(value).replace(/&/g, "&amp;").replace(/>/g, "&gt;").replace(/</g, "&lt;").replace(/\"/g, "&quot;");
25
+ },
26
+ format : function(format){ //jqgformat
27
+ var args = $.makeArray(arguments).slice(1);
28
+ if(format===undefined) { format = ""; }
29
+ return format.replace(/\{(\d+)\}/g, function(m, i){
30
+ return args[i];
31
+ });
32
+ },
33
+ getCellIndex : function (cell) {
34
+ var c = $(cell);
35
+ if (c.is('tr')) { return -1; }
36
+ c = (!c.is('td') && !c.is('th') ? c.closest("td,th") : c)[0];
37
+ if ($.browser.msie) { return $.inArray(c, c.parentNode.cells); }
38
+ return c.cellIndex;
39
+ },
40
+ stripHtml : function(v) {
41
+ v = v+"";
42
+ var regexp = /<("[^"]*"|'[^']*'|[^'">])*>/gi;
43
+ if (v) {
44
+ v = v.replace(regexp,"");
45
+ return (v && v !== '&nbsp;' && v !== '&#160;') ? v.replace(/\"/g,"'") : "";
46
+ } else {
47
+ return v;
48
+ }
49
+ },
50
+ stringToDoc : function (xmlString) {
51
+ var xmlDoc;
52
+ if(typeof xmlString !== 'string') { return xmlString; }
53
+ try {
54
+ var parser = new DOMParser();
55
+ xmlDoc = parser.parseFromString(xmlString,"text/xml");
56
+ }
57
+ catch(e) {
58
+ xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
59
+ xmlDoc.async=false;
60
+ xmlDoc.loadXML(xmlString);
61
+ }
62
+ return (xmlDoc && xmlDoc.documentElement && xmlDoc.documentElement.tagName != 'parsererror') ? xmlDoc : null;
63
+ },
64
+ parse : function(jsonString) {
65
+ var js = jsonString;
66
+ if (js.substr(0,9) == "while(1);") { js = js.substr(9); }
67
+ if (js.substr(0,2) == "/*") { js = js.substr(2,js.length-4); }
68
+ if(!js) { js = "{}"; }
69
+ return ($.jgrid.useJSON===true && typeof (JSON) === 'object' && typeof (JSON.parse) === 'function') ?
70
+ JSON.parse(js) :
71
+ eval('(' + js + ')');
72
+ },
73
+ parseDate : function(format, date) {
74
+ var tsp = {m : 1, d : 1, y : 1970, h : 0, i : 0, s : 0},k,hl,dM, regdate = /[\\\/:_;.,\t\T\s-]/;
75
+ if(date && date !== null && date !== undefined){
76
+ date = $.trim(date);
77
+ date = date.split(regdate);
78
+ format = format.split(regdate);
79
+ var dfmt = $.jgrid.formatter.date.monthNames;
80
+ var afmt = $.jgrid.formatter.date.AmPm;
81
+ var h12to24 = function(ampm, h){
82
+ if (ampm === 0){ if (h == 12) { h = 0;} }
83
+ else { if (h != 12) { h += 12; } }
84
+ return h;
85
+ };
86
+ for(k=0,hl=format.length;k<hl;k++){
87
+ if(format[k] == 'M') {
88
+ dM = $.inArray(date[k],dfmt);
89
+ if(dM !== -1 && dM < 12){date[k] = dM+1;}
90
+ }
91
+ if(format[k] == 'F') {
92
+ dM = $.inArray(date[k],dfmt);
93
+ if(dM !== -1 && dM > 11){date[k] = dM+1-12;}
94
+ }
95
+ if(format[k] == 'a') {
96
+ dM = $.inArray(date[k],afmt);
97
+ if(dM !== -1 && dM < 2 && date[k] == afmt[dM]){
98
+ date[k] = dM;
99
+ tsp.h = h12to24(date[k], tsp.h);
100
+ }
101
+ }
102
+ if(format[k] == 'A') {
103
+ dM = $.inArray(date[k],afmt);
104
+ if(dM !== -1 && dM > 1 && date[k] == afmt[dM]){
105
+ date[k] = dM-2;
106
+ tsp.h = h12to24(date[k], tsp.h);
107
+ }
108
+ }
109
+ if(date[k] !== undefined) {
110
+ tsp[format[k].toLowerCase()] = parseInt(date[k],10);
111
+ }
112
+ }
113
+ tsp.m = parseInt(tsp.m,10)-1;
114
+ var ty = tsp.y;
115
+ if (ty >= 70 && ty <= 99) {tsp.y = 1900+tsp.y;}
116
+ else if (ty >=0 && ty <=69) {tsp.y= 2000+tsp.y;}
117
+ }
118
+ return new Date(tsp.y, tsp.m, tsp.d, tsp.h, tsp.i, tsp.s,0);
119
+ },
120
+ jqID : function(sid){
121
+ return String(sid).replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g,"\\$&");
122
+ },
123
+ guid : 1,
124
+ uidPref: 'jqg',
125
+ randId : function( prefix ) {
126
+ return (prefix? prefix: $.jgrid.uidPref) + ($.jgrid.guid++);
127
+ },
128
+ getAccessor : function(obj, expr) {
129
+ var ret,p,prm = [], i;
130
+ if( typeof expr === 'function') { return expr(obj); }
131
+ ret = obj[expr];
132
+ if(ret===undefined) {
133
+ try {
134
+ if ( typeof expr === 'string' ) {
135
+ prm = expr.split('.');
136
+ }
137
+ i = prm.length;
138
+ if( i ) {
139
+ ret = obj;
140
+ while (ret && i--) {
141
+ p = prm.shift();
142
+ ret = ret[p];
143
+ }
144
+ }
145
+ } catch (e) {}
146
+ }
147
+ return ret;
148
+ },
149
+ ajaxOptions: {},
150
+ from : function(source,initalQuery){
151
+ // Original Author Hugo Bonacci
152
+ // License MIT http://jlinq.codeplex.com/license
153
+ var queryObject=function(d,q){
154
+ if(typeof(d)=="string"){
155
+ d=$.data(d);
156
+ }
157
+ var self=this,
158
+ _data=d,
159
+ _usecase=true,
160
+ _trim=false,
161
+ _query=q,
162
+ _stripNum = /[\$,%]/g,
163
+ _lastCommand=null,
164
+ _lastField=null,
165
+ _negate=false,
166
+ _queuedOperator="",
167
+ _sorting=[],
168
+ _useProperties=true;
169
+ if(typeof(d)=="object"&&d.push) {
170
+ if(d.length>0){
171
+ if(typeof(d[0])!="object"){
172
+ _useProperties=false;
173
+ }else{
174
+ _useProperties=true;
175
+ }
176
+ }
177
+ }else{
178
+ throw "data provides is not an array";
179
+ }
180
+ this._hasData=function(){
181
+ return _data===null?false:_data.length===0?false:true;
182
+ };
183
+ this._getStr=function(s){
184
+ var phrase=[];
185
+ if(_trim){
186
+ phrase.push("jQuery.trim(");
187
+ }
188
+ phrase.push("String("+s+")");
189
+ if(_trim){
190
+ phrase.push(")");
191
+ }
192
+ if(!_usecase){
193
+ phrase.push(".toLowerCase()");
194
+ }
195
+ return phrase.join("");
196
+ };
197
+ this._strComp=function(val){
198
+ if(typeof(val)=="string"){
199
+ return".toString()";
200
+ }else{
201
+ return"";
202
+ }
203
+ };
204
+ this._group=function(f,u){
205
+ return({field:f.toString(),unique:u,items:[]});
206
+ };
207
+ this._toStr=function(phrase){
208
+ if(_trim){
209
+ phrase=$.trim(phrase);
210
+ }
211
+ if(!_usecase){
212
+ phrase=phrase.toLowerCase();
213
+ }
214
+ phrase=phrase.toString().replace(/\\/g,'\\\\').replace(/\"/g,'\\"');
215
+ return phrase;
216
+ };
217
+ this._funcLoop=function(func){
218
+ var results=[];
219
+ $.each(_data,function(i,v){
220
+ results.push(func(v));
221
+ });
222
+ return results;
223
+ };
224
+ this._append=function(s){
225
+ if(_query===null){
226
+ _query="";
227
+ } else {
228
+ _query+=_queuedOperator === "" ? " && " :_queuedOperator;
229
+ }
230
+ if(_negate){
231
+ _query+="!";
232
+ }
233
+ _query+="("+s+")";
234
+ _negate=false;
235
+ _queuedOperator="";
236
+ };
237
+ this._setCommand=function(f,c){
238
+ _lastCommand=f;
239
+ _lastField=c;
240
+ };
241
+ this._resetNegate=function(){
242
+ _negate=false;
243
+ };
244
+ this._repeatCommand=function(f,v){
245
+ if(_lastCommand===null){
246
+ return self;
247
+ }
248
+ if(f!==null&&v!==null){
249
+ return _lastCommand(f,v);
250
+ }
251
+ if(_lastField===null){
252
+ return _lastCommand(f);
253
+ }
254
+ if(!_useProperties){
255
+ return _lastCommand(f);
256
+ }
257
+ return _lastCommand(_lastField,f);
258
+ };
259
+ this._equals=function(a,b){
260
+ return(self._compare(a,b,1)===0);
261
+ };
262
+ this._compare=function(a,b,d){
263
+ if( d === undefined) { d = 1; }
264
+ if(a===undefined) { a = null; }
265
+ if(b===undefined) { b = null; }
266
+ if(a===null && b===null){
267
+ return 0;
268
+ }
269
+ if(a===null&&b!==null){
270
+ return 1;
271
+ }
272
+ if(a!==null&&b===null){
273
+ return -1;
274
+ }
275
+ if(!_usecase && typeof(a) !== "number" && typeof(b) !== "number" ) {
276
+ a=String(a).toLowerCase();
277
+ b=String(b).toLowerCase();
278
+ }
279
+ if(a<b){return -d;}
280
+ if(a>b){return d;}
281
+ return 0;
282
+ };
283
+ this._performSort=function(){
284
+ if(_sorting.length===0){return;}
285
+ _data=self._doSort(_data,0);
286
+ };
287
+ this._doSort=function(d,q){
288
+ var by=_sorting[q].by,
289
+ dir=_sorting[q].dir,
290
+ type = _sorting[q].type,
291
+ dfmt = _sorting[q].datefmt;
292
+ if(q==_sorting.length-1){
293
+ return self._getOrder(d, by, dir, type, dfmt);
294
+ }
295
+ q++;
296
+ var values=self._getGroup(d,by,dir,type,dfmt);
297
+ var results=[];
298
+ for(var i=0;i<values.length;i++){
299
+ var sorted=self._doSort(values[i].items,q);
300
+ for(var j=0;j<sorted.length;j++){
301
+ results.push(sorted[j]);
302
+ }
303
+ }
304
+ return results;
305
+ };
306
+ this._getOrder=function(data,by,dir,type, dfmt){
307
+ var sortData=[],_sortData=[], newDir = dir=="a" ? 1 : -1, i,ab,j,
308
+ findSortKey;
309
+
310
+ if(type === undefined ) { type = "text"; }
311
+ if (type == 'float' || type== 'number' || type== 'currency' || type== 'numeric') {
312
+ findSortKey = function($cell, a) {
313
+ var key = parseFloat( String($cell).replace(_stripNum, ''));
314
+ return isNaN(key) ? 0.00 : key;
315
+ };
316
+ } else if (type=='int' || type=='integer') {
317
+ findSortKey = function($cell, a) {
318
+ return $cell ? parseFloat(String($cell).replace(_stripNum, '')) : 0;
319
+ };
320
+ } else if(type == 'date' || type == 'datetime') {
321
+ findSortKey = function($cell, a) {
322
+ return $.jgrid.parseDate(dfmt,$cell).getTime();
323
+ };
324
+ } else if($.isFunction(type)) {
325
+ findSortKey = type;
326
+ } else {
327
+ findSortKey = function($cell, a) {
328
+ if(!$cell) {$cell ="";}
329
+ return $.trim(String($cell).toUpperCase());
330
+ };
331
+ }
332
+ $.each(data,function(i,v){
333
+ ab = by!=="" ? $.jgrid.getAccessor(v,by) : v;
334
+ if(ab === undefined) { ab = ""; }
335
+ ab = findSortKey(ab, v);
336
+ _sortData.push({ 'vSort': ab,'index':i});
337
+ });
338
+
339
+ _sortData.sort(function(a,b){
340
+ a = a.vSort;
341
+ b = b.vSort;
342
+ return self._compare(a,b,newDir);
343
+ });
344
+ j=0;
345
+ var nrec= data.length;
346
+ // overhead, but we do not change the original data.
347
+ while(j<nrec) {
348
+ i = _sortData[j].index;
349
+ sortData.push(data[i]);
350
+ j++;
351
+ }
352
+ return sortData;
353
+ };
354
+ this._getGroup=function(data,by,dir,type, dfmt){
355
+ var results=[],
356
+ group=null,
357
+ last=null, val;
358
+ $.each(self._getOrder(data,by,dir,type, dfmt),function(i,v){
359
+ val = $.jgrid.getAccessor(v, by);
360
+ if(val === undefined) { val = ""; }
361
+ if(!self._equals(last,val)){
362
+ last=val;
363
+ if(group !== null){
364
+ results.push(group);
365
+ }
366
+ group=self._group(by,val);
367
+ }
368
+ group.items.push(v);
369
+ });
370
+ if(group !== null){
371
+ results.push(group);
372
+ }
373
+ return results;
374
+ };
375
+ this.ignoreCase=function(){
376
+ _usecase=false;
377
+ return self;
378
+ };
379
+ this.useCase=function(){
380
+ _usecase=true;
381
+ return self;
382
+ };
383
+ this.trim=function(){
384
+ _trim=true;
385
+ return self;
386
+ };
387
+ this.noTrim=function(){
388
+ _trim=false;
389
+ return self;
390
+ };
391
+ this.execute=function(){
392
+ var match=_query, results=[];
393
+ if(match === null){
394
+ return self;
395
+ }
396
+ $.each(_data,function(){
397
+ if(eval(match)){results.push(this);}
398
+ });
399
+ _data=results;
400
+ return self;
401
+ };
402
+ this.data=function(){
403
+ return _data;
404
+ };
405
+ this.select=function(f){
406
+ self._performSort();
407
+ if(!self._hasData()){ return[]; }
408
+ self.execute();
409
+ if($.isFunction(f)){
410
+ var results=[];
411
+ $.each(_data,function(i,v){
412
+ results.push(f(v));
413
+ });
414
+ return results;
415
+ }
416
+ return _data;
417
+ };
418
+ this.hasMatch=function(f){
419
+ if(!self._hasData()) { return false; }
420
+ self.execute();
421
+ return _data.length>0;
422
+ };
423
+ this.andNot=function(f,v,x){
424
+ _negate=!_negate;
425
+ return self.and(f,v,x);
426
+ };
427
+ this.orNot=function(f,v,x){
428
+ _negate=!_negate;
429
+ return self.or(f,v,x);
430
+ };
431
+ this.not=function(f,v,x){
432
+ return self.andNot(f,v,x);
433
+ };
434
+ this.and=function(f,v,x){
435
+ _queuedOperator=" && ";
436
+ if(f===undefined){
437
+ return self;
438
+ }
439
+ return self._repeatCommand(f,v,x);
440
+ };
441
+ this.or=function(f,v,x){
442
+ _queuedOperator=" || ";
443
+ if(f===undefined) { return self; }
444
+ return self._repeatCommand(f,v,x);
445
+ };
446
+ this.isNot=function(f){
447
+ _negate=!_negate;
448
+ return self.is(f);
449
+ };
450
+ this.is=function(f){
451
+ self._append('this.'+f);
452
+ self._resetNegate();
453
+ return self;
454
+ };
455
+ this._compareValues=function(func,f,v,how,t){
456
+ var fld;
457
+ if(_useProperties){
458
+ fld='jQuery.jgrid.getAccessor(this,\''+f+'\')';
459
+ }else{
460
+ fld='this';
461
+ }
462
+ if(v===undefined) { v = null; }
463
+ //var val=v===null?f:v,
464
+ var val =v,
465
+ swst = t.stype === undefined ? "text" : t.stype;
466
+ if(v !== null) {
467
+ switch(swst) {
468
+ case 'int':
469
+ case 'integer':
470
+ val = (isNaN(Number(val)) || val==="") ? '0' : val; // To be fixed with more inteligent code
471
+ fld = 'parseInt('+fld+',10)';
472
+ val = 'parseInt('+val+',10)';
473
+ break;
474
+ case 'float':
475
+ case 'number':
476
+ case 'numeric':
477
+ val = String(val).replace(_stripNum, '');
478
+ val = (isNaN(Number(val)) || val==="") ? '0' : val; // To be fixed with more inteligent code
479
+ fld = 'parseFloat('+fld+')';
480
+ val = 'parseFloat('+val+')';
481
+ break;
482
+ case 'date':
483
+ case 'datetime':
484
+ val = String($.jgrid.parseDate(t.newfmt || 'Y-m-d',val).getTime());
485
+ fld = 'jQuery.jgrid.parseDate("'+t.srcfmt+'",'+fld+').getTime()';
486
+ break;
487
+ default :
488
+ fld=self._getStr(fld);
489
+ val=self._getStr('"'+self._toStr(val)+'"');
490
+ }
491
+ }
492
+ self._append(fld+' '+how+' '+val);
493
+ self._setCommand(func,f);
494
+ self._resetNegate();
495
+ return self;
496
+ };
497
+ this.equals=function(f,v,t){
498
+ return self._compareValues(self.equals,f,v,"==",t);
499
+ };
500
+ this.notEquals=function(f,v,t){
501
+ return self._compareValues(self.equals,f,v,"!==",t);
502
+ };
503
+ this.isNull = function(f,v,t){
504
+ return self._compareValues(self.equals,f,null,"===",t);
505
+ };
506
+ this.greater=function(f,v,t){
507
+ return self._compareValues(self.greater,f,v,">",t);
508
+ };
509
+ this.less=function(f,v,t){
510
+ return self._compareValues(self.less,f,v,"<",t);
511
+ };
512
+ this.greaterOrEquals=function(f,v,t){
513
+ return self._compareValues(self.greaterOrEquals,f,v,">=",t);
514
+ };
515
+ this.lessOrEquals=function(f,v,t){
516
+ return self._compareValues(self.lessOrEquals,f,v,"<=",t);
517
+ };
518
+ this.startsWith=function(f,v){
519
+ var val = (v===undefined || v===null) ? f: v,
520
+ length=_trim ? $.trim(val.toString()).length : val.toString().length;
521
+ if(_useProperties){
522
+ self._append(self._getStr('jQuery.jgrid.getAccessor(this,\''+f+'\')')+'.substr(0,'+length+') == '+self._getStr('"'+self._toStr(v)+'"'));
523
+ }else{
524
+ length=_trim?$.trim(v.toString()).length:v.toString().length;
525
+ self._append(self._getStr('this')+'.substr(0,'+length+') == '+self._getStr('"'+self._toStr(f)+'"'));
526
+ }
527
+ self._setCommand(self.startsWith,f);
528
+ self._resetNegate();
529
+ return self;
530
+ };
531
+ this.endsWith=function(f,v){
532
+ var val = (v===undefined || v===null) ? f: v,
533
+ length=_trim ? $.trim(val.toString()).length:val.toString().length;
534
+ if(_useProperties){
535
+ self._append(self._getStr('jQuery.jgrid.getAccessor(this,\''+f+'\')')+'.substr('+self._getStr('jQuery.jgrid.getAccessor(this,\''+f+'\')')+'.length-'+length+','+length+') == "'+self._toStr(v)+'"');
536
+ } else {
537
+ self._append(self._getStr('this')+'.substr('+self._getStr('this')+'.length-"'+self._toStr(f)+'".length,"'+self._toStr(f)+'".length) == "'+self._toStr(f)+'"');
538
+ }
539
+ self._setCommand(self.endsWith,f);self._resetNegate();
540
+ return self;
541
+ };
542
+ this.contains=function(f,v){
543
+ if(_useProperties){
544
+ self._append(self._getStr('jQuery.jgrid.getAccessor(this,\''+f+'\')')+'.indexOf("'+self._toStr(v)+'",0) > -1');
545
+ }else{
546
+ self._append(self._getStr('this')+'.indexOf("'+self._toStr(f)+'",0) > -1');
547
+ }
548
+ self._setCommand(self.contains,f);
549
+ self._resetNegate();
550
+ return self;
551
+ };
552
+ this.groupBy=function(by,dir,type, datefmt){
553
+ if(!self._hasData()){
554
+ return null;
555
+ }
556
+ return self._getGroup(_data,by,dir,type, datefmt);
557
+ };
558
+ this.orderBy=function(by,dir,stype, dfmt){
559
+ dir = dir === undefined || dir === null ? "a" :$.trim(dir.toString().toLowerCase());
560
+ if(stype === null || stype === undefined) { stype = "text"; }
561
+ if(dfmt === null || dfmt === undefined) { dfmt = "Y-m-d"; }
562
+ if(dir=="desc"||dir=="descending"){dir="d";}
563
+ if(dir=="asc"||dir=="ascending"){dir="a";}
564
+ _sorting.push({by:by,dir:dir,type:stype, datefmt: dfmt});
565
+ return self;
566
+ };
567
+ return self;
568
+ };
569
+ return new queryObject(source,null);
570
+ },
571
+ extend : function(methods) {
572
+ $.extend($.fn.jqGrid,methods);
573
+ if (!this.no_legacy_api) {
574
+ $.fn.extend(methods);
575
+ }
576
+ }
577
+ });
578
+
579
+ $.fn.jqGrid = function( pin ) {
580
+ if (typeof pin == 'string') {
581
+ //var fn = $.fn.jqGrid[pin];
582
+ var fn = $.jgrid.getAccessor($.fn.jqGrid,pin);
583
+ if (!fn) {
584
+ throw ("jqGrid - No such method: " + pin);
585
+ }
586
+ var args = $.makeArray(arguments).slice(1);
587
+ return fn.apply(this,args);
588
+ }
589
+ return this.each( function() {
590
+ if(this.grid) {return;}
591
+
592
+ var p = $.extend(true,{
593
+ url: "",
594
+ height: 150,
595
+ page: 1,
596
+ rowNum: 20,
597
+ rowTotal : null,
598
+ records: 0,
599
+ pager: "",
600
+ pgbuttons: true,
601
+ pginput: true,
602
+ colModel: [],
603
+ rowList: [],
604
+ colNames: [],
605
+ sortorder: "asc",
606
+ sortname: "",
607
+ datatype: "xml",
608
+ mtype: "GET",
609
+ altRows: false,
610
+ selarrrow: [],
611
+ savedRow: [],
612
+ shrinkToFit: true,
613
+ xmlReader: {},
614
+ jsonReader: {},
615
+ subGrid: false,
616
+ subGridModel :[],
617
+ reccount: 0,
618
+ lastpage: 0,
619
+ lastsort: 0,
620
+ selrow: null,
621
+ beforeSelectRow: null,
622
+ onSelectRow: null,
623
+ onSortCol: null,
624
+ ondblClickRow: null,
625
+ onRightClickRow: null,
626
+ onPaging: null,
627
+ onSelectAll: null,
628
+ loadComplete: null,
629
+ gridComplete: null,
630
+ loadError: null,
631
+ loadBeforeSend: null,
632
+ afterInsertRow: null,
633
+ beforeRequest: null,
634
+ onHeaderClick: null,
635
+ viewrecords: false,
636
+ loadonce: false,
637
+ multiselect: false,
638
+ multikey: false,
639
+ editurl: null,
640
+ search: false,
641
+ caption: "",
642
+ hidegrid: true,
643
+ hiddengrid: false,
644
+ postData: {},
645
+ userData: {},
646
+ treeGrid : false,
647
+ treeGridModel : 'nested',
648
+ treeReader : {},
649
+ treeANode : -1,
650
+ ExpandColumn: null,
651
+ tree_root_level : 0,
652
+ prmNames: {page:"page",rows:"rows", sort: "sidx",order: "sord", search:"_search", nd:"nd", id:"id",oper:"oper",editoper:"edit",addoper:"add",deloper:"del", subgridid:"id", npage: null, totalrows:"totalrows"},
653
+ forceFit : false,
654
+ gridstate : "visible",
655
+ cellEdit: false,
656
+ cellsubmit: "remote",
657
+ nv:0,
658
+ loadui: "enable",
659
+ toolbar: [false,""],
660
+ scroll: false,
661
+ multiboxonly : false,
662
+ deselectAfterSort : true,
663
+ scrollrows : false,
664
+ autowidth: false,
665
+ scrollOffset :18,
666
+ cellLayout: 5,
667
+ subGridWidth: 20,
668
+ multiselectWidth: 20,
669
+ gridview: false,
670
+ rownumWidth: 25,
671
+ rownumbers : false,
672
+ pagerpos: 'center',
673
+ recordpos: 'right',
674
+ footerrow : false,
675
+ userDataOnFooter : false,
676
+ hoverrows : true,
677
+ altclass : 'ui-priority-secondary',
678
+ viewsortcols : [false,'vertical',true],
679
+ resizeclass : '',
680
+ autoencode : false,
681
+ remapColumns : [],
682
+ ajaxGridOptions :{},
683
+ direction : "ltr",
684
+ toppager: false,
685
+ headertitles: false,
686
+ scrollTimeout: 40,
687
+ data : [],
688
+ _index : {},
689
+ grouping : false,
690
+ groupingView : {groupField:[],groupOrder:[], groupText:[],groupColumnShow:[],groupSummary:[], showSummaryOnHide: false, sortitems:[], sortnames:[], groupDataSorted : false, summary:[],summaryval:[], plusicon: 'ui-icon-circlesmall-plus', minusicon: 'ui-icon-circlesmall-minus'},
691
+ ignoreCase : false,
692
+ cmTemplate : {}
693
+ }, $.jgrid.defaults, pin || {});
694
+ var grid={
695
+ headers:[],
696
+ cols:[],
697
+ footers: [],
698
+ dragStart: function(i,x,y) {
699
+ this.resizing = { idx: i, startX: x.clientX, sOL : y[0]};
700
+ this.hDiv.style.cursor = "col-resize";
701
+ this.curGbox = $("#rs_m"+$.jgrid.jqID(p.id),"#gbox_"+$.jgrid.jqID(p.id));
702
+ this.curGbox.css({display:"block",left:y[0],top:y[1],height:y[2]});
703
+ if($.isFunction(p.resizeStart)) { p.resizeStart.call(this,x,i); }
704
+ document.onselectstart=function(){return false;};
705
+ },
706
+ dragMove: function(x) {
707
+ if(this.resizing) {
708
+ var diff = x.clientX-this.resizing.startX,
709
+ h = this.headers[this.resizing.idx],
710
+ newWidth = p.direction === "ltr" ? h.width + diff : h.width - diff, hn, nWn;
711
+ if(newWidth > 33) {
712
+ this.curGbox.css({left:this.resizing.sOL+diff});
713
+ if(p.forceFit===true ){
714
+ hn = this.headers[this.resizing.idx+p.nv];
715
+ nWn = p.direction === "ltr" ? hn.width - diff : hn.width + diff;
716
+ if(nWn >33) {
717
+ h.newWidth = newWidth;
718
+ hn.newWidth = nWn;
719
+ }
720
+ } else {
721
+ this.newWidth = p.direction === "ltr" ? p.tblwidth+diff : p.tblwidth-diff;
722
+ h.newWidth = newWidth;
723
+ }
724
+ }
725
+ }
726
+ },
727
+ dragEnd: function() {
728
+ this.hDiv.style.cursor = "default";
729
+ if(this.resizing) {
730
+ var idx = this.resizing.idx,
731
+ nw = this.headers[idx].newWidth || this.headers[idx].width;
732
+ nw = parseInt(nw,10);
733
+ this.resizing = false;
734
+ $("#rs_m"+$.jgrid.jqID(p.id)).css("display","none");
735
+ p.colModel[idx].width = nw;
736
+ this.headers[idx].width = nw;
737
+ this.headers[idx].el.style.width = nw + "px";
738
+ this.cols[idx].style.width = nw+"px";
739
+ if(this.footers.length>0) {this.footers[idx].style.width = nw+"px";}
740
+ if(p.forceFit===true){
741
+ nw = this.headers[idx+p.nv].newWidth || this.headers[idx+p.nv].width;
742
+ this.headers[idx+p.nv].width = nw;
743
+ this.headers[idx+p.nv].el.style.width = nw + "px";
744
+ this.cols[idx+p.nv].style.width = nw+"px";
745
+ if(this.footers.length>0) {this.footers[idx+p.nv].style.width = nw+"px";}
746
+ p.colModel[idx+p.nv].width = nw;
747
+ } else {
748
+ p.tblwidth = this.newWidth || p.tblwidth;
749
+ $('table:first',this.bDiv).css("width",p.tblwidth+"px");
750
+ $('table:first',this.hDiv).css("width",p.tblwidth+"px");
751
+ this.hDiv.scrollLeft = this.bDiv.scrollLeft;
752
+ if(p.footerrow) {
753
+ $('table:first',this.sDiv).css("width",p.tblwidth+"px");
754
+ this.sDiv.scrollLeft = this.bDiv.scrollLeft;
755
+ }
756
+ }
757
+ if($.isFunction(p.resizeStop)) { p.resizeStop.call(this,nw,idx); }
758
+ }
759
+ this.curGbox = null;
760
+ document.onselectstart=function(){return true;};
761
+ },
762
+ populateVisible: function() {
763
+ if (grid.timer) { clearTimeout(grid.timer); }
764
+ grid.timer = null;
765
+ var dh = $(grid.bDiv).height();
766
+ if (!dh) { return; }
767
+ var table = $("table:first", grid.bDiv);
768
+ var rows, rh;
769
+ if(table[0].rows.length) {
770
+ try {
771
+ rows = table[0].rows[1];
772
+ rh = rows ? $(rows).outerHeight() || grid.prevRowHeight : grid.prevRowHeight;
773
+ } catch (pv) {
774
+ rh = grid.prevRowHeight;
775
+ }
776
+ }
777
+ if (!rh) { return; }
778
+ grid.prevRowHeight = rh;
779
+ var rn = p.rowNum;
780
+ var scrollTop = grid.scrollTop = grid.bDiv.scrollTop;
781
+ var ttop = Math.round(table.position().top) - scrollTop;
782
+ var tbot = ttop + table.height();
783
+ var div = rh * rn;
784
+ var page, npage, empty;
785
+ if ( tbot < dh && ttop <= 0 &&
786
+ (p.lastpage===undefined||parseInt((tbot + scrollTop + div - 1) / div,10) <= p.lastpage))
787
+ {
788
+ npage = parseInt((dh - tbot + div - 1) / div,10);
789
+ if (tbot >= 0 || npage < 2 || p.scroll === true) {
790
+ page = Math.round((tbot + scrollTop) / div) + 1;
791
+ ttop = -1;
792
+ } else {
793
+ ttop = 1;
794
+ }
795
+ }
796
+ if (ttop > 0) {
797
+ page = parseInt(scrollTop / div,10) + 1;
798
+ npage = parseInt((scrollTop + dh) / div,10) + 2 - page;
799
+ empty = true;
800
+ }
801
+ if (npage) {
802
+ if (p.lastpage && page > p.lastpage || p.lastpage==1 || (page === p.page && page===p.lastpage) ) {
803
+ return;
804
+ }
805
+ if (grid.hDiv.loading) {
806
+ grid.timer = setTimeout(grid.populateVisible, p.scrollTimeout);
807
+ } else {
808
+ p.page = page;
809
+ if (empty) {
810
+ grid.selectionPreserver(table[0]);
811
+ grid.emptyRows(grid.bDiv,false, false);
812
+ }
813
+ grid.populate(npage);
814
+ }
815
+ }
816
+ },
817
+ scrollGrid: function( e ) {
818
+ if(p.scroll) {
819
+ var scrollTop = grid.bDiv.scrollTop;
820
+ if(grid.scrollTop === undefined) { grid.scrollTop = 0; }
821
+ if (scrollTop != grid.scrollTop) {
822
+ grid.scrollTop = scrollTop;
823
+ if (grid.timer) { clearTimeout(grid.timer); }
824
+ grid.timer = setTimeout(grid.populateVisible, p.scrollTimeout);
825
+ }
826
+ }
827
+ grid.hDiv.scrollLeft = grid.bDiv.scrollLeft;
828
+ if(p.footerrow) {
829
+ grid.sDiv.scrollLeft = grid.bDiv.scrollLeft;
830
+ }
831
+ if( e ) { e.stopPropagation(); }
832
+ },
833
+ selectionPreserver : function(ts) {
834
+ var p = ts.p;
835
+ var sr = p.selrow, sra = p.selarrrow ? $.makeArray(p.selarrrow) : null;
836
+ var left = ts.grid.bDiv.scrollLeft;
837
+ var complete = p.gridComplete;
838
+ p.gridComplete = function() {
839
+ p.selrow = null;
840
+ p.selarrrow = [];
841
+ if(p.multiselect && sra && sra.length>0) {
842
+ for(var i=0;i<sra.length;i++){
843
+ if (sra[i] != sr) {
844
+ $(ts).jqGrid("setSelection",sra[i],false);
845
+ }
846
+ }
847
+ }
848
+ if (sr) {
849
+ $(ts).jqGrid("setSelection",sr,false);
850
+ }
851
+ ts.grid.bDiv.scrollLeft = left;
852
+ p.gridComplete = complete;
853
+ if (p.gridComplete) {
854
+ complete();
855
+ }
856
+ };
857
+ }
858
+ };
859
+ if(this.tagName.toUpperCase()!='TABLE') {
860
+ alert("Element is not a table");
861
+ return;
862
+ }
863
+ $(this).empty().attr("tabindex","1");
864
+ this.p = p ;
865
+ var i, dir,ts;
866
+ if(this.p.colNames.length === 0) {
867
+ for (i=0;i<this.p.colModel.length;i++){
868
+ this.p.colNames[i] = this.p.colModel[i].label || this.p.colModel[i].name;
869
+ }
870
+ }
871
+ if( this.p.colNames.length !== this.p.colModel.length ) {
872
+ alert($.jgrid.errors.model);
873
+ return;
874
+ }
875
+ var gv = $("<div class='ui-jqgrid-view'></div>"), ii,
876
+ isMSIE = $.browser.msie ? true:false,
877
+ isSafari = $.browser.webkit || $.browser.safari ? true : false;
878
+ ts = this;
879
+ ts.p.direction = $.trim(ts.p.direction.toLowerCase());
880
+ if($.inArray(ts.p.direction,["ltr","rtl"]) == -1) { ts.p.direction = "ltr"; }
881
+ dir = ts.p.direction;
882
+
883
+ $(gv).insertBefore(this);
884
+ $(this).appendTo(gv).removeClass("scroll");
885
+ var eg = $("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");
886
+ $(eg).insertBefore(gv).attr({"id" : "gbox_"+this.id,"dir":dir});
887
+ $(gv).appendTo(eg).attr("id","gview_"+this.id);
888
+ if (isMSIE && $.browser.version <= 6) {
889
+ ii = '<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>';
890
+ } else { ii="";}
891
+ $("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(ii).insertBefore(gv);
892
+ $("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(gv);
893
+ $(this).attr({cellspacing:"0",cellpadding:"0",border:"0","role":"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});
894
+ var sortkeys = ["shiftKey","altKey","ctrlKey"],
895
+ intNum = function(val,defval) {
896
+ val = parseInt(val,10);
897
+ if (isNaN(val)) { return defval ? defval : 0;}
898
+ else {return val;}
899
+ },
900
+ formatCol = function (pos, rowInd, tv, rawObject, rowId, rdata){
901
+ var cm = ts.p.colModel[pos],
902
+ ral = cm.align, result="style=\"", clas = cm.classes, nm = cm.name, celp, acp=[];
903
+ if(ral) { result += "text-align:"+ral+";"; }
904
+ if(cm.hidden===true) { result += "display:none;"; }
905
+ if(rowInd===0) {
906
+ result += "width: "+grid.headers[pos].width+"px;";
907
+ } else if (cm.cellattr && $.isFunction(cm.cellattr))
908
+ {
909
+ celp = cm.cellattr.call(ts, rowId, tv, rawObject, cm, rdata);
910
+ if(celp && typeof(celp) === "string") {
911
+ celp = celp.replace(/style/i,'style').replace(/title/i,'title');
912
+ if(celp.indexOf('title') > -1) { cm.title=false;}
913
+ if(celp.indexOf('class') > -1) { clas = undefined;}
914
+ acp = celp.split("style");
915
+ if(acp.length === 2 ) {
916
+ acp[1] = $.trim(acp[1].replace("=",""));
917
+ if(acp[1].indexOf("'") === 0 || acp[1].indexOf('"') === 0) {
918
+ acp[1] = acp[1].substring(1);
919
+ }
920
+ result += acp[1].replace(/'/gi,'"');
921
+ } else {
922
+ result += "\"";
923
+ }
924
+ }
925
+ }
926
+ if(!acp.length) { acp[0] = ""; result += "\"";}
927
+ result += (clas !== undefined ? (" class=\""+clas+"\"") :"") + ((cm.title && tv) ? (" title=\""+$.jgrid.stripHtml(tv)+"\"") :"");
928
+ result += " aria-describedby=\""+ts.p.id+"_"+nm+"\"";
929
+ return result + acp[0];
930
+ },
931
+ cellVal = function (val) {
932
+ return val === undefined || val === null || val === "" ? "&#160;" : (ts.p.autoencode ? $.jgrid.htmlEncode(val) : val+"");
933
+ },
934
+ formatter = function (rowId, cellval , colpos, rwdat, _act){
935
+ var cm = ts.p.colModel[colpos],v;
936
+ if(typeof cm.formatter !== 'undefined') {
937
+ var opts= {rowId: rowId, colModel:cm, gid:ts.p.id, pos:colpos };
938
+ if($.isFunction( cm.formatter ) ) {
939
+ v = cm.formatter.call(ts,cellval,opts,rwdat,_act);
940
+ } else if($.fmatter){
941
+ v = $.fn.fmatter(cm.formatter, cellval,opts, rwdat, _act);
942
+ } else {
943
+ v = cellVal(cellval);
944
+ }
945
+ } else {
946
+ v = cellVal(cellval);
947
+ }
948
+ return v;
949
+ },
950
+ addCell = function(rowId,cell,pos,irow, srvr) {
951
+ var v,prp;
952
+ v = formatter(rowId,cell,pos,srvr,'add');
953
+ prp = formatCol( pos,irow, v, srvr, rowId, true);
954
+ return "<td role=\"gridcell\" "+prp+">"+v+"</td>";
955
+ },
956
+ addMulti = function(rowid,pos,irow){
957
+ var v = "<input role=\"checkbox\" type=\"checkbox\""+" id=\"jqg_"+ts.p.id+"_"+rowid+"\" class=\"cbox\" name=\"jqg_"+ts.p.id+"_"+rowid+"\"/>",
958
+ prp = formatCol( pos,irow,'',null, rowid, true);
959
+ return "<td role=\"gridcell\" "+prp+">"+v+"</td>";
960
+ },
961
+ addRowNum = function (pos,irow,pG,rN) {
962
+ var v = (parseInt(pG,10)-1)*parseInt(rN,10)+1+irow,
963
+ prp = formatCol( pos,irow,v, null, irow, true);
964
+ return "<td role=\"gridcell\" class=\"ui-state-default jqgrid-rownum\" "+prp+">"+v+"</td>";
965
+ },
966
+ reader = function (datatype) {
967
+ var field, f=[], j=0, i;
968
+ for(i =0; i<ts.p.colModel.length; i++){
969
+ field = ts.p.colModel[i];
970
+ if (field.name !== 'cb' && field.name !=='subgrid' && field.name !=='rn') {
971
+ if(datatype == "local") {
972
+ f[j] = field.name;
973
+ } else {
974
+ f[j] = (datatype=="xml") ? field.xmlmap || field.name : field.jsonmap || field.name;
975
+ }
976
+ j++;
977
+ }
978
+ }
979
+ return f;
980
+ },
981
+ orderedCols = function (offset) {
982
+ var order = ts.p.remapColumns;
983
+ if (!order || !order.length) {
984
+ order = $.map(ts.p.colModel, function(v,i) { return i; });
985
+ }
986
+ if (offset) {
987
+ order = $.map(order, function(v) { return v<offset?null:v-offset; });
988
+ }
989
+ return order;
990
+ },
991
+ emptyRows = function (parent, scroll, locdata) {
992
+ if(ts.p.deepempty) {$("#"+$.jgrid.jqID(ts.p.id)+" tbody:first tr:gt(0)").remove();}
993
+ else {
994
+ var trf = $("#"+$.jgrid.jqID(ts.p.id)+" tbody:first tr:first")[0];
995
+ $("#"+$.jgrid.jqID(ts.p.id)+" tbody:first").empty().append(trf);
996
+ }
997
+ if (scroll && ts.p.scroll) {
998
+ $(">div:first", parent).css({height:"auto"}).children("div:first").css({height:0,display:"none"});
999
+ parent.scrollTop = 0;
1000
+ }
1001
+ if(locdata === true) {
1002
+ if(ts.p.treeGrid === true ) {
1003
+ ts.p.data = []; ts.p._index = {};
1004
+ }
1005
+ }
1006
+ },
1007
+ refreshIndex = function() {
1008
+ var datalen = ts.p.data.length, idname, i, val,
1009
+ ni = ts.p.rownumbers===true ? 1 :0,
1010
+ gi = ts.p.multiselect ===true ? 1 :0,
1011
+ si = ts.p.subGrid===true ? 1 :0;
1012
+
1013
+ if(ts.p.keyIndex === false || ts.p.loadonce === true) {
1014
+ idname = ts.p.localReader.id;
1015
+ } else {
1016
+ idname = ts.p.colModel[ts.p.keyIndex+gi+si+ni].name;
1017
+ }
1018
+ for(i =0;i < datalen; i++) {
1019
+ val = $.jgrid.getAccessor(ts.p.data[i],idname);
1020
+ ts.p._index[val] = i;
1021
+ }
1022
+ },
1023
+ addXmlData = function (xml,t, rcnt, more, adjust) {
1024
+ var startReq = new Date(),
1025
+ locdata = (ts.p.datatype != "local" && ts.p.loadonce) || ts.p.datatype == "xmlstring",
1026
+ xmlid = "_id_",
1027
+ frd = ts.p.datatype == "local" ? "local" : "xml";
1028
+ if(locdata) {
1029
+ ts.p.data = [];
1030
+ ts.p._index = {};
1031
+ ts.p.localReader.id = xmlid;
1032
+ }
1033
+ ts.p.reccount = 0;
1034
+ if($.isXMLDoc(xml)) {
1035
+ if(ts.p.treeANode===-1 && !ts.p.scroll) {
1036
+ emptyRows(t,false, true);
1037
+ rcnt=1;
1038
+ } else { rcnt = rcnt > 1 ? rcnt :1; }
1039
+ } else { return; }
1040
+ var i,fpos,ir=0,v,row,gi=0,si=0,ni=0,idn, getId,f=[],F,rd ={}, xmlr,rid, rowData=[], cn=(ts.p.altRows === true) ? " "+ts.p.altclass:"",cn1;
1041
+ if(!ts.p.xmlReader.repeatitems) {f = reader(frd);}
1042
+ if( ts.p.keyIndex===false) {
1043
+ idn = ts.p.xmlReader.id;
1044
+ } else {
1045
+ idn = ts.p.keyIndex;
1046
+ }
1047
+ if(f.length>0 && !isNaN(idn)) {
1048
+ if (ts.p.remapColumns && ts.p.remapColumns.length) {
1049
+ idn = $.inArray(idn, ts.p.remapColumns);
1050
+ }
1051
+ idn=f[idn];
1052
+ }
1053
+ if( (idn+"").indexOf("[") === -1 ) {
1054
+ if (f.length) {
1055
+ getId = function( trow, k) {return $(idn,trow).text() || k;};
1056
+ } else {
1057
+ getId = function( trow, k) {return $(ts.p.xmlReader.cell,trow).eq(idn).text() || k;};
1058
+ }
1059
+ }
1060
+ else {
1061
+ getId = function( trow, k) {return trow.getAttribute(idn.replace(/[\[\]]/g,"")) || k;};
1062
+ }
1063
+ ts.p.userData = {};
1064
+ $(ts.p.xmlReader.page,xml).each(function() {ts.p.page = this.textContent || this.text || 0; });
1065
+ $(ts.p.xmlReader.total,xml).each(function() {ts.p.lastpage = this.textContent || this.text; if(ts.p.lastpage===undefined) { ts.p.lastpage=1; } } );
1066
+ $(ts.p.xmlReader.records,xml).each(function() {ts.p.records = this.textContent || this.text || 0; } );
1067
+ $(ts.p.xmlReader.userdata,xml).each(function() {ts.p.userData[this.getAttribute("name")]=this.textContent || this.text;});
1068
+ var gxml = $(ts.p.xmlReader.root+" "+ts.p.xmlReader.row,xml);
1069
+ if (!gxml) { gxml = []; }
1070
+ var gl = gxml.length, j=0, grpdata={}, rn;
1071
+ if(gxml && gl){
1072
+ rn = parseInt(ts.p.rowNum,10);
1073
+ var br=ts.p.scroll?$.jgrid.randId():1,altr;
1074
+ if (adjust) { rn *= adjust+1; }
1075
+ var afterInsRow = $.isFunction(ts.p.afterInsertRow), hiderow="";
1076
+ if(ts.p.grouping && ts.p.groupingView.groupCollapse === true) {
1077
+ hiderow = " style=\"display:none;\"";
1078
+ }
1079
+ while (j<gl) {
1080
+ xmlr = gxml[j];
1081
+ rid = getId(xmlr,br+j);
1082
+ altr = rcnt === 0 ? 0 : rcnt+1;
1083
+ cn1 = (altr+j)%2 == 1 ? cn : '';
1084
+ rowData.push( "<tr"+hiderow+" id=\""+rid+"\" tabindex=\"-1\" role=\"row\" class =\"ui-widget-content jqgrow ui-row-"+ts.p.direction+""+cn1+"\">" );
1085
+ if(ts.p.rownumbers===true) {
1086
+ rowData.push( addRowNum(0,j,ts.p.page,ts.p.rowNum) );
1087
+ ni=1;
1088
+ }
1089
+ if(ts.p.multiselect===true) {
1090
+ rowData.push( addMulti(rid,ni,j) );
1091
+ gi=1;
1092
+ }
1093
+ if (ts.p.subGrid===true) {
1094
+ rowData.push( $(ts).jqGrid("addSubGridCell",gi+ni,j+rcnt) );
1095
+ si= 1;
1096
+ }
1097
+ if(ts.p.xmlReader.repeatitems){
1098
+ if (!F) { F=orderedCols(gi+si+ni); }
1099
+ var cells = $(ts.p.xmlReader.cell,xmlr);
1100
+ $.each(F, function (k) {
1101
+ var cell = cells[this];
1102
+ if (!cell) { return false; }
1103
+ v = cell.textContent || cell.text;
1104
+ rd[ts.p.colModel[k+gi+si+ni].name] = v;
1105
+ rowData.push( addCell(rid,v,k+gi+si+ni,j+rcnt,xmlr) );
1106
+ });
1107
+ } else {
1108
+ for(i = 0; i < f.length;i++) {
1109
+ v = $(f[i],xmlr).text();
1110
+ rd[ts.p.colModel[i+gi+si+ni].name] = v;
1111
+ rowData.push( addCell(rid, v, i+gi+si+ni, j+rcnt, xmlr) );
1112
+ }
1113
+ }
1114
+ rowData.push("</tr>");
1115
+ if(ts.p.grouping) {
1116
+ var grlen = ts.p.groupingView.groupField.length, grpitem = [];
1117
+ for(var z=0;z<grlen;z++) {
1118
+ grpitem.push(rd[ts.p.groupingView.groupField[z]]);
1119
+ }
1120
+ grpdata = $(ts).jqGrid('groupingPrepare',rowData, grpitem, grpdata, rd);
1121
+ rowData = [];
1122
+ }
1123
+ if(locdata || ts.p.treeGrid === true) {
1124
+ rd[xmlid] = rid;
1125
+ ts.p.data.push(rd);
1126
+ ts.p._index[rid] = ts.p.data.length-1;
1127
+ }
1128
+ if(ts.p.gridview === false ) {
1129
+ $("tbody:first",t).append(rowData.join(''));
1130
+ if(afterInsRow) {ts.p.afterInsertRow.call(ts,rid,rd,xmlr);}
1131
+ rowData=[];
1132
+ }
1133
+ rd={};
1134
+ ir++;
1135
+ j++;
1136
+ if(ir==rn) {break;}
1137
+ }
1138
+ }
1139
+ if(ts.p.gridview === true) {
1140
+ fpos = ts.p.treeANode > -1 ? ts.p.treeANode: 0;
1141
+ if(ts.p.grouping) {
1142
+ $(ts).jqGrid('groupingRender',grpdata,ts.p.colModel.length);
1143
+ grpdata = null;
1144
+ } else if(ts.p.treeGrid === true && fpos > 0) {
1145
+ $(ts.rows[fpos]).after(rowData.join(''));
1146
+ } else {
1147
+ $("tbody:first",t).append(rowData.join(''));
1148
+ }
1149
+ }
1150
+ if(ts.p.subGrid === true ) {
1151
+ try {$(ts).jqGrid("addSubGrid",gi+ni);} catch (_){}
1152
+ }
1153
+ ts.p.totaltime = new Date() - startReq;
1154
+ if(ir>0) { if(ts.p.records===0) { ts.p.records=gl;} }
1155
+ rowData =null;
1156
+ if( ts.p.treeGrid === true) {
1157
+ try {$(ts).jqGrid("setTreeNode", fpos+1, ir+fpos+1);} catch (e) {}
1158
+ }
1159
+ if(!ts.p.treeGrid && !ts.p.scroll) {ts.grid.bDiv.scrollTop = 0;}
1160
+ ts.p.reccount=ir;
1161
+ ts.p.treeANode = -1;
1162
+ if(ts.p.userDataOnFooter) { $(ts).jqGrid("footerData","set",ts.p.userData,true); }
1163
+ if(locdata) {
1164
+ ts.p.records = gl;
1165
+ ts.p.lastpage = Math.ceil(gl/ rn);
1166
+ }
1167
+ if (!more) { ts.updatepager(false,true); }
1168
+ if(locdata) {
1169
+ while (ir<gl) {
1170
+ xmlr = gxml[ir];
1171
+ rid = getId(xmlr,ir);
1172
+ if(ts.p.xmlReader.repeatitems){
1173
+ if (!F) { F=orderedCols(gi+si+ni); }
1174
+ var cells2 = $(ts.p.xmlReader.cell,xmlr);
1175
+ $.each(F, function (k) {
1176
+ var cell = cells2[this];
1177
+ if (!cell) { return false; }
1178
+ v = cell.textContent || cell.text;
1179
+ rd[ts.p.colModel[k+gi+si+ni].name] = v;
1180
+ });
1181
+ } else {
1182
+ for(i = 0; i < f.length;i++) {
1183
+ v = $(f[i],xmlr).text();
1184
+ rd[ts.p.colModel[i+gi+si+ni].name] = v;
1185
+ }
1186
+ }
1187
+ rd[xmlid] = rid;
1188
+ ts.p.data.push(rd);
1189
+ ts.p._index[rid] = ts.p.data.length-1;
1190
+ rd = {};
1191
+ ir++;
1192
+ }
1193
+ }
1194
+ },
1195
+ addJSONData = function(data,t, rcnt, more, adjust) {
1196
+ var startReq = new Date();
1197
+ if(data) {
1198
+ if(ts.p.treeANode === -1 && !ts.p.scroll) {
1199
+ emptyRows(t,false, true);
1200
+ rcnt=1;
1201
+ } else { rcnt = rcnt > 1 ? rcnt :1; }
1202
+ } else { return; }
1203
+
1204
+ var dReader, locid = "_id_", frd,
1205
+ locdata = (ts.p.datatype != "local" && ts.p.loadonce) || ts.p.datatype == "jsonstring";
1206
+ if(locdata) { ts.p.data = []; ts.p._index = {}; ts.p.localReader.id = locid;}
1207
+ ts.p.reccount = 0;
1208
+ if(ts.p.datatype == "local") {
1209
+ dReader = ts.p.localReader;
1210
+ frd= 'local';
1211
+ } else {
1212
+ dReader = ts.p.jsonReader;
1213
+ frd='json';
1214
+ }
1215
+ var ir=0,v,i,j,f=[],F,cur,gi=0,si=0,ni=0,len,drows,idn,rd={}, fpos, idr,rowData=[],cn=(ts.p.altRows === true) ? " "+ts.p.altclass:"",cn1,lp;
1216
+ ts.p.page = $.jgrid.getAccessor(data,dReader.page) || 0;
1217
+ lp = $.jgrid.getAccessor(data,dReader.total);
1218
+ ts.p.lastpage = lp === undefined ? 1 : lp;
1219
+ ts.p.records = $.jgrid.getAccessor(data,dReader.records) || 0;
1220
+ ts.p.userData = $.jgrid.getAccessor(data,dReader.userdata) || {};
1221
+ if(!dReader.repeatitems) {
1222
+ F = f = reader(frd);
1223
+ }
1224
+ if( ts.p.keyIndex===false ) {
1225
+ idn = dReader.id;
1226
+ } else {
1227
+ idn = ts.p.keyIndex;
1228
+ }
1229
+ if(f.length>0 && !isNaN(idn)) {
1230
+ if (ts.p.remapColumns && ts.p.remapColumns.length) {
1231
+ idn = $.inArray(idn, ts.p.remapColumns);
1232
+ }
1233
+ idn=f[idn];
1234
+ }
1235
+ drows = $.jgrid.getAccessor(data,dReader.root);
1236
+ if (!drows) { drows = []; }
1237
+ len = drows.length; i=0;
1238
+ var rn = parseInt(ts.p.rowNum,10),br=ts.p.scroll?$.jgrid.randId():1, altr;
1239
+ if (adjust) { rn *= adjust+1; }
1240
+ var afterInsRow = $.isFunction(ts.p.afterInsertRow), grpdata={}, hiderow="";
1241
+ if(ts.p.grouping && ts.p.groupingView.groupCollapse === true) {
1242
+ hiderow = " style=\"display:none;\"";
1243
+ }
1244
+ while (i<len) {
1245
+ cur = drows[i];
1246
+ idr = $.jgrid.getAccessor(cur,idn);
1247
+ if(idr === undefined) {
1248
+ idr = br+i;
1249
+ if(f.length===0){
1250
+ if(dReader.cell){
1251
+ var ccur = $.jgrid.getAccessor(cur,dReader.cell);
1252
+ idr = ccur[idn] || idr;
1253
+ ccur=null;
1254
+ }
1255
+ }
1256
+ }
1257
+ altr = rcnt === 1 ? 0 : rcnt;
1258
+ cn1 = (altr+i)%2 == 1 ? cn : '';
1259
+ rowData.push("<tr"+hiderow+" id=\""+ idr +"\" tabindex=\"-1\" role=\"row\" class= \"ui-widget-content jqgrow ui-row-"+ts.p.direction+""+cn1+"\">");
1260
+ if(ts.p.rownumbers===true) {
1261
+ rowData.push( addRowNum(0,i,ts.p.page,ts.p.rowNum) );
1262
+ ni=1;
1263
+ }
1264
+ if(ts.p.multiselect){
1265
+ rowData.push( addMulti(idr,ni,i) );
1266
+ gi = 1;
1267
+ }
1268
+ if (ts.p.subGrid) {
1269
+ rowData.push( $(ts).jqGrid("addSubGridCell",gi+ni,i+rcnt) );
1270
+ si= 1;
1271
+ }
1272
+ if (dReader.repeatitems) {
1273
+ if(dReader.cell) {cur = $.jgrid.getAccessor(cur,dReader.cell);}
1274
+ if (!F) { F=orderedCols(gi+si+ni); }
1275
+ }
1276
+ for (j=0;j<F.length;j++) {
1277
+ v = $.jgrid.getAccessor(cur,F[j]);
1278
+ rowData.push( addCell(idr,v,j+gi+si+ni,i+rcnt,cur) );
1279
+ rd[ts.p.colModel[j+gi+si+ni].name] = v;
1280
+ }
1281
+ rowData.push( "</tr>" );
1282
+ if(ts.p.grouping) {
1283
+ var grlen = ts.p.groupingView.groupField.length, grpitem = [];
1284
+ for(var z=0;z<grlen;z++) {
1285
+ grpitem.push(rd[ts.p.groupingView.groupField[z]]);
1286
+ }
1287
+ grpdata = $(ts).jqGrid('groupingPrepare',rowData, grpitem, grpdata, rd);
1288
+ rowData = [];
1289
+ }
1290
+ if(locdata || ts.p.treeGrid===true) {
1291
+ rd[locid] = idr;
1292
+ ts.p.data.push(rd);
1293
+ ts.p._index[idr] = ts.p.data.length-1;
1294
+ }
1295
+ if(ts.p.gridview === false ) {
1296
+ $("#"+$.jgrid.jqID(ts.p.id)+" tbody:first").append(rowData.join(''));
1297
+ if(afterInsRow) {ts.p.afterInsertRow.call(ts,idr,rd,cur);}
1298
+ rowData=[];//ari=0;
1299
+ }
1300
+ rd={};
1301
+ ir++;
1302
+ i++;
1303
+ if(ir==rn) { break; }
1304
+ }
1305
+ if(ts.p.gridview === true ) {
1306
+ fpos = ts.p.treeANode > -1 ? ts.p.treeANode: 0;
1307
+ if(ts.p.grouping) {
1308
+ $(ts).jqGrid('groupingRender',grpdata,ts.p.colModel.length);
1309
+ grpdata = null;
1310
+ } else if(ts.p.treeGrid === true && fpos > 0) {
1311
+ $(ts.rows[fpos]).after(rowData.join(''));
1312
+ } else {
1313
+ $("#"+$.jgrid.jqID(ts.p.id)+" tbody:first").append(rowData.join(''));
1314
+ }
1315
+ }
1316
+ if(ts.p.subGrid === true ) {
1317
+ try { $(ts).jqGrid("addSubGrid",gi+ni);} catch (_){}
1318
+ }
1319
+ ts.p.totaltime = new Date() - startReq;
1320
+ if(ir>0) {
1321
+ if(ts.p.records===0) { ts.p.records=len; }
1322
+ }
1323
+ rowData = null;
1324
+ if( ts.p.treeGrid === true) {
1325
+ try {$(ts).jqGrid("setTreeNode", fpos+1, ir+fpos+1);} catch (e) {}
1326
+ }
1327
+ if(!ts.p.treeGrid && !ts.p.scroll) {ts.grid.bDiv.scrollTop = 0;}
1328
+ ts.p.reccount=ir;
1329
+ ts.p.treeANode = -1;
1330
+ if(ts.p.userDataOnFooter) { $(ts).jqGrid("footerData","set",ts.p.userData,true); }
1331
+ if(locdata) {
1332
+ ts.p.records = len;
1333
+ ts.p.lastpage = Math.ceil(len/ rn);
1334
+ }
1335
+ if (!more) { ts.updatepager(false,true); }
1336
+ if(locdata) {
1337
+ while (ir<len && drows[ir]) {
1338
+ cur = drows[ir];
1339
+ idr = $.jgrid.getAccessor(cur,idn);
1340
+ if(idr === undefined) {
1341
+ idr = br+ir;
1342
+ if(f.length===0){
1343
+ if(dReader.cell){
1344
+ var ccur2 = $.jgrid.getAccessor(cur,dReader.cell);
1345
+ idr = ccur2[idn] || idr;
1346
+ ccur2=null;
1347
+ }
1348
+ }
1349
+ }
1350
+ if(cur) {
1351
+ if (dReader.repeatitems) {
1352
+ if(dReader.cell) {cur = $.jgrid.getAccessor(cur,dReader.cell);}
1353
+ if (!F) { F=orderedCols(gi+si+ni); }
1354
+ }
1355
+
1356
+ for (j=0;j<F.length;j++) {
1357
+ v = $.jgrid.getAccessor(cur,F[j]);
1358
+ rd[ts.p.colModel[j+gi+si+ni].name] = v;
1359
+ }
1360
+ rd[locid] = idr;
1361
+ ts.p.data.push(rd);
1362
+ ts.p._index[idr] = ts.p.data.length-1;
1363
+ rd = {};
1364
+ }
1365
+ ir++;
1366
+ }
1367
+ }
1368
+ },
1369
+ addLocalData = function() {
1370
+ var st, fndsort=false, cmtypes={}, grtypes=[], grindexes=[], srcformat, sorttype, newformat;
1371
+ if(!$.isArray(ts.p.data)) {
1372
+ return;
1373
+ }
1374
+ var grpview = ts.p.grouping ? ts.p.groupingView : false;
1375
+ $.each(ts.p.colModel,function(i,v){
1376
+ sorttype = this.sorttype || "text";
1377
+ if(sorttype == "date" || sorttype == "datetime") {
1378
+ if(this.formatter && typeof(this.formatter) === 'string' && this.formatter == 'date') {
1379
+ if(this.formatoptions && this.formatoptions.srcformat) {
1380
+ srcformat = this.formatoptions.srcformat;
1381
+ } else {
1382
+ srcformat = $.jgrid.formatter.date.srcformat;
1383
+ }
1384
+ if(this.formatoptions && this.formatoptions.newformat) {
1385
+ newformat = this.formatoptions.newformat;
1386
+ } else {
1387
+ newformat = $.jgrid.formatter.date.newformat;
1388
+ }
1389
+ } else {
1390
+ srcformat = newformat = this.datefmt || "Y-m-d";
1391
+ }
1392
+ cmtypes[this.name] = {"stype": sorttype, "srcfmt": srcformat,"newfmt":newformat};
1393
+ } else {
1394
+ cmtypes[this.name] = {"stype": sorttype, "srcfmt":'',"newfmt":''};
1395
+ }
1396
+ if(ts.p.grouping && this.name == grpview.groupField[0]) {
1397
+ var grindex = this.name;
1398
+ if (typeof this.index != 'undefined') {
1399
+ grindex = this.index;
1400
+ }
1401
+ grtypes[0] = cmtypes[grindex];
1402
+ grindexes.push(grindex);
1403
+ }
1404
+ if(!fndsort && (this.index == ts.p.sortname || this.name == ts.p.sortname)){
1405
+ st = this.name; // ???
1406
+ fndsort = true;
1407
+ }
1408
+ });
1409
+ if(ts.p.treeGrid) {
1410
+ $(ts).jqGrid("SortTree", st, ts.p.sortorder, cmtypes[st].stype, cmtypes[st].srcfmt);
1411
+ return;
1412
+ }
1413
+ var compareFnMap = {
1414
+ 'eq':function(queryObj, op) {return queryObj.equals;},
1415
+ 'ne':function(queryObj,op) {return queryObj.notEquals;},
1416
+ 'lt':function(queryObj,op) {return queryObj.less;},
1417
+ 'le':function(queryObj,op) {return queryObj.lessOrEquals;},
1418
+ 'gt':function(queryObj,op) {return queryObj.greater;},
1419
+ 'ge':function(queryObj,op) {return queryObj.greaterOrEquals;},
1420
+ 'cn':function(queryObj,op) {return queryObj.contains;},
1421
+ 'nc':function(queryObj,op) {return op === "OR" ? queryObj.orNot().contains : queryObj.andNot().contains;},
1422
+ 'bw':function(queryObj,op) {return queryObj.startsWith;},
1423
+ 'bn':function(queryObj,op) {return op === "OR" ? queryObj.orNot().startsWith : queryObj.andNot().startsWith;},
1424
+ 'en':function(queryObj,op) {return op === "OR" ? queryObj.orNot().endsWith : queryObj.andNot().endsWith;},
1425
+ 'ew':function(queryObj,op) {return queryObj.endsWith;},
1426
+ 'ni':function(queryObj,op) {return op === "OR" ? queryObj.orNot().equals : queryObj.andNot().equals;},
1427
+ 'in':function(queryObj,op) {return queryObj.equals;},
1428
+ 'nu':function(queryObj,op) {return queryObj.isNull;},
1429
+ 'nn':function(queryObj,op) {return op === "OR" ? queryObj.orNot().isNull : queryObj.andNot().isNull;}
1430
+
1431
+ },
1432
+ query = $.jgrid.from(ts.p.data);
1433
+ if (ts.p.ignoreCase) { query = query.ignoreCase(); }
1434
+ function tojLinq ( group ) {
1435
+ var s = 0, index, opr, rule;
1436
+ if (group.groups !== undefined) {
1437
+ for (index = 0; index < group.groups.length; index++) {
1438
+ try {
1439
+ tojLinq(group.groups[index]);
1440
+ } catch (e) {alert(e);}
1441
+ s++;
1442
+ }
1443
+ }
1444
+ if (group.rules !== undefined) {
1445
+ if(s>0) {
1446
+ var result = query.select();
1447
+ query = $.jgrid.from( result);
1448
+ }
1449
+ try{
1450
+ for (index = 0; index < group.rules.length; index++) {
1451
+ rule = group.rules[index];
1452
+ opr = group.groupOp.toString().toUpperCase();
1453
+ if (compareFnMap[rule.op] && rule.field ) {
1454
+ if(s > 0 && opr && opr === "OR") {
1455
+ query = query.or();
1456
+ }
1457
+ query = compareFnMap[rule.op](query, opr)(rule.field, rule.data, cmtypes[rule.field]);
1458
+ }
1459
+ s++;
1460
+ }
1461
+ } catch (g) {alert(g);}
1462
+ }
1463
+ }
1464
+
1465
+ if (ts.p.search === true) {
1466
+ var srules = ts.p.postData.filters;
1467
+ if(srules) {
1468
+ if(typeof srules == "string") { srules = $.jgrid.parse(srules);}
1469
+ tojLinq( srules );
1470
+ } else {
1471
+ try {
1472
+ query = compareFnMap[ts.p.postData.searchOper](query)(ts.p.postData.searchField, ts.p.postData.searchString,cmtypes[ts.p.postData.searchField]);
1473
+ } catch (se){}
1474
+ }
1475
+ }
1476
+ if(ts.p.grouping) {
1477
+ query.orderBy(grindexes,grpview.groupOrder[0],grtypes[0].stype, grtypes[0].srcfmt);
1478
+ grpview.groupDataSorted = true;
1479
+ }
1480
+ if (st && ts.p.sortorder && fndsort) {
1481
+ if(ts.p.sortorder.toUpperCase() == "DESC") {
1482
+ query.orderBy(ts.p.sortname, "d", cmtypes[st].stype, cmtypes[st].srcfmt);
1483
+ } else {
1484
+ query.orderBy(ts.p.sortname, "a", cmtypes[st].stype, cmtypes[st].srcfmt);
1485
+ }
1486
+ }
1487
+ var queryResults = query.select(),
1488
+ recordsperpage = parseInt(ts.p.rowNum,10),
1489
+ total = queryResults.length,
1490
+ page = parseInt(ts.p.page,10),
1491
+ totalpages = Math.ceil(total / recordsperpage),
1492
+ retresult = {};
1493
+ queryResults = queryResults.slice( (page-1)*recordsperpage , page*recordsperpage );
1494
+ query = null;
1495
+ cmtypes = null;
1496
+ retresult[ts.p.localReader.total] = totalpages;
1497
+ retresult[ts.p.localReader.page] = page;
1498
+ retresult[ts.p.localReader.records] = total;
1499
+ retresult[ts.p.localReader.root] = queryResults;
1500
+ queryResults = null;
1501
+ return retresult;
1502
+ },
1503
+ updatepager = function(rn, dnd) {
1504
+ var cp, last, base, from,to,tot,fmt, pgboxes = "", sppg,
1505
+ tspg = ts.p.pager ? "_"+$.jgrid.jqID(ts.p.pager.substr(1)) : "",
1506
+ tspg_t = ts.p.toppager ? "_"+ts.p.toppager.substr(1) : "";
1507
+ base = parseInt(ts.p.page,10)-1;
1508
+ if(base < 0) { base = 0; }
1509
+ base = base*parseInt(ts.p.rowNum,10);
1510
+ to = base + ts.p.reccount;
1511
+ if (ts.p.scroll) {
1512
+ var rows = $("tbody:first > tr:gt(0)", ts.grid.bDiv);
1513
+ base = to - rows.length;
1514
+ ts.p.reccount = rows.length;
1515
+ var rh = rows.outerHeight() || ts.grid.prevRowHeight;
1516
+ if (rh) {
1517
+ var top = base * rh;
1518
+ var height = parseInt(ts.p.records,10) * rh;
1519
+ $(">div:first",ts.grid.bDiv).css({height : height}).children("div:first").css({height:top,display:top?"":"none"});
1520
+ }
1521
+ ts.grid.bDiv.scrollLeft = ts.grid.hDiv.scrollLeft;
1522
+ }
1523
+ pgboxes = ts.p.pager ? ts.p.pager : "";
1524
+ pgboxes += ts.p.toppager ? (pgboxes ? "," + ts.p.toppager : ts.p.toppager) : "";
1525
+ if(pgboxes) {
1526
+ fmt = $.jgrid.formatter.integer || {};
1527
+ cp = intNum(ts.p.page);
1528
+ last = intNum(ts.p.lastpage);
1529
+ $(".selbox",pgboxes).attr("disabled",false);
1530
+ if(ts.p.pginput===true) {
1531
+ $('.ui-pg-input',pgboxes).val(ts.p.page);
1532
+ sppg = ts.p.toppager ? '#sp_1'+tspg+",#sp_1"+tspg_t : '#sp_1'+tspg;
1533
+ $(sppg).html($.fmatter ? $.fmatter.util.NumberFormat(ts.p.lastpage,fmt):ts.p.lastpage);
1534
+
1535
+ }
1536
+ if (ts.p.viewrecords){
1537
+ if(ts.p.reccount === 0) {
1538
+ $(".ui-paging-info",pgboxes).html(ts.p.emptyrecords);
1539
+ } else {
1540
+ from = base+1;
1541
+ tot=ts.p.records;
1542
+ if($.fmatter) {
1543
+ from = $.fmatter.util.NumberFormat(from,fmt);
1544
+ to = $.fmatter.util.NumberFormat(to,fmt);
1545
+ tot = $.fmatter.util.NumberFormat(tot,fmt);
1546
+ }
1547
+ $(".ui-paging-info",pgboxes).html($.jgrid.format(ts.p.recordtext,from,to,tot));
1548
+ }
1549
+ }
1550
+ if(ts.p.pgbuttons===true) {
1551
+ if(cp<=0) {cp = last = 0;}
1552
+ if(cp==1 || cp === 0) {
1553
+ $("#first"+tspg+", #prev"+tspg).addClass('ui-state-disabled').removeClass('ui-state-hover');
1554
+ if(ts.p.toppager) { $("#first_t"+tspg_t+", #prev_t"+tspg_t).addClass('ui-state-disabled').removeClass('ui-state-hover'); }
1555
+ } else {
1556
+ $("#first"+tspg+", #prev"+tspg).removeClass('ui-state-disabled');
1557
+ if(ts.p.toppager) { $("#first_t"+tspg_t+", #prev_t"+tspg_t).removeClass('ui-state-disabled'); }
1558
+ }
1559
+ if(cp==last || cp === 0) {
1560
+ $("#next"+tspg+", #last"+tspg).addClass('ui-state-disabled').removeClass('ui-state-hover');
1561
+ if(ts.p.toppager) { $("#next_t"+tspg_t+", #last_t"+tspg_t).addClass('ui-state-disabled').removeClass('ui-state-hover'); }
1562
+ } else {
1563
+ $("#next"+tspg+", #last"+tspg).removeClass('ui-state-disabled');
1564
+ if(ts.p.toppager) { $("#next_t"+tspg_t+", #last_t"+tspg_t).removeClass('ui-state-disabled'); }
1565
+ }
1566
+ }
1567
+ }
1568
+ if(rn===true && ts.p.rownumbers === true) {
1569
+ $("td.jqgrid-rownum",ts.rows).each(function(i){
1570
+ $(this).html(base+1+i);
1571
+ });
1572
+ }
1573
+ if(dnd && ts.p.jqgdnd) { $(ts).jqGrid('gridDnD','updateDnD');}
1574
+ if($.isFunction(ts.p.gridComplete)) {ts.p.gridComplete.call(ts);}
1575
+ },
1576
+ beginReq = function() {
1577
+ ts.grid.hDiv.loading = true;
1578
+ if(ts.p.hiddengrid) { return;}
1579
+ switch(ts.p.loadui) {
1580
+ case "disable":
1581
+ break;
1582
+ case "enable":
1583
+ $("#load_"+$.jgrid.jqID(ts.p.id)).show();
1584
+ break;
1585
+ case "block":
1586
+ $("#lui_"+$.jgrid.jqID(ts.p.id)).show();
1587
+ $("#load_"+$.jgrid.jqID(ts.p.id)).show();
1588
+ break;
1589
+ }
1590
+ },
1591
+ endReq = function() {
1592
+ ts.grid.hDiv.loading = false;
1593
+ switch(ts.p.loadui) {
1594
+ case "disable":
1595
+ break;
1596
+ case "enable":
1597
+ $("#load_"+$.jgrid.jqID(ts.p.id)).hide();
1598
+ break;
1599
+ case "block":
1600
+ $("#lui_"+$.jgrid.jqID(ts.p.id)).hide();
1601
+ $("#load_"+$.jgrid.jqID(ts.p.id)).hide();
1602
+ break;
1603
+ }
1604
+ },
1605
+ populate = function (npage) {
1606
+ if(!ts.grid.hDiv.loading) {
1607
+ var pvis = ts.p.scroll && npage === false;
1608
+ var prm = {}, dt, dstr, pN=ts.p.prmNames;
1609
+ if(ts.p.page <=0) { ts.p.page = 1; }
1610
+ if(pN.search !== null) {prm[pN.search] = ts.p.search;} if(pN.nd !== null) {prm[pN.nd] = new Date().getTime();}
1611
+ if(pN.rows !== null) {prm[pN.rows]= ts.p.rowNum;} if(pN.page !== null) {prm[pN.page]= ts.p.page;}
1612
+ if(pN.sort !== null) {prm[pN.sort]= ts.p.sortname;} if(pN.order !== null) {prm[pN.order]= ts.p.sortorder;}
1613
+ if(ts.p.rowTotal !== null && pN.totalrows !== null) { prm[pN.totalrows]= ts.p.rowTotal; }
1614
+ var lc = ts.p.loadComplete;
1615
+ var lcf = $.isFunction(lc);
1616
+ if (!lcf) { lc = null; }
1617
+ var adjust = 0;
1618
+ npage = npage || 1;
1619
+ if (npage > 1) {
1620
+ if(pN.npage !== null) {
1621
+ prm[pN.npage] = npage;
1622
+ adjust = npage - 1;
1623
+ npage = 1;
1624
+ } else {
1625
+ lc = function(req) {
1626
+ ts.p.page++;
1627
+ ts.grid.hDiv.loading = false;
1628
+ if (lcf) {
1629
+ ts.p.loadComplete.call(ts,req);
1630
+ }
1631
+ populate(npage-1);
1632
+ };
1633
+ }
1634
+ } else if (pN.npage !== null) {
1635
+ delete ts.p.postData[pN.npage];
1636
+ }
1637
+ if(ts.p.grouping) {
1638
+ $(ts).jqGrid('groupingSetup');
1639
+ if(ts.p.groupingView.groupDataSorted === true) {
1640
+ prm[pN.sort] = ts.p.groupingView.groupField[0] +" "+ ts.p.groupingView.groupOrder[0]+", "+prm[pN.sort];
1641
+ }
1642
+ }
1643
+ $.extend(ts.p.postData,prm);
1644
+ var rcnt = !ts.p.scroll ? 1 : ts.rows.length-1;
1645
+ if ($.isFunction(ts.p.datatype)) { ts.p.datatype.call(ts,ts.p.postData,"load_"+ts.p.id); return;}
1646
+ else if($.isFunction(ts.p.beforeRequest)) {ts.p.beforeRequest.call(ts);}
1647
+ dt = ts.p.datatype.toLowerCase();
1648
+ switch(dt)
1649
+ {
1650
+ case "json":
1651
+ case "jsonp":
1652
+ case "xml":
1653
+ case "script":
1654
+ $.ajax($.extend({
1655
+ url:ts.p.url,
1656
+ type:ts.p.mtype,
1657
+ dataType: dt ,
1658
+ data: $.isFunction(ts.p.serializeGridData)? ts.p.serializeGridData.call(ts,ts.p.postData) : ts.p.postData,
1659
+ success:function(data,st) {
1660
+ if(dt === "xml") { addXmlData(data,ts.grid.bDiv,rcnt,npage>1,adjust); }
1661
+ else { addJSONData(data,ts.grid.bDiv,rcnt,npage>1,adjust); }
1662
+ if(lc) { lc.call(ts,data); }
1663
+ if (pvis) { ts.grid.populateVisible(); }
1664
+ if( ts.p.loadonce || ts.p.treeGrid) {ts.p.datatype = "local";}
1665
+ data=null;
1666
+ endReq();
1667
+ },
1668
+ error:function(xhr,st,err){
1669
+ if($.isFunction(ts.p.loadError)) { ts.p.loadError.call(ts,xhr,st,err); }
1670
+ endReq();
1671
+ xhr=null;
1672
+ },
1673
+ beforeSend: function(xhr){
1674
+ beginReq();
1675
+ if($.isFunction(ts.p.loadBeforeSend)) { ts.p.loadBeforeSend.call(ts,xhr); }
1676
+ }
1677
+ },$.jgrid.ajaxOptions, ts.p.ajaxGridOptions));
1678
+ break;
1679
+ case "xmlstring":
1680
+ beginReq();
1681
+ dstr = $.jgrid.stringToDoc(ts.p.datastr);
1682
+ addXmlData(dstr,ts.grid.bDiv);
1683
+ if(lcf) {ts.p.loadComplete.call(ts,dstr);}
1684
+ ts.p.datatype = "local";
1685
+ ts.p.datastr = null;
1686
+ endReq();
1687
+ break;
1688
+ case "jsonstring":
1689
+ beginReq();
1690
+ if(typeof ts.p.datastr == 'string') { dstr = $.jgrid.parse(ts.p.datastr); }
1691
+ else { dstr = ts.p.datastr; }
1692
+ addJSONData(dstr,ts.grid.bDiv);
1693
+ if(lcf) {ts.p.loadComplete.call(ts,dstr);}
1694
+ ts.p.datatype = "local";
1695
+ ts.p.datastr = null;
1696
+ endReq();
1697
+ break;
1698
+ case "local":
1699
+ case "clientside":
1700
+ beginReq();
1701
+ ts.p.datatype = "local";
1702
+ var req = addLocalData();
1703
+ addJSONData(req,ts.grid.bDiv,rcnt,npage>1,adjust);
1704
+ if(lc) { lc.call(ts,req); }
1705
+ if (pvis) { ts.grid.populateVisible(); }
1706
+ endReq();
1707
+ break;
1708
+ }
1709
+ }
1710
+ },
1711
+ setPager = function (pgid, tp){
1712
+ // TBD - consider escaping pgid with pgid = $.jgrid.jqID(pgid);
1713
+ var sep = "<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>",
1714
+ pginp = "",
1715
+ pgl="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",
1716
+ str="", pgcnt, lft, cent, rgt, twd, tdw, i,
1717
+ clearVals = function(onpaging){
1718
+ var ret;
1719
+ if ($.isFunction(ts.p.onPaging) ) { ret = ts.p.onPaging.call(ts,onpaging); }
1720
+ ts.p.selrow = null;
1721
+ if(ts.p.multiselect) {ts.p.selarrrow =[];$('#cb_'+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false);}
1722
+ ts.p.savedRow = [];
1723
+ if(ret=='stop') {return false;}
1724
+ return true;
1725
+ };
1726
+ pgid = pgid.substr(1);
1727
+ tp += "_" + pgid;
1728
+ pgcnt = "pg_"+pgid;
1729
+ lft = pgid+"_left"; cent = pgid+"_center"; rgt = pgid+"_right";
1730
+ $("#"+$.jgrid.jqID(pgid) )
1731
+ .append("<div id='"+pgcnt+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;height:100%;' role='row'><tbody><tr><td id='"+lft+"' align='left'></td><td id='"+cent+"' align='center' style='white-space:pre;'></td><td id='"+rgt+"' align='right'></td></tr></tbody></table></div>")
1732
+ .attr("dir","ltr"); //explicit setting
1733
+ if(ts.p.rowList.length >0){
1734
+ str = "<td dir='"+dir+"'>";
1735
+ str +="<select class='ui-pg-selbox' role='listbox'>";
1736
+ for(i=0;i<ts.p.rowList.length;i++){
1737
+ str +="<option role=\"option\" value=\""+ts.p.rowList[i]+"\""+((ts.p.rowNum == ts.p.rowList[i])?" selected=\"selected\"":"")+">"+ts.p.rowList[i]+"</option>";
1738
+ }
1739
+ str +="</select></td>";
1740
+ }
1741
+ if(dir=="rtl") { pgl += str; }
1742
+ if(ts.p.pginput===true) { pginp= "<td dir='"+dir+"'>"+$.jgrid.format(ts.p.pgtext || "","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1_"+$.jgrid.jqID(pgid)+"'></span>")+"</td>";}
1743
+ if(ts.p.pgbuttons===true) {
1744
+ var po=["first"+tp,"prev"+tp, "next"+tp,"last"+tp]; if(dir=="rtl") { po.reverse(); }
1745
+ pgl += "<td id='"+po[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>";
1746
+ pgl += "<td id='"+po[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>";
1747
+ pgl += pginp !== "" ? sep+pginp+sep:"";
1748
+ pgl += "<td id='"+po[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>";
1749
+ pgl += "<td id='"+po[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>";
1750
+ } else if (pginp !== "") { pgl += pginp; }
1751
+ if(dir=="ltr") { pgl += str; }
1752
+ pgl += "</tr></tbody></table>";
1753
+ if(ts.p.viewrecords===true) {$("td#"+pgid+"_"+ts.p.recordpos,"#"+pgcnt).append("<div dir='"+dir+"' style='text-align:"+ts.p.recordpos+"' class='ui-paging-info'></div>");}
1754
+ $("td#"+pgid+"_"+ts.p.pagerpos,"#"+pgcnt).append(pgl);
1755
+ tdw = $(".ui-jqgrid").css("font-size") || "11px";
1756
+ $(document.body).append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+tdw+";visibility:hidden;' ></div>");
1757
+ twd = $(pgl).clone().appendTo("#testpg").width();
1758
+ $("#testpg").remove();
1759
+ if(twd > 0) {
1760
+ if(pginp !== "") { twd += 50; } //should be param
1761
+ $("td#"+pgid+"_"+ts.p.pagerpos,"#"+pgcnt).width(twd);
1762
+ }
1763
+ ts.p._nvtd = [];
1764
+ ts.p._nvtd[0] = twd ? Math.floor((ts.p.width - twd)/2) : Math.floor(ts.p.width/3);
1765
+ ts.p._nvtd[1] = 0;
1766
+ pgl=null;
1767
+ $('.ui-pg-selbox',"#"+pgcnt).bind('change',function() {
1768
+ ts.p.page = Math.round(ts.p.rowNum*(ts.p.page-1)/this.value-0.5)+1;
1769
+ ts.p.rowNum = this.value;
1770
+ if(tp) { $('.ui-pg-selbox',ts.p.pager).val(this.value); }
1771
+ else if(ts.p.toppager) { $('.ui-pg-selbox',ts.p.toppager).val(this.value); }
1772
+ if(!clearVals('records')) { return false; }
1773
+ populate();
1774
+ return false;
1775
+ });
1776
+ if(ts.p.pgbuttons===true) {
1777
+ $(".ui-pg-button","#"+pgcnt).hover(function(e){
1778
+ if($(this).hasClass('ui-state-disabled')) {
1779
+ this.style.cursor='default';
1780
+ } else {
1781
+ $(this).addClass('ui-state-hover');
1782
+ this.style.cursor='pointer';
1783
+ }
1784
+ },function(e) {
1785
+ if($(this).hasClass('ui-state-disabled')) {
1786
+ } else {
1787
+ $(this).removeClass('ui-state-hover');
1788
+ this.style.cursor= "default";
1789
+ }
1790
+ });
1791
+ $("#first"+$.jgrid.jqID(tp)+", #prev"+$.jgrid.jqID(tp)+", #next"+$.jgrid.jqID(tp)+", #last"+$.jgrid.jqID(tp)).click( function(e) {
1792
+ var cp = intNum(ts.p.page,1),
1793
+ last = intNum(ts.p.lastpage,1), selclick = false,
1794
+ fp=true, pp=true, np=true,lp=true;
1795
+ if(last ===0 || last===1) {fp=false;pp=false;np=false;lp=false; }
1796
+ else if( last>1 && cp >=1) {
1797
+ if( cp === 1) { fp=false; pp=false; }
1798
+ else if( cp>1 && cp <last){ }
1799
+ else if( cp===last){ np=false;lp=false; }
1800
+ } else if( last>1 && cp===0 ) { np=false;lp=false; cp=last-1;}
1801
+ if( this.id === 'first'+tp && fp ) { ts.p.page=1; selclick=true;}
1802
+ if( this.id === 'prev'+tp && pp) { ts.p.page=(cp-1); selclick=true;}
1803
+ if( this.id === 'next'+tp && np) { ts.p.page=(cp+1); selclick=true;}
1804
+ if( this.id === 'last'+tp && lp) { ts.p.page=last; selclick=true;}
1805
+ if(selclick) {
1806
+ if(!clearVals(this.id)) { return false; }
1807
+ populate();
1808
+ }
1809
+ return false;
1810
+ });
1811
+ }
1812
+ if(ts.p.pginput===true) {
1813
+ $('input.ui-pg-input',"#"+pgcnt).keypress( function(e) {
1814
+ var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
1815
+ if(key == 13) {
1816
+ ts.p.page = ($(this).val()>0) ? $(this).val():ts.p.page;
1817
+ if(!clearVals('user')) { return false; }
1818
+ populate();
1819
+ return false;
1820
+ }
1821
+ return this;
1822
+ });
1823
+ }
1824
+ },
1825
+ sortData = function (index, idxcol,reload,sor){
1826
+ if(!ts.p.colModel[idxcol].sortable) { return; }
1827
+ var so;
1828
+ if(ts.p.savedRow.length > 0) {return;}
1829
+ if(!reload) {
1830
+ if( ts.p.lastsort == idxcol ) {
1831
+ if( ts.p.sortorder == 'asc') {
1832
+ ts.p.sortorder = 'desc';
1833
+ } else if(ts.p.sortorder == 'desc') { ts.p.sortorder = 'asc';}
1834
+ } else { ts.p.sortorder = ts.p.colModel[idxcol].firstsortorder || 'asc'; }
1835
+ ts.p.page = 1;
1836
+ }
1837
+ if(sor) {
1838
+ if(ts.p.lastsort == idxcol && ts.p.sortorder == sor && !reload) { return; }
1839
+ else { ts.p.sortorder = sor; }
1840
+ }
1841
+ var thd= $("thead:first",ts.grid.hDiv).get(0);
1842
+ $("tr th:eq("+ts.p.lastsort+") span.ui-grid-ico-sort",thd).addClass('ui-state-disabled');
1843
+ $("tr th:eq("+ts.p.lastsort+")",thd).attr("aria-selected","false");
1844
+ $("tr th:eq("+idxcol+") span.ui-icon-"+ts.p.sortorder,thd).removeClass('ui-state-disabled');
1845
+ $("tr th:eq("+idxcol+")",thd).attr("aria-selected","true");
1846
+ if(!ts.p.viewsortcols[0]) {
1847
+ if(ts.p.lastsort != idxcol) {
1848
+ $("tr th:eq("+ts.p.lastsort+") span.s-ico",thd).hide();
1849
+ $("tr th:eq("+idxcol+") span.s-ico",thd).show();
1850
+ }
1851
+ }
1852
+ index = index.substring(5);
1853
+ ts.p.sortname = ts.p.colModel[idxcol].index || index;
1854
+ so = ts.p.sortorder;
1855
+ if($.isFunction(ts.p.onSortCol)) {if (ts.p.onSortCol.call(ts,index,idxcol,so)=='stop') {ts.p.lastsort = idxcol; return;}}
1856
+ if(ts.p.datatype == "local") {
1857
+ if(ts.p.deselectAfterSort) {$(ts).jqGrid("resetSelection");}
1858
+ } else {
1859
+ ts.p.selrow = null;
1860
+ if(ts.p.multiselect){$("#cb_"+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false);}
1861
+ ts.p.selarrrow =[];
1862
+ ts.p.savedRow =[];
1863
+ }
1864
+ if(ts.p.scroll) {
1865
+ var sscroll = ts.grid.bDiv.scrollLeft;
1866
+ emptyRows(ts.grid.bDiv,true, false);
1867
+ ts.grid.hDiv.scrollLeft = sscroll;
1868
+ }
1869
+ if(ts.p.subGrid && ts.p.datatype=='local') {
1870
+ $("td.sgexpanded","#"+$.jgrid.jqID(ts.p.id)).each(function(){
1871
+ $(this).trigger("click");
1872
+ });
1873
+ }
1874
+ populate();
1875
+ ts.p.lastsort = idxcol;
1876
+ if(ts.p.sortname != index && idxcol) {ts.p.lastsort = idxcol;}
1877
+ },
1878
+ setColWidth = function () {
1879
+ var initwidth = 0, brd=isSafari? 0: ts.p.cellLayout, vc=0, lvc, scw=ts.p.scrollOffset,cw,hs=false,aw,gw=0,
1880
+ cl = 0, cr;
1881
+ $.each(ts.p.colModel, function(i) {
1882
+ if(typeof this.hidden === 'undefined') {this.hidden=false;}
1883
+ this.widthOrg = cw = intNum(this.width,0);
1884
+ if(this.hidden===false){
1885
+ initwidth += cw+brd;
1886
+ if(this.fixed) {
1887
+ gw += cw+brd;
1888
+ } else {
1889
+ vc++;
1890
+ }
1891
+ cl++;
1892
+ }
1893
+ });
1894
+ if(isNaN(ts.p.width)) {ts.p.width = grid.width = initwidth;}
1895
+ else { grid.width = ts.p.width;}
1896
+ ts.p.tblwidth = initwidth;
1897
+ if(ts.p.shrinkToFit ===false && ts.p.forceFit === true) {ts.p.forceFit=false;}
1898
+ if(ts.p.shrinkToFit===true && vc > 0) {
1899
+ aw = grid.width-brd*vc-gw;
1900
+ if(isNaN(ts.p.height)) {
1901
+ } else {
1902
+ aw -= scw;
1903
+ hs = true;
1904
+ }
1905
+ initwidth =0;
1906
+ $.each(ts.p.colModel, function(i) {
1907
+ if(this.hidden === false && !this.fixed){
1908
+ cw = Math.round(aw*this.width/(ts.p.tblwidth-brd*vc-gw));
1909
+ this.width =cw;
1910
+ initwidth += cw;
1911
+ lvc = i;
1912
+ }
1913
+ });
1914
+ cr =0;
1915
+ if (hs) {
1916
+ if(grid.width-gw-(initwidth+brd*vc) !== scw){
1917
+ cr = grid.width-gw-(initwidth+brd*vc)-scw;
1918
+ }
1919
+ } else if(!hs && Math.abs(grid.width-gw-(initwidth+brd*vc)) !== 1) {
1920
+ cr = grid.width-gw-(initwidth+brd*vc);
1921
+ }
1922
+ ts.p.colModel[lvc].width += cr;
1923
+ ts.p.tblwidth = initwidth+cr+brd*vc+gw;
1924
+ if(ts.p.tblwidth > ts.p.width) {
1925
+ ts.p.colModel[lvc].width -= (ts.p.tblwidth - parseInt(ts.p.width,10));
1926
+ ts.p.tblwidth = ts.p.width;
1927
+ }
1928
+ }
1929
+ },
1930
+ nextVisible= function(iCol) {
1931
+ var ret = iCol, j=iCol, i;
1932
+ for (i = iCol+1;i<ts.p.colModel.length;i++){
1933
+ if(ts.p.colModel[i].hidden !== true ) {
1934
+ j=i; break;
1935
+ }
1936
+ }
1937
+ return j-ret;
1938
+ },
1939
+ getOffset = function (iCol) {
1940
+ var i, ret = {}, brd1 = isSafari ? 0 : ts.p.cellLayout;
1941
+ ret[0] = ret[1] = ret[2] = 0;
1942
+ for(i=0;i<=iCol;i++){
1943
+ if(ts.p.colModel[i].hidden === false ) {
1944
+ ret[0] += ts.p.colModel[i].width+brd1;
1945
+ }
1946
+ }
1947
+ if(ts.p.direction=="rtl") { ret[0] = ts.p.width - ret[0]; }
1948
+ ret[0] = ret[0] - ts.grid.bDiv.scrollLeft;
1949
+ if($(ts.grid.cDiv).is(":visible")) {ret[1] += $(ts.grid.cDiv).height() +parseInt($(ts.grid.cDiv).css("padding-top"),10)+parseInt($(ts.grid.cDiv).css("padding-bottom"),10);}
1950
+ if(ts.p.toolbar[0]===true && (ts.p.toolbar[1]=='top' || ts.p.toolbar[1]=='both')) {ret[1] += $(ts.grid.uDiv).height()+parseInt($(ts.grid.uDiv).css("border-top-width"),10)+parseInt($(ts.grid.uDiv).css("border-bottom-width"),10);}
1951
+ if(ts.p.toppager) {ret[1] += $(ts.grid.topDiv).height()+parseInt($(ts.grid.topDiv).css("border-bottom-width"),10);}
1952
+ ret[2] += $(ts.grid.bDiv).height() + $(ts.grid.hDiv).height();
1953
+ return ret;
1954
+ };
1955
+ this.p.id = this.id;
1956
+ if ($.inArray(ts.p.multikey,sortkeys) == -1 ) {ts.p.multikey = false;}
1957
+ ts.p.keyIndex=false;
1958
+ for (i=0; i<ts.p.colModel.length;i++) {
1959
+ ts.p.colModel[i] = $.extend(true, {}, ts.p.cmTemplate, ts.p.colModel[i].template || {}, ts.p.colModel[i]);
1960
+ if (ts.p.keyIndex === false && ts.p.colModel[i].key===true) {
1961
+ ts.p.keyIndex = i;
1962
+ }
1963
+ }
1964
+ ts.p.sortorder = ts.p.sortorder.toLowerCase();
1965
+ if(ts.p.grouping===true) {
1966
+ ts.p.scroll = false;
1967
+ ts.p.rownumbers = false;
1968
+ ts.p.subGrid = false;
1969
+ ts.p.treeGrid = false;
1970
+ ts.p.gridview = true;
1971
+ }
1972
+ if(this.p.treeGrid === true) {
1973
+ try { $(this).jqGrid("setTreeGrid");} catch (_) {}
1974
+ if(ts.p.datatype != "local") { ts.p.localReader = {id: "_id_"}; }
1975
+ }
1976
+ if(this.p.subGrid) {
1977
+ try { $(ts).jqGrid("setSubGrid");} catch (s){}
1978
+ }
1979
+ if(this.p.multiselect) {
1980
+ this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>");
1981
+ this.p.colModel.unshift({name:'cb',width:isSafari ? ts.p.multiselectWidth+ts.p.cellLayout : ts.p.multiselectWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:'center',fixed:true});
1982
+ }
1983
+ if(this.p.rownumbers) {
1984
+ this.p.colNames.unshift("");
1985
+ this.p.colModel.unshift({name:'rn',width:ts.p.rownumWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:'center',fixed:true});
1986
+ }
1987
+ ts.p.xmlReader = $.extend(true,{
1988
+ root: "rows",
1989
+ row: "row",
1990
+ page: "rows>page",
1991
+ total: "rows>total",
1992
+ records : "rows>records",
1993
+ repeatitems: true,
1994
+ cell: "cell",
1995
+ id: "[id]",
1996
+ userdata: "userdata",
1997
+ subgrid: {root:"rows", row: "row", repeatitems: true, cell:"cell"}
1998
+ }, ts.p.xmlReader);
1999
+ ts.p.jsonReader = $.extend(true,{
2000
+ root: "rows",
2001
+ page: "page",
2002
+ total: "total",
2003
+ records: "records",
2004
+ repeatitems: true,
2005
+ cell: "cell",
2006
+ id: "id",
2007
+ userdata: "userdata",
2008
+ subgrid: {root:"rows", repeatitems: true, cell:"cell"}
2009
+ },ts.p.jsonReader);
2010
+ ts.p.localReader = $.extend(true,{
2011
+ root: "rows",
2012
+ page: "page",
2013
+ total: "total",
2014
+ records: "records",
2015
+ repeatitems: false,
2016
+ cell: "cell",
2017
+ id: "id",
2018
+ userdata: "userdata",
2019
+ subgrid: {root:"rows", repeatitems: true, cell:"cell"}
2020
+ },ts.p.localReader);
2021
+ if(ts.p.scroll){
2022
+ ts.p.pgbuttons = false; ts.p.pginput=false; ts.p.rowList=[];
2023
+ }
2024
+ if(ts.p.data.length) { refreshIndex(); }
2025
+ var thead = "<thead><tr class='ui-jqgrid-labels' role='rowheader'>",
2026
+ tdc, idn, w, res, sort,
2027
+ td, ptr, tbody, imgs,iac="",idc="";
2028
+ if(ts.p.shrinkToFit===true && ts.p.forceFit===true) {
2029
+ for (i=ts.p.colModel.length-1;i>=0;i--){
2030
+ if(!ts.p.colModel[i].hidden) {
2031
+ ts.p.colModel[i].resizable=false;
2032
+ break;
2033
+ }
2034
+ }
2035
+ }
2036
+ if(ts.p.viewsortcols[1] == 'horizontal') {iac=" ui-i-asc";idc=" ui-i-desc";}
2037
+ tdc = isMSIE ? "class='ui-th-div-ie'" :"";
2038
+ imgs = "<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+iac+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+dir+"'></span>";
2039
+ imgs += "<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+idc+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+dir+"'></span></span>";
2040
+ for(i=0;i<this.p.colNames.length;i++){
2041
+ var tooltip = ts.p.headertitles ? (" title=\""+$.jgrid.stripHtml(ts.p.colNames[i])+"\"") :"";
2042
+ thead += "<th id='"+ts.p.id+"_"+ts.p.colModel[i].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+dir+"'"+ tooltip+">";
2043
+ idn = ts.p.colModel[i].index || ts.p.colModel[i].name;
2044
+ thead += "<div id='jqgh_"+ts.p.id+"_"+ts.p.colModel[i].name+"' "+tdc+">"+ts.p.colNames[i];
2045
+ if(!ts.p.colModel[i].width) { ts.p.colModel[i].width = 150; }
2046
+ else { ts.p.colModel[i].width = parseInt(ts.p.colModel[i].width,10); }
2047
+ if(typeof(ts.p.colModel[i].title) !== "boolean") { ts.p.colModel[i].title = true; }
2048
+ if (idn == ts.p.sortname) {
2049
+ ts.p.lastsort = i;
2050
+ }
2051
+ thead += imgs+"</div></th>";
2052
+ }
2053
+ thead += "</tr></thead>";
2054
+ imgs = null;
2055
+ $(this).append(thead);
2056
+ $("thead tr:first th",this).hover(function(){$(this).addClass('ui-state-hover');},function(){$(this).removeClass('ui-state-hover');});
2057
+ if(this.p.multiselect) {
2058
+ var emp=[], chk;
2059
+ $('#cb_'+$.jgrid.jqID(ts.p.id),this).bind('click',function(){
2060
+ ts.p.selarrrow = [];
2061
+ if (this.checked) {
2062
+ $(ts.rows).each(function(i) {
2063
+ if ( i>0 ) {
2064
+ if(!$(this).hasClass("subgrid") && !$(this).hasClass("jqgroup") && !$(this).hasClass('ui-state-disabled')){
2065
+ $("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+$.jgrid.jqID(this.id) ).attr("checked","checked");
2066
+ $(this).addClass("ui-state-highlight").attr("aria-selected","true");
2067
+ ts.p.selarrrow.push(this.id);
2068
+ ts.p.selrow = this.id;
2069
+ }
2070
+ }
2071
+ });
2072
+ chk=true;
2073
+ emp=[];
2074
+ }
2075
+ else {
2076
+ $(ts.rows).each(function(i) {
2077
+ if(i>0) {
2078
+ if(!$(this).hasClass("subgrid") && !$(this).hasClass('ui-state-disabled')){
2079
+ $("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+$.jgrid.jqID(this.id) ).removeAttr("checked");
2080
+ $(this).removeClass("ui-state-highlight").attr("aria-selected","false");
2081
+ emp.push(this.id);
2082
+ }
2083
+ }
2084
+ });
2085
+ ts.p.selrow = null;
2086
+ chk=false;
2087
+ }
2088
+ if($.isFunction(ts.p.onSelectAll)) {ts.p.onSelectAll.call(ts, chk ? ts.p.selarrrow : emp,chk);}
2089
+ });
2090
+ }
2091
+
2092
+ if(ts.p.autowidth===true) {
2093
+ var pw = $(eg).innerWidth();
2094
+ ts.p.width = pw > 0? pw: 'nw';
2095
+ }
2096
+ setColWidth();
2097
+ $(eg).css("width",grid.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+ts.p.id+"'>&#160;</div>");
2098
+ $(gv).css("width",grid.width+"px");
2099
+ thead = $("thead:first",ts).get(0);
2100
+ var tfoot = "";
2101
+ if(ts.p.footerrow) { tfoot += "<table role='grid' style='width:"+ts.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+dir+"'>"; }
2102
+ var thr = $("tr:first",thead),
2103
+ firstr = "<tr class='jqgfirstrow' role='row' style='height:auto'>";
2104
+ ts.p.disableClick=false;
2105
+ $("th",thr).each(function ( j ) {
2106
+ w = ts.p.colModel[j].width;
2107
+ if(typeof ts.p.colModel[j].resizable === 'undefined') {ts.p.colModel[j].resizable = true;}
2108
+ if(ts.p.colModel[j].resizable){
2109
+ res = document.createElement("span");
2110
+ $(res).html("&#160;").addClass('ui-jqgrid-resize ui-jqgrid-resize-'+dir);
2111
+ if(!$.browser.opera) { $(res).css("cursor","col-resize"); }
2112
+ $(this).addClass(ts.p.resizeclass);
2113
+ } else {
2114
+ res = "";
2115
+ }
2116
+ $(this).css("width",w+"px").prepend(res);
2117
+ var hdcol = "";
2118
+ if( ts.p.colModel[j].hidden ) {
2119
+ $(this).css("display","none");
2120
+ hdcol = "display:none;";
2121
+ }
2122
+ firstr += "<td role='gridcell' style='height:0px;width:"+w+"px;"+hdcol+"'></td>";
2123
+ grid.headers[j] = { width: w, el: this };
2124
+ sort = ts.p.colModel[j].sortable;
2125
+ if( typeof sort !== 'boolean') {ts.p.colModel[j].sortable = true; sort=true;}
2126
+ var nm = ts.p.colModel[j].name;
2127
+ if( !(nm == 'cb' || nm=='subgrid' || nm=='rn') ) {
2128
+ if(ts.p.viewsortcols[2]){
2129
+ $("div",this).addClass('ui-jqgrid-sortable');
2130
+ }
2131
+ }
2132
+ if(sort) {
2133
+ if(ts.p.viewsortcols[0]) {$("div span.s-ico",this).show(); if(j==ts.p.lastsort){ $("div span.ui-icon-"+ts.p.sortorder,this).removeClass("ui-state-disabled");}}
2134
+ else if( j == ts.p.lastsort) {$("div span.s-ico",this).show();$("div span.ui-icon-"+ts.p.sortorder,this).removeClass("ui-state-disabled");}
2135
+ }
2136
+ if(ts.p.footerrow) { tfoot += "<td role='gridcell' "+formatCol(j,0,'', null, '', false)+">&#160;</td>"; }
2137
+ }).mousedown(function(e) {
2138
+ if ($(e.target).closest("th>span.ui-jqgrid-resize").length != 1) { return; }
2139
+ var ci = $.jgrid.getCellIndex(this);
2140
+ if(ts.p.forceFit===true) {ts.p.nv= nextVisible(ci);}
2141
+ grid.dragStart(ci, e, getOffset(ci));
2142
+ return false;
2143
+ }).click(function(e) {
2144
+ if (ts.p.disableClick) {
2145
+ ts.p.disableClick = false;
2146
+ return false;
2147
+ }
2148
+ var s = "th>div.ui-jqgrid-sortable",r,d;
2149
+ if (!ts.p.viewsortcols[2]) { s = "th>div>span>span.ui-grid-ico-sort"; }
2150
+ var t = $(e.target).closest(s);
2151
+ if (t.length != 1) { return; }
2152
+ var ci = $.jgrid.getCellIndex(this);
2153
+ if (!ts.p.viewsortcols[2]) { r=true;d=t.attr("sort"); }
2154
+ sortData( $('div',this)[0].id, ci, r, d);
2155
+ return false;
2156
+ });
2157
+ if (ts.p.sortable && $.fn.sortable) {
2158
+ try {
2159
+ $(ts).jqGrid("sortableColumns", thr);
2160
+ } catch (e){}
2161
+ }
2162
+ if(ts.p.footerrow) { tfoot += "</tr></tbody></table>"; }
2163
+ firstr += "</tr>";
2164
+ tbody = document.createElement("tbody");
2165
+ this.appendChild(tbody);
2166
+ $(this).addClass('ui-jqgrid-btable').append(firstr);
2167
+ firstr = null;
2168
+ var hTable = $("<table class='ui-jqgrid-htable' style='width:"+ts.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(thead),
2169
+ hg = (ts.p.caption && ts.p.hiddengrid===true) ? true : false,
2170
+ hb = $("<div class='ui-jqgrid-hbox" + (dir=="rtl" ? "-rtl" : "" )+"'></div>");
2171
+ thead = null;
2172
+ grid.hDiv = document.createElement("div");
2173
+ $(grid.hDiv)
2174
+ .css({ width: grid.width+"px"})
2175
+ .addClass("ui-state-default ui-jqgrid-hdiv")
2176
+ .append(hb);
2177
+ $(hb).append(hTable);
2178
+ hTable = null;
2179
+ if(hg) { $(grid.hDiv).hide(); }
2180
+ if(ts.p.pager){
2181
+ // TBD -- escape ts.p.pager here?
2182
+ if(typeof ts.p.pager == "string") {if(ts.p.pager.substr(0,1) !="#") { ts.p.pager = "#"+ts.p.pager;} }
2183
+ else { ts.p.pager = "#"+ $(ts.p.pager).attr("id");}
2184
+ $(ts.p.pager).css({width: grid.width+"px"}).appendTo(eg).addClass('ui-state-default ui-jqgrid-pager ui-corner-bottom');
2185
+ if(hg) {$(ts.p.pager).hide();}
2186
+ setPager(ts.p.pager,'');
2187
+ }
2188
+ if( ts.p.cellEdit === false && ts.p.hoverrows === true) {
2189
+ $(ts).bind('mouseover',function(e) {
2190
+ ptr = $(e.target).closest("tr.jqgrow");
2191
+ if($(ptr).attr("class") !== "subgrid") {
2192
+ $(ptr).addClass("ui-state-hover");
2193
+ }
2194
+ return false;
2195
+ }).bind('mouseout',function(e) {
2196
+ ptr = $(e.target).closest("tr.jqgrow");
2197
+ $(ptr).removeClass("ui-state-hover");
2198
+ return false;
2199
+ });
2200
+ }
2201
+ var ri,ci;
2202
+ $(ts).before(grid.hDiv).click(function(e) {
2203
+ td = e.target;
2204
+ ptr = $(td,ts.rows).closest("tr.jqgrow");
2205
+ if($(ptr).length === 0 || ptr[0].className.indexOf( 'ui-state-disabled' ) > -1 ) {
2206
+ return this;
2207
+ }
2208
+ var scb = $(td).hasClass("cbox"),
2209
+ cSel = true;
2210
+ if($.isFunction(ts.p.beforeSelectRow)) { cSel = ts.p.beforeSelectRow.call(ts,ptr[0].id, e); }
2211
+ if (td.tagName == 'A' || ((td.tagName == 'INPUT' || td.tagName == 'TEXTAREA' || td.tagName == 'OPTION' || td.tagName == 'SELECT' ) && !scb) ) { return this; }
2212
+ if(cSel === true) {
2213
+ if(ts.p.cellEdit === true) {
2214
+ if(ts.p.multiselect && scb){
2215
+ $(ts).jqGrid("setSelection",ptr[0].id,true);
2216
+ } else {
2217
+ ri = ptr[0].rowIndex;
2218
+ ci = $.jgrid.getCellIndex(td);
2219
+ try {$(ts).jqGrid("editCell",ri,ci,true);} catch (_) {}
2220
+ }
2221
+ } else if ( !ts.p.multikey ) {
2222
+ if(ts.p.multiselect && ts.p.multiboxonly) {
2223
+ if(scb){$(ts).jqGrid("setSelection",ptr[0].id,true);}
2224
+ else {
2225
+ $(ts.p.selarrrow).each(function(i,n){
2226
+ var ind = ts.rows.namedItem(n);
2227
+ $(ind).removeClass("ui-state-highlight");
2228
+ $("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+$.jgrid.jqID(n)).attr("checked",false);
2229
+ });
2230
+ ts.p.selarrrow = [];
2231
+ $("#cb_"+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false);
2232
+ $(ts).jqGrid("setSelection",ptr[0].id,true);
2233
+ }
2234
+ } else {
2235
+ $(ts).jqGrid("setSelection",ptr[0].id,true);
2236
+ }
2237
+ } else {
2238
+ if(e[ts.p.multikey]) {
2239
+ $(ts).jqGrid("setSelection",ptr[0].id,true);
2240
+ } else if(ts.p.multiselect && scb) {
2241
+ scb = $("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+ptr[0].id).attr("checked");
2242
+ $("#jqg_"+$.jgrid.jqID(ts.p.id)+"_"+ptr[0].id).attr("checked",!scb);
2243
+ }
2244
+ }
2245
+ if($.isFunction(ts.p.onCellSelect)) {
2246
+ ri = ptr[0].id;
2247
+ ci = $.jgrid.getCellIndex(td);
2248
+ ts.p.onCellSelect.call(ts,ri,ci,$(td).html(),e);
2249
+ }
2250
+ //e.stopPropagation();
2251
+ }
2252
+ //else {
2253
+ return this;
2254
+ //}
2255
+ }).bind('reloadGrid', function(e,opts) {
2256
+ if(ts.p.treeGrid ===true) { ts.p.datatype = ts.p.treedatatype;}
2257
+ if (opts && opts.current) {
2258
+ ts.grid.selectionPreserver(ts);
2259
+ }
2260
+ if(ts.p.datatype=="local"){ $(ts).jqGrid("resetSelection"); if(ts.p.data.length) { refreshIndex();} }
2261
+ else if(!ts.p.treeGrid) {
2262
+ ts.p.selrow=null;
2263
+ if(ts.p.multiselect) {ts.p.selarrrow =[];$('#cb_'+$.jgrid.jqID(ts.p.id),ts.grid.hDiv).attr("checked",false);}
2264
+ ts.p.savedRow = [];
2265
+ }
2266
+ if(ts.p.scroll) {emptyRows(ts.grid.bDiv,true, false);}
2267
+ if (opts && opts.page) {
2268
+ var page = opts.page;
2269
+ if (page > ts.p.lastpage) { page = ts.p.lastpage; }
2270
+ if (page < 1) { page = 1; }
2271
+ ts.p.page = page;
2272
+ if (ts.grid.prevRowHeight) {
2273
+ ts.grid.bDiv.scrollTop = (page - 1) * ts.grid.prevRowHeight * ts.p.rowNum;
2274
+ } else {
2275
+ ts.grid.bDiv.scrollTop = 0;
2276
+ }
2277
+ }
2278
+ if (ts.grid.prevRowHeight && ts.p.scroll) {
2279
+ delete ts.p.lastpage;
2280
+ ts.grid.populateVisible();
2281
+ } else {
2282
+ ts.grid.populate();
2283
+ }
2284
+ return false;
2285
+ });
2286
+ if( $.isFunction(this.p.ondblClickRow) ) {
2287
+ $(this).dblclick(function(e) {
2288
+ td = e.target;
2289
+ ptr = $(td,ts.rows).closest("tr.jqgrow");
2290
+ if($(ptr).length === 0 ){return false;}
2291
+ ri = ptr[0].rowIndex;
2292
+ ci = $.jgrid.getCellIndex(td);
2293
+ ts.p.ondblClickRow.call(ts,$(ptr).attr("id"),ri,ci, e);
2294
+ return false;
2295
+ });
2296
+ }
2297
+ if ($.isFunction(this.p.onRightClickRow)) {
2298
+ $(this).bind('contextmenu', function(e) {
2299
+ td = e.target;
2300
+ ptr = $(td,ts.rows).closest("tr.jqgrow");
2301
+ if($(ptr).length === 0 ){return false;}
2302
+ if(!ts.p.multiselect) { $(ts).jqGrid("setSelection",ptr[0].id,true); }
2303
+ ri = ptr[0].rowIndex;
2304
+ ci = $.jgrid.getCellIndex(td);
2305
+ ts.p.onRightClickRow.call(ts,$(ptr).attr("id"),ri,ci, e);
2306
+ return false;
2307
+ });
2308
+ }
2309
+ grid.bDiv = document.createElement("div");
2310
+ if(isMSIE) { if(String(ts.p.height).toLowerCase() === "auto") { ts.p.height = "100%"; } }
2311
+ $(grid.bDiv)
2312
+ .append($('<div style="position:relative;'+(isMSIE && $.browser.version < 8 ? "height:0.01%;" : "")+'"></div>').append('<div></div>').append(this))
2313
+ .addClass("ui-jqgrid-bdiv")
2314
+ .css({ height: ts.p.height+(isNaN(ts.p.height)?"":"px"), width: (grid.width)+"px"})
2315
+ .scroll(grid.scrollGrid);
2316
+ $("table:first",grid.bDiv).css({width:ts.p.tblwidth+"px"});
2317
+ if( isMSIE ) {
2318
+ if( $("tbody",this).size() == 2 ) { $("tbody:gt(0)",this).remove();}
2319
+ if( ts.p.multikey) {$(grid.bDiv).bind("selectstart",function(){return false;});}
2320
+ } else {
2321
+ if( ts.p.multikey) {$(grid.bDiv).bind("mousedown",function(){return false;});}
2322
+ }
2323
+ if(hg) {$(grid.bDiv).hide();}
2324
+ grid.cDiv = document.createElement("div");
2325
+ var arf = ts.p.hidegrid===true ? $("<a role='link' href='javascript:void(0)'/>").addClass('ui-jqgrid-titlebar-close HeaderButton').hover(
2326
+ function(){ arf.addClass('ui-state-hover');},
2327
+ function() {arf.removeClass('ui-state-hover');})
2328
+ .append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css((dir=="rtl"?"left":"right"),"0px") : "";
2329
+ $(grid.cDiv).append(arf).append("<span class='ui-jqgrid-title"+(dir=="rtl" ? "-rtl" :"" )+"'>"+ts.p.caption+"</span>")
2330
+ .addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");
2331
+ $(grid.cDiv).insertBefore(grid.hDiv);
2332
+ if( ts.p.toolbar[0] ) {
2333
+ grid.uDiv = document.createElement("div");
2334
+ if(ts.p.toolbar[1] == "top") {$(grid.uDiv).insertBefore(grid.hDiv);}
2335
+ else if (ts.p.toolbar[1]=="bottom" ) {$(grid.uDiv).insertAfter(grid.hDiv);}
2336
+ if(ts.p.toolbar[1]=="both") {
2337
+ grid.ubDiv = document.createElement("div");
2338
+ $(grid.uDiv).insertBefore(grid.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);
2339
+ $(grid.ubDiv).insertAfter(grid.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id);
2340
+ if(hg) {$(grid.ubDiv).hide();}
2341
+ } else {
2342
+ $(grid.uDiv).width(grid.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);
2343
+ }
2344
+ if(hg) {$(grid.uDiv).hide();}
2345
+ }
2346
+ if(ts.p.toppager) {
2347
+ ts.p.toppager = $.jgrid.jqID(ts.p.id)+"_toppager";
2348
+ grid.topDiv = $("<div id='"+ts.p.toppager+"'></div>")[0];
2349
+ ts.p.toppager = "#"+ts.p.toppager;
2350
+ $(grid.topDiv).insertBefore(grid.hDiv).addClass('ui-state-default ui-jqgrid-toppager').width(grid.width);
2351
+ setPager(ts.p.toppager,'_t');
2352
+ }
2353
+ if(ts.p.footerrow) {
2354
+ grid.sDiv = $("<div class='ui-jqgrid-sdiv'></div>")[0];
2355
+ hb = $("<div class='ui-jqgrid-hbox"+(dir=="rtl"?"-rtl":"")+"'></div>");
2356
+ $(grid.sDiv).append(hb).insertAfter(grid.hDiv).width(grid.width);
2357
+ $(hb).append(tfoot);
2358
+ grid.footers = $(".ui-jqgrid-ftable",grid.sDiv)[0].rows[0].cells;
2359
+ if(ts.p.rownumbers) { grid.footers[0].className = 'ui-state-default jqgrid-rownum'; }
2360
+ if(hg) {$(grid.sDiv).hide();}
2361
+ }
2362
+ hb = null;
2363
+ if(ts.p.caption) {
2364
+ var tdt = ts.p.datatype;
2365
+ if(ts.p.hidegrid===true) {
2366
+ $(".ui-jqgrid-titlebar-close",grid.cDiv).click( function(e){
2367
+ var onHdCl = $.isFunction(ts.p.onHeaderClick),
2368
+ elems = ".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",
2369
+ counter, self = this;
2370
+ if(ts.p.toolbar[0]===true) {
2371
+ if( ts.p.toolbar[1]=='both') {
2372
+ elems += ', #' + $(grid.ubDiv).attr('id');
2373
+ }
2374
+ elems += ', #' + $(grid.uDiv).attr('id');
2375
+ }
2376
+ counter = $(elems,"#gview_"+$.jgrid.jqID(ts.p.id)).length;
2377
+
2378
+ if(ts.p.gridstate == 'visible') {
2379
+ $(elems,"#gbox_"+$.jgrid.jqID(ts.p.id)).slideUp("fast", function() {
2380
+ counter--;
2381
+ if (counter === 0) {
2382
+ $("span",self).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");
2383
+ ts.p.gridstate = 'hidden';
2384
+ if($("#gbox_"+$.jgrid.jqID(ts.p.id)).hasClass("ui-resizable")) { $(".ui-resizable-handle","#gbox_"+$.jgrid.jqID(ts.p.id)).hide(); }
2385
+ if(onHdCl) {if(!hg) {ts.p.onHeaderClick.call(ts,ts.p.gridstate,e);}}
2386
+ }
2387
+ });
2388
+ } else if(ts.p.gridstate == 'hidden'){
2389
+ $(elems,"#gbox_"+$.jgrid.jqID(ts.p.id)).slideDown("fast", function() {
2390
+ counter--;
2391
+ if (counter === 0) {
2392
+ $("span",self).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");
2393
+ if(hg) {ts.p.datatype = tdt;populate();hg=false;}
2394
+ ts.p.gridstate = 'visible';
2395
+ if($("#gbox_"+$.jgrid.jqID(ts.p.id)).hasClass("ui-resizable")) { $(".ui-resizable-handle","#gbox_"+$.jgrid.jqID(ts.p.id)).show(); }
2396
+ if(onHdCl) {if(!hg) {ts.p.onHeaderClick.call(ts,ts.p.gridstate,e);}}
2397
+ }
2398
+ });
2399
+ }
2400
+ return false;
2401
+ });
2402
+ if(hg) {ts.p.datatype="local"; $(".ui-jqgrid-titlebar-close",grid.cDiv).trigger("click");}
2403
+ }
2404
+ } else {$(grid.cDiv).hide();}
2405
+ $(grid.hDiv).after(grid.bDiv)
2406
+ .mousemove(function (e) {
2407
+ if(grid.resizing){grid.dragMove(e);return false;}
2408
+ });
2409
+ $(".ui-jqgrid-labels",grid.hDiv).bind("selectstart", function () { return false; });
2410
+ $(document).mouseup(function (e) {
2411
+ if(grid.resizing) { grid.dragEnd(); return false;}
2412
+ return true;
2413
+ });
2414
+ ts.formatCol = formatCol;
2415
+ ts.sortData = sortData;
2416
+ ts.updatepager = updatepager;
2417
+ ts.refreshIndex = refreshIndex;
2418
+ ts.formatter = function ( rowId, cellval , colpos, rwdat, act){return formatter(rowId, cellval , colpos, rwdat, act);};
2419
+ $.extend(grid,{populate : populate, emptyRows: emptyRows});
2420
+ this.grid = grid;
2421
+ ts.addXmlData = function(d) {addXmlData(d,ts.grid.bDiv);};
2422
+ ts.addJSONData = function(d) {addJSONData(d,ts.grid.bDiv);};
2423
+ this.grid.cols = this.rows[0].cells;
2424
+
2425
+ populate();ts.p.hiddengrid=false;
2426
+ $(window).unload(function () {
2427
+ ts = null;
2428
+ });
2429
+ });
2430
+ };
2431
+ $.jgrid.extend({
2432
+ getGridParam : function(pName) {
2433
+ var $t = this[0];
2434
+ if (!$t || !$t.grid) {return;}
2435
+ if (!pName) { return $t.p; }
2436
+ else {return typeof($t.p[pName]) != "undefined" ? $t.p[pName] : null;}
2437
+ },
2438
+ setGridParam : function (newParams){
2439
+ return this.each(function(){
2440
+ if (this.grid && typeof(newParams) === 'object') {$.extend(true,this.p,newParams);}
2441
+ });
2442
+ },
2443
+ getDataIDs : function () {
2444
+ var ids=[], i=0, len, j=0;
2445
+ this.each(function(){
2446
+ len = this.rows.length;
2447
+ if(len && len>0){
2448
+ while(i<len) {
2449
+ if($(this.rows[i]).hasClass('jqgrow')) {
2450
+ ids[j] = this.rows[i].id;
2451
+ j++;
2452
+ }
2453
+ i++;
2454
+ }
2455
+ }
2456
+ });
2457
+ return ids;
2458
+ },
2459
+ setSelection : function(selection,onsr) {
2460
+ return this.each(function(){
2461
+ var $t = this, stat,pt, ner, ia, tpsr;
2462
+ if(selection === undefined) { return; }
2463
+ onsr = onsr === false ? false : true;
2464
+ pt=$t.rows.namedItem(selection+"");
2465
+ if(!pt || pt.className.indexOf( 'ui-state-disabled' ) > -1 ) { return; }
2466
+ function scrGrid(iR){
2467
+ var ch = $($t.grid.bDiv)[0].clientHeight,
2468
+ st = $($t.grid.bDiv)[0].scrollTop,
2469
+ rpos = $t.rows[iR].offsetTop,
2470
+ rh = $t.rows[iR].clientHeight;
2471
+ if(rpos+rh >= ch+st) { $($t.grid.bDiv)[0].scrollTop = rpos-(ch+st)+rh+st; }
2472
+ else if(rpos < ch+st) {
2473
+ if(rpos < st) {
2474
+ $($t.grid.bDiv)[0].scrollTop = rpos;
2475
+ }
2476
+ }
2477
+ }
2478
+ if($t.p.scrollrows===true) {
2479
+ ner = $t.rows.namedItem(selection).rowIndex;
2480
+ if(ner >=0 ){
2481
+ scrGrid(ner);
2482
+ }
2483
+ }
2484
+ if(!$t.p.multiselect) {
2485
+ if(pt.className !== "ui-subgrid") {
2486
+ if( $t.p.selrow != pt.id) {
2487
+ $($t.rows.namedItem($t.p.selrow)).removeClass("ui-state-highlight").attr({"aria-selected":"false", "tabindex" : "-1"});
2488
+ $(pt).addClass("ui-state-highlight").attr({"aria-selected":true, "tabindex" : "0"});//.focus();
2489
+ stat = true;
2490
+ } else {
2491
+ stat = false;
2492
+ }
2493
+ $t.p.selrow = pt.id;
2494
+ if( $t.p.onSelectRow && onsr) { $t.p.onSelectRow.call($t, pt.id, stat); }
2495
+ }
2496
+ } else {
2497
+ $t.p.selrow = pt.id;
2498
+ ia = $.inArray($t.p.selrow,$t.p.selarrrow);
2499
+ if ( ia === -1 ){
2500
+ if(pt.className !== "ui-subgrid") { $(pt).addClass("ui-state-highlight").attr("aria-selected","true");}
2501
+ stat = true;
2502
+ $("#jqg_"+$.jgrid.jqID($t.p.id)+"_"+$.jgrid.jqID($t.p.selrow)).attr("checked",stat);
2503
+ $t.p.selarrrow.push($t.p.selrow);
2504
+ } else {
2505
+ if(pt.className !== "ui-subgrid") { $(pt).removeClass("ui-state-highlight").attr("aria-selected","false");}
2506
+ stat = false;
2507
+ $("#jqg_"+$.jgrid.jqID($t.p.id)+"_"+$.jgrid.jqID($t.p.selrow)).attr("checked",stat);
2508
+ $t.p.selarrrow.splice(ia,1);
2509
+ tpsr = $t.p.selarrrow[0];
2510
+ $t.p.selrow = (tpsr === undefined) ? null : tpsr;
2511
+ }
2512
+ if( $t.p.onSelectRow && onsr) { $t.p.onSelectRow.call($t, pt.id , stat); }
2513
+ }
2514
+ });
2515
+ },
2516
+ resetSelection : function( rowid ){
2517
+ return this.each(function(){
2518
+ var t = this, ind, sr;
2519
+ if(typeof(rowid) !== "undefined" ) {
2520
+ sr = rowid === t.p.selrow ? t.p.selrow : rowid;
2521
+ $("#"+$.jgrid.jqID(t.p.id)+" tbody:first tr#"+$.jgrid.jqID(sr)).removeClass("ui-state-highlight").attr("aria-selected","false");
2522
+ if(t.p.multiselect) {
2523
+ $("#jqg_"+$.jgrid.jqID(t.p.id)+"_"+$.jgrid.jqID(sr)).attr("checked",false);
2524
+ $("#cb_"+$.jgrid.jqID(t.p.id)).attr("checked",false);
2525
+ }
2526
+ sr = null;
2527
+ } else if(!t.p.multiselect) {
2528
+ if(t.p.selrow) {
2529
+ $("#"+$.jgrid.jqID(t.p.id)+" tbody:first tr#"+$.jgrid.jqID(t.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false");
2530
+ t.p.selrow = null;
2531
+ }
2532
+ } else {
2533
+ $(t.p.selarrrow).each(function(i,n){
2534
+ ind = t.rows.namedItem(n);
2535
+ $(ind).removeClass("ui-state-highlight").attr("aria-selected","false");
2536
+ $("#jqg_"+$.jgrid.jqID(t.p.id)+"_"+$.jgrid.jqID(n)).attr("checked",false);
2537
+ });
2538
+ $("#cb_"+$.jgrid.jqID(t.p.id)).attr("checked",false);
2539
+ t.p.selarrrow = [];
2540
+ }
2541
+ t.p.savedRow = [];
2542
+ });
2543
+ },
2544
+ getRowData : function( rowid ) {
2545
+ var res = {}, resall, getall=false, len, j=0;
2546
+ this.each(function(){
2547
+ var $t = this,nm,ind;
2548
+ if(typeof(rowid) == 'undefined') {
2549
+ getall = true;
2550
+ resall = [];
2551
+ len = $t.rows.length;
2552
+ } else {
2553
+ ind = $t.rows.namedItem(rowid);
2554
+ if(!ind) { return res; }
2555
+ len = 2;
2556
+ }
2557
+ while(j<len){
2558
+ if(getall) { ind = $t.rows[j]; }
2559
+ if( $(ind).hasClass('jqgrow') ) {
2560
+ $('td',ind).each( function(i) {
2561
+ nm = $t.p.colModel[i].name;
2562
+ if ( nm !== 'cb' && nm !== 'subgrid' && nm !== 'rn') {
2563
+ if($t.p.treeGrid===true && nm == $t.p.ExpandColumn) {
2564
+ res[nm] = $.jgrid.htmlDecode($("span:first",this).html());
2565
+ } else {
2566
+ try {
2567
+ res[nm] = $.unformat(this,{rowId:ind.id, colModel:$t.p.colModel[i]},i);
2568
+ } catch (e){
2569
+ res[nm] = $.jgrid.htmlDecode($(this).html());
2570
+ }
2571
+ }
2572
+ }
2573
+ });
2574
+ if(getall) { resall.push(res); res={}; }
2575
+ }
2576
+ j++;
2577
+ }
2578
+ });
2579
+ return resall ? resall: res;
2580
+ },
2581
+ delRowData : function(rowid) {
2582
+ var success = false, rowInd, ia, ri;
2583
+ this.each(function() {
2584
+ var $t = this;
2585
+ rowInd = $t.rows.namedItem(rowid);
2586
+ if(!rowInd) {return false;}
2587
+ else {
2588
+ ri = rowInd.rowIndex;
2589
+ $(rowInd).remove();
2590
+ $t.p.records--;
2591
+ $t.p.reccount--;
2592
+ $t.updatepager(true,false);
2593
+ success=true;
2594
+ if($t.p.multiselect) {
2595
+ ia = $.inArray(rowid,$t.p.selarrrow);
2596
+ if(ia != -1) { $t.p.selarrrow.splice(ia,1);}
2597
+ }
2598
+ if(rowid == $t.p.selrow) {$t.p.selrow=null;}
2599
+ }
2600
+ if($t.p.datatype == 'local') {
2601
+ var pos = $t.p._index[rowid];
2602
+ if(typeof(pos) != 'undefined') {
2603
+ $t.p.data.splice(pos,1);
2604
+ $t.refreshIndex();
2605
+ }
2606
+ }
2607
+ if( $t.p.altRows === true && success ) {
2608
+ var cn = $t.p.altclass;
2609
+ $($t.rows).each(function(i){
2610
+ if(i % 2 ==1) { $(this).addClass(cn); }
2611
+ else { $(this).removeClass(cn); }
2612
+ });
2613
+ }
2614
+ });
2615
+ return success;
2616
+ },
2617
+ setRowData : function(rowid, data, cssp) {
2618
+ var nm, success=true, title;
2619
+ this.each(function(){
2620
+ if(!this.grid) {return false;}
2621
+ var t = this, vl, ind, cp = typeof cssp, lcdata={};
2622
+ ind = t.rows.namedItem(rowid);
2623
+ if(!ind) { return false; }
2624
+ if( data ) {
2625
+ try {
2626
+ $(this.p.colModel).each(function(i){
2627
+ nm = this.name;
2628
+ if( data[nm] !== undefined) {
2629
+ lcdata[nm] = this.formatter && typeof(this.formatter) === 'string' && this.formatter == 'date' ? $.unformat.date(data[nm],this) : data[nm];
2630
+ vl = t.formatter( rowid, data[nm], i, data, 'edit');
2631
+ title = this.title ? {"title":$.jgrid.stripHtml(vl)} : {};
2632
+ if(t.p.treeGrid===true && nm == t.p.ExpandColumn) {
2633
+ $("td:eq("+i+") > span:first",ind).html(vl).attr(title);
2634
+ } else {
2635
+ $("td:eq("+i+")",ind).html(vl).attr(title);
2636
+ }
2637
+ }
2638
+ });
2639
+ if(t.p.datatype == 'local') {
2640
+ var pos = t.p._index[rowid];
2641
+ if(t.p.treeGrid) {
2642
+ for(var key in t.p.treeReader ){
2643
+ if(lcdata.hasOwnProperty(t.p.treeReader[key])) {
2644
+ delete lcdata[t.p.treeReader[key]];
2645
+ }
2646
+ }
2647
+ }
2648
+ if(typeof(pos) != 'undefined') {
2649
+ t.p.data[pos] = $.extend(true, t.p.data[pos], lcdata);
2650
+ }
2651
+ lcdata = null;
2652
+ }
2653
+ } catch (e) {
2654
+ success = false;
2655
+ }
2656
+ }
2657
+ if(success) {
2658
+ if(cp === 'string') {$(ind).addClass(cssp);} else if(cp === 'object') {$(ind).css(cssp);}
2659
+ }
2660
+ });
2661
+ return success;
2662
+ },
2663
+ addRowData : function(rowid,rdata,pos,src) {
2664
+ if(!pos) {pos = "last";}
2665
+ var success = false, nm, row, gi, si, ni,sind, i, v, prp="", aradd, cnm, cn, data, cm;
2666
+ if(rdata) {
2667
+ if($.isArray(rdata)) {
2668
+ aradd=true;
2669
+ pos = "last";
2670
+ cnm = rowid;
2671
+ } else {
2672
+ rdata = [rdata];
2673
+ aradd = false;
2674
+ }
2675
+ this.each(function() {
2676
+ var t = this, datalen = rdata.length;
2677
+ ni = t.p.rownumbers===true ? 1 :0;
2678
+ gi = t.p.multiselect ===true ? 1 :0;
2679
+ si = t.p.subGrid===true ? 1 :0;
2680
+ if(!aradd) {
2681
+ if(typeof(rowid) != 'undefined') { rowid = rowid+"";}
2682
+ else {
2683
+ rowid = $.jgrid.randId();
2684
+ if(t.p.keyIndex !== false) {
2685
+ cnm = t.p.colModel[t.p.keyIndex+gi+si+ni].name;
2686
+ if(typeof rdata[0][cnm] != "undefined") { rowid = rdata[0][cnm]; }
2687
+ }
2688
+ }
2689
+ }
2690
+ cn = t.p.altclass;
2691
+ var k = 0, cna ="", lcdata = {},
2692
+ air = $.isFunction(t.p.afterInsertRow) ? true : false;
2693
+ while(k < datalen) {
2694
+ data = rdata[k];
2695
+ row="";
2696
+ if(aradd) {
2697
+ try {rowid = data[cnm];}
2698
+ catch (e) {rowid = $.jgrid.randId();}
2699
+ cna = t.p.altRows === true ? (t.rows.length-1)%2 === 0 ? cn : "" : "";
2700
+ }
2701
+ if(ni){
2702
+ prp = t.formatCol(0,1,'',null,rowid, true);
2703
+ row += "<td role=\"gridcell\" aria-describedby=\""+t.p.id+"_rn\" class=\"ui-state-default jqgrid-rownum\" "+prp+">0</td>";
2704
+ }
2705
+ if(gi) {
2706
+ v = "<input role=\"checkbox\" type=\"checkbox\""+" id=\"jqg_"+t.p.id+"_"+rowid+"\" class=\"cbox\"/>";
2707
+ prp = t.formatCol(ni,1,'', null, rowid, true);
2708
+ row += "<td role=\"gridcell\" aria-describedby=\""+t.p.id+"_cb\" "+prp+">"+v+"</td>";
2709
+ }
2710
+ if(si) {
2711
+ row += $(t).jqGrid("addSubGridCell",gi+ni,1);
2712
+ }
2713
+ for(i = gi+si+ni; i < t.p.colModel.length;i++){
2714
+ cm = t.p.colModel[i];
2715
+ nm = cm.name;
2716
+ lcdata[nm] = cm.formatter && typeof(cm.formatter) === 'string' && cm.formatter == 'date' ? $.unformat.date(data[nm],cm) : data[nm];
2717
+ v = t.formatter( rowid, $.jgrid.getAccessor(data,nm), i, data, 'edit');
2718
+ prp = t.formatCol(i,1,v, rowid, data, true);
2719
+ row += "<td role=\"gridcell\" aria-describedby=\""+t.p.id+"_"+nm+"\" "+prp+">"+v+"</td>";
2720
+ }
2721
+ row = "<tr id=\""+rowid+"\" role=\"row\" tabindex=\"-1\" class=\"ui-widget-content jqgrow ui-row-"+t.p.direction+" "+cna+"\">" + row+"</tr>";
2722
+ if(t.rows.length === 0){
2723
+ $("table:first",t.grid.bDiv).append(row);
2724
+ } else {
2725
+ switch (pos) {
2726
+ case 'last':
2727
+ $(t.rows[t.rows.length-1]).after(row);
2728
+ sind = t.rows.length-1;
2729
+ break;
2730
+ case 'first':
2731
+ $(t.rows[0]).after(row);
2732
+ sind = 1;
2733
+ break;
2734
+ case 'after':
2735
+ sind = t.rows.namedItem(src);
2736
+ if (sind) {
2737
+ if($(t.rows[sind.rowIndex+1]).hasClass("ui-subgrid")) { $(t.rows[sind.rowIndex+1]).after(row); }
2738
+ else { $(sind).after(row); }
2739
+ }
2740
+ sind++;
2741
+ break;
2742
+ case 'before':
2743
+ sind = t.rows.namedItem(src);
2744
+ if(sind) {$(sind).before(row);sind=sind.rowIndex;}
2745
+ sind--;
2746
+ break;
2747
+ }
2748
+ }
2749
+ if(t.p.subGrid===true) {
2750
+ $(t).jqGrid("addSubGrid",gi+ni, sind);
2751
+ }
2752
+ t.p.records++;
2753
+ t.p.reccount++;
2754
+ if(air) { t.p.afterInsertRow.call(t,rowid,data,data); }
2755
+ k++;
2756
+ if(t.p.datatype == 'local') {
2757
+ lcdata[t.p.localReader.id] = rowid;
2758
+ t.p._index[rowid] = t.p.data.length;
2759
+ t.p.data.push(lcdata);
2760
+ lcdata = {};
2761
+ }
2762
+ }
2763
+ if( t.p.altRows === true && !aradd) {
2764
+ if (pos == "last") {
2765
+ if ((t.rows.length-1)%2 == 1) {$(t.rows[t.rows.length-1]).addClass(cn);}
2766
+ } else {
2767
+ $(t.rows).each(function(i){
2768
+ if(i % 2 ==1) { $(this).addClass(cn); }
2769
+ else { $(this).removeClass(cn); }
2770
+ });
2771
+ }
2772
+ }
2773
+ t.updatepager(true,true);
2774
+ success = true;
2775
+ });
2776
+ }
2777
+ return success;
2778
+ },
2779
+ footerData : function(action,data, format) {
2780
+ var nm, success=false, res={}, title;
2781
+ function isEmpty(obj) {
2782
+ for(var i in obj) {
2783
+ if (obj.hasOwnProperty(i)) { return false; }
2784
+ }
2785
+ return true;
2786
+ }
2787
+ if(typeof(action) == "undefined") { action = "get"; }
2788
+ if(typeof(format) != "boolean") { format = true; }
2789
+ action = action.toLowerCase();
2790
+ this.each(function(){
2791
+ var t = this, vl;
2792
+ if(!t.grid || !t.p.footerrow) {return false;}
2793
+ if(action == "set") { if(isEmpty(data)) { return false; } }
2794
+ success=true;
2795
+ $(this.p.colModel).each(function(i){
2796
+ nm = this.name;
2797
+ if(action == "set") {
2798
+ if( data[nm] !== undefined) {
2799
+ vl = format ? t.formatter( "", data[nm], i, data, 'edit') : data[nm];
2800
+ title = this.title ? {"title":$.jgrid.stripHtml(vl)} : {};
2801
+ $("tr.footrow td:eq("+i+")",t.grid.sDiv).html(vl).attr(title);
2802
+ success = true;
2803
+ }
2804
+ } else if(action == "get") {
2805
+ res[nm] = $("tr.footrow td:eq("+i+")",t.grid.sDiv).html();
2806
+ }
2807
+ });
2808
+ });
2809
+ return action == "get" ? res : success;
2810
+ },
2811
+ showHideCol : function(colname,show) {
2812
+ return this.each(function() {
2813
+ var $t = this, fndh=false, brd=$.browser.webkit||$.browser.safari? 0: $t.p.cellLayout, cw;
2814
+ if (!$t.grid ) {return;}
2815
+ if( typeof colname === 'string') {colname=[colname];}
2816
+ show = show != "none" ? "" : "none";
2817
+ var sw = show === "" ? true :false;
2818
+ $(this.p.colModel).each(function(i) {
2819
+ if ($.inArray(this.name,colname) !== -1 && this.hidden === sw) {
2820
+ $("tr",$t.grid.hDiv).each(function(){
2821
+ $(this).children("th:eq("+i+")").css("display",show);
2822
+ });
2823
+ $($t.rows).each(function(j){
2824
+ $(this).children("td:eq("+i+")").css("display",show);
2825
+ });
2826
+ if($t.p.footerrow) { $("tr.footrow td:eq("+i+")", $t.grid.sDiv).css("display", show); }
2827
+ cw = this.widthOrg? this.widthOrg: parseInt(this.width,10);
2828
+ if(show === "none") {$t.p.tblwidth -= cw+brd;} else {$t.p.tblwidth += cw+brd;}
2829
+ this.hidden = !sw;
2830
+ fndh=true;
2831
+ }
2832
+ });
2833
+ if(fndh===true) {
2834
+ if($t.p.shrinkToFit === false) {
2835
+ $($t).jqGrid("setGridWidth",$t.grid.width );
2836
+ } else if($t.grid.width!==$t.p.tblwidth) {
2837
+ $($t).jqGrid("setGridWidth",$t.p.tblwidth );
2838
+ }
2839
+ }
2840
+ });
2841
+ },
2842
+ hideCol : function (colname) {
2843
+ return this.each(function(){$(this).jqGrid("showHideCol",colname,"none");});
2844
+ },
2845
+ showCol : function(colname) {
2846
+ return this.each(function(){$(this).jqGrid("showHideCol",colname,"");});
2847
+ },
2848
+ remapColumns : function(permutation, updateCells, keepHeader)
2849
+ {
2850
+ function resortArray(a) {
2851
+ var ac;
2852
+ if (a.length) {
2853
+ ac = $.makeArray(a);
2854
+ } else {
2855
+ ac = $.extend({}, a);
2856
+ }
2857
+ $.each(permutation, function(i) {
2858
+ a[i] = ac[this];
2859
+ });
2860
+ }
2861
+ var ts = this.get(0);
2862
+ function resortRows(parent, clobj) {
2863
+ $(">tr"+(clobj||""), parent).each(function() {
2864
+ var row = this;
2865
+ var elems = $.makeArray(row.cells);
2866
+ $.each(permutation, function() {
2867
+ var e = elems[this];
2868
+ if (e) {
2869
+ row.appendChild(e);
2870
+ }
2871
+ });
2872
+ });
2873
+ }
2874
+ resortArray(ts.p.colModel);
2875
+ resortArray(ts.p.colNames);
2876
+ resortArray(ts.grid.headers);
2877
+ resortRows($("thead:first", ts.grid.hDiv), keepHeader && ":not(.ui-jqgrid-labels)");
2878
+ if (updateCells) {
2879
+ resortRows($("#"+$.jgrid.jqID(ts.p.id)+" tbody:first"), ".jqgfirstrow, tr.jqgrow, tr.jqfoot");
2880
+ }
2881
+ if (ts.p.footerrow) {
2882
+ resortRows($("tbody:first", ts.grid.sDiv));
2883
+ }
2884
+ if (ts.p.remapColumns) {
2885
+ if (!ts.p.remapColumns.length){
2886
+ ts.p.remapColumns = $.makeArray(permutation);
2887
+ } else {
2888
+ resortArray(ts.p.remapColumns);
2889
+ }
2890
+ }
2891
+ ts.p.lastsort = $.inArray(ts.p.lastsort, permutation);
2892
+ if(ts.p.treeGrid) { ts.p.expColInd = $.inArray(ts.p.expColInd, permutation); }
2893
+ },
2894
+ setGridWidth : function(nwidth, shrink) {
2895
+ return this.each(function(){
2896
+ if (!this.grid ) {return;}
2897
+ var $t = this, cw,
2898
+ initwidth = 0, brd=$.browser.webkit||$.browser.safari? 0: $t.p.cellLayout, lvc, vc=0, hs=false, scw=$t.p.scrollOffset, aw, gw=0,
2899
+ cl = 0,cr;
2900
+ if(typeof shrink != 'boolean') {
2901
+ shrink=$t.p.shrinkToFit;
2902
+ }
2903
+ if(isNaN(nwidth)) {return;}
2904
+ else { nwidth = parseInt(nwidth,10); $t.grid.width = $t.p.width = nwidth;}
2905
+ $("#gbox_"+$.jgrid.jqID($t.p.id)).css("width",nwidth+"px");
2906
+ $("#gview_"+$.jgrid.jqID($t.p.id)).css("width",nwidth+"px");
2907
+ $($t.grid.bDiv).css("width",nwidth+"px");
2908
+ $($t.grid.hDiv).css("width",nwidth+"px");
2909
+ if($t.p.pager ) {$($t.p.pager).css("width",nwidth+"px");}
2910
+ if($t.p.toppager ) {$($t.p.toppager).css("width",nwidth+"px");}
2911
+ if($t.p.toolbar[0] === true){
2912
+ $($t.grid.uDiv).css("width",nwidth+"px");
2913
+ if($t.p.toolbar[1]=="both") {$($t.grid.ubDiv).css("width",nwidth+"px");}
2914
+ }
2915
+ if($t.p.footerrow) { $($t.grid.sDiv).css("width",nwidth+"px"); }
2916
+ if(shrink ===false && $t.p.forceFit === true) {$t.p.forceFit=false;}
2917
+ if(shrink===true) {
2918
+ $.each($t.p.colModel, function(i) {
2919
+ if(this.hidden===false){
2920
+ cw = this.widthOrg? this.widthOrg: parseInt(this.width,10);
2921
+ initwidth += cw+brd;
2922
+ if(this.fixed) {
2923
+ gw += cw+brd;
2924
+ } else {
2925
+ vc++;
2926
+ }
2927
+ cl++;
2928
+ }
2929
+ });
2930
+ if(vc === 0) { return; }
2931
+ $t.p.tblwidth = initwidth;
2932
+ aw = nwidth-brd*vc-gw;
2933
+ if(!isNaN($t.p.height)) {
2934
+ if($($t.grid.bDiv)[0].clientHeight < $($t.grid.bDiv)[0].scrollHeight || $t.rows.length === 1){
2935
+ hs = true;
2936
+ aw -= scw;
2937
+ }
2938
+ }
2939
+ initwidth =0;
2940
+ var cle = $t.grid.cols.length >0;
2941
+ $.each($t.p.colModel, function(i) {
2942
+ if(this.hidden === false && !this.fixed){
2943
+ cw = this.widthOrg? this.widthOrg: parseInt(this.width,10);
2944
+ cw = Math.round(aw*cw/($t.p.tblwidth-brd*vc-gw));
2945
+ if (cw < 0) { return; }
2946
+ this.width =cw;
2947
+ initwidth += cw;
2948
+ $t.grid.headers[i].width=cw;
2949
+ $t.grid.headers[i].el.style.width=cw+"px";
2950
+ if($t.p.footerrow) { $t.grid.footers[i].style.width = cw+"px"; }
2951
+ if(cle) { $t.grid.cols[i].style.width = cw+"px"; }
2952
+ lvc = i;
2953
+ }
2954
+ });
2955
+ cr =0;
2956
+ if (hs) {
2957
+ if(nwidth-gw-(initwidth+brd*vc) !== scw){
2958
+ cr = nwidth-gw-(initwidth+brd*vc)-scw;
2959
+ }
2960
+ } else if( Math.abs(nwidth-gw-(initwidth+brd*vc)) !== 1) {
2961
+ cr = nwidth-gw-(initwidth+brd*vc);
2962
+ }
2963
+ $t.p.colModel[lvc].width += cr;
2964
+ $t.p.tblwidth = initwidth+cr+brd*vc+gw;
2965
+ if($t.p.tblwidth > nwidth) {
2966
+ var delta = $t.p.tblwidth - parseInt(nwidth,10);
2967
+ $t.p.tblwidth = nwidth;
2968
+ cw = $t.p.colModel[lvc].width = $t.p.colModel[lvc].width-delta;
2969
+ } else {
2970
+ cw= $t.p.colModel[lvc].width;
2971
+ }
2972
+ $t.grid.headers[lvc].width = cw;
2973
+ $t.grid.headers[lvc].el.style.width=cw+"px";
2974
+ if(cle) { $t.grid.cols[lvc].style.width = cw+"px"; }
2975
+ if($t.p.footerrow) {
2976
+ $t.grid.footers[lvc].style.width = cw+"px";
2977
+ }
2978
+ }
2979
+ if($t.p.tblwidth) {
2980
+ $('table:first',$t.grid.bDiv).css("width",$t.p.tblwidth+"px");
2981
+ $('table:first',$t.grid.hDiv).css("width",$t.p.tblwidth+"px");
2982
+ $t.grid.hDiv.scrollLeft = $t.grid.bDiv.scrollLeft;
2983
+ if($t.p.footerrow) {
2984
+ $('table:first',$t.grid.sDiv).css("width",$t.p.tblwidth+"px");
2985
+ }
2986
+ }
2987
+ });
2988
+ },
2989
+ setGridHeight : function (nh) {
2990
+ return this.each(function (){
2991
+ var $t = this;
2992
+ if(!$t.grid) {return;}
2993
+ $($t.grid.bDiv).css({height: nh+(isNaN(nh)?"":"px")});
2994
+ $t.p.height = nh;
2995
+ if ($t.p.scroll) { $t.grid.populateVisible(); }
2996
+ });
2997
+ },
2998
+ setCaption : function (newcap){
2999
+ return this.each(function(){
3000
+ this.p.caption=newcap;
3001
+ $("span.ui-jqgrid-title",this.grid.cDiv).html(newcap);
3002
+ $(this.grid.cDiv).show();
3003
+ });
3004
+ },
3005
+ setLabel : function(colname, nData, prop, attrp ){
3006
+ return this.each(function(){
3007
+ var $t = this, pos=-1;
3008
+ if(!$t.grid) {return;}
3009
+ if(typeof(colname) != "undefined") {
3010
+ $($t.p.colModel).each(function(i){
3011
+ if (this.name == colname) {
3012
+ pos = i;return false;
3013
+ }
3014
+ });
3015
+ } else { return; }
3016
+ if(pos>=0) {
3017
+ var thecol = $("tr.ui-jqgrid-labels th:eq("+pos+")",$t.grid.hDiv);
3018
+ if (nData){
3019
+ var ico = $(".s-ico",thecol);
3020
+ $("[id^=jqgh_]",thecol).empty().html(nData).append(ico);
3021
+ $t.p.colNames[pos] = nData;
3022
+ }
3023
+ if (prop) {
3024
+ if(typeof prop === 'string') {$(thecol).addClass(prop);} else {$(thecol).css(prop);}
3025
+ }
3026
+ if(typeof attrp === 'object') {$(thecol).attr(attrp);}
3027
+ }
3028
+ });
3029
+ },
3030
+ setCell : function(rowid,colname,nData,cssp,attrp, forceupd) {
3031
+ return this.each(function(){
3032
+ var $t = this, pos =-1,v, title;
3033
+ if(!$t.grid) {return;}
3034
+ if(isNaN(colname)) {
3035
+ $($t.p.colModel).each(function(i){
3036
+ if (this.name == colname) {
3037
+ pos = i;return false;
3038
+ }
3039
+ });
3040
+ } else {pos = parseInt(colname,10);}
3041
+ if(pos>=0) {
3042
+ var ind = $t.rows.namedItem(rowid);
3043
+ if (ind){
3044
+ var tcell = $("td:eq("+pos+")",ind);
3045
+ if(nData !== "" || forceupd === true) {
3046
+ v = $t.formatter(rowid, nData, pos,ind,'edit');
3047
+ title = $t.p.colModel[pos].title ? {"title":$.jgrid.stripHtml(v)} : {};
3048
+ if($t.p.treeGrid && $(".tree-wrap",$(tcell)).length>0) {
3049
+ $("span",$(tcell)).html(v).attr(title);
3050
+ } else {
3051
+ $(tcell).html(v).attr(title);
3052
+ }
3053
+ if($t.p.datatype == "local") {
3054
+ var cm = $t.p.colModel[pos], index;
3055
+ nData = cm.formatter && typeof(cm.formatter) === 'string' && cm.formatter == 'date' ? $.unformat.date(nData,cm) : nData;
3056
+ index = $t.p._index[rowid];
3057
+ if(typeof index != "undefined") {
3058
+ $t.p.data[index][cm.name] = nData;
3059
+ }
3060
+ }
3061
+ }
3062
+ if(typeof cssp === 'string'){
3063
+ $(tcell).addClass(cssp);
3064
+ } else if(cssp) {
3065
+ $(tcell).css(cssp);
3066
+ }
3067
+ if(typeof attrp === 'object') {$(tcell).attr(attrp);}
3068
+ }
3069
+ }
3070
+ });
3071
+ },
3072
+ getCell : function(rowid,col) {
3073
+ var ret = false;
3074
+ this.each(function(){
3075
+ var $t=this, pos=-1;
3076
+ if(!$t.grid) {return;}
3077
+ if(isNaN(col)) {
3078
+ $($t.p.colModel).each(function(i){
3079
+ if (this.name === col) {
3080
+ pos = i;return false;
3081
+ }
3082
+ });
3083
+ } else {pos = parseInt(col,10);}
3084
+ if(pos>=0) {
3085
+ var ind = $t.rows.namedItem(rowid);
3086
+ if(ind) {
3087
+ try {
3088
+ ret = $.unformat($("td:eq("+pos+")",ind),{rowId:ind.id, colModel:$t.p.colModel[pos]},pos);
3089
+ } catch (e){
3090
+ ret = $.jgrid.htmlDecode($("td:eq("+pos+")",ind).html());
3091
+ }
3092
+ }
3093
+ }
3094
+ });
3095
+ return ret;
3096
+ },
3097
+ getCol : function (col, obj, mathopr) {
3098
+ var ret = [], val, sum=0, min=0, max=0, v;
3099
+ obj = typeof (obj) != 'boolean' ? false : obj;
3100
+ if(typeof mathopr == 'undefined') { mathopr = false; }
3101
+ this.each(function(){
3102
+ var $t=this, pos=-1;
3103
+ if(!$t.grid) {return;}
3104
+ if(isNaN(col)) {
3105
+ $($t.p.colModel).each(function(i){
3106
+ if (this.name === col) {
3107
+ pos = i;return false;
3108
+ }
3109
+ });
3110
+ } else {pos = parseInt(col,10);}
3111
+ if(pos>=0) {
3112
+ var ln = $t.rows.length, i =0;
3113
+ if (ln && ln>0){
3114
+ while(i<ln){
3115
+ if($($t.rows[i]).hasClass('jqgrow')) {
3116
+ try {
3117
+ val = $.unformat($($t.rows[i].cells[pos]),{rowId:$t.rows[i].id, colModel:$t.p.colModel[pos]},pos);
3118
+ } catch (e) {
3119
+ val = $.jgrid.htmlDecode($t.rows[i].cells[pos].innerHTML);
3120
+ }
3121
+ if(mathopr) {
3122
+ v = parseFloat(val);
3123
+ sum += v;
3124
+ min = Math.min(min, v);
3125
+ max = Math.max(min, v);
3126
+ }
3127
+ else if(obj) { ret.push( {id:$t.rows[i].id,value:val} ); }
3128
+ else { ret.push( val ); }
3129
+ }
3130
+ i++;
3131
+ }
3132
+ if(mathopr) {
3133
+ switch(mathopr.toLowerCase()){
3134
+ case 'sum': ret =sum; break;
3135
+ case 'avg': ret = sum/ln; break;
3136
+ case 'count': ret = ln; break;
3137
+ case 'min': ret = min; break;
3138
+ case 'max': ret = max; break;
3139
+ }
3140
+ }
3141
+ }
3142
+ }
3143
+ });
3144
+ return ret;
3145
+ },
3146
+ clearGridData : function(clearfooter) {
3147
+ return this.each(function(){
3148
+ var $t = this;
3149
+ if(!$t.grid) {return;}
3150
+ if(typeof clearfooter != 'boolean') { clearfooter = false; }
3151
+ if($t.p.deepempty) {$("#"+$.jgrid.jqID($t.p.id)+" tbody:first tr:gt(0)").remove();}
3152
+ else {
3153
+ var trf = $("#"+$.jgrid.jqID($t.p.id)+" tbody:first tr:first")[0];
3154
+ $("#"+$.jgrid.jqID($t.p.id)+" tbody:first").empty().append(trf);
3155
+ }
3156
+ if($t.p.footerrow && clearfooter) { $(".ui-jqgrid-ftable td",$t.grid.sDiv).html("&#160;"); }
3157
+ $t.p.selrow = null; $t.p.selarrrow= []; $t.p.savedRow = [];
3158
+ $t.p.records = 0;$t.p.page=1;$t.p.lastpage=0;$t.p.reccount=0;
3159
+ $t.p.data = []; $t.p._index = {};
3160
+ $t.updatepager(true,false);
3161
+ });
3162
+ },
3163
+ getInd : function(rowid,rc){
3164
+ var ret =false,rw;
3165
+ this.each(function(){
3166
+ rw = this.rows.namedItem(rowid);
3167
+ if(rw) {
3168
+ ret = rc===true ? rw: rw.rowIndex;
3169
+ }
3170
+ });
3171
+ return ret;
3172
+ },
3173
+ bindKeys : function( settings ){
3174
+ var o = $.extend({
3175
+ onEnter: null,
3176
+ onSpace: null,
3177
+ onLeftKey: null,
3178
+ onRightKey: null,
3179
+ scrollingRows : true
3180
+ },settings || {});
3181
+ return this.each(function(){
3182
+ var $t = this;
3183
+ if( !$('body').is('[role]') ){$('body').attr('role','application');}
3184
+ $t.p.scrollrows = o.scrollingRows;
3185
+ $($t).keydown(function(event){
3186
+ var target = $($t).find('tr[tabindex=0]')[0], id, r, mind,
3187
+ expanded = $t.p.treeReader.expanded_field;
3188
+ //check for arrow keys
3189
+ if(target) {
3190
+ mind = $t.p._index[target.id];
3191
+ if(event.keyCode === 37 || event.keyCode === 38 || event.keyCode === 39 || event.keyCode === 40){
3192
+ // up key
3193
+ if(event.keyCode === 38 ){
3194
+ r = target.previousSibling;
3195
+ id = "";
3196
+ if(r) {
3197
+ if($(r).is(":hidden")) {
3198
+ while(r) {
3199
+ r = r.previousSibling;
3200
+ if(!$(r).is(":hidden") && $(r).hasClass('jqgrow')) {id = r.id;break;}
3201
+ }
3202
+ } else {
3203
+ id = r.id;
3204
+ }
3205
+ }
3206
+ $($t).jqGrid('setSelection', id);
3207
+ }
3208
+ //if key is down arrow
3209
+ if(event.keyCode === 40){
3210
+ r = target.nextSibling;
3211
+ id ="";
3212
+ if(r) {
3213
+ if($(r).is(":hidden")) {
3214
+ while(r) {
3215
+ r = r.nextSibling;
3216
+ if(!$(r).is(":hidden") && $(r).hasClass('jqgrow') ) {id = r.id;break;}
3217
+ }
3218
+ } else {
3219
+ id = r.id;
3220
+ }
3221
+ }
3222
+ $($t).jqGrid('setSelection', id);
3223
+ }
3224
+ // left
3225
+ if(event.keyCode === 37 ){
3226
+ if($t.p.treeGrid && $t.p.data[mind][expanded]) {
3227
+ $(target).find("div.treeclick").trigger('click');
3228
+ }
3229
+ if($.isFunction(o.onLeftKey)) {
3230
+ o.onLeftKey.call($t, $t.p.selrow);
3231
+ }
3232
+ }
3233
+ // right
3234
+ if(event.keyCode === 39 ){
3235
+ if($t.p.treeGrid && !$t.p.data[mind][expanded]) {
3236
+ $(target).find("div.treeclick").trigger('click');
3237
+ }
3238
+ if($.isFunction(o.onRightKey)) {
3239
+ o.onRightKey.call($t, $t.p.selrow);
3240
+ }
3241
+ }
3242
+ return false;
3243
+ }
3244
+ //check if enter was pressed on a grid or treegrid node
3245
+ else if( event.keyCode === 13 ){
3246
+ if($.isFunction(o.onEnter)) {
3247
+ o.onEnter.call($t, $t.p.selrow);
3248
+ }
3249
+ return false;
3250
+ } else if(event.keyCode === 32) {
3251
+ if($.isFunction(o.onSpace)) {
3252
+ o.onSpace.call($t, $t.p.selrow);
3253
+ }
3254
+ return false;
3255
+ }
3256
+ }
3257
+ });
3258
+ });
3259
+ },
3260
+ unbindKeys : function(){
3261
+ return this.each(function(){
3262
+ var $t = this;
3263
+ $($t).unbind('keydown');
3264
+ });
3265
+ },
3266
+ getLocalRow : function (rowid) {
3267
+ var ret = false, ind;
3268
+ this.each(function(){
3269
+ if(typeof(rowid) !== "undefined") {
3270
+ ind = this.p._index[rowid];
3271
+ if(ind >= 0 ) {
3272
+ ret = this.p.data[ind];
3273
+ }
3274
+ }
3275
+ });
3276
+ return ret;
3277
+ }
3278
+ });
3279
+ })(jQuery);