compass-jquery-plugin 0.3.3.0 → 0.3.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (220) hide show
  1. data/README.md +4 -4
  2. data/VERSION.yml +1 -1
  3. data/lib/handle_js_files.rb +1 -1
  4. data/lib/jquery/gridify/grid_column.rb +4 -0
  5. data/lib/jquery/gridify/grid_options.rb +5 -1
  6. data/lib/jquery/gridify/grid_view.rb +8 -3
  7. data/templates/dynatree/jquery.dynatree.js +184 -73
  8. data/templates/dynatree/jquery.dynatree.min.js +78 -76
  9. data/templates/emulators/emulators/galaxy.tab.7.7.landscape.png +0 -0
  10. data/templates/emulators/emulators/{palm.pre.2.landscape.scss → galaxy.tab.7.7.landscape.scss} +7 -7
  11. data/templates/emulators/emulators/galaxy.tab.7.7.portrait.png +0 -0
  12. data/templates/emulators/emulators/{palm.pre.2.portrait.scss → galaxy.tab.7.7.portrait.scss} +7 -7
  13. data/templates/emulators/manifest.rb +4 -4
  14. data/templates/graphics/config/initializers/graphics.rb +1 -1
  15. data/templates/graphics/highcharts/dark-blue.js +257 -159
  16. data/templates/graphics/highcharts/dark-blue.min.js +4 -2
  17. data/templates/graphics/highcharts/dark-green.js +257 -159
  18. data/templates/graphics/highcharts/dark-green.min.js +4 -2
  19. data/templates/graphics/highcharts/gray.js +252 -154
  20. data/templates/graphics/highcharts/gray.min.js +4 -2
  21. data/templates/graphics/highcharts/grid.js +84 -84
  22. data/templates/graphics/highcharts/highslide-full.min.js +3 -3
  23. data/templates/graphics/highcharts/highslide.js +3391 -0
  24. data/templates/graphics/highcharts/highslide.min.js +132 -0
  25. data/templates/graphics/jquery.ganttView.min.js +4 -4
  26. data/templates/graphics/jquery.highcharts.js +15379 -1071
  27. data/templates/graphics/jquery.highcharts.min.js +384 -167
  28. data/templates/graphics/jquery.sparkline.min.js +2 -2
  29. data/templates/graphics/manifest.rb +2 -0
  30. data/templates/ical/jquery.ical.min.js +46 -47
  31. data/templates/jqgrid/i18n/jqgrid/locale-bg.min.js +2 -2
  32. data/templates/jqgrid/i18n/jqgrid/locale-bg1251.min.js +2 -2
  33. data/templates/jqgrid/i18n/jqgrid/locale-fi.js +20 -19
  34. data/templates/jqgrid/i18n/jqgrid/locale-fi.min.js +7 -6
  35. data/templates/jqgrid/i18n/jqgrid/locale-is.js +28 -28
  36. data/templates/jqgrid/i18n/jqgrid/locale-is.min.js +6 -6
  37. data/templates/jqgrid/i18n/jqgrid/locale-th.js +134 -0
  38. data/templates/jqgrid/i18n/jqgrid/locale-th.min.js +6 -0
  39. data/templates/jqgrid/jquery.jqGrid.js +674 -598
  40. data/templates/jqgrid/jquery.jqGrid.min.js +444 -441
  41. data/templates/jqgrid/jquery/jqGrid.scss +0 -3
  42. data/templates/jqgrid/manifest.rb +2 -0
  43. data/templates/jqtouch/jquery.jqtouch.js +201 -156
  44. data/templates/jqtouch/jquery.jqtouch.min.js +1 -1
  45. data/templates/jqtouch/jquery/touch/apple.scss +2 -2
  46. data/templates/jqtouch/jquery/touch/default.scss +2 -2
  47. data/templates/jquery/amplify.store.js +111 -78
  48. data/templates/jquery/amplify.store.min.js +6 -6
  49. data/templates/jquery/history.js +3 -3
  50. data/templates/jquery/i18n/jquery.ui/datepicker-nl.js +1 -1
  51. data/templates/jquery/i18n/jquery.ui/datepicker-nl.min.js +1 -1
  52. data/templates/jquery/jquery-ui.js +1286 -1042
  53. data/templates/jquery/jquery-ui.min.js +320 -316
  54. data/templates/jquery/jquery.contextMenu.js +2 -2
  55. data/templates/jquery/jquery.easing.js +152 -152
  56. data/templates/jquery/jquery.easing.min.js +7 -7
  57. data/templates/jquery/jquery.farbtastic.min.js +2 -2
  58. data/templates/jquery/jquery.form.js +30 -30
  59. data/templates/jquery/jquery.haml.min.js +5 -5
  60. data/templates/jquery/jquery.hotkeys.min.js +1 -1
  61. data/templates/jquery/jquery.js +419 -311
  62. data/templates/jquery/jquery.layout.js +59 -40
  63. data/templates/jquery/jquery.min.js +176 -176
  64. data/templates/jquery/jquery.themeswitchertool.js +37 -37
  65. data/templates/jquery/jquery.tmpl.js +4 -4
  66. data/templates/jquery/jquery.tmpl.min.js +9 -9
  67. data/templates/jquery/jquery.tmplPlus.min.js +3 -3
  68. data/templates/jquery/jquery.tokeninput.js +613 -490
  69. data/templates/jquery/jquery.tokeninput.min.js +17 -14
  70. data/templates/jquery/jquery/ui/_theme.scss +39 -63
  71. data/templates/jquery/json.js +31 -15
  72. data/templates/jstree/jquery.jstree.js +415 -410
  73. data/templates/jstree/jquery.jstree.min.js +134 -133
  74. data/templates/markitup/jquery.markitup.js +567 -560
  75. data/templates/markitup/jquery.markitup.min.js +1 -1
  76. data/templates/markitup/jquery/markitup/sets/default.scss +7 -3
  77. data/templates/markitup/jquery/markitup/sets/default/list-bullet.png +0 -0
  78. data/templates/markitup/jquery/markitup/sets/default/list-numeric.png +0 -0
  79. data/templates/markitup/jquery/markitup/skins/markitup.scss +3 -10
  80. data/templates/markitup/jquery/markitup/skins/markitup/bg-container.png +0 -0
  81. data/templates/markitup/jquery/markitup/skins/markitup/menu.png +0 -0
  82. data/templates/markitup/jquery/markitup/skins/simple.scss +2 -3
  83. data/templates/markitup/jquery/markitup/skins/simple/menu.png +0 -0
  84. data/templates/markitup/manifest.rb +2 -0
  85. data/templates/markitup/markitup/jquery.markitup.set.default.js +21 -21
  86. data/templates/markitup/markitup/jquery.markitup.set.default.min.js +3 -2
  87. data/templates/mobile/jquery.mobile.js +5230 -2846
  88. data/templates/mobile/jquery.mobile.min.js +192 -46
  89. data/templates/mobile/jquery/mobile/_base.scss +141 -18
  90. data/templates/mobile/jquery/mobile/default.scss +263 -66
  91. data/templates/mobile/jquery/mobile/default/icons-18-black.png +0 -0
  92. data/templates/mobile/jquery/mobile/default/icons-18-white.png +0 -0
  93. data/templates/mobile/jquery/mobile/default/icons-36-black.png +0 -0
  94. data/templates/mobile/jquery/mobile/default/icons-36-white.png +0 -0
  95. data/templates/mobile/jquery/mobile/valencia.scss +242 -53
  96. data/templates/mobile/jquery/mobile/valencia/icons-18-black.png +0 -0
  97. data/templates/mobile/jquery/mobile/valencia/icons-18-white.png +0 -0
  98. data/templates/mobile/jquery/mobile/valencia/icons-36-black.png +0 -0
  99. data/templates/mobile/jquery/mobile/valencia/icons-36-white.png +0 -0
  100. data/templates/tiny_mce/manifest.rb +2 -0
  101. data/templates/tiny_mce/tiny_mce/langs/de.js +1 -1
  102. data/templates/tiny_mce/tiny_mce/plugins/advhr/rule.htm +1 -1
  103. data/templates/tiny_mce/tiny_mce/plugins/advimage/editor_plugin.js +1 -1
  104. data/templates/tiny_mce/tiny_mce/plugins/advimage/editor_plugin_src.js +1 -1
  105. data/templates/tiny_mce/tiny_mce/plugins/advimage/image.htm +1 -1
  106. data/templates/tiny_mce/tiny_mce/plugins/advimage/js/image.js +1 -1
  107. data/templates/tiny_mce/tiny_mce/plugins/advlink/link.htm +1 -1
  108. data/templates/tiny_mce/tiny_mce/plugins/advlist/editor_plugin.js +1 -1
  109. data/templates/tiny_mce/tiny_mce/plugins/advlist/editor_plugin_src.js +1 -1
  110. data/templates/tiny_mce/tiny_mce/plugins/autolink/editor_plugin.js +1 -1
  111. data/templates/tiny_mce/tiny_mce/plugins/autolink/editor_plugin_src.js +1 -1
  112. data/templates/tiny_mce/tiny_mce/plugins/autoresize/editor_plugin.js +1 -1
  113. data/templates/tiny_mce/tiny_mce/plugins/autoresize/editor_plugin_src.js +1 -1
  114. data/templates/tiny_mce/tiny_mce/plugins/autosave/editor_plugin.js +1 -1
  115. data/templates/tiny_mce/tiny_mce/plugins/autosave/editor_plugin_src.js +1 -1
  116. data/templates/tiny_mce/tiny_mce/plugins/contextmenu/editor_plugin.js +1 -1
  117. data/templates/tiny_mce/tiny_mce/plugins/contextmenu/editor_plugin_src.js +1 -1
  118. data/templates/tiny_mce/tiny_mce/plugins/emotions/emotions.htm +1 -1
  119. data/templates/tiny_mce/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
  120. data/templates/tiny_mce/tiny_mce/plugins/emotions/img/smiley-laughing.gif +0 -0
  121. data/templates/tiny_mce/tiny_mce/plugins/emotions/img/smiley-sealed.gif +0 -0
  122. data/templates/tiny_mce/tiny_mce/plugins/emotions/img/smiley-smile.gif +0 -0
  123. data/templates/tiny_mce/tiny_mce/plugins/emotions/img/smiley-surprised.gif +0 -0
  124. data/templates/tiny_mce/tiny_mce/plugins/emotions/img/smiley-wink.gif +0 -0
  125. data/templates/tiny_mce/tiny_mce/plugins/example/dialog.htm +1 -1
  126. data/templates/tiny_mce/tiny_mce/plugins/example_dependency/editor_plugin.js +1 -0
  127. data/templates/tiny_mce/tiny_mce/plugins/example_dependency/editor_plugin_src.js +1 -0
  128. data/templates/tiny_mce/tiny_mce/plugins/fullpage/editor_plugin.js +1 -1
  129. data/templates/tiny_mce/tiny_mce/plugins/fullpage/editor_plugin_src.js +1 -1
  130. data/templates/tiny_mce/tiny_mce/plugins/fullpage/fullpage.htm +1 -1
  131. data/templates/tiny_mce/tiny_mce/plugins/inlinepopups/editor_plugin.js +1 -1
  132. data/templates/tiny_mce/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +1 -1
  133. data/templates/tiny_mce/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
  134. data/templates/tiny_mce/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
  135. data/templates/tiny_mce/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
  136. data/templates/tiny_mce/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
  137. data/templates/tiny_mce/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
  138. data/templates/tiny_mce/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +1 -1
  139. data/templates/tiny_mce/tiny_mce/plugins/inlinepopups/template.htm +1 -1
  140. data/templates/tiny_mce/tiny_mce/plugins/lists/editor_plugin.js +1 -1
  141. data/templates/tiny_mce/tiny_mce/plugins/lists/editor_plugin_src.js +1 -1
  142. data/templates/tiny_mce/tiny_mce/plugins/media/editor_plugin.js +1 -1
  143. data/templates/tiny_mce/tiny_mce/plugins/media/editor_plugin_src.js +1 -1
  144. data/templates/tiny_mce/tiny_mce/plugins/media/js/media.js +1 -1
  145. data/templates/tiny_mce/tiny_mce/plugins/media/langs/en_dlg.js +1 -1
  146. data/templates/tiny_mce/tiny_mce/plugins/media/media.htm +1 -1
  147. data/templates/tiny_mce/tiny_mce/plugins/noneditable/editor_plugin.js +1 -1
  148. data/templates/tiny_mce/tiny_mce/plugins/noneditable/editor_plugin_src.js +1 -1
  149. data/templates/tiny_mce/tiny_mce/plugins/paste/editor_plugin.js +1 -1
  150. data/templates/tiny_mce/tiny_mce/plugins/paste/editor_plugin_src.js +1 -1
  151. data/templates/tiny_mce/tiny_mce/plugins/paste/pastetext.htm +1 -1
  152. data/templates/tiny_mce/tiny_mce/plugins/paste/pasteword.htm +1 -1
  153. data/templates/tiny_mce/tiny_mce/plugins/preview/example.html +16 -17
  154. data/templates/tiny_mce/tiny_mce/plugins/preview/preview.html +9 -10
  155. data/templates/tiny_mce/tiny_mce/plugins/searchreplace/searchreplace.htm +1 -1
  156. data/templates/tiny_mce/tiny_mce/plugins/spellchecker/editor_plugin.js +1 -1
  157. data/templates/tiny_mce/tiny_mce/plugins/spellchecker/editor_plugin_src.js +1 -1
  158. data/templates/tiny_mce/tiny_mce/plugins/style/js/props.js +1 -1
  159. data/templates/tiny_mce/tiny_mce/plugins/style/props.htm +1 -1
  160. data/templates/tiny_mce/tiny_mce/plugins/tabfocus/editor_plugin.js +1 -1
  161. data/templates/tiny_mce/tiny_mce/plugins/tabfocus/editor_plugin_src.js +1 -1
  162. data/templates/tiny_mce/tiny_mce/plugins/table/cell.htm +1 -1
  163. data/templates/tiny_mce/tiny_mce/plugins/table/editor_plugin.js +1 -1
  164. data/templates/tiny_mce/tiny_mce/plugins/table/editor_plugin_src.js +1 -1
  165. data/templates/tiny_mce/tiny_mce/plugins/table/js/cell.js +1 -1
  166. data/templates/tiny_mce/tiny_mce/plugins/table/js/row.js +1 -1
  167. data/templates/tiny_mce/tiny_mce/plugins/table/langs/de_dlg.js +1 -1
  168. data/templates/tiny_mce/tiny_mce/plugins/table/langs/en_dlg.js +1 -1
  169. data/templates/tiny_mce/tiny_mce/plugins/table/merge_cells.htm +1 -1
  170. data/templates/tiny_mce/tiny_mce/plugins/table/row.htm +1 -1
  171. data/templates/tiny_mce/tiny_mce/plugins/table/table.htm +1 -1
  172. data/templates/tiny_mce/tiny_mce/plugins/template/blank.htm +1 -1
  173. data/templates/tiny_mce/tiny_mce/plugins/template/template.htm +1 -1
  174. data/templates/tiny_mce/tiny_mce/plugins/wordcount/editor_plugin.js +1 -1
  175. data/templates/tiny_mce/tiny_mce/plugins/wordcount/editor_plugin_src.js +1 -1
  176. data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/abbr.htm +1 -1
  177. data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/acronym.htm +1 -1
  178. data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/attributes.htm +1 -1
  179. data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/cite.htm +1 -1
  180. data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/del.htm +1 -1
  181. data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/ins.htm +1 -1
  182. data/templates/tiny_mce/tiny_mce/themes/advanced/about.htm +1 -1
  183. data/templates/tiny_mce/tiny_mce/themes/advanced/anchor.htm +1 -1
  184. data/templates/tiny_mce/tiny_mce/themes/advanced/color_picker.htm +1 -1
  185. data/templates/tiny_mce/tiny_mce/themes/advanced/editor_template.js +1 -1
  186. data/templates/tiny_mce/tiny_mce/themes/advanced/editor_template_src.js +1 -1
  187. data/templates/tiny_mce/tiny_mce/themes/advanced/image.htm +1 -1
  188. data/templates/tiny_mce/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
  189. data/templates/tiny_mce/tiny_mce/themes/advanced/img/flash.gif +0 -0
  190. data/templates/tiny_mce/tiny_mce/themes/advanced/img/icons.gif +0 -0
  191. data/templates/tiny_mce/tiny_mce/themes/advanced/img/quicktime.gif +0 -0
  192. data/templates/tiny_mce/tiny_mce/themes/advanced/img/shockwave.gif +0 -0
  193. data/templates/tiny_mce/tiny_mce/themes/advanced/js/image.js +1 -1
  194. data/templates/tiny_mce/tiny_mce/themes/advanced/langs/de.js +1 -1
  195. data/templates/tiny_mce/tiny_mce/themes/advanced/link.htm +1 -1
  196. data/templates/tiny_mce/tiny_mce/themes/advanced/skins/default/content.css +1 -1
  197. data/templates/tiny_mce/tiny_mce/themes/advanced/skins/default/dialog.css +1 -1
  198. data/templates/tiny_mce/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
  199. data/templates/tiny_mce/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
  200. data/templates/tiny_mce/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
  201. data/templates/tiny_mce/tiny_mce/themes/advanced/skins/default/ui.css +1 -1
  202. data/templates/tiny_mce/tiny_mce/themes/advanced/skins/highcontrast/dialog.css +1 -1
  203. data/templates/tiny_mce/tiny_mce/themes/advanced/skins/highcontrast/ui.css +1 -1
  204. data/templates/tiny_mce/tiny_mce/themes/advanced/skins/o2k7/content.css +1 -1
  205. data/templates/tiny_mce/tiny_mce/themes/advanced/skins/o2k7/dialog.css +1 -1
  206. data/templates/tiny_mce/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
  207. data/templates/tiny_mce/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
  208. data/templates/tiny_mce/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
  209. data/templates/tiny_mce/tiny_mce/themes/advanced/skins/o2k7/ui.css +1 -1
  210. data/templates/tiny_mce/tiny_mce/themes/advanced/source_editor.htm +1 -1
  211. data/templates/tiny_mce/tiny_mce/themes/simple/img/icons.gif +0 -0
  212. data/templates/tiny_mce/tiny_mce/themes/simple/skins/default/ui.css +1 -1
  213. data/templates/tiny_mce/tiny_mce/themes/simple/skins/o2k7/ui.css +1 -1
  214. data/templates/tiny_mce/tiny_mce/tiny_mce.js +1 -1
  215. data/templates/tools/flowplayer.min.js +1 -1
  216. data/templates/tools/jquery.tools.js +17 -17
  217. data/templates/tools/jquery.tools.min.js +22 -22
  218. metadata +17 -9
  219. data/templates/emulators/emulators/palm.pre.2.landscape.png +0 -0
  220. data/templates/emulators/emulators/palm.pre.2.portrait.png +0 -0
@@ -1,475 +1,478 @@
1
1
  /*
2
- jqGrid 4.0 - jQuery Grid
2
+ jqGrid 4.1.2 - jQuery Grid
3
3
  Copyright (c) 2008, Tony Tomov, tony@trirand.com
4
4
  Dual licensed under the MIT and GPL licenses
5
5
  http://www.opensource.org/licenses/mit-license.php
6
6
  http://www.gnu.org/licenses/gpl-2.0.html
7
- Date: 2011-04-09
7
+ Date: 2011-07-20
8
8
  */
9
- (function(a){a.jgrid=a.jgrid||{};a.extend(a.jgrid,{htmlDecode:function(a){if(a&&(a=="&nbsp;"||a=="&#160;"||a.length==1&&a.charCodeAt(0)==160))return"";return!a?a:String(a).replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"')},htmlEncode:function(a){return!a?a:String(a).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\"/g,"&quot;")},format:function(b){var d=a.makeArray(arguments).slice(1);b===void 0&&(b="");return b.replace(/\{(\d+)\}/g,function(a,
10
- b){return d[b]})},getCellIndex:function(b){b=a(b);if(b.is("tr"))return-1;b=(!b.is("td")&&!b.is("th")?b.closest("td,th"):b)[0];if(a.browser.msie)return a.inArray(b,b.parentNode.cells);return b.cellIndex},stripHtml:function(a){a+="";var d=/<("[^"]*"|'[^']*'|[^'">])*>/gi;return a?(a=a.replace(d,""))&&a!=="&nbsp;"&&a!=="&#160;"?a.replace(/\"/g,"'"):"":a},stringToDoc:function(a){var d;if(typeof a!=="string")return a;try{d=(new DOMParser).parseFromString(a,"text/xml")}catch(c){d=new ActiveXObject("Microsoft.XMLDOM"),
11
- d.async=!1,d.loadXML(a)}return d&&d.documentElement&&d.documentElement.tagName!="parsererror"?d:null},parse:function(b){b.substr(0,9)=="while(1);"&&(b=b.substr(9));b.substr(0,2)=="/*"&&(b=b.substr(2,b.length-4));b||(b="{}");return a.jgrid.useJSON===!0&&typeof JSON==="object"&&typeof JSON.parse==="function"?JSON.parse(b):eval("("+b+")")},parseDate:function(b,d){var c={m:1,d:1,y:1970,h:0,i:0,s:0},f,h,g;f=/[\\\/:_;.,\t\T\s-]/;if(d&&d!==null&&d!==void 0){var d=a.trim(d),d=d.split(f),b=b.split(f),j=a.jgrid.formatter.date.monthNames,
12
- e=a.jgrid.formatter.date.AmPm,l=function(a,b){a===0?b==12&&(b=0):b!=12&&(b+=12);return b};f=0;for(h=b.length;f<h;f++){b[f]=="M"&&(g=a.inArray(d[f],j),g!==-1&&g<12&&(d[f]=g+1));b[f]=="F"&&(g=a.inArray(d[f],j),g!==-1&&g>11&&(d[f]=g+1-12));if(b[f]=="a"&&(g=a.inArray(d[f],e),g!==-1&&g<2&&d[f]==e[g]))d[f]=g,c.h=l(d[f],c.h);if(b[f]=="A"&&(g=a.inArray(d[f],e),g!==-1&&g>1&&d[f]==e[g]))d[f]=g-2,c.h=l(d[f],c.h);d[f]!==void 0&&(c[b[f].toLowerCase()]=parseInt(d[f],10))}c.m=parseInt(c.m,10)-1;f=c.y;if(f>=70&&
13
- f<=99)c.y=1900+c.y;else if(f>=0&&f<=69)c.y=2E3+c.y}return new Date(c.y,c.m,c.d,c.h,c.i,c.s,0)},jqID:function(a){a+="";return a.replace(/([\.\:\[\]])/g,"\\$1")},guid:1,uidPref:"jqg",randId:function(b){return(b?b:a.jgrid.uidPref)+a.jgrid.guid++},getAccessor:function(a,d){var c,f,h=[],g;if(typeof d==="function")return d(a);c=a[d];if(c===void 0)try{if(typeof d==="string"&&(h=d.split(".")),g=h.length)for(c=a;c&&g--;)f=h.shift(),c=c[f]}catch(j){}return c},ajaxOptions:{},from:function(b){return new function(b,
14
- c){typeof b=="string"&&(b=a.data(b));var f=this,h=b,g=!0,j=!1,e=c,l=/[\$,%]/g,k=null,o=null,m=!1,n="",p=[],s=!0;if(typeof b=="object"&&b.push)b.length>0&&(s=typeof b[0]!="object"?!1:!0);else throw"data provides is not an array";this._hasData=function(){return h===null?!1:h.length===0?!1:!0};this._getStr=function(a){var b=[];j&&b.push("jQuery.trim(");b.push("String("+a+")");j&&b.push(")");g||b.push(".toLowerCase()");return b.join("")};this._strComp=function(a){return typeof a=="string"?".toString()":
15
- ""};this._group=function(a,b){return{field:a.toString(),unique:b,items:[]}};this._toStr=function(b){j&&(b=a.trim(b));g||(b=b.toLowerCase());return b=b.toString().replace(/\\/g,"\\\\").replace(/\"/g,'\\"')};this._funcLoop=function(b){var c=[];a.each(h,function(a,e){c.push(b(e))});return c};this._append=function(a){e===null?e="":e+=n===""?" && ":n;m&&(e+="!");e+="("+a+")";m=!1;n=""};this._setCommand=function(a,b){k=a;o=b};this._resetNegate=function(){m=!1};this._repeatCommand=function(a,b){if(k===null)return f;
16
- if(a!==null&&b!==null)return k(a,b);if(o===null)return k(a);if(!s)return k(a);return k(o,a)};this._equals=function(a,b){return f._compare(a,b,1)===0};this._compare=function(a,b,c){c===void 0&&(c=1);a===void 0&&(a=null);b===void 0&&(b=null);if(a===null&&b===null)return 0;if(a===null&&b!==null)return 1;if(a!==null&&b===null)return-1;!g&&typeof a!=="number"&&typeof b!=="number"&&(a=String(a).toLowerCase(),b=String(b).toLowerCase());if(a<b)return-c;if(a>b)return c;return 0};this._performSort=function(){p.length!==
17
- 0&&(h=f._doSort(h,0))};this._doSort=function(a,b){var c=p[b].by,e=p[b].dir,d=p[b].type,h=p[b].datefmt;if(b==p.length-1)return f._getOrder(a,c,e,d,h);b++;c=f._getGroup(a,c,e,d,h);e=[];for(d=0;d<c.length;d++)for(var h=f._doSort(c[d].items,b),g=0;g<h.length;g++)e.push(h[g]);return e};this._getOrder=function(b,c,e,d,h){var g=[],j=[],k=e=="a"?1:-1,m,p;d===void 0&&(d="text");p=d=="float"||d=="number"||d=="currency"||d=="numeric"?function(a){a=parseFloat(String(a).replace(l,""));return isNaN(a)?0:a}:d==
18
- "int"||d=="integer"?function(a){return a?parseFloat(String(a).replace(l,"")):0}:d=="date"||d=="datetime"?function(b){return a.jgrid.parseDate(h,b).getTime()}:a.isFunction(d)?d:function(b){b||(b="");return a.trim(String(b).toUpperCase())};a.each(b,function(b,e){m=c!==""?a.jgrid.getAccessor(e,c):e;m===void 0&&(m="");m=p(m,e);j.push({vSort:m,index:b})});j.sort(function(a,b){a=a.vSort;b=b.vSort;return f._compare(a,b,k)});for(var d=0,n=b.length;d<n;)e=j[d].index,g.push(b[e]),d++;return g};this._getGroup=
19
- function(b,c,e,d,h){var g=[],j=null,k=null,m;a.each(f._getOrder(b,c,e,d,h),function(b,e){m=a.jgrid.getAccessor(e,c);m===void 0&&(m="");f._equals(k,m)||(k=m,j!==null&&g.push(j),j=f._group(c,m));j.items.push(e)});j!==null&&g.push(j);return g};this.ignoreCase=function(){g=!1;return f};this.useCase=function(){g=!0;return f};this.trim=function(){j=!0;return f};this.noTrim=function(){j=!1;return f};this.execute=function(){var b=e,c=[];if(b===null)return f;a.each(h,function(){eval(b)&&c.push(this)});h=c;
20
- return f};this.data=function(){return h};this.select=function(b){f._performSort();if(!f._hasData())return[];f.execute();if(a.isFunction(b)){var c=[];a.each(h,function(a,e){c.push(b(e))});return c}return h};this.hasMatch=function(){if(!f._hasData())return!1;f.execute();return h.length>0};this.andNot=function(a,b,c){m=!m;return f.and(a,b,c)};this.orNot=function(a,b,c){m=!m;return f.or(a,b,c)};this.not=function(a,b,c){return f.andNot(a,b,c)};this.and=function(a,b,c){n=" && ";if(a===void 0)return f;return f._repeatCommand(a,
21
- b,c)};this.or=function(a,b,c){n=" || ";if(a===void 0)return f;return f._repeatCommand(a,b,c)};this.isNot=function(a){m=!m;return f.is(a)};this.is=function(a){f._append("this."+a);f._resetNegate();return f};this._compareValues=function(b,c,e,d,h){var g;g=s?"jQuery.jgrid.getAccessor(this,'"+c+"')":"this";e===void 0&&(e=null);var j=e,k=h.stype===void 0?"text":h.stype;if(e!==null)switch(k){case "int":case "integer":j=isNaN(Number(j))||j===""?"0":j;g="parseInt("+g+",10)";j="parseInt("+j+",10)";break;case "float":case "number":case "numeric":j=
22
- String(j).replace(l,"");j=isNaN(Number(j))||j===""?"0":j;g="parseFloat("+g+")";j="parseFloat("+j+")";break;case "date":case "datetime":j=String(a.jgrid.parseDate(h.newfmt||"Y-m-d",j).getTime());g='jQuery.jgrid.parseDate("'+h.srcfmt+'",'+g+").getTime()";break;default:g=f._getStr(g),j=f._getStr('"'+f._toStr(j)+'"')}f._append(g+" "+d+" "+j);f._setCommand(b,c);f._resetNegate();return f};this.equals=function(a,b,c){return f._compareValues(f.equals,a,b,"==",c)};this.notEquals=function(a,b,c){return f._compareValues(f.equals,
23
- a,b,"!==",c)};this.isNull=function(a,b,c){return f._compareValues(f.equals,a,null,"===",c)};this.greater=function(a,b,c){return f._compareValues(f.greater,a,b,">",c)};this.less=function(a,b,c){return f._compareValues(f.less,a,b,"<",c)};this.greaterOrEquals=function(a,b,c){return f._compareValues(f.greaterOrEquals,a,b,">=",c)};this.lessOrEquals=function(a,b,c){return f._compareValues(f.lessOrEquals,a,b,"<=",c)};this.startsWith=function(b,c){var e=c===void 0||c===null?b:c,e=j?a.trim(e.toString()).length:
24
- e.toString().length;s?f._append(f._getStr("jQuery.jgrid.getAccessor(this,'"+b+"')")+".substr(0,"+e+") == "+f._getStr('"'+f._toStr(c)+'"')):(e=j?a.trim(c.toString()).length:c.toString().length,f._append(f._getStr("this")+".substr(0,"+e+") == "+f._getStr('"'+f._toStr(b)+'"')));f._setCommand(f.startsWith,b);f._resetNegate();return f};this.endsWith=function(b,c){var e=c===void 0||c===null?b:c,e=j?a.trim(e.toString()).length:e.toString().length;s?f._append(f._getStr("jQuery.jgrid.getAccessor(this,'"+b+
25
- "')")+".substr("+f._getStr("jQuery.jgrid.getAccessor(this,'"+b+"')")+".length-"+e+","+e+') == "'+f._toStr(c)+'"'):f._append(f._getStr("this")+".substr("+f._getStr("this")+'.length-"'+f._toStr(b)+'".length,"'+f._toStr(b)+'".length) == "'+f._toStr(b)+'"');f._setCommand(f.endsWith,b);f._resetNegate();return f};this.contains=function(a,b){s?f._append(f._getStr("jQuery.jgrid.getAccessor(this,'"+a+"')")+'.indexOf("'+f._toStr(b)+'",0) > -1'):f._append(f._getStr("this")+'.indexOf("'+f._toStr(a)+'",0) > -1');
26
- f._setCommand(f.contains,a);f._resetNegate();return f};this.groupBy=function(a,b,c,e){if(!f._hasData())return null;return f._getGroup(h,a,b,c,e)};this.orderBy=function(b,c,e,d){c=c===void 0||c===null?"a":a.trim(c.toString().toLowerCase());if(e===null||e===void 0)e="text";if(d===null||d===void 0)d="Y-m-d";if(c=="desc"||c=="descending")c="d";if(c=="asc"||c=="ascending")c="a";p.push({by:b,dir:c,type:e,datefmt:d});return f};return f}(b,null)},extend:function(b){a.extend(a.fn.jqGrid,b);this.no_legacy_api||
27
- a.fn.extend(b)}});a.fn.jqGrid=function(b){if(typeof b=="string"){var d=a.jgrid.getAccessor(a.fn.jqGrid,b);if(!d)throw"jqGrid - No such method: "+b;var c=a.makeArray(arguments).slice(1);return d.apply(this,c)}return this.each(function(){if(!this.grid){var c=a.extend(!0,{url:"",height:150,page:1,rowNum:20,rowTotal:null,records:0,pager:"",pgbuttons:!0,pginput:!0,colModel:[],rowList:[],colNames:[],sortorder:"asc",sortname:"",datatype:"xml",mtype:"GET",altRows:!1,selarrrow:[],savedRow:[],shrinkToFit:!0,
28
- xmlReader:{},jsonReader:{},subGrid:!1,subGridModel:[],reccount:0,lastpage:0,lastsort:0,selrow:null,beforeSelectRow:null,onSelectRow:null,onSortCol:null,ondblClickRow:null,onRightClickRow:null,onPaging:null,onSelectAll:null,loadComplete:null,gridComplete:null,loadError:null,loadBeforeSend:null,afterInsertRow:null,beforeRequest:null,onHeaderClick:null,viewrecords:!1,loadonce:!1,multiselect:!1,multikey:!1,editurl:null,search:!1,caption:"",hidegrid:!0,hiddengrid:!1,postData:{},userData:{},treeGrid:!1,
29
- treeGridModel:"nested",treeReader:{},treeANode:-1,ExpandColumn:null,tree_root_level:0,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"},forceFit:!1,gridstate:"visible",cellEdit:!1,cellsubmit:"remote",nv:0,loadui:"enable",toolbar:[!1,""],scroll:!1,multiboxonly:!1,deselectAfterSort:!0,scrollrows:!1,autowidth:!1,scrollOffset:18,cellLayout:5,subGridWidth:20,
30
- multiselectWidth:20,gridview:!1,rownumWidth:25,rownumbers:!1,pagerpos:"center",recordpos:"right",footerrow:!1,userDataOnFooter:!1,hoverrows:!0,altclass:"ui-priority-secondary",viewsortcols:[!1,"vertical",!0],resizeclass:"",autoencode:!1,remapColumns:[],ajaxGridOptions:{},direction:"ltr",toppager:!1,headertitles:!1,scrollTimeout:40,data:[],_index:{},grouping:!1,groupingView:{groupField:[],groupOrder:[],groupText:[],groupColumnShow:[],groupSummary:[],showSummaryOnHide:!1,sortitems:[],sortnames:[],groupDataSorted:!1,
31
- summary:[],summaryval:[],plusicon:"ui-icon-circlesmall-plus",minusicon:"ui-icon-circlesmall-minus"},ignoreCase:!1,cmTemplate:{}},a.jgrid.defaults,b||{}),d={headers:[],cols:[],footers:[],dragStart:function(b,d,e){this.resizing={idx:b,startX:d.clientX,sOL:e[0]};this.hDiv.style.cursor="col-resize";this.curGbox=a("#rs_m"+a.jgrid.jqID(c.id),"#gbox_"+a.jgrid.jqID(c.id));this.curGbox.css({display:"block",left:e[0],top:e[1],height:e[2]});a.isFunction(c.resizeStart)&&c.resizeStart.call(this,d,b);document.onselectstart=
32
- function(){return!1}},dragMove:function(a){if(this.resizing){var b=a.clientX-this.resizing.startX,a=this.headers[this.resizing.idx],d=c.direction==="ltr"?a.width+b:a.width-b,e;if(d>33)if(this.curGbox.css({left:this.resizing.sOL+b}),c.forceFit===!0){if(e=this.headers[this.resizing.idx+c.nv],b=c.direction==="ltr"?e.width-b:e.width+b,b>33)a.newWidth=d,e.newWidth=b}else this.newWidth=c.direction==="ltr"?c.tblwidth+b:c.tblwidth-b,a.newWidth=d}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var b=
33
- this.resizing.idx,d=this.headers[b].newWidth||this.headers[b].width,d=parseInt(d,10);this.resizing=!1;a("#rs_m"+a.jgrid.jqID(c.id)).css("display","none");c.colModel[b].width=d;this.headers[b].width=d;this.headers[b].el.style.width=d+"px";this.cols[b].style.width=d+"px";if(this.footers.length>0)this.footers[b].style.width=d+"px";if(c.forceFit===!0){d=this.headers[b+c.nv].newWidth||this.headers[b+c.nv].width;this.headers[b+c.nv].width=d;this.headers[b+c.nv].el.style.width=d+"px";this.cols[b+c.nv].style.width=
34
- d+"px";if(this.footers.length>0)this.footers[b+c.nv].style.width=d+"px";c.colModel[b+c.nv].width=d}else if(c.tblwidth=this.newWidth||c.tblwidth,a("table:first",this.bDiv).css("width",c.tblwidth+"px"),a("table:first",this.hDiv).css("width",c.tblwidth+"px"),this.hDiv.scrollLeft=this.bDiv.scrollLeft,c.footerrow)a("table:first",this.sDiv).css("width",c.tblwidth+"px"),this.sDiv.scrollLeft=this.bDiv.scrollLeft;a.isFunction(c.resizeStop)&&c.resizeStop.call(this,d,b)}this.curGbox=null;document.onselectstart=
35
- function(){return!0}},populateVisible:function(){d.timer&&clearTimeout(d.timer);d.timer=null;var b=a(d.bDiv).height();if(b){var e=a("table:first",d.bDiv),g,j;if(e[0].rows.length)try{j=(g=e[0].rows[1])?a(g).outerHeight()||d.prevRowHeight:d.prevRowHeight}catch(k){j=d.prevRowHeight}if(j){d.prevRowHeight=j;var m=c.rowNum;g=d.scrollTop=d.bDiv.scrollTop;var p=Math.round(e.position().top)-g,l=p+e.height();j*=m;var n,o,s;if(l<b&&p<=0&&(c.lastpage===void 0||parseInt((l+g+j-1)/j,10)<=c.lastpage))o=parseInt((b-
36
- l+j-1)/j,10),l>=0||o<2||c.scroll===!0?(n=Math.round((l+g)/j)+1,p=-1):p=1;p>0&&(n=parseInt(g/j,10)+1,o=parseInt((g+b)/j,10)+2-n,s=!0);if(o&&!(c.lastpage&&n>c.lastpage||c.lastpage==1||n===c.page&&n===c.lastpage))d.hDiv.loading?d.timer=setTimeout(d.populateVisible,c.scrollTimeout):(c.page=n,s&&(d.selectionPreserver(e[0]),d.emptyRows(d.bDiv,!1,!1)),d.populate(o))}}},scrollGrid:function(a){if(c.scroll){var b=d.bDiv.scrollTop;if(d.scrollTop===void 0)d.scrollTop=0;if(b!=d.scrollTop)d.scrollTop=b,d.timer&&
37
- clearTimeout(d.timer),d.timer=setTimeout(d.populateVisible,c.scrollTimeout)}d.hDiv.scrollLeft=d.bDiv.scrollLeft;if(c.footerrow)d.sDiv.scrollLeft=d.bDiv.scrollLeft;a&&a.stopPropagation()},selectionPreserver:function(b){var c=b.p,d=c.selrow,e=c.selarrrow?a.makeArray(c.selarrrow):null,f=b.grid.bDiv.scrollLeft,g=c.gridComplete;c.gridComplete=function(){c.selrow=null;c.selarrrow=[];if(c.multiselect&&e&&e.length>0)for(var j=0;j<e.length;j++)e[j]!=d&&a(b).jqGrid("setSelection",e[j],!1);d&&a(b).jqGrid("setSelection",
38
- d,!1);b.grid.bDiv.scrollLeft=f;c.gridComplete=g;c.gridComplete&&g()}}};if(this.tagName.toUpperCase()!="TABLE")alert("Element is not a table");else{a(this).empty().attr("tabindex","1");this.p=c;var g,j,e;if(this.p.colNames.length===0)for(g=0;g<this.p.colModel.length;g++)this.p.colNames[g]=this.p.colModel[g].label||this.p.colModel[g].name;if(this.p.colNames.length!==this.p.colModel.length)alert(a.jgrid.errors.model);else{var l=a("<div class='ui-jqgrid-view'></div>"),k,o=a.browser.msie?!0:!1,m=a.browser.webkit||
39
- a.browser.safari?!0:!1;e=this;e.p.direction=a.trim(e.p.direction.toLowerCase());if(a.inArray(e.p.direction,["ltr","rtl"])==-1)e.p.direction="ltr";j=e.p.direction;a(l).insertBefore(this);a(this).appendTo(l).removeClass("scroll");var n=a("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");a(n).insertBefore(l).attr({id:"gbox_"+this.id,dir:j});a(l).appendTo(n).attr("id","gview_"+this.id);k=o&&a.browser.version<=6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':
40
- "";a("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(k).insertBefore(l);a("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(l);a(this).attr({cellspacing:"0",cellpadding:"0",border:"0",role:"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});var p=function(a,b){a=parseInt(a,10);return isNaN(a)?b?b:0:a},s=function(b,c,f,g,j,k){var m=e.p.colModel[b],p=m.align,n='style="',
41
- l=m.classes,o=m.name,s=[];p&&(n+="text-align:"+p+";");m.hidden===!0&&(n+="display:none;");if(c===0)n+="width: "+d.headers[b].width+"px;";else if(m.cellattr&&a.isFunction(m.cellattr)&&(b=m.cellattr.call(e,j,f,g,m,k))&&typeof b==="string"){b=b.replace(/style/i,"style").replace(/title/i,"title");if(b.indexOf("title")>-1)m.title=!1;b.indexOf("class")>-1&&(l=void 0);s=b.split("style");if(s.length===2){s[1]=a.trim(s[1].replace("=",""));if(s[1].indexOf("'")===0||s[1].indexOf('"')===0)s[1]=s[1].substring(1);
42
- n+=s[1].replace(/'/gi,'"')}else n+='"'}s.length||(s[0]="",n+='"');n+=(l!==void 0?' class="'+l+'"':"")+(m.title&&f?' title="'+a.jgrid.stripHtml(f)+'"':"");n+=' aria-describedby="'+e.p.id+"_"+o+'"';return n+s[0]},q=function(b){return b===void 0||b===null||b===""?"&#160;":e.p.autoencode?a.jgrid.htmlEncode(b):b+""},r=function(b,c,d,f,g){var j=e.p.colModel[d];typeof j.formatter!=="undefined"?(b={rowId:b,colModel:j,gid:e.p.id,pos:d},c=a.isFunction(j.formatter)?j.formatter.call(e,c,b,f,g):a.fmatter?a.fn.fmatter(j.formatter,
43
- c,b,f,g):q(c)):c=q(c);return c},t=function(a,b,c,d,e){b=r(a,b,c,e,"add");return'<td role="gridcell" '+s(c,d,b,e,a,!0)+">"+b+"</td>"},v=function(a,b,c){var d='<input role="checkbox" type="checkbox" id="jqg_'+e.p.id+"_"+a+'" class="cbox" name="jqg_'+e.p.id+"_"+a+'"/>';return'<td role="gridcell" '+s(b,c,"",null,a,!0)+">"+d+"</td>"},w=function(a,b,c,d){c=(parseInt(c,10)-1)*parseInt(d,10)+1+b;return'<td role="gridcell" class="ui-state-default jqgrid-rownum" '+s(a,b,c,null,b,!0)+">"+c+"</td>"},z=function(a){var b,
44
- c=[],d=0,f;for(f=0;f<e.p.colModel.length;f++)b=e.p.colModel[f],b.name!=="cb"&&b.name!=="subgrid"&&b.name!=="rn"&&(c[d]=a=="local"?b.name:a=="xml"?b.xmlmap||b.name:b.jsonmap||b.name,d++);return c},C=function(b){var c=e.p.remapColumns;if(!c||!c.length)c=a.map(e.p.colModel,function(a,b){return b});b&&(c=a.map(c,function(a){return a<b?null:a-b}));return c},y=function(b,c,d){if(e.p.deepempty)a("#"+a.jgrid.jqID(e.p.id)+" tbody:first tr:gt(0)").remove();else{var f=a("#"+a.jgrid.jqID(e.p.id)+" tbody:first tr:first")[0];
45
- a("#"+a.jgrid.jqID(e.p.id)+" tbody:first").empty().append(f)}if(c&&e.p.scroll)a(">div:first",b).css({height:"auto"}).children("div:first").css({height:0,display:"none"}),b.scrollTop=0;if(d===!0&&e.p.treeGrid===!0)e.p.data=[],e.p._index={}},A=function(){var b=e.p.data.length,c,d,f;c=e.p.rownumbers===!0?1:0;d=e.p.multiselect===!0?1:0;f=e.p.subGrid===!0?1:0;c=e.p.keyIndex===!1||e.p.loadonce===!0?e.p.localReader.id:e.p.colModel[e.p.keyIndex+d+f+c].name;for(d=0;d<b;d++)f=a.jgrid.getAccessor(e.p.data[d],
46
- c),e.p._index[f]=d},B=function(b,c,d,f,g){var j=new Date,h=e.p.datatype!="local"&&e.p.loadonce||e.p.datatype=="xmlstring",k=e.p.datatype=="local"?"local":"xml";if(h)e.p.data=[],e.p._index={},e.p.localReader.id="_id_";e.p.reccount=0;if(a.isXMLDoc(b)){e.p.treeANode===-1&&!e.p.scroll?(y(c,!1,!0),d=1):d=d>1?d:1;var m,p,n=0,l,o=0,s=0,q=0,r,u=[],A,D={},F,x,B=[],E=e.p.altRows===!0?" "+e.p.altclass:"";e.p.xmlReader.repeatitems||(u=z(k));r=e.p.keyIndex===!1?e.p.xmlReader.id:e.p.keyIndex;u.length>0&&!isNaN(r)&&
47
- (e.p.remapColumns&&e.p.remapColumns.length&&(r=a.inArray(r,e.p.remapColumns)),r=u[r]);k=(r+"").indexOf("[")===-1?u.length?function(b,c){return a(r,b).text()||c}:function(b,c){return a(e.p.xmlReader.cell,b).eq(r).text()||c}:function(a,b){return a.getAttribute(r.replace(/[\[\]]/g,""))||b};e.p.userData={};a(e.p.xmlReader.page,b).each(function(){e.p.page=this.textContent||this.text||0});a(e.p.xmlReader.total,b).each(function(){e.p.lastpage=this.textContent||this.text;if(e.p.lastpage===void 0)e.p.lastpage=
48
- 1});a(e.p.xmlReader.records,b).each(function(){e.p.records=this.textContent||this.text||0});a(e.p.xmlReader.userdata,b).each(function(){e.p.userData[this.getAttribute("name")]=this.textContent||this.text});(b=a(e.p.xmlReader.root+" "+e.p.xmlReader.row,b))||(b=[]);var J=b.length,H=0,K={},P;if(b&&J){P=parseInt(e.p.rowNum,10);var X=e.p.scroll?a.jgrid.randId():1;g&&(P*=g+1);var g=a.isFunction(e.p.afterInsertRow),Q="";for(e.p.grouping&&e.p.groupingView.groupCollapse===!0&&(Q=' style="display:none;"');H<
49
- J;){F=b[H];x=k(F,X+H);m=d===0?0:d+1;m=(m+H)%2==1?E:"";B.push("<tr"+Q+' id="'+x+'" tabindex="-1" role="row" class ="ui-widget-content jqgrow ui-row-'+e.p.direction+""+m+'">');e.p.rownumbers===!0&&(B.push(w(0,H,e.p.page,e.p.rowNum)),q=1);e.p.multiselect===!0&&(B.push(v(x,q,H)),o=1);e.p.subGrid===!0&&(B.push(a(e).jqGrid("addSubGridCell",o+q,H+d)),s=1);if(e.p.xmlReader.repeatitems){A||(A=C(o+s+q));var O=a(e.p.xmlReader.cell,F);a.each(A,function(a){var b=O[this];if(!b)return!1;l=b.textContent||b.text;
50
- D[e.p.colModel[a+o+s+q].name]=l;B.push(t(x,l,a+o+s+q,H+d,F))})}else for(m=0;m<u.length;m++)l=a(u[m],F).text(),D[e.p.colModel[m+o+s+q].name]=l,B.push(t(x,l,m+o+s+q,H+d,F));B.push("</tr>");if(e.p.grouping){m=e.p.groupingView.groupField.length;for(var V=[],G=0;G<m;G++)V.push(D[e.p.groupingView.groupField[G]]);K=a(e).jqGrid("groupingPrepare",B,V,K,D);B=[]}if(h||e.p.treeGrid===!0)D._id_=x,e.p.data.push(D),e.p._index[x]=e.p.data.length-1;e.p.gridview===!1&&(a("tbody:first",c).append(B.join("")),g&&e.p.afterInsertRow.call(e,
51
- x,D,F),B=[]);D={};n++;H++;if(n==P)break}}e.p.gridview===!0&&(p=e.p.treeANode>-1?e.p.treeANode:0,e.p.grouping?(a(e).jqGrid("groupingRender",K,e.p.colModel.length),K=null):e.p.treeGrid===!0&&p>0?a(e.rows[p]).after(B.join("")):a("tbody:first",c).append(B.join("")));if(e.p.subGrid===!0)try{a(e).jqGrid("addSubGrid",o+q)}catch(N){}e.p.totaltime=new Date-j;if(n>0&&e.p.records===0)e.p.records=J;B=null;if(e.p.treeGrid===!0)try{a(e).jqGrid("setTreeNode",p+1,n+p+1)}catch(L){}if(!e.p.treeGrid&&!e.p.scroll)e.grid.bDiv.scrollTop=
52
- 0;e.p.reccount=n;e.p.treeANode=-1;e.p.userDataOnFooter&&a(e).jqGrid("footerData","set",e.p.userData,!0);if(h)e.p.records=J,e.p.lastpage=Math.ceil(J/P);f||e.updatepager(!1,!0);if(h)for(;n<J;){F=b[n];x=k(F,n);if(e.p.xmlReader.repeatitems){A||(A=C(o+s+q));var M=a(e.p.xmlReader.cell,F);a.each(A,function(a){var b=M[this];if(!b)return!1;l=b.textContent||b.text;D[e.p.colModel[a+o+s+q].name]=l})}else for(m=0;m<u.length;m++)l=a(u[m],F).text(),D[e.p.colModel[m+o+s+q].name]=l;D._id_=x;e.p.data.push(D);e.p._index[x]=
53
- e.p.data.length-1;D={};n++}}},u=function(b,c,d,f,g){var j=new Date;if(b){e.p.treeANode===-1&&!e.p.scroll?(y(c,!1,!0),d=1):d=d>1?d:1;var h,k=e.p.datatype!="local"&&e.p.loadonce||e.p.datatype=="jsonstring";if(k)e.p.data=[],e.p._index={},e.p.localReader.id="_id_";e.p.reccount=0;e.p.datatype=="local"?(c=e.p.localReader,h="local"):(c=e.p.jsonReader,h="json");var m=0,n,p,l=[],o,s=0,q=0,r=0,u,D,A={},F,x,B=[],H=e.p.altRows===!0?" "+e.p.altclass:"";e.p.page=a.jgrid.getAccessor(b,c.page)||0;u=a.jgrid.getAccessor(b,
54
- c.total);e.p.lastpage=u===void 0?1:u;e.p.records=a.jgrid.getAccessor(b,c.records)||0;e.p.userData=a.jgrid.getAccessor(b,c.userdata)||{};c.repeatitems||(o=l=z(h));h=e.p.keyIndex===!1?c.id:e.p.keyIndex;l.length>0&&!isNaN(h)&&(e.p.remapColumns&&e.p.remapColumns.length&&(h=a.inArray(h,e.p.remapColumns)),h=l[h]);(D=a.jgrid.getAccessor(b,c.root))||(D=[]);u=D.length;var b=0,J=parseInt(e.p.rowNum,10),E=e.p.scroll?a.jgrid.randId():1;g&&(J*=g+1);var K=a.isFunction(e.p.afterInsertRow),P={},Q="";for(e.p.grouping&&
55
- e.p.groupingView.groupCollapse===!0&&(Q=' style="display:none;"');b<u;){g=D[b];x=a.jgrid.getAccessor(g,h);x===void 0&&(x=E+b,l.length===0&&c.cell&&(x=a.jgrid.getAccessor(g,c.cell)[h]||x));n=d===1?0:d;n=(n+b)%2==1?H:"";B.push("<tr"+Q+' id="'+x+'" tabindex="-1" role="row" class= "ui-widget-content jqgrow ui-row-'+e.p.direction+""+n+'">');e.p.rownumbers===!0&&(B.push(w(0,b,e.p.page,e.p.rowNum)),r=1);e.p.multiselect&&(B.push(v(x,r,b)),s=1);e.p.subGrid&&(B.push(a(e).jqGrid("addSubGridCell",s+r,b+d)),q=
56
- 1);c.repeatitems&&(c.cell&&(g=a.jgrid.getAccessor(g,c.cell)),o||(o=C(s+q+r)));for(p=0;p<o.length;p++)n=a.jgrid.getAccessor(g,o[p]),B.push(t(x,n,p+s+q+r,b+d,g)),A[e.p.colModel[p+s+q+r].name]=n;B.push("</tr>");if(e.p.grouping){n=e.p.groupingView.groupField.length;p=[];for(var X=0;X<n;X++)p.push(A[e.p.groupingView.groupField[X]]);P=a(e).jqGrid("groupingPrepare",B,p,P,A);B=[]}if(k||e.p.treeGrid===!0)A._id_=x,e.p.data.push(A),e.p._index[x]=e.p.data.length-1;e.p.gridview===!1&&(a("#"+a.jgrid.jqID(e.p.id)+
57
- " tbody:first").append(B.join("")),K&&e.p.afterInsertRow.call(e,x,A,g),B=[]);A={};m++;b++;if(m==J)break}e.p.gridview===!0&&(F=e.p.treeANode>-1?e.p.treeANode:0,e.p.grouping?a(e).jqGrid("groupingRender",P,e.p.colModel.length):e.p.treeGrid===!0&&F>0?a(e.rows[F]).after(B.join("")):a("#"+a.jgrid.jqID(e.p.id)+" tbody:first").append(B.join("")));if(e.p.subGrid===!0)try{a(e).jqGrid("addSubGrid",s+r)}catch(O){}e.p.totaltime=new Date-j;if(m>0&&e.p.records===0)e.p.records=u;if(e.p.treeGrid===!0)try{a(e).jqGrid("setTreeNode",
58
- F+1,m+F+1)}catch(G){}if(!e.p.treeGrid&&!e.p.scroll)e.grid.bDiv.scrollTop=0;e.p.reccount=m;e.p.treeANode=-1;e.p.userDataOnFooter&&a(e).jqGrid("footerData","set",e.p.userData,!0);if(k)e.p.records=u,e.p.lastpage=Math.ceil(u/J);f||e.updatepager(!1,!0);if(k)for(;m<u&&D[m];){g=D[m];x=a.jgrid.getAccessor(g,h);x===void 0&&(x=E+m,l.length===0&&c.cell&&(x=a.jgrid.getAccessor(g,c.cell)[h]||x));if(g){c.repeatitems&&(c.cell&&(g=a.jgrid.getAccessor(g,c.cell)),o||(o=C(s+q+r)));for(p=0;p<o.length;p++)n=a.jgrid.getAccessor(g,
59
- o[p]),A[e.p.colModel[p+s+q+r].name]=n;A._id_=x;e.p.data.push(A);e.p._index[x]=e.p.data.length-1;A={}}m++}}},N=function(){function b(c){var d=0,e,g,j;if(c.groups!==void 0)for(e=0;e<c.groups.length;e++){try{b(c.groups[e])}catch(h){alert(h)}d++}if(c.rules!==void 0){if(d>0){var m=l.select();l=a.jgrid.from(m)}try{for(e=0;e<c.rules.length;e++)j=c.rules[e],g=c.groupOp.toString().toUpperCase(),n[j.op]&&j.field&&(d>0&&g&&g==="OR"&&(l=l.or()),l=n[j.op](l,g)(j.field,j.data,f[j.field])),d++}catch(k){alert(k)}}}
60
- var c,d=!1,f={},g=[],j=[],h,m,k;if(a.isArray(e.p.data)){var p=e.p.grouping?e.p.groupingView:!1;a.each(e.p.colModel,function(){m=this.sorttype||"text";m=="date"||m=="datetime"?(this.formatter&&typeof this.formatter==="string"&&this.formatter=="date"?(h=this.formatoptions&&this.formatoptions.srcformat?this.formatoptions.srcformat:a.jgrid.formatter.date.srcformat,k=this.formatoptions&&this.formatoptions.newformat?this.formatoptions.newformat:a.jgrid.formatter.date.newformat):h=k=this.datefmt||"Y-m-d",
61
- f[this.name]={stype:m,srcfmt:h,newfmt:k}):f[this.name]={stype:m,srcfmt:"",newfmt:""};if(e.p.grouping&&this.name==p.groupField[0]){var b=this.name;if(typeof this.index!="undefined")b=this.index;g[0]=f[b];j.push(b)}if(!d&&(this.index==e.p.sortname||this.name==e.p.sortname))c=this.name,d=!0});if(e.p.treeGrid)a(e).jqGrid("SortTree",c,e.p.sortorder,f[c].stype,f[c].srcfmt);else{var n={eq:function(a){return a.equals},ne:function(a){return a.notEquals},lt:function(a){return a.less},le:function(a){return a.lessOrEquals},
62
- gt:function(a){return a.greater},ge:function(a){return a.greaterOrEquals},cn:function(a){return a.contains},nc:function(a,b){return b==="OR"?a.orNot().contains:a.andNot().contains},bw:function(a){return a.startsWith},bn:function(a,b){return b==="OR"?a.orNot().startsWith:a.andNot().startsWith},en:function(a,b){return b==="OR"?a.orNot().endsWith:a.andNot().endsWith},ew:function(a){return a.endsWith},ni:function(a,b){return b==="OR"?a.orNot().equals:a.andNot().equals},"in":function(a){return a.equals},
63
- nu:function(a){return a.isNull},nn:function(a,b){return b==="OR"?a.orNot().isNull:a.andNot().isNull}},l=a.jgrid.from(e.p.data);e.p.ignoreCase&&(l=l.ignoreCase());if(e.p.search===!0){var o=e.p.postData.filters;if(o)typeof o=="string"&&(o=a.jgrid.parse(o)),b(o);else try{l=n[e.p.postData.searchOper](l)(e.p.postData.searchField,e.p.postData.searchString,f[e.p.postData.searchField])}catch(s){}}if(e.p.grouping)l.orderBy(j,p.groupOrder[0],g[0].stype,g[0].srcfmt),p.groupDataSorted=!0;c&&e.p.sortorder&&d&&
64
- (e.p.sortorder.toUpperCase()=="DESC"?l.orderBy(e.p.sortname,"d",f[c].stype,f[c].srcfmt):l.orderBy(e.p.sortname,"a",f[c].stype,f[c].srcfmt));var o=l.select(),q=parseInt(e.p.rowNum,10),r=o.length,t=parseInt(e.p.page,10),u=Math.ceil(r/q),v={},o=o.slice((t-1)*q,t*q),f=l=null;v[e.p.localReader.total]=u;v[e.p.localReader.page]=t;v[e.p.localReader.records]=r;v[e.p.localReader.root]=o;o=null;return v}}},O=function(){e.grid.hDiv.loading=!0;if(!e.p.hiddengrid)switch(e.p.loadui){case "enable":a("#load_"+a.jgrid.jqID(e.p.id)).show();
65
- break;case "block":a("#lui_"+a.jgrid.jqID(e.p.id)).show(),a("#load_"+a.jgrid.jqID(e.p.id)).show()}},S=function(){e.grid.hDiv.loading=!1;switch(e.p.loadui){case "enable":a("#load_"+a.jgrid.jqID(e.p.id)).hide();break;case "block":a("#lui_"+a.jgrid.jqID(e.p.id)).hide(),a("#load_"+a.jgrid.jqID(e.p.id)).hide()}},L=function(b){if(!e.grid.hDiv.loading){var c=e.p.scroll&&b===!1,d={},f,g=e.p.prmNames;if(e.p.page<=0)e.p.page=1;if(g.search!==null)d[g.search]=e.p.search;g.nd!==null&&(d[g.nd]=(new Date).getTime());
66
- if(g.rows!==null)d[g.rows]=e.p.rowNum;if(g.page!==null)d[g.page]=e.p.page;if(g.sort!==null)d[g.sort]=e.p.sortname;if(g.order!==null)d[g.order]=e.p.sortorder;if(e.p.rowTotal!==null&&g.totalrows!==null)d[g.totalrows]=e.p.rowTotal;var j=e.p.loadComplete,h=a.isFunction(j);h||(j=null);var m=0,b=b||1;b>1?g.npage!==null?(d[g.npage]=b,m=b-1,b=1):j=function(a){e.p.page++;e.grid.hDiv.loading=!1;h&&e.p.loadComplete.call(e,a);L(b-1)}:g.npage!==null&&delete e.p.postData[g.npage];e.p.grouping&&(a(e).jqGrid("groupingSetup"),
67
- e.p.groupingView.groupDataSorted===!0&&(d[g.sort]=e.p.groupingView.groupField[0]+" "+e.p.groupingView.groupOrder[0]+", "+d[g.sort]));a.extend(e.p.postData,d);var k=!e.p.scroll?1:e.rows.length-1;if(a.isFunction(e.p.datatype))e.p.datatype.call(e,e.p.postData,"load_"+e.p.id);else switch(a.isFunction(e.p.beforeRequest)&&e.p.beforeRequest.call(e),f=e.p.datatype.toLowerCase(),f){case "json":case "jsonp":case "xml":case "script":a.ajax(a.extend({url:e.p.url,type:e.p.mtype,dataType:f,data:a.isFunction(e.p.serializeGridData)?
68
- e.p.serializeGridData.call(e,e.p.postData):e.p.postData,success:function(a){f==="xml"?B(a,e.grid.bDiv,k,b>1,m):u(a,e.grid.bDiv,k,b>1,m);j&&j.call(e,a);c&&e.grid.populateVisible();if(e.p.loadonce||e.p.treeGrid)e.p.datatype="local";S()},error:function(b,c,d){a.isFunction(e.p.loadError)&&e.p.loadError.call(e,b,c,d);S()},beforeSend:function(b){O();a.isFunction(e.p.loadBeforeSend)&&e.p.loadBeforeSend.call(e,b)}},a.jgrid.ajaxOptions,e.p.ajaxGridOptions));break;case "xmlstring":O();d=a.jgrid.stringToDoc(e.p.datastr);
69
- B(d,e.grid.bDiv);h&&e.p.loadComplete.call(e,d);e.p.datatype="local";e.p.datastr=null;S();break;case "jsonstring":O();d=typeof e.p.datastr=="string"?a.jgrid.parse(e.p.datastr):e.p.datastr;u(d,e.grid.bDiv);h&&e.p.loadComplete.call(e,d);e.p.datatype="local";e.p.datastr=null;S();break;case "local":case "clientside":O(),e.p.datatype="local",d=N(),u(d,e.grid.bDiv,k,b>1,m),j&&j.call(e,d),c&&e.grid.populateVisible(),S()}}};k=function(b,c){var d="",f="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",
70
- g="",h,m,k,l,n=function(b){var c;a.isFunction(e.p.onPaging)&&(c=e.p.onPaging.call(e,b));e.p.selrow=null;if(e.p.multiselect)e.p.selarrrow=[],a("#cb_"+a.jgrid.jqID(e.p.id),e.grid.hDiv).attr("checked",!1);e.p.savedRow=[];if(c=="stop")return!1;return!0},b=b.substr(1);c+="_"+b;h="pg_"+b;m=b+"_left";k=b+"_center";l=b+"_right";a("#"+a.jgrid.jqID(b)).append("<div id='"+h+"' 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='"+
71
- m+"' align='left'></td><td id='"+k+"' align='center' style='white-space:pre;'></td><td id='"+l+"' align='right'></td></tr></tbody></table></div>").attr("dir","ltr");if(e.p.rowList.length>0){g="<td dir='"+j+"'>";g+="<select class='ui-pg-selbox' role='listbox'>";for(m=0;m<e.p.rowList.length;m++)g+='<option role="option" value="'+e.p.rowList[m]+'"'+(e.p.rowNum==e.p.rowList[m]?' selected="selected"':"")+">"+e.p.rowList[m]+"</option>";g+="</select></td>"}j=="rtl"&&(f+=g);e.p.pginput===!0&&(d="<td dir='"+
72
- j+"'>"+a.jgrid.format(e.p.pgtext||"","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1_"+a.jgrid.jqID(b)+"'></span>")+"</td>");e.p.pgbuttons===!0?(m=["first"+c,"prev"+c,"next"+c,"last"+c],j=="rtl"&&m.reverse(),f+="<td id='"+m[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>",f+="<td id='"+m[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>",f+=d!==""?"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>"+
73
- d+"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>":"",f+="<td id='"+m[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>",f+="<td id='"+m[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>"):d!==""&&(f+=d);j=="ltr"&&(f+=g);f+="</tr></tbody></table>";e.p.viewrecords===!0&&a("td#"+b+"_"+e.p.recordpos,"#"+h).append("<div dir='"+j+"' style='text-align:"+e.p.recordpos+
74
- "' class='ui-paging-info'></div>");a("td#"+b+"_"+e.p.pagerpos,"#"+h).append(f);g=a(".ui-jqgrid").css("font-size")||"11px";a(document.body).append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+g+";visibility:hidden;' ></div>");f=a(f).clone().appendTo("#testpg").width();a("#testpg").remove();f>0&&(d!==""&&(f+=50),a("td#"+b+"_"+e.p.pagerpos,"#"+h).width(f));e.p._nvtd=[];e.p._nvtd[0]=f?Math.floor((e.p.width-f)/2):Math.floor(e.p.width/3);e.p._nvtd[1]=0;f=null;a(".ui-pg-selbox",
75
- "#"+h).bind("change",function(){e.p.page=Math.round(e.p.rowNum*(e.p.page-1)/this.value-0.5)+1;e.p.rowNum=this.value;c?a(".ui-pg-selbox",e.p.pager).val(this.value):e.p.toppager&&a(".ui-pg-selbox",e.p.toppager).val(this.value);if(!n("records"))return!1;L();return!1});e.p.pgbuttons===!0&&(a(".ui-pg-button","#"+h).hover(function(){a(this).hasClass("ui-state-disabled")?this.style.cursor="default":(a(this).addClass("ui-state-hover"),this.style.cursor="pointer")},function(){if(!a(this).hasClass("ui-state-disabled"))a(this).removeClass("ui-state-hover"),
76
- this.style.cursor="default"}),a("#first"+a.jgrid.jqID(c)+", #prev"+a.jgrid.jqID(c)+", #next"+a.jgrid.jqID(c)+", #last"+a.jgrid.jqID(c)).click(function(){var a=p(e.p.page,1),b=p(e.p.lastpage,1),d=!1,f=!0,g=!0,j=!0,h=!0;b===0||b===1?h=j=g=f=!1:b>1&&a>=1?a===1?g=f=!1:!(a>1&&a<b)&&a===b&&(h=j=!1):b>1&&a===0&&(h=j=!1,a=b-1);if(this.id==="first"+c&&f)e.p.page=1,d=!0;if(this.id==="prev"+c&&g)e.p.page=a-1,d=!0;if(this.id==="next"+c&&j)e.p.page=a+1,d=!0;if(this.id==="last"+c&&h)e.p.page=b,d=!0;if(d){if(!n(this.id))return!1;
77
- L()}return!1}));e.p.pginput===!0&&a("input.ui-pg-input","#"+h).keypress(function(b){if((b.charCode?b.charCode:b.keyCode?b.keyCode:0)==13){e.p.page=a(this).val()>0?a(this).val():e.p.page;if(!n("user"))return!1;L();return!1}return this})};var G=function(b,c,d,f){if(e.p.colModel[c].sortable&&!(e.p.savedRow.length>0)){if(!d){if(e.p.lastsort==c)if(e.p.sortorder=="asc")e.p.sortorder="desc";else{if(e.p.sortorder=="desc")e.p.sortorder="asc"}else e.p.sortorder=e.p.colModel[c].firstsortorder||"asc";e.p.page=
9
+ (function(a){a.jgrid=a.jgrid||{};a.extend(a.jgrid,{htmlDecode:function(a){return a&&(a=="&nbsp;"||a=="&#160;"||a.length==1&&a.charCodeAt(0)==160)?"":!a?a:String(a).replace(/&amp;/g,"&").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"')},htmlEncode:function(a){return!a?a:String(a).replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\"/g,"&quot;")},format:function(b){var d=a.makeArray(arguments).slice(1);b===void 0&&(b="");return b.replace(/\{(\d+)\}/g,function(a,
10
+ b){return d[b]})},getCellIndex:function(b){b=a(b);if(b.is("tr"))return-1;b=(!b.is("td")&&!b.is("th")?b.closest("td,th"):b)[0];return a.browser.msie?a.inArray(b,b.parentNode.cells):b.cellIndex},stripHtml:function(a){a+="";var d=/<("[^"]*"|'[^']*'|[^'">])*>/gi;return a?(a=a.replace(d,""))&&a!=="&nbsp;"&&a!=="&#160;"?a.replace(/\"/g,"'"):"":a},stringToDoc:function(a){var d;if(typeof a!=="string")return a;try{d=(new DOMParser).parseFromString(a,"text/xml")}catch(c){d=new ActiveXObject("Microsoft.XMLDOM"),
11
+ d.async=!1,d.loadXML(a)}return d&&d.documentElement&&d.documentElement.tagName!="parsererror"?d:null},parse:function(b){b.substr(0,9)=="while(1);"&&(b=b.substr(9));b.substr(0,2)=="/*"&&(b=b.substr(2,b.length-4));b||(b="{}");return a.jgrid.useJSON===!0&&typeof JSON==="object"&&typeof JSON.parse==="function"?JSON.parse(b):eval("("+b+")")},parseDate:function(b,d){var c={m:1,d:1,y:1970,h:0,i:0,s:0},f,g,h;f=/[\\\/:_;.,\t\T\s-]/;if(d&&d!==null&&d!==void 0){var d=a.trim(d),d=d.split(f),b=b.split(f),j=a.jgrid.formatter.date.monthNames,
12
+ e=a.jgrid.formatter.date.AmPm,l=function(a,b){a===0?b==12&&(b=0):b!=12&&(b+=12);return b};f=0;for(g=b.length;f<g;f++){b[f]=="M"&&(h=a.inArray(d[f],j),h!==-1&&h<12&&(d[f]=h+1));b[f]=="F"&&(h=a.inArray(d[f],j),h!==-1&&h>11&&(d[f]=h+1-12));if(b[f]=="a"&&(h=a.inArray(d[f],e),h!==-1&&h<2&&d[f]==e[h]))d[f]=h,c.h=l(d[f],c.h);if(b[f]=="A"&&(h=a.inArray(d[f],e),h!==-1&&h>1&&d[f]==e[h]))d[f]=h-2,c.h=l(d[f],c.h);d[f]!==void 0&&(c[b[f].toLowerCase()]=parseInt(d[f],10))}c.m=parseInt(c.m,10)-1;f=c.y;if(f>=70&&
13
+ f<=99)c.y=1900+c.y;else if(f>=0&&f<=69)c.y=2E3+c.y}return new Date(c.y,c.m,c.d,c.h,c.i,c.s,0)},jqID:function(a){return String(a).replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g,"\\$&")},guid:1,uidPref:"jqg",randId:function(b){return(b?b:a.jgrid.uidPref)+a.jgrid.guid++},getAccessor:function(a,d){var c,f,g=[],h;if(typeof d==="function")return d(a);c=a[d];if(c===void 0)try{if(typeof d==="string"&&(g=d.split(".")),h=g.length)for(c=a;c&&h--;)f=g.shift(),c=c[f]}catch(j){}return c},ajaxOptions:{},from:function(b){return new function(b,
14
+ c){typeof b=="string"&&(b=a.data(b));var f=this,g=b,h=!0,j=!1,e=c,l=/[\$,%]/g,k=null,n=null,o=0,p=!1,m="",r=[],q=!0;if(typeof b=="object"&&b.push)b.length>0&&(q=typeof b[0]!="object"?!1:!0);else throw"data provides is not an array";this._hasData=function(){return g===null?!1:g.length===0?!1:!0};this._getStr=function(a){var b=[];j&&b.push("jQuery.trim(");b.push("String("+a+")");j&&b.push(")");h||b.push(".toLowerCase()");return b.join("")};this._strComp=function(a){return typeof a=="string"?".toString()":
15
+ ""};this._group=function(a,b){return{field:a.toString(),unique:b,items:[]}};this._toStr=function(b){j&&(b=a.trim(b));h||(b=b.toLowerCase());return b=b.toString().replace(/\\/g,"\\\\").replace(/\"/g,'\\"')};this._funcLoop=function(b){var c=[];a.each(g,function(a,e){c.push(b(e))});return c};this._append=function(a){var b;e===null?e="":e+=m===""?" && ":m;for(b=0;b<o;b++)e+="(";p&&(e+="!");e+="("+a+")";p=!1;m="";o=0};this._setCommand=function(a,b){k=a;n=b};this._resetNegate=function(){p=!1};this._repeatCommand=
16
+ function(a,b){return k===null?f:a!==null&&b!==null?k(a,b):n===null?k(a):!q?k(a):k(n,a)};this._equals=function(a,b){return f._compare(a,b,1)===0};this._compare=function(a,b,c){c===void 0&&(c=1);a===void 0&&(a=null);b===void 0&&(b=null);if(a===null&&b===null)return 0;if(a===null&&b!==null)return 1;if(a!==null&&b===null)return-1;!h&&typeof a!=="number"&&typeof b!=="number"&&(a=String(a).toLowerCase(),b=String(b).toLowerCase());return a<b?-c:a>b?c:0};this._performSort=function(){r.length!==0&&(g=f._doSort(g,
17
+ 0))};this._doSort=function(a,b){var c=r[b].by,e=r[b].dir,d=r[b].type,g=r[b].datefmt;if(b==r.length-1)return f._getOrder(a,c,e,d,g);b++;c=f._getGroup(a,c,e,d,g);e=[];for(d=0;d<c.length;d++)for(var g=f._doSort(c[d].items,b),h=0;h<g.length;h++)e.push(g[h]);return e};this._getOrder=function(b,c,e,d,g){var h=[],j=[],m=e=="a"?1:-1,k,n;d===void 0&&(d="text");n=d=="float"||d=="number"||d=="currency"||d=="numeric"?function(a){a=parseFloat(String(a).replace(l,""));return isNaN(a)?0:a}:d=="int"||d=="integer"?
18
+ function(a){return a?parseFloat(String(a).replace(l,"")):0}:d=="date"||d=="datetime"?function(b){return a.jgrid.parseDate(g,b).getTime()}:a.isFunction(d)?d:function(b){b||(b="");return a.trim(String(b).toUpperCase())};a.each(b,function(b,e){k=c!==""?a.jgrid.getAccessor(e,c):e;k===void 0&&(k="");k=n(k,e);j.push({vSort:k,index:b})});j.sort(function(a,b){a=a.vSort;b=b.vSort;return f._compare(a,b,m)});for(var d=0,o=b.length;d<o;)e=j[d].index,h.push(b[e]),d++;return h};this._getGroup=function(b,c,e,d,
19
+ g){var h=[],j=null,m=null,k;a.each(f._getOrder(b,c,e,d,g),function(b,e){k=a.jgrid.getAccessor(e,c);k===void 0&&(k="");f._equals(m,k)||(m=k,j!==null&&h.push(j),j=f._group(c,k));j.items.push(e)});j!==null&&h.push(j);return h};this.ignoreCase=function(){h=!1;return f};this.useCase=function(){h=!0;return f};this.trim=function(){j=!0;return f};this.noTrim=function(){j=!1;return f};this.execute=function(){var b=e,c=[];if(b===null)return f;a.each(g,function(){eval(b)&&c.push(this)});g=c;return f};this.data=
20
+ function(){return g};this.select=function(b){f._performSort();if(!f._hasData())return[];f.execute();if(a.isFunction(b)){var c=[];a.each(g,function(a,e){c.push(b(e))});return c}return g};this.hasMatch=function(){if(!f._hasData())return!1;f.execute();return g.length>0};this.andNot=function(a,b,c){p=!p;return f.and(a,b,c)};this.orNot=function(a,b,c){p=!p;return f.or(a,b,c)};this.not=function(a,b,c){return f.andNot(a,b,c)};this.and=function(a,b,c){m=" && ";return a===void 0?f:f._repeatCommand(a,b,c)};
21
+ this.or=function(a,b,c){m=" || ";return a===void 0?f:f._repeatCommand(a,b,c)};this.orBegin=function(){o++;return f};this.orEnd=function(){e!==null&&(e+=")");return f};this.isNot=function(a){p=!p;return f.is(a)};this.is=function(a){f._append("this."+a);f._resetNegate();return f};this._compareValues=function(b,c,e,d,g){var h;h=q?"jQuery.jgrid.getAccessor(this,'"+c+"')":"this";e===void 0&&(e=null);var j=e,m=g.stype===void 0?"text":g.stype;if(e!==null)switch(m){case "int":case "integer":j=isNaN(Number(j))||
22
+ j===""?"0":j;h="parseInt("+h+",10)";j="parseInt("+j+",10)";break;case "float":case "number":case "numeric":j=String(j).replace(l,"");j=isNaN(Number(j))||j===""?"0":j;h="parseFloat("+h+")";j="parseFloat("+j+")";break;case "date":case "datetime":j=String(a.jgrid.parseDate(g.newfmt||"Y-m-d",j).getTime());h='jQuery.jgrid.parseDate("'+g.srcfmt+'",'+h+").getTime()";break;default:h=f._getStr(h),j=f._getStr('"'+f._toStr(j)+'"')}f._append(h+" "+d+" "+j);f._setCommand(b,c);f._resetNegate();return f};this.equals=
23
+ function(a,b,c){return f._compareValues(f.equals,a,b,"==",c)};this.notEquals=function(a,b,c){return f._compareValues(f.equals,a,b,"!==",c)};this.isNull=function(a,b,c){return f._compareValues(f.equals,a,null,"===",c)};this.greater=function(a,b,c){return f._compareValues(f.greater,a,b,">",c)};this.less=function(a,b,c){return f._compareValues(f.less,a,b,"<",c)};this.greaterOrEquals=function(a,b,c){return f._compareValues(f.greaterOrEquals,a,b,">=",c)};this.lessOrEquals=function(a,b,c){return f._compareValues(f.lessOrEquals,
24
+ a,b,"<=",c)};this.startsWith=function(b,c){var e=c===void 0||c===null?b:c,e=j?a.trim(e.toString()).length:e.toString().length;q?f._append(f._getStr("jQuery.jgrid.getAccessor(this,'"+b+"')")+".substr(0,"+e+") == "+f._getStr('"'+f._toStr(c)+'"')):(e=j?a.trim(c.toString()).length:c.toString().length,f._append(f._getStr("this")+".substr(0,"+e+") == "+f._getStr('"'+f._toStr(b)+'"')));f._setCommand(f.startsWith,b);f._resetNegate();return f};this.endsWith=function(b,c){var e=c===void 0||c===null?b:c,e=j?
25
+ a.trim(e.toString()).length:e.toString().length;q?f._append(f._getStr("jQuery.jgrid.getAccessor(this,'"+b+"')")+".substr("+f._getStr("jQuery.jgrid.getAccessor(this,'"+b+"')")+".length-"+e+","+e+') == "'+f._toStr(c)+'"'):f._append(f._getStr("this")+".substr("+f._getStr("this")+'.length-"'+f._toStr(b)+'".length,"'+f._toStr(b)+'".length) == "'+f._toStr(b)+'"');f._setCommand(f.endsWith,b);f._resetNegate();return f};this.contains=function(a,b){q?f._append(f._getStr("jQuery.jgrid.getAccessor(this,'"+a+
26
+ "')")+'.indexOf("'+f._toStr(b)+'",0) > -1'):f._append(f._getStr("this")+'.indexOf("'+f._toStr(a)+'",0) > -1');f._setCommand(f.contains,a);f._resetNegate();return f};this.groupBy=function(a,b,c,e){return!f._hasData()?null:f._getGroup(g,a,b,c,e)};this.orderBy=function(b,c,e,d){c=c===void 0||c===null?"a":a.trim(c.toString().toLowerCase());if(e===null||e===void 0)e="text";if(d===null||d===void 0)d="Y-m-d";if(c=="desc"||c=="descending")c="d";if(c=="asc"||c=="ascending")c="a";r.push({by:b,dir:c,type:e,
27
+ datefmt:d});return f};return f}(b,null)},extend:function(b){a.extend(a.fn.jqGrid,b);this.no_legacy_api||a.fn.extend(b)}});a.fn.jqGrid=function(b){if(typeof b=="string"){var d=a.jgrid.getAccessor(a.fn.jqGrid,b);if(!d)throw"jqGrid - No such method: "+b;var c=a.makeArray(arguments).slice(1);return d.apply(this,c)}return this.each(function(){if(!this.grid){var c=a.extend(!0,{url:"",height:150,page:1,rowNum:20,rowTotal:null,records:0,pager:"",pgbuttons:!0,pginput:!0,colModel:[],rowList:[],colNames:[],
28
+ sortorder:"asc",sortname:"",datatype:"xml",mtype:"GET",altRows:!1,selarrrow:[],savedRow:[],shrinkToFit:!0,xmlReader:{},jsonReader:{},subGrid:!1,subGridModel:[],reccount:0,lastpage:0,lastsort:0,selrow:null,beforeSelectRow:null,onSelectRow:null,onSortCol:null,ondblClickRow:null,onRightClickRow:null,onPaging:null,onSelectAll:null,loadComplete:null,gridComplete:null,loadError:null,loadBeforeSend:null,afterInsertRow:null,beforeRequest:null,onHeaderClick:null,viewrecords:!1,loadonce:!1,multiselect:!1,multikey:!1,
29
+ editurl:null,search:!1,caption:"",hidegrid:!0,hiddengrid:!1,postData:{},userData:{},treeGrid:!1,treeGridModel:"nested",treeReader:{},treeANode:-1,ExpandColumn:null,tree_root_level:0,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"},forceFit:!1,gridstate:"visible",cellEdit:!1,cellsubmit:"remote",nv:0,loadui:"enable",toolbar:[!1,""],scroll:!1,multiboxonly:!1,
30
+ deselectAfterSort:!0,scrollrows:!1,autowidth:!1,scrollOffset:18,cellLayout:5,subGridWidth:20,multiselectWidth:20,gridview:!1,rownumWidth:25,rownumbers:!1,pagerpos:"center",recordpos:"right",footerrow:!1,userDataOnFooter:!1,hoverrows:!0,altclass:"ui-priority-secondary",viewsortcols:[!1,"vertical",!0],resizeclass:"",autoencode:!1,remapColumns:[],ajaxGridOptions:{},direction:"ltr",toppager:!1,headertitles:!1,scrollTimeout:40,data:[],_index:{},grouping:!1,groupingView:{groupField:[],groupOrder:[],groupText:[],
31
+ groupColumnShow:[],groupSummary:[],showSummaryOnHide:!1,sortitems:[],sortnames:[],groupDataSorted:!1,summary:[],summaryval:[],plusicon:"ui-icon-circlesmall-plus",minusicon:"ui-icon-circlesmall-minus"},ignoreCase:!1,cmTemplate:{}},a.jgrid.defaults,b||{}),d={headers:[],cols:[],footers:[],dragStart:function(b,e,d){this.resizing={idx:b,startX:e.clientX,sOL:d[0]};this.hDiv.style.cursor="col-resize";this.curGbox=a("#rs_m"+a.jgrid.jqID(c.id),"#gbox_"+a.jgrid.jqID(c.id));this.curGbox.css({display:"block",
32
+ left:d[0],top:d[1],height:d[2]});a.isFunction(c.resizeStart)&&c.resizeStart.call(this,e,b);document.onselectstart=function(){return!1}},dragMove:function(a){if(this.resizing){var b=a.clientX-this.resizing.startX,a=this.headers[this.resizing.idx],e=c.direction==="ltr"?a.width+b:a.width-b,d;if(e>33)if(this.curGbox.css({left:this.resizing.sOL+b}),c.forceFit===!0){if(d=this.headers[this.resizing.idx+c.nv],b=c.direction==="ltr"?d.width-b:d.width+b,b>33)a.newWidth=e,d.newWidth=b}else this.newWidth=c.direction===
33
+ "ltr"?c.tblwidth+b:c.tblwidth-b,a.newWidth=e}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var b=this.resizing.idx,e=this.headers[b].newWidth||this.headers[b].width,e=parseInt(e,10);this.resizing=!1;a("#rs_m"+a.jgrid.jqID(c.id)).css("display","none");c.colModel[b].width=e;this.headers[b].width=e;this.headers[b].el.style.width=e+"px";this.cols[b].style.width=e+"px";if(this.footers.length>0)this.footers[b].style.width=e+"px";if(c.forceFit===!0){e=this.headers[b+c.nv].newWidth||
34
+ this.headers[b+c.nv].width;this.headers[b+c.nv].width=e;this.headers[b+c.nv].el.style.width=e+"px";this.cols[b+c.nv].style.width=e+"px";if(this.footers.length>0)this.footers[b+c.nv].style.width=e+"px";c.colModel[b+c.nv].width=e}else if(c.tblwidth=this.newWidth||c.tblwidth,a("table:first",this.bDiv).css("width",c.tblwidth+"px"),a("table:first",this.hDiv).css("width",c.tblwidth+"px"),this.hDiv.scrollLeft=this.bDiv.scrollLeft,c.footerrow)a("table:first",this.sDiv).css("width",c.tblwidth+"px"),this.sDiv.scrollLeft=
35
+ this.bDiv.scrollLeft;a.isFunction(c.resizeStop)&&c.resizeStop.call(this,e,b)}this.curGbox=null;document.onselectstart=function(){return!0}},populateVisible:function(){d.timer&&clearTimeout(d.timer);d.timer=null;var b=a(d.bDiv).height();if(b){var e=a("table:first",d.bDiv),h,j;if(e[0].rows.length)try{j=(h=e[0].rows[1])?a(h).outerHeight()||d.prevRowHeight:d.prevRowHeight}catch(m){j=d.prevRowHeight}if(j){d.prevRowHeight=j;var k=c.rowNum;h=d.scrollTop=d.bDiv.scrollTop;var n=Math.round(e.position().top)-
36
+ h,o=n+e.height();j*=k;var l,p,q;if(o<b&&n<=0&&(c.lastpage===void 0||parseInt((o+h+j-1)/j,10)<=c.lastpage))p=parseInt((b-o+j-1)/j,10),o>=0||p<2||c.scroll===!0?(l=Math.round((o+h)/j)+1,n=-1):n=1;n>0&&(l=parseInt(h/j,10)+1,p=parseInt((h+b)/j,10)+2-l,q=!0);if(p&&!(c.lastpage&&l>c.lastpage||c.lastpage==1||l===c.page&&l===c.lastpage))d.hDiv.loading?d.timer=setTimeout(d.populateVisible,c.scrollTimeout):(c.page=l,q&&(d.selectionPreserver(e[0]),d.emptyRows(d.bDiv,!1,!1)),d.populate(p))}}},scrollGrid:function(a){if(c.scroll){var b=
37
+ d.bDiv.scrollTop;if(d.scrollTop===void 0)d.scrollTop=0;if(b!=d.scrollTop)d.scrollTop=b,d.timer&&clearTimeout(d.timer),d.timer=setTimeout(d.populateVisible,c.scrollTimeout)}d.hDiv.scrollLeft=d.bDiv.scrollLeft;if(c.footerrow)d.sDiv.scrollLeft=d.bDiv.scrollLeft;a&&a.stopPropagation()},selectionPreserver:function(b){var c=b.p,e=c.selrow,d=c.selarrrow?a.makeArray(c.selarrrow):null,f=b.grid.bDiv.scrollLeft,h=c.gridComplete;c.gridComplete=function(){c.selrow=null;c.selarrrow=[];if(c.multiselect&&d&&d.length>
38
+ 0)for(var j=0;j<d.length;j++)d[j]!=e&&a(b).jqGrid("setSelection",d[j],!1);e&&a(b).jqGrid("setSelection",e,!1);b.grid.bDiv.scrollLeft=f;c.gridComplete=h;c.gridComplete&&h()}}};if(this.tagName.toUpperCase()!="TABLE")alert("Element is not a table");else{a(this).empty().attr("tabindex","1");this.p=c;var h,j,e;if(this.p.colNames.length===0)for(h=0;h<this.p.colModel.length;h++)this.p.colNames[h]=this.p.colModel[h].label||this.p.colModel[h].name;if(this.p.colNames.length!==this.p.colModel.length)alert(a.jgrid.errors.model);
39
+ else{var l=a("<div class='ui-jqgrid-view'></div>"),k,n=a.browser.msie?!0:!1,o=a.browser.webkit||a.browser.safari?!0:!1;e=this;e.p.direction=a.trim(e.p.direction.toLowerCase());if(a.inArray(e.p.direction,["ltr","rtl"])==-1)e.p.direction="ltr";j=e.p.direction;a(l).insertBefore(this);a(this).appendTo(l).removeClass("scroll");var p=a("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");a(p).insertBefore(l).attr({id:"gbox_"+this.id,dir:j});a(l).appendTo(p).attr("id","gview_"+this.id);
40
+ k=n&&a.browser.version<=6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':"";a("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(k).insertBefore(l);a("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(l);a(this).attr({cellspacing:"0",cellpadding:"0",border:"0",role:"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+
41
+ this.id});var m=function(a,b){a=parseInt(a,10);return isNaN(a)?b?b:0:a},r=function(b,c,f,h,j,m){var k=e.p.colModel[b],n=k.align,o='style="',l=k.classes,p=k.name,q=[];n&&(o+="text-align:"+n+";");k.hidden===!0&&(o+="display:none;");if(c===0)o+="width: "+d.headers[b].width+"px;";else if(k.cellattr&&a.isFunction(k.cellattr)&&(b=k.cellattr.call(e,j,f,h,k,m))&&typeof b==="string"){b=b.replace(/style/i,"style").replace(/title/i,"title");if(b.indexOf("title")>-1)k.title=!1;b.indexOf("class")>-1&&(l=void 0);
42
+ q=b.split("style");if(q.length===2){q[1]=a.trim(q[1].replace("=",""));if(q[1].indexOf("'")===0||q[1].indexOf('"')===0)q[1]=q[1].substring(1);o+=q[1].replace(/'/gi,'"')}else o+='"'}q.length||(q[0]="",o+='"');o+=(l!==void 0?' class="'+l+'"':"")+(k.title&&f?' title="'+a.jgrid.stripHtml(f)+'"':"");o+=' aria-describedby="'+e.p.id+"_"+p+'"';return o+q[0]},q=function(b){return b===void 0||b===null||b===""?"&#160;":e.p.autoencode?a.jgrid.htmlEncode(b):b+""},s=function(b,c,d,f,h){var j=e.p.colModel[d];typeof j.formatter!==
43
+ "undefined"?(b={rowId:b,colModel:j,gid:e.p.id,pos:d},c=a.isFunction(j.formatter)?j.formatter.call(e,c,b,f,h):a.fmatter?a.fn.fmatter(j.formatter,c,b,f,h):q(c)):c=q(c);return c},t=function(a,b,c,e,d){b=s(a,b,c,d,"add");return'<td role="gridcell" '+r(c,e,b,d,a,!0)+">"+b+"</td>"},w=function(a,b,c){var d='<input role="checkbox" type="checkbox" id="jqg_'+e.p.id+"_"+a+'" class="cbox" name="jqg_'+e.p.id+"_"+a+'"/>';return'<td role="gridcell" '+r(b,c,"",null,a,!0)+">"+d+"</td>"},v=function(a,b,c,e){c=(parseInt(c,
44
+ 10)-1)*parseInt(e,10)+1+b;return'<td role="gridcell" class="ui-state-default jqgrid-rownum" '+r(a,b,c,null,b,!0)+">"+c+"</td>"},z=function(a){var b,c=[],d=0,f;for(f=0;f<e.p.colModel.length;f++)b=e.p.colModel[f],b.name!=="cb"&&b.name!=="subgrid"&&b.name!=="rn"&&(c[d]=a=="local"?b.name:a=="xml"?b.xmlmap||b.name:b.jsonmap||b.name,d++);return c},D=function(b){var c=e.p.remapColumns;if(!c||!c.length)c=a.map(e.p.colModel,function(a,b){return b});b&&(c=a.map(c,function(a){return a<b?null:a-b}));return c},
45
+ y=function(b,c,d){if(e.p.deepempty)a("#"+a.jgrid.jqID(e.p.id)+" tbody:first tr:gt(0)").remove();else{var f=a("#"+a.jgrid.jqID(e.p.id)+" tbody:first tr:first")[0];a("#"+a.jgrid.jqID(e.p.id)+" tbody:first").empty().append(f)}if(c&&e.p.scroll)a(">div:first",b).css({height:"auto"}).children("div:first").css({height:0,display:"none"}),b.scrollTop=0;if(d===!0&&e.p.treeGrid===!0)e.p.data=[],e.p._index={}},B=function(){var b=e.p.data.length,c,d,f;c=e.p.rownumbers===!0?1:0;d=e.p.multiselect===!0?1:0;f=e.p.subGrid===
46
+ !0?1:0;c=e.p.keyIndex===!1||e.p.loadonce===!0?e.p.localReader.id:e.p.colModel[e.p.keyIndex+d+f+c].name;for(d=0;d<b;d++)f=a.jgrid.getAccessor(e.p.data[d],c),e.p._index[f]=d},A=function(b,c,d,f,j){var h=new Date,g=e.p.datatype!="local"&&e.p.loadonce||e.p.datatype=="xmlstring",k=e.p.datatype=="local"?"local":"xml";if(g)e.p.data=[],e.p._index={},e.p.localReader.id="_id_";e.p.reccount=0;if(a.isXMLDoc(b)){e.p.treeANode===-1&&!e.p.scroll?(y(c,!1,!0),d=1):d=d>1?d:1;var m,o,n=0,l,p=0,q=0,s=0,r,u=[],B,C={},
47
+ E,x,A=[],H=e.p.altRows===!0?" "+e.p.altclass:"";e.p.xmlReader.repeatitems||(u=z(k));r=e.p.keyIndex===!1?e.p.xmlReader.id:e.p.keyIndex;u.length>0&&!isNaN(r)&&(e.p.remapColumns&&e.p.remapColumns.length&&(r=a.inArray(r,e.p.remapColumns)),r=u[r]);k=(r+"").indexOf("[")===-1?u.length?function(b,c){return a(r,b).text()||c}:function(b,c){return a(e.p.xmlReader.cell,b).eq(r).text()||c}:function(a,b){return a.getAttribute(r.replace(/[\[\]]/g,""))||b};e.p.userData={};a(e.p.xmlReader.page,b).each(function(){e.p.page=
48
+ this.textContent||this.text||0});a(e.p.xmlReader.total,b).each(function(){e.p.lastpage=this.textContent||this.text;if(e.p.lastpage===void 0)e.p.lastpage=1});a(e.p.xmlReader.records,b).each(function(){e.p.records=this.textContent||this.text||0});a(e.p.xmlReader.userdata,b).each(function(){e.p.userData[this.getAttribute("name")]=a(this).text()});(b=a(e.p.xmlReader.root+" "+e.p.xmlReader.row,b))||(b=[]);var L=b.length,F=0,I={},P;if(b&&L){P=parseInt(e.p.rowNum,10);var O=e.p.scroll?a.jgrid.randId():1;
49
+ j&&(P*=j+1);var j=a.isFunction(e.p.afterInsertRow),Q="";for(e.p.grouping&&e.p.groupingView.groupCollapse===!0&&(Q=' style="display:none;"');F<L;){E=b[F];x=k(E,O+F);m=d===0?0:d+1;m=(m+F)%2==1?H:"";A.push("<tr"+Q+' id="'+x+'" tabindex="-1" role="row" class ="ui-widget-content jqgrow ui-row-'+e.p.direction+""+m+'">');e.p.rownumbers===!0&&(A.push(v(0,F,e.p.page,e.p.rowNum)),s=1);e.p.multiselect===!0&&(A.push(w(x,s,F)),p=1);e.p.subGrid===!0&&(A.push(a(e).jqGrid("addSubGridCell",p+s,F+d)),q=1);if(e.p.xmlReader.repeatitems){B||
50
+ (B=D(p+q+s));var S=a(e.p.xmlReader.cell,E);a.each(B,function(a){var b=S[this];if(!b)return!1;l=b.textContent||b.text;C[e.p.colModel[a+p+q+s].name]=l;A.push(t(x,l,a+p+q+s,F+d,E))})}else for(m=0;m<u.length;m++)l=a(u[m],E).text(),C[e.p.colModel[m+p+q+s].name]=l,A.push(t(x,l,m+p+q+s,F+d,E));A.push("</tr>");if(e.p.grouping){m=e.p.groupingView.groupField.length;for(var N=[],J=0;J<m;J++)N.push(C[e.p.groupingView.groupField[J]]);I=a(e).jqGrid("groupingPrepare",A,N,I,C);A=[]}if(g||e.p.treeGrid===!0)C._id_=
51
+ x,e.p.data.push(C),e.p._index[x]=e.p.data.length-1;e.p.gridview===!1&&(a("tbody:first",c).append(A.join("")),j&&e.p.afterInsertRow.call(e,x,C,E),A=[]);C={};n++;F++;if(n==P)break}}e.p.gridview===!0&&(o=e.p.treeANode>-1?e.p.treeANode:0,e.p.grouping?(a(e).jqGrid("groupingRender",I,e.p.colModel.length),I=null):e.p.treeGrid===!0&&o>0?a(e.rows[o]).after(A.join("")):a("tbody:first",c).append(A.join("")));if(e.p.subGrid===!0)try{a(e).jqGrid("addSubGrid",p+s)}catch(K){}e.p.totaltime=new Date-h;if(n>0&&e.p.records===
52
+ 0)e.p.records=L;A=null;if(e.p.treeGrid===!0)try{a(e).jqGrid("setTreeNode",o+1,n+o+1)}catch(M){}if(!e.p.treeGrid&&!e.p.scroll)e.grid.bDiv.scrollTop=0;e.p.reccount=n;e.p.treeANode=-1;e.p.userDataOnFooter&&a(e).jqGrid("footerData","set",e.p.userData,!0);if(g)e.p.records=L,e.p.lastpage=Math.ceil(L/P);f||e.updatepager(!1,!0);if(g)for(;n<L;){E=b[n];x=k(E,n);if(e.p.xmlReader.repeatitems){B||(B=D(p+q+s));var G=a(e.p.xmlReader.cell,E);a.each(B,function(a){var b=G[this];if(!b)return!1;l=b.textContent||b.text;
53
+ C[e.p.colModel[a+p+q+s].name]=l})}else for(m=0;m<u.length;m++)l=a(u[m],E).text(),C[e.p.colModel[m+p+q+s].name]=l;C._id_=x;e.p.data.push(C);e.p._index[x]=e.p.data.length-1;C={};n++}}},u=function(b,c,d,f,j){var h=new Date;if(b){e.p.treeANode===-1&&!e.p.scroll?(y(c,!1,!0),d=1):d=d>1?d:1;var g,m=e.p.datatype!="local"&&e.p.loadonce||e.p.datatype=="jsonstring";if(m)e.p.data=[],e.p._index={},e.p.localReader.id="_id_";e.p.reccount=0;e.p.datatype=="local"?(c=e.p.localReader,g="local"):(c=e.p.jsonReader,g=
54
+ "json");var k=0,o,n,l=[],p,q=0,s=0,r=0,u,B,C={},E,x,A=[],H=e.p.altRows===!0?" "+e.p.altclass:"";e.p.page=a.jgrid.getAccessor(b,c.page)||0;u=a.jgrid.getAccessor(b,c.total);e.p.lastpage=u===void 0?1:u;e.p.records=a.jgrid.getAccessor(b,c.records)||0;e.p.userData=a.jgrid.getAccessor(b,c.userdata)||{};c.repeatitems||(p=l=z(g));g=e.p.keyIndex===!1?c.id:e.p.keyIndex;l.length>0&&!isNaN(g)&&(e.p.remapColumns&&e.p.remapColumns.length&&(g=a.inArray(g,e.p.remapColumns)),g=l[g]);(B=a.jgrid.getAccessor(b,c.root))||
55
+ (B=[]);u=B.length;var b=0,F=parseInt(e.p.rowNum,10),L=e.p.scroll?a.jgrid.randId():1;j&&(F*=j+1);var I=a.isFunction(e.p.afterInsertRow),P={},O="";for(e.p.grouping&&e.p.groupingView.groupCollapse===!0&&(O=' style="display:none;"');b<u;){j=B[b];x=a.jgrid.getAccessor(j,g);x===void 0&&(x=L+b,l.length===0&&c.cell&&(x=a.jgrid.getAccessor(j,c.cell)[g]||x));o=d===1?0:d;o=(o+b)%2==1?H:"";A.push("<tr"+O+' id="'+x+'" tabindex="-1" role="row" class= "ui-widget-content jqgrow ui-row-'+e.p.direction+""+o+'">');
56
+ e.p.rownumbers===!0&&(A.push(v(0,b,e.p.page,e.p.rowNum)),r=1);e.p.multiselect&&(A.push(w(x,r,b)),q=1);e.p.subGrid&&(A.push(a(e).jqGrid("addSubGridCell",q+r,b+d)),s=1);c.repeatitems&&(c.cell&&(j=a.jgrid.getAccessor(j,c.cell)),p||(p=D(q+s+r)));for(n=0;n<p.length;n++)o=a.jgrid.getAccessor(j,p[n]),A.push(t(x,o,n+q+s+r,b+d,j)),C[e.p.colModel[n+q+s+r].name]=o;A.push("</tr>");if(e.p.grouping){o=e.p.groupingView.groupField.length;n=[];for(var Q=0;Q<o;Q++)n.push(C[e.p.groupingView.groupField[Q]]);P=a(e).jqGrid("groupingPrepare",
57
+ A,n,P,C);A=[]}if(m||e.p.treeGrid===!0)C._id_=x,e.p.data.push(C),e.p._index[x]=e.p.data.length-1;e.p.gridview===!1&&(a("#"+a.jgrid.jqID(e.p.id)+" tbody:first").append(A.join("")),I&&e.p.afterInsertRow.call(e,x,C,j),A=[]);C={};k++;b++;if(k==F)break}e.p.gridview===!0&&(E=e.p.treeANode>-1?e.p.treeANode:0,e.p.grouping?a(e).jqGrid("groupingRender",P,e.p.colModel.length):e.p.treeGrid===!0&&E>0?a(e.rows[E]).after(A.join("")):a("#"+a.jgrid.jqID(e.p.id)+" tbody:first").append(A.join("")));if(e.p.subGrid===
58
+ !0)try{a(e).jqGrid("addSubGrid",q+r)}catch(J){}e.p.totaltime=new Date-h;if(k>0&&e.p.records===0)e.p.records=u;if(e.p.treeGrid===!0)try{a(e).jqGrid("setTreeNode",E+1,k+E+1)}catch(S){}if(!e.p.treeGrid&&!e.p.scroll)e.grid.bDiv.scrollTop=0;e.p.reccount=k;e.p.treeANode=-1;e.p.userDataOnFooter&&a(e).jqGrid("footerData","set",e.p.userData,!0);if(m)e.p.records=u,e.p.lastpage=Math.ceil(u/F);f||e.updatepager(!1,!0);if(m)for(;k<u&&B[k];){j=B[k];x=a.jgrid.getAccessor(j,g);x===void 0&&(x=L+k,l.length===0&&c.cell&&
59
+ (x=a.jgrid.getAccessor(j,c.cell)[g]||x));if(j){c.repeatitems&&(c.cell&&(j=a.jgrid.getAccessor(j,c.cell)),p||(p=D(q+s+r)));for(n=0;n<p.length;n++)o=a.jgrid.getAccessor(j,p[n]),C[e.p.colModel[n+q+s+r].name]=o;C._id_=x;e.p.data.push(C);e.p._index[x]=e.p.data.length-1;C={}}k++}}},J=function(){function b(c){var d=0,j,h,g,m,k;if(c.groups!==void 0){(h=c.groups.length&&c.groupOp.toString().toUpperCase()==="OR")&&l.orBegin();for(j=0;j<c.groups.length;j++){d>0&&h&&l.or();try{b(c.groups[j])}catch(n){alert(n)}d++}h&&
60
+ l.orEnd()}if(c.rules!==void 0){d>0&&(h=l.select(),l=a.jgrid.from(h),e.p.ignoreCase&&(l=l.ignoreCase()));try{(g=c.rules.length&&c.groupOp.toString().toUpperCase()==="OR")&&l.orBegin();for(j=0;j<c.rules.length;j++)k=c.rules[j],m=c.groupOp.toString().toUpperCase(),o[k.op]&&k.field&&(d>0&&m&&m==="OR"&&(l=l.or()),l=o[k.op](l,m)(k.field,k.data,f[k.field])),d++;g&&l.orEnd()}catch(p){alert(p)}}}var c,d=!1,f={},j=[],h=[],g,m,k;if(a.isArray(e.p.data)){var n=e.p.grouping?e.p.groupingView:!1;a.each(e.p.colModel,
61
+ function(){m=this.sorttype||"text";m=="date"||m=="datetime"?(this.formatter&&typeof this.formatter==="string"&&this.formatter=="date"?(g=this.formatoptions&&this.formatoptions.srcformat?this.formatoptions.srcformat:a.jgrid.formatter.date.srcformat,k=this.formatoptions&&this.formatoptions.newformat?this.formatoptions.newformat:a.jgrid.formatter.date.newformat):g=k=this.datefmt||"Y-m-d",f[this.name]={stype:m,srcfmt:g,newfmt:k}):f[this.name]={stype:m,srcfmt:"",newfmt:""};if(e.p.grouping&&this.name==
62
+ n.groupField[0]){var b=this.name;if(typeof this.index!="undefined")b=this.index;j[0]=f[b];h.push(b)}if(!d&&(this.index==e.p.sortname||this.name==e.p.sortname))c=this.name,d=!0});if(e.p.treeGrid)a(e).jqGrid("SortTree",c,e.p.sortorder,f[c].stype,f[c].srcfmt);else{var o={eq:function(a){return a.equals},ne:function(a){return a.notEquals},lt:function(a){return a.less},le:function(a){return a.lessOrEquals},gt:function(a){return a.greater},ge:function(a){return a.greaterOrEquals},cn:function(a){return a.contains},
63
+ nc:function(a,b){return b==="OR"?a.orNot().contains:a.andNot().contains},bw:function(a){return a.startsWith},bn:function(a,b){return b==="OR"?a.orNot().startsWith:a.andNot().startsWith},en:function(a,b){return b==="OR"?a.orNot().endsWith:a.andNot().endsWith},ew:function(a){return a.endsWith},ni:function(a,b){return b==="OR"?a.orNot().equals:a.andNot().equals},"in":function(a){return a.equals},nu:function(a){return a.isNull},nn:function(a,b){return b==="OR"?a.orNot().isNull:a.andNot().isNull}},l=a.jgrid.from(e.p.data);
64
+ e.p.ignoreCase&&(l=l.ignoreCase());if(e.p.search===!0){var p=e.p.postData.filters;if(p)typeof p=="string"&&(p=a.jgrid.parse(p)),b(p);else try{l=o[e.p.postData.searchOper](l)(e.p.postData.searchField,e.p.postData.searchString,f[e.p.postData.searchField])}catch(q){}}if(e.p.grouping)l.orderBy(h,n.groupOrder[0],j[0].stype,j[0].srcfmt),n.groupDataSorted=!0;c&&e.p.sortorder&&d&&(e.p.sortorder.toUpperCase()=="DESC"?l.orderBy(e.p.sortname,"d",f[c].stype,f[c].srcfmt):l.orderBy(e.p.sortname,"a",f[c].stype,
65
+ f[c].srcfmt));var p=l.select(),r=parseInt(e.p.rowNum,10),s=p.length,t=parseInt(e.p.page,10),w=Math.ceil(s/r),v={},p=p.slice((t-1)*r,t*r),f=l=null;v[e.p.localReader.total]=w;v[e.p.localReader.page]=t;v[e.p.localReader.records]=s;v[e.p.localReader.root]=p;p=null;return v}}},N=function(){e.grid.hDiv.loading=!0;if(!e.p.hiddengrid)switch(e.p.loadui){case "enable":a("#load_"+a.jgrid.jqID(e.p.id)).show();break;case "block":a("#lui_"+a.jgrid.jqID(e.p.id)).show(),a("#load_"+a.jgrid.jqID(e.p.id)).show()}},
66
+ T=function(){e.grid.hDiv.loading=!1;switch(e.p.loadui){case "enable":a("#load_"+a.jgrid.jqID(e.p.id)).hide();break;case "block":a("#lui_"+a.jgrid.jqID(e.p.id)).hide(),a("#load_"+a.jgrid.jqID(e.p.id)).hide()}},M=function(b){if(!e.grid.hDiv.loading){var c=e.p.scroll&&b===!1,d={},f,j=e.p.prmNames;if(e.p.page<=0)e.p.page=1;if(j.search!==null)d[j.search]=e.p.search;j.nd!==null&&(d[j.nd]=(new Date).getTime());if(j.rows!==null)d[j.rows]=e.p.rowNum;if(j.page!==null)d[j.page]=e.p.page;if(j.sort!==null)d[j.sort]=
67
+ e.p.sortname;if(j.order!==null)d[j.order]=e.p.sortorder;if(e.p.rowTotal!==null&&j.totalrows!==null)d[j.totalrows]=e.p.rowTotal;var h=e.p.loadComplete,g=a.isFunction(h);g||(h=null);var m=0,b=b||1;b>1?j.npage!==null?(d[j.npage]=b,m=b-1,b=1):h=function(a){e.p.page++;e.grid.hDiv.loading=!1;g&&e.p.loadComplete.call(e,a);M(b-1)}:j.npage!==null&&delete e.p.postData[j.npage];e.p.grouping&&(a(e).jqGrid("groupingSetup"),e.p.groupingView.groupDataSorted===!0&&(d[j.sort]=e.p.groupingView.groupField[0]+" "+e.p.groupingView.groupOrder[0]+
68
+ ", "+d[j.sort]));a.extend(e.p.postData,d);var k=!e.p.scroll?1:e.rows.length-1;if(a.isFunction(e.p.datatype))e.p.datatype.call(e,e.p.postData,"load_"+e.p.id);else switch(a.isFunction(e.p.beforeRequest)&&e.p.beforeRequest.call(e),f=e.p.datatype.toLowerCase(),f){case "json":case "jsonp":case "xml":case "script":a.ajax(a.extend({url:e.p.url,type:e.p.mtype,dataType:f,data:a.isFunction(e.p.serializeGridData)?e.p.serializeGridData.call(e,e.p.postData):e.p.postData,success:function(a){f==="xml"?A(a,e.grid.bDiv,
69
+ k,b>1,m):u(a,e.grid.bDiv,k,b>1,m);h&&h.call(e,a);c&&e.grid.populateVisible();if(e.p.loadonce||e.p.treeGrid)e.p.datatype="local";T()},error:function(b,c,d){a.isFunction(e.p.loadError)&&e.p.loadError.call(e,b,c,d);T()},beforeSend:function(b){N();a.isFunction(e.p.loadBeforeSend)&&e.p.loadBeforeSend.call(e,b)}},a.jgrid.ajaxOptions,e.p.ajaxGridOptions));break;case "xmlstring":N();d=a.jgrid.stringToDoc(e.p.datastr);A(d,e.grid.bDiv);g&&e.p.loadComplete.call(e,d);e.p.datatype="local";e.p.datastr=null;T();
70
+ break;case "jsonstring":N();d=typeof e.p.datastr=="string"?a.jgrid.parse(e.p.datastr):e.p.datastr;u(d,e.grid.bDiv);g&&e.p.loadComplete.call(e,d);e.p.datatype="local";e.p.datastr=null;T();break;case "local":case "clientside":N(),e.p.datatype="local",d=J(),u(d,e.grid.bDiv,k,b>1,m),h&&h.call(e,d),c&&e.grid.populateVisible(),T()}}};k=function(b,c){var d="",f="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",h="",g,k,n,o,l=function(b){var c;
71
+ a.isFunction(e.p.onPaging)&&(c=e.p.onPaging.call(e,b));e.p.selrow=null;if(e.p.multiselect)e.p.selarrrow=[],a("#cb_"+a.jgrid.jqID(e.p.id),e.grid.hDiv).attr("checked",!1);e.p.savedRow=[];return c=="stop"?!1:!0},b=b.substr(1);c+="_"+b;g="pg_"+b;k=b+"_left";n=b+"_center";o=b+"_right";a("#"+a.jgrid.jqID(b)).append("<div id='"+g+"' 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='"+
72
+ k+"' align='left'></td><td id='"+n+"' align='center' style='white-space:pre;'></td><td id='"+o+"' align='right'></td></tr></tbody></table></div>").attr("dir","ltr");if(e.p.rowList.length>0){h="<td dir='"+j+"'>";h+="<select class='ui-pg-selbox' role='listbox'>";for(k=0;k<e.p.rowList.length;k++)h+='<option role="option" value="'+e.p.rowList[k]+'"'+(e.p.rowNum==e.p.rowList[k]?' selected="selected"':"")+">"+e.p.rowList[k]+"</option>";h+="</select></td>"}j=="rtl"&&(f+=h);e.p.pginput===!0&&(d="<td dir='"+
73
+ j+"'>"+a.jgrid.format(e.p.pgtext||"","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>","<span id='sp_1_"+a.jgrid.jqID(b)+"'></span>")+"</td>");e.p.pgbuttons===!0?(k=["first"+c,"prev"+c,"next"+c,"last"+c],j=="rtl"&&k.reverse(),f+="<td id='"+k[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>",f+="<td id='"+k[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>",f+=d!==""?"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>"+
74
+ d+"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>":"",f+="<td id='"+k[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>",f+="<td id='"+k[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>"):d!==""&&(f+=d);j=="ltr"&&(f+=h);f+="</tr></tbody></table>";e.p.viewrecords===!0&&a("td#"+b+"_"+e.p.recordpos,"#"+g).append("<div dir='"+j+"' style='text-align:"+e.p.recordpos+
75
+ "' class='ui-paging-info'></div>");a("td#"+b+"_"+e.p.pagerpos,"#"+g).append(f);h=a(".ui-jqgrid").css("font-size")||"11px";a(document.body).append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+h+";visibility:hidden;' ></div>");f=a(f).clone().appendTo("#testpg").width();a("#testpg").remove();f>0&&(d!==""&&(f+=50),a("td#"+b+"_"+e.p.pagerpos,"#"+g).width(f));e.p._nvtd=[];e.p._nvtd[0]=f?Math.floor((e.p.width-f)/2):Math.floor(e.p.width/3);e.p._nvtd[1]=0;f=null;a(".ui-pg-selbox",
76
+ "#"+g).bind("change",function(){e.p.page=Math.round(e.p.rowNum*(e.p.page-1)/this.value-0.5)+1;e.p.rowNum=this.value;c?a(".ui-pg-selbox",e.p.pager).val(this.value):e.p.toppager&&a(".ui-pg-selbox",e.p.toppager).val(this.value);if(!l("records"))return!1;M();return!1});e.p.pgbuttons===!0&&(a(".ui-pg-button","#"+g).hover(function(){a(this).hasClass("ui-state-disabled")?this.style.cursor="default":(a(this).addClass("ui-state-hover"),this.style.cursor="pointer")},function(){if(!a(this).hasClass("ui-state-disabled"))a(this).removeClass("ui-state-hover"),
77
+ this.style.cursor="default"}),a("#first"+a.jgrid.jqID(c)+", #prev"+a.jgrid.jqID(c)+", #next"+a.jgrid.jqID(c)+", #last"+a.jgrid.jqID(c)).click(function(){var a=m(e.p.page,1),b=m(e.p.lastpage,1),d=!1,f=!0,j=!0,h=!0,g=!0;b===0||b===1?g=h=j=f=!1:b>1&&a>=1?a===1?j=f=!1:!(a>1&&a<b)&&a===b&&(g=h=!1):b>1&&a===0&&(g=h=!1,a=b-1);if(this.id==="first"+c&&f)e.p.page=1,d=!0;if(this.id==="prev"+c&&j)e.p.page=a-1,d=!0;if(this.id==="next"+c&&h)e.p.page=a+1,d=!0;if(this.id==="last"+c&&g)e.p.page=b,d=!0;if(d){if(!l(this.id))return!1;
78
+ M()}return!1}));e.p.pginput===!0&&a("input.ui-pg-input","#"+g).keypress(function(b){if((b.charCode?b.charCode:b.keyCode?b.keyCode:0)==13){e.p.page=a(this).val()>0?a(this).val():e.p.page;if(!l("user"))return!1;M();return!1}return this})};var K=function(b,c,d,f){if(e.p.colModel[c].sortable&&!(e.p.savedRow.length>0)){if(!d){if(e.p.lastsort==c)if(e.p.sortorder=="asc")e.p.sortorder="desc";else{if(e.p.sortorder=="desc")e.p.sortorder="asc"}else e.p.sortorder=e.p.colModel[c].firstsortorder||"asc";e.p.page=
78
79
  1}if(f)if(e.p.lastsort==c&&e.p.sortorder==f&&!d)return;else e.p.sortorder=f;d=a("thead:first",e.grid.hDiv).get(0);a("tr th:eq("+e.p.lastsort+") span.ui-grid-ico-sort",d).addClass("ui-state-disabled");a("tr th:eq("+e.p.lastsort+")",d).attr("aria-selected","false");a("tr th:eq("+c+") span.ui-icon-"+e.p.sortorder,d).removeClass("ui-state-disabled");a("tr th:eq("+c+")",d).attr("aria-selected","true");!e.p.viewsortcols[0]&&e.p.lastsort!=c&&(a("tr th:eq("+e.p.lastsort+") span.s-ico",d).hide(),a("tr th:eq("+
79
- c+") span.s-ico",d).show());b=b.substring(5);e.p.sortname=e.p.colModel[c].index||b;d=e.p.sortorder;if(a.isFunction(e.p.onSortCol)&&e.p.onSortCol.call(e,b,c,d)=="stop")e.p.lastsort=c;else{e.p.datatype=="local"?e.p.deselectAfterSort&&a(e).jqGrid("resetSelection"):(e.p.selrow=null,e.p.multiselect&&a("#cb_"+a.jgrid.jqID(e.p.id),e.grid.hDiv).attr("checked",!1),e.p.selarrrow=[],e.p.savedRow=[]);if(e.p.scroll)d=e.grid.bDiv.scrollLeft,y(e.grid.bDiv,!0,!1),e.grid.hDiv.scrollLeft=d;e.p.subGrid&&e.p.datatype==
80
- "local"&&a("td.sgexpanded","#"+a.jgrid.jqID(e.p.id)).each(function(){a(this).trigger("click")});L();e.p.lastsort=c;if(e.p.sortname!=b&&c)e.p.lastsort=c}}},T=function(b){var c,d={},f=m?0:e.p.cellLayout;for(c=d[0]=d[1]=d[2]=0;c<=b;c++)e.p.colModel[c].hidden===!1&&(d[0]+=e.p.colModel[c].width+f);e.p.direction=="rtl"&&(d[0]=e.p.width-d[0]);d[0]-=e.grid.bDiv.scrollLeft;a(e.grid.cDiv).is(":visible")&&(d[1]+=a(e.grid.cDiv).height()+parseInt(a(e.grid.cDiv).css("padding-top"),10)+parseInt(a(e.grid.cDiv).css("padding-bottom"),
81
- 10));if(e.p.toolbar[0]===!0&&(e.p.toolbar[1]=="top"||e.p.toolbar[1]=="both"))d[1]+=a(e.grid.uDiv).height()+parseInt(a(e.grid.uDiv).css("border-top-width"),10)+parseInt(a(e.grid.uDiv).css("border-bottom-width"),10);e.p.toppager&&(d[1]+=a(e.grid.topDiv).height()+parseInt(a(e.grid.topDiv).css("border-bottom-width"),10));d[2]+=a(e.grid.bDiv).height()+a(e.grid.hDiv).height();return d};this.p.id=this.id;if(a.inArray(e.p.multikey,["shiftKey","altKey","ctrlKey"])==-1)e.p.multikey=!1;e.p.keyIndex=!1;for(g=
82
- 0;g<e.p.colModel.length;g++)if(e.p.colModel[g]=a.extend(!0,{},e.p.cmTemplate,e.p.colModel[g].template||{},e.p.colModel[g]),e.p.keyIndex===!1&&e.p.colModel[g].key===!0)e.p.keyIndex=g;e.p.sortorder=e.p.sortorder.toLowerCase();if(e.p.grouping===!0)e.p.scroll=!1,e.p.rownumbers=!1,e.p.subGrid=!1,e.p.treeGrid=!1,e.p.gridview=!0;if(this.p.treeGrid===!0){try{a(this).jqGrid("setTreeGrid")}catch(U){}if(e.p.datatype!="local")e.p.localReader={id:"_id_"}}if(this.p.subGrid)try{a(e).jqGrid("setSubGrid")}catch(Z){}this.p.multiselect&&
83
- (this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>"),this.p.colModel.unshift({name:"cb",width:m?e.p.multiselectWidth+e.p.cellLayout:e.p.multiselectWidth,sortable:!1,resizable:!1,hidedlg:!0,search:!1,align:"center",fixed:!0}));this.p.rownumbers&&(this.p.colNames.unshift(""),this.p.colModel.unshift({name:"rn",width:e.p.rownumWidth,sortable:!1,resizable:!1,hidedlg:!0,search:!1,align:"center",fixed:!0}));e.p.xmlReader=a.extend(!0,{root:"rows",row:"row",
80
+ c+") span.s-ico",d).show());b=b.substring(5+e.p.id.length+1);e.p.sortname=e.p.colModel[c].index||b;d=e.p.sortorder;if(a.isFunction(e.p.onSortCol)&&e.p.onSortCol.call(e,b,c,d)=="stop")e.p.lastsort=c;else{e.p.datatype=="local"?e.p.deselectAfterSort&&a(e).jqGrid("resetSelection"):(e.p.selrow=null,e.p.multiselect&&a("#cb_"+a.jgrid.jqID(e.p.id),e.grid.hDiv).attr("checked",!1),e.p.selarrrow=[],e.p.savedRow=[]);if(e.p.scroll)d=e.grid.bDiv.scrollLeft,y(e.grid.bDiv,!0,!1),e.grid.hDiv.scrollLeft=d;e.p.subGrid&&
81
+ e.p.datatype=="local"&&a("td.sgexpanded","#"+a.jgrid.jqID(e.p.id)).each(function(){a(this).trigger("click")});M();e.p.lastsort=c;if(e.p.sortname!=b&&c)e.p.lastsort=c}}},U=function(b){var c,d={},f=o?0:e.p.cellLayout;for(c=d[0]=d[1]=d[2]=0;c<=b;c++)e.p.colModel[c].hidden===!1&&(d[0]+=e.p.colModel[c].width+f);e.p.direction=="rtl"&&(d[0]=e.p.width-d[0]);d[0]-=e.grid.bDiv.scrollLeft;a(e.grid.cDiv).is(":visible")&&(d[1]+=a(e.grid.cDiv).height()+parseInt(a(e.grid.cDiv).css("padding-top"),10)+parseInt(a(e.grid.cDiv).css("padding-bottom"),
82
+ 10));if(e.p.toolbar[0]===!0&&(e.p.toolbar[1]=="top"||e.p.toolbar[1]=="both"))d[1]+=a(e.grid.uDiv).height()+parseInt(a(e.grid.uDiv).css("border-top-width"),10)+parseInt(a(e.grid.uDiv).css("border-bottom-width"),10);e.p.toppager&&(d[1]+=a(e.grid.topDiv).height()+parseInt(a(e.grid.topDiv).css("border-bottom-width"),10));d[2]+=a(e.grid.bDiv).height()+a(e.grid.hDiv).height();return d};this.p.id=this.id;if(a.inArray(e.p.multikey,["shiftKey","altKey","ctrlKey"])==-1)e.p.multikey=!1;e.p.keyIndex=!1;for(h=
83
+ 0;h<e.p.colModel.length;h++)if(e.p.colModel[h]=a.extend(!0,{},e.p.cmTemplate,e.p.colModel[h].template||{},e.p.colModel[h]),e.p.keyIndex===!1&&e.p.colModel[h].key===!0)e.p.keyIndex=h;e.p.sortorder=e.p.sortorder.toLowerCase();if(e.p.grouping===!0)e.p.scroll=!1,e.p.rownumbers=!1,e.p.subGrid=!1,e.p.treeGrid=!1,e.p.gridview=!0;if(this.p.treeGrid===!0){try{a(this).jqGrid("setTreeGrid")}catch(V){}if(e.p.datatype!="local")e.p.localReader={id:"_id_"}}if(this.p.subGrid)try{a(e).jqGrid("setSubGrid")}catch(Z){}this.p.multiselect&&
84
+ (this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>"),this.p.colModel.unshift({name:"cb",width:o?e.p.multiselectWidth+e.p.cellLayout:e.p.multiselectWidth,sortable:!1,resizable:!1,hidedlg:!0,search:!1,align:"center",fixed:!0}));this.p.rownumbers&&(this.p.colNames.unshift(""),this.p.colModel.unshift({name:"rn",width:e.p.rownumWidth,sortable:!1,resizable:!1,hidedlg:!0,search:!1,align:"center",fixed:!0}));e.p.xmlReader=a.extend(!0,{root:"rows",row:"row",
84
85
  page:"rows>page",total:"rows>total",records:"rows>records",repeatitems:!0,cell:"cell",id:"[id]",userdata:"userdata",subgrid:{root:"rows",row:"row",repeatitems:!0,cell:"cell"}},e.p.xmlReader);e.p.jsonReader=a.extend(!0,{root:"rows",page:"page",total:"total",records:"records",repeatitems:!0,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:!0,cell:"cell"}},e.p.jsonReader);e.p.localReader=a.extend(!0,{root:"rows",page:"page",total:"total",records:"records",repeatitems:!1,cell:"cell",
85
- id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:!0,cell:"cell"}},e.p.localReader);if(e.p.scroll)e.p.pgbuttons=!1,e.p.pginput=!1,e.p.rowList=[];e.p.data.length&&A();var I="<thead><tr class='ui-jqgrid-labels' role='rowheader'>",W,R,D,F,J,x,E,K;R=K="";if(e.p.shrinkToFit===!0&&e.p.forceFit===!0)for(g=e.p.colModel.length-1;g>=0;g--)if(!e.p.colModel[g].hidden){e.p.colModel[g].resizable=!1;break}e.p.viewsortcols[1]=="horizontal"&&(K=" ui-i-asc",R=" ui-i-desc");W=o?"class='ui-th-div-ie'":"";
86
- K="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+K+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+j+"'></span>";K+="<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+R+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+j+"'></span></span>";for(g=0;g<this.p.colNames.length;g++){R=e.p.headertitles?' title="'+a.jgrid.stripHtml(e.p.colNames[g])+'"':"";I+="<th id='"+e.p.id+"_"+e.p.colModel[g].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+
87
- j+"'"+R+">";R=e.p.colModel[g].index||e.p.colModel[g].name;I+="<div id='jqgh_"+e.p.id+"_"+e.p.colModel[g].name+"' "+W+">"+e.p.colNames[g];e.p.colModel[g].width=e.p.colModel[g].width?parseInt(e.p.colModel[g].width,10):150;if(typeof e.p.colModel[g].title!=="boolean")e.p.colModel[g].title=!0;if(R==e.p.sortname)e.p.lastsort=g;I+=K+"</div></th>"}I+="</tr></thead>";K=null;a(this).append(I);a("thead tr:first th",this).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});
88
- if(this.p.multiselect){var P=[],V;a("#cb_"+a.jgrid.jqID(e.p.id),this).bind("click",function(){e.p.selarrrow=[];this.checked?(a(e.rows).each(function(b){if(b>0&&!a(this).hasClass("subgrid")&&!a(this).hasClass("jqgroup")&&!a(this).hasClass("ui-state-disabled"))a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+a.jgrid.jqID(this.id)).attr("checked","checked"),a(this).addClass("ui-state-highlight").attr("aria-selected","true"),e.p.selarrrow.push(this.id),e.p.selrow=this.id}),V=!0,P=[]):(a(e.rows).each(function(b){b>
89
- 0&&!a(this).hasClass("subgrid")&&!a(this).hasClass("ui-state-disabled")&&(a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+a.jgrid.jqID(this.id)).removeAttr("checked"),a(this).removeClass("ui-state-highlight").attr("aria-selected","false"),P.push(this.id))}),e.p.selrow=null,V=!1);a.isFunction(e.p.onSelectAll)&&e.p.onSelectAll.call(e,V?e.p.selarrrow:P,V)})}if(e.p.autowidth===!0)I=a(n).innerWidth(),e.p.width=I>0?I:"nw";(function(){var b=0,c=m?0:e.p.cellLayout,f=0,g,j=e.p.scrollOffset,k,n=!1,l,o=0,s=0,q;a.each(e.p.colModel,
90
- function(){if(typeof this.hidden==="undefined")this.hidden=!1;this.widthOrg=k=p(this.width,0);this.hidden===!1&&(b+=k+c,this.fixed?o+=k+c:f++,s++)});isNaN(e.p.width)?e.p.width=d.width=b:d.width=e.p.width;e.p.tblwidth=b;if(e.p.shrinkToFit===!1&&e.p.forceFit===!0)e.p.forceFit=!1;if(e.p.shrinkToFit===!0&&f>0&&(l=d.width-c*f-o,isNaN(e.p.height)||(l-=j,n=!0),b=0,a.each(e.p.colModel,function(a){if(this.hidden===!1&&!this.fixed)this.width=k=Math.round(l*this.width/(e.p.tblwidth-c*f-o)),b+=k,g=a}),q=0,n?
91
- d.width-o-(b+c*f)!==j&&(q=d.width-o-(b+c*f)-j):!n&&Math.abs(d.width-o-(b+c*f))!==1&&(q=d.width-o-(b+c*f)),e.p.colModel[g].width+=q,e.p.tblwidth=b+q+c*f+o,e.p.tblwidth>e.p.width))e.p.colModel[g].width-=e.p.tblwidth-parseInt(e.p.width,10),e.p.tblwidth=e.p.width})();a(n).css("width",d.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+e.p.id+"'>&#160;</div>");a(l).css("width",d.width+"px");var I=a("thead:first",e).get(0),H="";e.p.footerrow&&(H+="<table role='grid' style='width:"+e.p.tblwidth+
92
- "px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+j+"'>");var l=a("tr:first",I),$="<tr class='jqgfirstrow' role='row' style='height:auto'>";e.p.disableClick=!1;a("th",l).each(function(b){D=e.p.colModel[b].width;if(typeof e.p.colModel[b].resizable==="undefined")e.p.colModel[b].resizable=!0;e.p.colModel[b].resizable?(F=document.createElement("span"),a(F).html("&#160;").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+
93
- j),a.browser.opera||a(F).css("cursor","col-resize"),a(this).addClass(e.p.resizeclass)):F="";a(this).css("width",D+"px").prepend(F);var c="";e.p.colModel[b].hidden&&(a(this).css("display","none"),c="display:none;");$+="<td role='gridcell' style='height:0px;width:"+D+"px;"+c+"'></td>";d.headers[b]={width:D,el:this};J=e.p.colModel[b].sortable;if(typeof J!=="boolean")J=e.p.colModel[b].sortable=!0;c=e.p.colModel[b].name;c=="cb"||c=="subgrid"||c=="rn"||e.p.viewsortcols[2]&&a("div",this).addClass("ui-jqgrid-sortable");
94
- J&&(e.p.viewsortcols[0]?(a("div span.s-ico",this).show(),b==e.p.lastsort&&a("div span.ui-icon-"+e.p.sortorder,this).removeClass("ui-state-disabled")):b==e.p.lastsort&&(a("div span.s-ico",this).show(),a("div span.ui-icon-"+e.p.sortorder,this).removeClass("ui-state-disabled")));e.p.footerrow&&(H+="<td role='gridcell' "+s(b,0,"",null,"",!1)+">&#160;</td>")}).mousedown(function(b){if(a(b.target).closest("th>span.ui-jqgrid-resize").length==1){var c=a.jgrid.getCellIndex(this);if(e.p.forceFit===!0){var f=
95
- e.p,g=c,j;for(j=c+1;j<e.p.colModel.length;j++)if(e.p.colModel[j].hidden!==!0){g=j;break}f.nv=g-c}d.dragStart(c,b,T(c));return!1}}).click(function(b){if(e.p.disableClick)return e.p.disableClick=!1;var c="th>div.ui-jqgrid-sortable",d,f;e.p.viewsortcols[2]||(c="th>div>span>span.ui-grid-ico-sort");b=a(b.target).closest(c);if(b.length==1)return c=a.jgrid.getCellIndex(this),e.p.viewsortcols[2]||(d=!0,f=b.attr("sort")),G(a("div",this)[0].id,c,d,f),!1});if(e.p.sortable&&a.fn.sortable)try{a(e).jqGrid("sortableColumns",
96
- l)}catch(X){}e.p.footerrow&&(H+="</tr></tbody></table>");$+="</tr>";this.appendChild(document.createElement("tbody"));a(this).addClass("ui-jqgrid-btable").append($);var $=null,l=a("<table class='ui-jqgrid-htable' style='width:"+e.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(I),M=e.p.caption&&e.p.hiddengrid===!0?!0:!1;g=a("<div class='ui-jqgrid-hbox"+(j=="rtl"?"-rtl":"")+"'></div>");I=null;d.hDiv=document.createElement("div");
97
- a(d.hDiv).css({width:d.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(g);a(g).append(l);l=null;M&&a(d.hDiv).hide();if(e.p.pager){if(typeof e.p.pager=="string"){if(e.p.pager.substr(0,1)!="#")e.p.pager="#"+e.p.pager}else e.p.pager="#"+a(e.p.pager).attr("id");a(e.p.pager).css({width:d.width+"px"}).appendTo(n).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");M&&a(e.p.pager).hide();k(e.p.pager,"")}e.p.cellEdit===!1&&e.p.hoverrows===!0&&a(e).bind("mouseover",function(b){E=
98
- a(b.target).closest("tr.jqgrow");a(E).attr("class")!=="subgrid"&&a(E).addClass("ui-state-hover");return!1}).bind("mouseout",function(b){E=a(b.target).closest("tr.jqgrow");a(E).removeClass("ui-state-hover");return!1});var Q,Y;a(e).before(d.hDiv).click(function(b){x=b.target;E=a(x,e.rows).closest("tr.jqgrow");if(a(E).length===0||E[0].className.indexOf("ui-state-disabled")>-1)return this;var c=a(x).hasClass("cbox"),d=!0;a.isFunction(e.p.beforeSelectRow)&&(d=e.p.beforeSelectRow.call(e,E[0].id,b));if(x.tagName==
99
- "A"||(x.tagName=="INPUT"||x.tagName=="TEXTAREA"||x.tagName=="OPTION"||x.tagName=="SELECT")&&!c)return this;if(d===!0){if(e.p.cellEdit===!0)if(e.p.multiselect&&c)a(e).jqGrid("setSelection",E[0].id,!0);else{Q=E[0].rowIndex;Y=a.jgrid.getCellIndex(x);try{a(e).jqGrid("editCell",Q,Y,!0)}catch(f){}}else if(e.p.multikey)b[e.p.multikey]?a(e).jqGrid("setSelection",E[0].id,!0):e.p.multiselect&&c&&(c=a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+E[0].id).attr("checked"),a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+E[0].id).attr("checked",
100
- !c));else{if(e.p.multiselect&&e.p.multiboxonly&&!c)a(e.p.selarrrow).each(function(b,c){var d=e.rows.namedItem(c);a(d).removeClass("ui-state-highlight");a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+a.jgrid.jqID(c)).attr("checked",!1)}),e.p.selarrrow=[],a("#cb_"+a.jgrid.jqID(e.p.id),e.grid.hDiv).attr("checked",!1);a(e).jqGrid("setSelection",E[0].id,!0)}if(a.isFunction(e.p.onCellSelect))Q=E[0].id,Y=a.jgrid.getCellIndex(x),e.p.onCellSelect.call(e,Q,Y,a(x).html(),b);b.stopPropagation()}else return this}).bind("reloadGrid",
101
- function(b,c){if(e.p.treeGrid===!0)e.p.datatype=e.p.treedatatype;c&&c.current&&e.grid.selectionPreserver(e);if(e.p.datatype=="local")a(e).jqGrid("resetSelection"),e.p.data.length&&A();else if(!e.p.treeGrid){e.p.selrow=null;if(e.p.multiselect)e.p.selarrrow=[],a("#cb_"+a.jgrid.jqID(e.p.id),e.grid.hDiv).attr("checked",!1);e.p.savedRow=[]}e.p.scroll&&y(e.grid.bDiv,!0,!1);if(c&&c.page){var d=c.page;if(d>e.p.lastpage)d=e.p.lastpage;d<1&&(d=1);e.p.page=d;e.grid.bDiv.scrollTop=e.grid.prevRowHeight?(d-1)*
102
- e.grid.prevRowHeight*e.p.rowNum:0}e.grid.prevRowHeight&&e.p.scroll?(delete e.p.lastpage,e.grid.populateVisible()):e.grid.populate();return!1});a.isFunction(this.p.ondblClickRow)&&a(this).dblclick(function(b){x=b.target;E=a(x,e.rows).closest("tr.jqgrow");if(a(E).length===0)return!1;Q=E[0].rowIndex;Y=a.jgrid.getCellIndex(x);e.p.ondblClickRow.call(e,a(E).attr("id"),Q,Y,b);return!1});d.bDiv=document.createElement("div");if(o&&String(e.p.height).toLowerCase()==="auto")e.p.height="100%";a(d.bDiv).append(a('<div style="position:relative;'+
103
- (o&&a.browser.version<8?"height:0.01%;":"")+'"></div>').append("<div></div>").append(this)).addClass("ui-jqgrid-bdiv").css({height:e.p.height+(isNaN(e.p.height)?"":"px"),width:d.width+"px"}).scroll(d.scrollGrid);a("table:first",d.bDiv).css({width:e.p.tblwidth+"px"});o?(a("tbody",this).size()==2&&a("tbody:gt(0)",this).remove(),e.p.multikey&&a(d.bDiv).bind("selectstart",function(){return!1})):e.p.multikey&&a(d.bDiv).bind("mousedown",function(){return!1});M&&a(d.bDiv).hide();d.cDiv=document.createElement("div");
104
- var aa=e.p.hidegrid===!0?a("<a role='link' href='javascript:void(0)'/>").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){aa.addClass("ui-state-hover")},function(){aa.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css(j=="rtl"?"left":"right","0px"):"";a(d.cDiv).append(aa).append("<span class='ui-jqgrid-title"+(j=="rtl"?"-rtl":"")+"'>"+e.p.caption+"</span>").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");
105
- a(d.cDiv).insertBefore(d.hDiv);if(e.p.toolbar[0])d.uDiv=document.createElement("div"),e.p.toolbar[1]=="top"?a(d.uDiv).insertBefore(d.hDiv):e.p.toolbar[1]=="bottom"&&a(d.uDiv).insertAfter(d.hDiv),e.p.toolbar[1]=="both"?(d.ubDiv=document.createElement("div"),a(d.uDiv).insertBefore(d.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id),a(d.ubDiv).insertAfter(d.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id),M&&a(d.ubDiv).hide()):a(d.uDiv).width(d.width).addClass("ui-userdata ui-state-default").attr("id",
106
- "t_"+this.id),M&&a(d.uDiv).hide();if(e.p.toppager)e.p.toppager=a.jgrid.jqID(e.p.id)+"_toppager",d.topDiv=a("<div id='"+e.p.toppager+"'></div>")[0],e.p.toppager="#"+e.p.toppager,a(d.topDiv).insertBefore(d.hDiv).addClass("ui-state-default ui-jqgrid-toppager").width(d.width),k(e.p.toppager,"_t");if(e.p.footerrow){d.sDiv=a("<div class='ui-jqgrid-sdiv'></div>")[0];g=a("<div class='ui-jqgrid-hbox"+(j=="rtl"?"-rtl":"")+"'></div>");a(d.sDiv).append(g).insertAfter(d.hDiv).width(d.width);a(g).append(H);d.footers=
107
- a(".ui-jqgrid-ftable",d.sDiv)[0].rows[0].cells;if(e.p.rownumbers)d.footers[0].className="ui-state-default jqgrid-rownum";M&&a(d.sDiv).hide()}g=null;if(e.p.caption){var ba=e.p.datatype;if(e.p.hidegrid===!0&&(a(".ui-jqgrid-titlebar-close",d.cDiv).click(function(b){var c=a.isFunction(e.p.onHeaderClick),f=".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",g,j=this;e.p.toolbar[0]===!0&&(e.p.toolbar[1]=="both"&&(f+=", #"+a(d.ubDiv).attr("id")),f+=", #"+a(d.uDiv).attr("id"));g=a(f,"#gview_"+
108
- a.jgrid.jqID(e.p.id)).length;e.p.gridstate=="visible"?a(f,"#gbox_"+a.jgrid.jqID(e.p.id)).slideUp("fast",function(){g--;if(g===0)a("span",j).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"),e.p.gridstate="hidden",a("#gbox_"+a.jgrid.jqID(e.p.id)).hasClass("ui-resizable")&&a(".ui-resizable-handle","#gbox_"+a.jgrid.jqID(e.p.id)).hide(),c&&(M||e.p.onHeaderClick.call(e,e.p.gridstate,b))}):e.p.gridstate=="hidden"&&a(f,"#gbox_"+a.jgrid.jqID(e.p.id)).slideDown("fast",function(){g--;
109
- if(g===0){a("span",j).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");if(M)e.p.datatype=ba,L(),M=!1;e.p.gridstate="visible";a("#gbox_"+a.jgrid.jqID(e.p.id)).hasClass("ui-resizable")&&a(".ui-resizable-handle","#gbox_"+a.jgrid.jqID(e.p.id)).show();c&&(M||e.p.onHeaderClick.call(e,e.p.gridstate,b))}});return!1}),M))e.p.datatype="local",a(".ui-jqgrid-titlebar-close",d.cDiv).trigger("click")}else a(d.cDiv).hide();a(d.hDiv).after(d.bDiv).mousemove(function(a){if(d.resizing)return d.dragMove(a),
110
- !1});a(".ui-jqgrid-labels",d.hDiv).bind("selectstart",function(){return!1});a(document).mouseup(function(){if(d.resizing)return d.dragEnd(),!1;return!0});e.formatCol=s;e.sortData=G;e.updatepager=function(b,c){var d,f,g,j,h,m,k,n="",l=e.p.pager?"_"+a.jgrid.jqID(e.p.pager.substr(1)):"",o=e.p.toppager?"_"+e.p.toppager.substr(1):"";g=parseInt(e.p.page,10)-1;g<0&&(g=0);g*=parseInt(e.p.rowNum,10);h=g+e.p.reccount;if(e.p.scroll){d=a("tbody:first > tr:gt(0)",e.grid.bDiv);g=h-d.length;e.p.reccount=d.length;
111
- if(f=d.outerHeight()||e.grid.prevRowHeight)d=g*f,f*=parseInt(e.p.records,10),a(">div:first",e.grid.bDiv).css({height:f}).children("div:first").css({height:d,display:d?"":"none"});e.grid.bDiv.scrollLeft=e.grid.hDiv.scrollLeft}n=e.p.pager?e.p.pager:"";n+=e.p.toppager?n?","+e.p.toppager:e.p.toppager:"";if(n){k=a.jgrid.formatter.integer||{};d=p(e.p.page);f=p(e.p.lastpage);a(".selbox",n).attr("disabled",!1);e.p.pginput===!0&&(a(".ui-pg-input",n).val(e.p.page),j=e.p.toppager?"#sp_1"+l+",#sp_1"+o:"#sp_1"+
112
- l,a(j).html(a.fmatter?a.fmatter.util.NumberFormat(e.p.lastpage,k):e.p.lastpage));if(e.p.viewrecords)e.p.reccount===0?a(".ui-paging-info",n).html(e.p.emptyrecords):(j=g+1,m=e.p.records,a.fmatter&&(j=a.fmatter.util.NumberFormat(j,k),h=a.fmatter.util.NumberFormat(h,k),m=a.fmatter.util.NumberFormat(m,k)),a(".ui-paging-info",n).html(a.jgrid.format(e.p.recordtext,j,h,m)));e.p.pgbuttons===!0&&(d<=0&&(d=f=0),d==1||d===0?(a("#first"+l+", #prev"+l).addClass("ui-state-disabled").removeClass("ui-state-hover"),
113
- e.p.toppager&&a("#first_t"+o+", #prev_t"+o).addClass("ui-state-disabled").removeClass("ui-state-hover")):(a("#first"+l+", #prev"+l).removeClass("ui-state-disabled"),e.p.toppager&&a("#first_t"+o+", #prev_t"+o).removeClass("ui-state-disabled")),d==f||d===0?(a("#next"+l+", #last"+l).addClass("ui-state-disabled").removeClass("ui-state-hover"),e.p.toppager&&a("#next_t"+o+", #last_t"+o).addClass("ui-state-disabled").removeClass("ui-state-hover")):(a("#next"+l+", #last"+l).removeClass("ui-state-disabled"),
114
- e.p.toppager&&a("#next_t"+o+", #last_t"+o).removeClass("ui-state-disabled")))}b===!0&&e.p.rownumbers===!0&&a("td.jqgrid-rownum",e.rows).each(function(b){a(this).html(g+1+b)});c&&e.p.jqgdnd&&a(e).jqGrid("gridDnD","updateDnD");a.isFunction(e.p.gridComplete)&&e.p.gridComplete.call(e)};e.refreshIndex=A;e.formatter=function(a,b,c,d,e){return r(a,b,c,d,e)};a.extend(d,{populate:L,emptyRows:y});this.grid=d;e.addXmlData=function(a){B(a,e.grid.bDiv)};e.addJSONData=function(a){u(a,e.grid.bDiv)};this.grid.cols=
115
- this.rows[0].cells;L();e.p.hiddengrid=!1;a(window).unload(function(){e=null})}}}})};a.jgrid.extend({getGridParam:function(a){var d=this[0];if(d&&d.grid)return a?typeof d.p[a]!="undefined"?d.p[a]:null:d.p},setGridParam:function(b){return this.each(function(){this.grid&&typeof b==="object"&&a.extend(!0,this.p,b)})},getDataIDs:function(){var b=[],d=0,c,f=0;this.each(function(){if((c=this.rows.length)&&c>0)for(;d<c;){if(a(this.rows[d]).hasClass("jqgrow"))b[f]=this.rows[d].id,f++;d++}});return b},setSelection:function(b,
116
- d){return this.each(function(){function c(b){var c=a(f.grid.bDiv)[0].clientHeight,d=a(f.grid.bDiv)[0].scrollTop,g=f.rows[b].offsetTop,b=f.rows[b].clientHeight;if(g+b>=c+d)a(f.grid.bDiv)[0].scrollTop=g-(c+d)+b+d;else if(g<c+d&&g<d)a(f.grid.bDiv)[0].scrollTop=g}var f=this,h,g,j;if(b!==void 0&&(d=d===!1?!1:!0,(g=f.rows.namedItem(b+""))&&!(g.className.indexOf("ui-state-disabled")>-1))){if(f.p.scrollrows===!0)h=f.rows.namedItem(b).rowIndex,h>=0&&c(h);if(f.p.multiselect)f.p.selrow=g.id,j=a.inArray(f.p.selrow,
117
- f.p.selarrrow),j===-1?(g.className!=="ui-subgrid"&&a(g).addClass("ui-state-highlight").attr("aria-selected","true"),h=!0,a("#jqg_"+a.jgrid.jqID(f.p.id)+"_"+a.jgrid.jqID(f.p.selrow)).attr("checked",h),f.p.selarrrow.push(f.p.selrow)):(g.className!=="ui-subgrid"&&a(g).removeClass("ui-state-highlight").attr("aria-selected","false"),h=!1,a("#jqg_"+a.jgrid.jqID(f.p.id)+"_"+a.jgrid.jqID(f.p.selrow)).attr("checked",h),f.p.selarrrow.splice(j,1),j=f.p.selarrrow[0],f.p.selrow=j===void 0?null:j),f.p.onSelectRow&&
118
- d&&f.p.onSelectRow.call(f,g.id,h);else if(g.className!=="ui-subgrid")f.p.selrow!=g.id?(a(f.rows.namedItem(f.p.selrow)).removeClass("ui-state-highlight").attr({"aria-selected":"false",tabindex:"-1"}),a(g).addClass("ui-state-highlight").attr({"aria-selected":!0,tabindex:"0"}),h=!0):h=!1,f.p.selrow=g.id,f.p.onSelectRow&&d&&f.p.onSelectRow.call(f,g.id,h)}})},resetSelection:function(b){return this.each(function(){var d=this,c,f;if(typeof b!=="undefined")f=b===d.p.selrow?d.p.selrow:b,a("#"+a.jgrid.jqID(d.p.id)+
119
- " tbody:first tr#"+a.jgrid.jqID(f)).removeClass("ui-state-highlight").attr("aria-selected","false"),d.p.multiselect&&(a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(f)).attr("checked",!1),a("#cb_"+a.jgrid.jqID(d.p.id)).attr("checked",!1)),f=null;else if(d.p.multiselect)a(d.p.selarrrow).each(function(b,f){c=d.rows.namedItem(f);a(c).removeClass("ui-state-highlight").attr("aria-selected","false");a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(f)).attr("checked",!1)}),a("#cb_"+a.jgrid.jqID(d.p.id)).attr("checked",
120
- !1),d.p.selarrrow=[];else if(d.p.selrow)a("#"+a.jgrid.jqID(d.p.id)+" tbody:first tr#"+a.jgrid.jqID(d.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false"),d.p.selrow=null;d.p.savedRow=[]})},getRowData:function(b){var d={},c,f=!1,h,g=0;this.each(function(){var j=this,e,l;if(typeof b=="undefined")f=!0,c=[],h=j.rows.length;else{l=j.rows.namedItem(b);if(!l)return d;h=2}for(;g<h;)f&&(l=j.rows[g]),a(l).hasClass("jqgrow")&&(a("td",l).each(function(b){e=j.p.colModel[b].name;if(e!=="cb"&&
121
- e!=="subgrid"&&e!=="rn")if(j.p.treeGrid===!0&&e==j.p.ExpandColumn)d[e]=a.jgrid.htmlDecode(a("span:first",this).html());else try{d[e]=a.unformat(this,{rowId:l.id,colModel:j.p.colModel[b]},b)}catch(c){d[e]=a.jgrid.htmlDecode(a(this).html())}}),f&&(c.push(d),d={})),g++});return c?c:d},delRowData:function(b){var d=!1,c,f;this.each(function(){if(c=this.rows.namedItem(b)){if(a(c).remove(),this.p.records--,this.p.reccount--,this.updatepager(!0,!1),d=!0,this.p.multiselect&&(f=a.inArray(b,this.p.selarrrow),
122
- f!=-1&&this.p.selarrrow.splice(f,1)),b==this.p.selrow)this.p.selrow=null}else return!1;if(this.p.datatype=="local"){var h=this.p._index[b];typeof h!="undefined"&&(this.p.data.splice(h,1),this.refreshIndex())}if(this.p.altRows===!0&&d){var g=this.p.altclass;a(this.rows).each(function(b){b%2==1?a(this).addClass(g):a(this).removeClass(g)})}});return d},setRowData:function(b,d,c){var f,h=!0,g;this.each(function(){if(!this.grid)return!1;var j=this,e,l,k=typeof c,o={};l=j.rows.namedItem(b);if(!l)return!1;
123
- if(d)try{if(a(this.p.colModel).each(function(c){f=this.name;d[f]!==void 0&&(o[f]=this.formatter&&typeof this.formatter==="string"&&this.formatter=="date"?a.unformat.date(d[f],this):d[f],e=j.formatter(b,d[f],c,d,"edit"),g=this.title?{title:a.jgrid.stripHtml(e)}:{},j.p.treeGrid===!0&&f==j.p.ExpandColumn?a("td:eq("+c+") > span:first",l).html(e).attr(g):a("td:eq("+c+")",l).html(e).attr(g))}),j.p.datatype=="local"){var m=j.p._index[b];if(j.p.treeGrid)for(var n in j.p.treeReader)o.hasOwnProperty(j.p.treeReader[n])&&
124
- delete o[j.p.treeReader[n]];typeof m!="undefined"&&(j.p.data[m]=a.extend(!0,j.p.data[m],o));o=null}}catch(p){h=!1}h&&(k==="string"?a(l).addClass(c):k==="object"&&a(l).css(c))});return h},addRowData:function(b,d,c,f){c||(c="last");var h=!1,g,j,e,l,k,o,m,n,p="",s,q,r,t,v;d&&(a.isArray(d)?(s=!0,c="last",q=b):(d=[d],s=!1),this.each(function(){var w=d.length;k=this.p.rownumbers===!0?1:0;e=this.p.multiselect===!0?1:0;l=this.p.subGrid===!0?1:0;if(!s)if(typeof b!="undefined")b+="";else if(b=a.jgrid.randId(),
125
- this.p.keyIndex!==!1)q=this.p.colModel[this.p.keyIndex+e+l+k].name,typeof d[0][q]!="undefined"&&(b=d[0][q]);r=this.p.altclass;for(var z=0,C="",y={},A=a.isFunction(this.p.afterInsertRow)?!0:!1;z<w;){t=d[z];j="";if(s){try{b=t[q]}catch(B){b=a.jgrid.randId()}C=this.p.altRows===!0?(this.rows.length-1)%2===0?r:"":""}k&&(p=this.formatCol(0,1,"",null,b,!0),j+='<td role="gridcell" aria-describedby="'+this.p.id+'_rn" class="ui-state-default jqgrid-rownum" '+p+">0</td>");e&&(n='<input role="checkbox" type="checkbox" id="jqg_'+
126
- this.p.id+"_"+b+'" class="cbox"/>',p=this.formatCol(k,1,"",null,b,!0),j+='<td role="gridcell" aria-describedby="'+this.p.id+'_cb" '+p+">"+n+"</td>");l&&(j+=a(this).jqGrid("addSubGridCell",e+k,1));for(m=e+l+k;m<this.p.colModel.length;m++)v=this.p.colModel[m],g=v.name,y[g]=v.formatter&&typeof v.formatter==="string"&&v.formatter=="date"?a.unformat.date(t[g],v):t[g],n=this.formatter(b,a.jgrid.getAccessor(t,g),m,t,"edit"),p=this.formatCol(m,1,n,b,t,!0),j+='<td role="gridcell" aria-describedby="'+this.p.id+
127
- "_"+g+'" '+p+">"+n+"</td>";j='<tr id="'+b+'" role="row" tabindex="-1" class="ui-widget-content jqgrow ui-row-'+this.p.direction+" "+C+'">'+j+"</tr>";this.p.subGrid===!0&&(j=a(j)[0],a(this).jqGrid("addSubGrid",j,e+k));if(this.rows.length===0)a("table:first",this.grid.bDiv).append(j);else switch(c){case "last":a(this.rows[this.rows.length-1]).after(j);break;case "first":a(this.rows[0]).after(j);break;case "after":(o=this.rows.namedItem(f))&&(a(this.rows[o.rowIndex+1]).hasClass("ui-subgrid")?a(this.rows[o.rowIndex+
128
- 1]).after(j):a(o).after(j));break;case "before":if(o=this.rows.namedItem(f))a(o).before(j),o=o.rowIndex}this.p.records++;this.p.reccount++;A&&this.p.afterInsertRow.call(this,b,t,t);z++;if(this.p.datatype=="local")y[this.p.localReader.id]=b,this.p._index[b]=this.p.data.length,this.p.data.push(y),y={}}this.p.altRows===!0&&!s&&(c=="last"?(this.rows.length-1)%2==1&&a(this.rows[this.rows.length-1]).addClass(r):a(this.rows).each(function(b){b%2==1?a(this).addClass(r):a(this).removeClass(r)}));this.updatepager(!0,
129
- !0);h=!0}));return h},footerData:function(b,d,c){function f(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}var h,g=!1,j={},e;typeof b=="undefined"&&(b="get");typeof c!="boolean"&&(c=!0);b=b.toLowerCase();this.each(function(){var l=this,k;if(!l.grid||!l.p.footerrow)return!1;if(b=="set"&&f(d))return!1;g=!0;a(this.p.colModel).each(function(f){h=this.name;b=="set"?d[h]!==void 0&&(k=c?l.formatter("",d[h],f,d,"edit"):d[h],e=this.title?{title:a.jgrid.stripHtml(k)}:{},a("tr.footrow td:eq("+f+
130
- ")",l.grid.sDiv).html(k).attr(e),g=!0):b=="get"&&(j[h]=a("tr.footrow td:eq("+f+")",l.grid.sDiv).html())})});return b=="get"?j:g},showHideCol:function(b,d){return this.each(function(){var c=this,f=!1,h=a.browser.webkit||a.browser.safari?0:c.p.cellLayout,g;if(c.grid){typeof b==="string"&&(b=[b]);d=d!="none"?"":"none";var j=d===""?!0:!1;a(this.p.colModel).each(function(e){if(a.inArray(this.name,b)!==-1&&this.hidden===j)a("tr",c.grid.hDiv).each(function(){a(this).children("th:eq("+e+")").css("display",
131
- d)}),a(c.rows).each(function(){a(this).children("td:eq("+e+")").css("display",d)}),c.p.footerrow&&a(c.grid.sDiv).children("td:eq("+e+")").css("display",d),g=this.widthOrg?this.widthOrg:parseInt(this.width,10),d==="none"?c.p.tblwidth-=g+h:c.p.tblwidth+=g+h,this.hidden=!j,f=!0});if(f===!0)c.p.shrinkToFit===!1?(a("table:first",c.grid.bDiv).css("width",c.p.tblwidth+"px"),a("table:first",c.grid.hDiv).css("width",c.p.tblwidth+"px"),c.grid.hDiv.scrollLeft=c.grid.bDiv.scrollLeft,c.p.footerrow&&a("table:first",
132
- c.grid.sDiv).css("width",c.p.tblwidth+"px")):c.grid.width!==c.p.tblwidth&&a(c).jqGrid("setGridWidth",c.p.tblwidth)}})},hideCol:function(b){return this.each(function(){a(this).jqGrid("showHideCol",b,"none")})},showCol:function(b){return this.each(function(){a(this).jqGrid("showHideCol",b,"")})},remapColumns:function(b,d,c){function f(c){var d;d=c.length?a.makeArray(c):a.extend({},c);a.each(b,function(a){c[a]=d[this]})}function h(c,d){a(">tr"+(d||""),c).each(function(){var c=this,d=a.makeArray(c.cells);
133
- a.each(b,function(){var a=d[this];a&&c.appendChild(a)})})}var g=this.get(0);f(g.p.colModel);f(g.p.colNames);f(g.grid.headers);h(a("thead:first",g.grid.hDiv),c&&":not(.ui-jqgrid-labels)");d&&h(a("#"+a.jgrid.jqID(g.p.id)+" tbody:first"),".jqgfirstrow, tr.jqgrow, tr.jqfoot");g.p.footerrow&&h(a("tbody:first",g.grid.sDiv));if(g.p.remapColumns)g.p.remapColumns.length?f(g.p.remapColumns):g.p.remapColumns=a.makeArray(b);g.p.lastsort=a.inArray(g.p.lastsort,b);if(g.p.treeGrid)g.p.expColInd=a.inArray(g.p.expColInd,
134
- b)},setGridWidth:function(b,d){return this.each(function(){if(this.grid){var c=this,f,h=0,g=a.browser.webkit||a.browser.safari?0:c.p.cellLayout,j,e=0,l=!1,k=c.p.scrollOffset,o,m=0,n=0,p;if(typeof d!="boolean")d=c.p.shrinkToFit;if(!isNaN(b)){b=parseInt(b,10);c.grid.width=c.p.width=b;a("#gbox_"+a.jgrid.jqID(c.p.id)).css("width",b+"px");a("#gview_"+a.jgrid.jqID(c.p.id)).css("width",b+"px");a(c.grid.bDiv).css("width",b+"px");a(c.grid.hDiv).css("width",b+"px");c.p.pager&&a(c.p.pager).css("width",b+"px");
135
- c.p.toppager&&a(c.p.toppager).css("width",b+"px");c.p.toolbar[0]===!0&&(a(c.grid.uDiv).css("width",b+"px"),c.p.toolbar[1]=="both"&&a(c.grid.ubDiv).css("width",b+"px"));c.p.footerrow&&a(c.grid.sDiv).css("width",b+"px");if(d===!1&&c.p.forceFit===!0)c.p.forceFit=!1;if(d===!0&&(a.each(c.p.colModel,function(){this.hidden===!1&&(f=this.widthOrg?this.widthOrg:parseInt(this.width,10),h+=f+g,this.fixed?m+=f+g:e++,n++)}),e!==0)){c.p.tblwidth=h;o=b-g*e-m;if(!isNaN(c.p.height)&&(a(c.grid.bDiv)[0].clientHeight<
136
- a(c.grid.bDiv)[0].scrollHeight||c.rows.length===1))l=!0,o-=k;var h=0,s=c.grid.cols.length>0;a.each(c.p.colModel,function(a){if(this.hidden===!1&&!this.fixed&&(f=this.widthOrg?this.widthOrg:parseInt(this.width,10),f=Math.round(o*f/(c.p.tblwidth-g*e-m)),!(f<0))){this.width=f;h+=f;c.grid.headers[a].width=f;c.grid.headers[a].el.style.width=f+"px";if(c.p.footerrow)c.grid.footers[a].style.width=f+"px";if(s)c.grid.cols[a].style.width=f+"px";j=a}});p=0;l?b-m-(h+g*e)!==k&&(p=b-m-(h+g*e)-k):Math.abs(b-m-(h+
137
- g*e))!==1&&(p=b-m-(h+g*e));c.p.colModel[j].width+=p;c.p.tblwidth=h+p+g*e+m;c.p.tblwidth>b?(l=c.p.tblwidth-parseInt(b,10),c.p.tblwidth=b,f=c.p.colModel[j].width-=l):f=c.p.colModel[j].width;c.grid.headers[j].width=f;c.grid.headers[j].el.style.width=f+"px";if(s)c.grid.cols[j].style.width=f+"px";a("table:first",c.grid.bDiv).css("width",c.p.tblwidth+"px");a("table:first",c.grid.hDiv).css("width",c.p.tblwidth+"px");c.grid.hDiv.scrollLeft=c.grid.bDiv.scrollLeft;if(c.p.footerrow)c.grid.footers[j].style.width=
138
- f+"px",a("table:first",c.grid.sDiv).css("width",c.p.tblwidth+"px")}}}})},setGridHeight:function(b){return this.each(function(){if(this.grid)a(this.grid.bDiv).css({height:b+(isNaN(b)?"":"px")}),this.p.height=b,this.p.scroll&&this.grid.populateVisible()})},setCaption:function(b){return this.each(function(){this.p.caption=b;a("span.ui-jqgrid-title",this.grid.cDiv).html(b);a(this.grid.cDiv).show()})},setLabel:function(b,d,c,f){return this.each(function(){var h=-1;if(this.grid&&typeof b!="undefined"&&
139
- (a(this.p.colModel).each(function(a){if(this.name==b)return h=a,!1}),h>=0)){var g=a("tr.ui-jqgrid-labels th:eq("+h+")",this.grid.hDiv);if(d){var j=a(".s-ico",g);a("[id^=jqgh_]",g).empty().html(d).append(j);this.p.colNames[h]=d}c&&(typeof c==="string"?a(g).addClass(c):a(g).css(c));typeof f==="object"&&a(g).attr(f)}})},setCell:function(b,d,c,f,h,g){return this.each(function(){var j=-1,e,l;if(this.grid&&(isNaN(d)?a(this.p.colModel).each(function(a){if(this.name==d)return j=a,!1}):j=parseInt(d,10),j>=
140
- 0&&(e=this.rows.namedItem(b)))){var k=a("td:eq("+j+")",e);if(c!==""||g===!0)e=this.formatter(b,c,j,e,"edit"),l=this.p.colModel[j].title?{title:a.jgrid.stripHtml(e)}:{},this.p.treeGrid&&a(".tree-wrap",a(k)).length>0?a("span",a(k)).html(e).attr(l):a(k).html(e).attr(l),this.p.datatype=="local"&&(e=this.p.colModel[j],c=e.formatter&&typeof e.formatter==="string"&&e.formatter=="date"?a.unformat.date(c,e):c,l=this.p._index[b],typeof l!="undefined"&&(this.p.data[l][e.name]=c));typeof f==="string"?a(k).addClass(f):
141
- f&&a(k).css(f);typeof h==="object"&&a(k).attr(h)}})},getCell:function(b,d){var c=!1;this.each(function(){var f=-1;if(this.grid&&(isNaN(d)?a(this.p.colModel).each(function(a){if(this.name===d)return f=a,!1}):f=parseInt(d,10),f>=0)){var h=this.rows.namedItem(b);if(h)try{c=a.unformat(a("td:eq("+f+")",h),{rowId:h.id,colModel:this.p.colModel[f]},f)}catch(g){c=a.jgrid.htmlDecode(a("td:eq("+f+")",h).html())}}});return c},getCol:function(b,d,c){var f=[],h,g=0,j=0,e=0,l,d=typeof d!="boolean"?!1:d;typeof c==
142
- "undefined"&&(c=!1);this.each(function(){var k=-1;if(this.grid&&(isNaN(b)?a(this.p.colModel).each(function(a){if(this.name===b)return k=a,!1}):k=parseInt(b,10),k>=0)){var o=this.rows.length,m=0;if(o&&o>0){for(;m<o;){if(a(this.rows[m]).hasClass("jqgrow")){try{h=a.unformat(a(this.rows[m].cells[k]),{rowId:this.rows[m].id,colModel:this.p.colModel[k]},k)}catch(n){h=a.jgrid.htmlDecode(this.rows[m].cells[k].innerHTML)}c?(l=parseFloat(h),g+=l,j=Math.min(j,l),e=Math.max(j,l)):d?f.push({id:this.rows[m].id,
143
- value:h}):f.push(h)}m++}if(c)switch(c.toLowerCase()){case "sum":f=g;break;case "avg":f=g/o;break;case "count":f=o;break;case "min":f=j;break;case "max":f=e}}}});return f},clearGridData:function(b){return this.each(function(){if(this.grid){typeof b!="boolean"&&(b=!1);if(this.p.deepempty)a("#"+a.jgrid.jqID(this.p.id)+" tbody:first tr:gt(0)").remove();else{var d=a("#"+a.jgrid.jqID(this.p.id)+" tbody:first tr:first")[0];a("#"+a.jgrid.jqID(this.p.id)+" tbody:first").empty().append(d)}this.p.footerrow&&
144
- b&&a(".ui-jqgrid-ftable td",this.grid.sDiv).html("&#160;");this.p.selrow=null;this.p.selarrrow=[];this.p.savedRow=[];this.p.records=0;this.p.page=1;this.p.lastpage=0;this.p.reccount=0;this.p.data=[];this.p_index={};this.updatepager(!0,!1)}})},getInd:function(a,d){var c=!1,f;this.each(function(){(f=this.rows.namedItem(a))&&(c=d===!0?f:f.rowIndex)});return c},bindKeys:function(b){var d=a.extend({onEnter:null,onSpace:null,onLeftKey:null,onRightKey:null,scrollingRows:!0},b||{});return this.each(function(){var b=
145
- this;a("body").is("[role]")||a("body").attr("role","application");b.p.scrollrows=d.scrollingRows;a(b).keydown(function(f){var h=a(b).find("tr[tabindex=0]")[0],g,j,e,l=b.p.treeReader.expanded_field;if(h)if(e=b.p._index[h.id],f.keyCode===37||f.keyCode===38||f.keyCode===39||f.keyCode===40){if(f.keyCode===38){j=h.previousSibling;g="";if(j)if(a(j).is(":hidden"))for(;j;){if(j=j.previousSibling,!a(j).is(":hidden")&&a(j).hasClass("jqgrow")){g=j.id;break}}else g=j.id;a(b).jqGrid("setSelection",g)}if(f.keyCode===
146
- 40){j=h.nextSibling;g="";if(j)if(a(j).is(":hidden"))for(;j;){if(j=j.nextSibling,!a(j).is(":hidden")&&a(j).hasClass("jqgrow")){g=j.id;break}}else g=j.id;a(b).jqGrid("setSelection",g)}f.keyCode===37&&(b.p.treeGrid&&b.p.data[e][l]&&a(h).find("div.treeclick").trigger("click"),a.isFunction(d.onLeftKey)&&d.onLeftKey.call(b,b.p.selrow));f.keyCode===39&&(b.p.treeGrid&&!b.p.data[e][l]&&a(h).find("div.treeclick").trigger("click"),a.isFunction(d.onRightKey)&&d.onRightKey.call(b,b.p.selrow));return!1}else if(f.keyCode===
147
- 13)return a.isFunction(d.onEnter)&&d.onEnter.call(b,b.p.selrow),!1;else if(f.keyCode===32)return a.isFunction(d.onSpace)&&d.onSpace.call(b,b.p.selrow),!1})})},unbindKeys:function(){return this.each(function(){a(this).unbind("keydown")})},getLocalRow:function(a){var d=!1,c;this.each(function(){typeof a!=="undefined"&&(c=this.p._index[a],c>=0&&(d=this.p.data[c]))});return d}})})(jQuery);
148
- (function(a){a.jgrid.extend({getColProp:function(a){var d={},c=this[0];if(!c.grid)return!1;for(var c=c.p.colModel,f=0;f<c.length;f++)if(c[f].name==a){d=c[f];break}return d},setColProp:function(b,d){return this.each(function(){if(this.grid&&d)for(var c=this.p.colModel,f=0;f<c.length;f++)if(c[f].name==b){a.extend(this.p.colModel[f],d);break}})},sortGrid:function(a,d,c){return this.each(function(){var f=-1;if(this.grid){if(!a)a=this.p.sortname;for(var h=0;h<this.p.colModel.length;h++)if(this.p.colModel[h].index==
149
- a||this.p.colModel[h].name==a){f=h;break}if(f!=-1)h=this.p.colModel[f].sortable,typeof h!=="boolean"&&(h=!0),typeof d!=="boolean"&&(d=!1),h&&this.sortData("jqgh_"+this.p.id+"_"+a,f,d,c)}})},GridDestroy:function(){return this.each(function(){if(this.grid){this.p.pager&&a(this.p.pager).remove();var b=this.id;try{a("#gbox_"+b).remove()}catch(d){}}})},GridUnload:function(){return this.each(function(){if(this.grid){var b={id:a(this).attr("id"),cl:a(this).attr("class")};this.p.pager&&a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom");
86
+ id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:!0,cell:"cell"}},e.p.localReader);if(e.p.scroll)e.p.pgbuttons=!1,e.p.pginput=!1,e.p.rowList=[];e.p.data.length&&B();var G="<thead><tr class='ui-jqgrid-labels' role='rowheader'>",X,R,W,C,E,H,x,O;R=O="";if(e.p.shrinkToFit===!0&&e.p.forceFit===!0)for(h=e.p.colModel.length-1;h>=0;h--)if(!e.p.colModel[h].hidden){e.p.colModel[h].resizable=!1;break}e.p.viewsortcols[1]=="horizontal"&&(O=" ui-i-asc",R=" ui-i-desc");X=n?"class='ui-th-div-ie'":"";
87
+ O="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+O+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+j+"'></span>";O+="<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+R+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+j+"'></span></span>";for(h=0;h<this.p.colNames.length;h++){R=e.p.headertitles?' title="'+a.jgrid.stripHtml(e.p.colNames[h])+'"':"";G+="<th id='"+e.p.id+"_"+e.p.colModel[h].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+
88
+ j+"'"+R+">";R=e.p.colModel[h].index||e.p.colModel[h].name;G+="<div id='jqgh_"+e.p.id+"_"+e.p.colModel[h].name+"' "+X+">"+e.p.colNames[h];e.p.colModel[h].width=e.p.colModel[h].width?parseInt(e.p.colModel[h].width,10):150;if(typeof e.p.colModel[h].title!=="boolean")e.p.colModel[h].title=!0;if(R==e.p.sortname)e.p.lastsort=h;G+=O+"</div></th>"}G+="</tr></thead>";O=null;a(this).append(G);a("thead tr:first th",this).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});
89
+ if(this.p.multiselect){var P=[],F;a("#cb_"+a.jgrid.jqID(e.p.id),this).bind("click",function(){e.p.selarrrow=[];this.checked?(a(e.rows).each(function(b){if(b>0&&!a(this).hasClass("subgrid")&&!a(this).hasClass("jqgroup")&&!a(this).hasClass("ui-state-disabled"))a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+a.jgrid.jqID(this.id)).attr("checked","checked"),a(this).addClass("ui-state-highlight").attr("aria-selected","true"),e.p.selarrrow.push(this.id),e.p.selrow=this.id}),F=!0,P=[]):(a(e.rows).each(function(b){b>
90
+ 0&&!a(this).hasClass("subgrid")&&!a(this).hasClass("ui-state-disabled")&&(a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+a.jgrid.jqID(this.id)).removeAttr("checked"),a(this).removeClass("ui-state-highlight").attr("aria-selected","false"),P.push(this.id))}),e.p.selrow=null,F=!1);a.isFunction(e.p.onSelectAll)&&e.p.onSelectAll.call(e,F?e.p.selarrrow:P,F)})}if(e.p.autowidth===!0)G=a(p).innerWidth(),e.p.width=G>0?G:"nw";(function(){var b=0,c=o?0:e.p.cellLayout,f=0,j,h=e.p.scrollOffset,k,n=!1,l,p=0,q=0,r;a.each(e.p.colModel,
91
+ function(){if(typeof this.hidden==="undefined")this.hidden=!1;this.widthOrg=k=m(this.width,0);this.hidden===!1&&(b+=k+c,this.fixed?p+=k+c:f++,q++)});isNaN(e.p.width)?e.p.width=d.width=b:d.width=e.p.width;e.p.tblwidth=b;if(e.p.shrinkToFit===!1&&e.p.forceFit===!0)e.p.forceFit=!1;if(e.p.shrinkToFit===!0&&f>0&&(l=d.width-c*f-p,isNaN(e.p.height)||(l-=h,n=!0),b=0,a.each(e.p.colModel,function(a){if(this.hidden===!1&&!this.fixed)this.width=k=Math.round(l*this.width/(e.p.tblwidth-c*f-p)),b+=k,j=a}),r=0,n?
92
+ d.width-p-(b+c*f)!==h&&(r=d.width-p-(b+c*f)-h):!n&&Math.abs(d.width-p-(b+c*f))!==1&&(r=d.width-p-(b+c*f)),e.p.colModel[j].width+=r,e.p.tblwidth=b+r+c*f+p,e.p.tblwidth>e.p.width))e.p.colModel[j].width-=e.p.tblwidth-parseInt(e.p.width,10),e.p.tblwidth=e.p.width})();a(p).css("width",d.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+e.p.id+"'>&#160;</div>");a(l).css("width",d.width+"px");var G=a("thead:first",e).get(0),Q="";e.p.footerrow&&(Q+="<table role='grid' style='width:"+e.p.tblwidth+
93
+ "px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+j+"'>");var l=a("tr:first",G),L="<tr class='jqgfirstrow' role='row' style='height:auto'>";e.p.disableClick=!1;a("th",l).each(function(b){W=e.p.colModel[b].width;if(typeof e.p.colModel[b].resizable==="undefined")e.p.colModel[b].resizable=!0;e.p.colModel[b].resizable?(C=document.createElement("span"),a(C).html("&#160;").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+
94
+ j),a.browser.opera||a(C).css("cursor","col-resize"),a(this).addClass(e.p.resizeclass)):C="";a(this).css("width",W+"px").prepend(C);var c="";e.p.colModel[b].hidden&&(a(this).css("display","none"),c="display:none;");L+="<td role='gridcell' style='height:0px;width:"+W+"px;"+c+"'></td>";d.headers[b]={width:W,el:this};E=e.p.colModel[b].sortable;if(typeof E!=="boolean")E=e.p.colModel[b].sortable=!0;c=e.p.colModel[b].name;c=="cb"||c=="subgrid"||c=="rn"||e.p.viewsortcols[2]&&a("div",this).addClass("ui-jqgrid-sortable");
95
+ E&&(e.p.viewsortcols[0]?(a("div span.s-ico",this).show(),b==e.p.lastsort&&a("div span.ui-icon-"+e.p.sortorder,this).removeClass("ui-state-disabled")):b==e.p.lastsort&&(a("div span.s-ico",this).show(),a("div span.ui-icon-"+e.p.sortorder,this).removeClass("ui-state-disabled")));e.p.footerrow&&(Q+="<td role='gridcell' "+r(b,0,"",null,"",!1)+">&#160;</td>")}).mousedown(function(b){if(a(b.target).closest("th>span.ui-jqgrid-resize").length==1){var c=a.jgrid.getCellIndex(this);if(e.p.forceFit===!0){var f=
96
+ e.p,j=c,h;for(h=c+1;h<e.p.colModel.length;h++)if(e.p.colModel[h].hidden!==!0){j=h;break}f.nv=j-c}d.dragStart(c,b,U(c));return!1}}).click(function(b){if(e.p.disableClick)return e.p.disableClick=!1;var c="th>div.ui-jqgrid-sortable",d,f;e.p.viewsortcols[2]||(c="th>div>span>span.ui-grid-ico-sort");b=a(b.target).closest(c);if(b.length==1)return c=a.jgrid.getCellIndex(this),e.p.viewsortcols[2]||(d=!0,f=b.attr("sort")),K(a("div",this)[0].id,c,d,f),!1});if(e.p.sortable&&a.fn.sortable)try{a(e).jqGrid("sortableColumns",
97
+ l)}catch(ba){}e.p.footerrow&&(Q+="</tr></tbody></table>");L+="</tr>";this.appendChild(document.createElement("tbody"));a(this).addClass("ui-jqgrid-btable").append(L);var L=null,l=a("<table class='ui-jqgrid-htable' style='width:"+e.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(G),I=e.p.caption&&e.p.hiddengrid===!0?!0:!1;h=a("<div class='ui-jqgrid-hbox"+(j=="rtl"?"-rtl":"")+"'></div>");G=null;d.hDiv=document.createElement("div");
98
+ a(d.hDiv).css({width:d.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(h);a(h).append(l);l=null;I&&a(d.hDiv).hide();if(e.p.pager){if(typeof e.p.pager=="string"){if(e.p.pager.substr(0,1)!="#")e.p.pager="#"+e.p.pager}else e.p.pager="#"+a(e.p.pager).attr("id");a(e.p.pager).css({width:d.width+"px"}).appendTo(p).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");I&&a(e.p.pager).hide();k(e.p.pager,"")}e.p.cellEdit===!1&&e.p.hoverrows===!0&&a(e).bind("mouseover",function(b){x=
99
+ a(b.target).closest("tr.jqgrow");a(x).attr("class")!=="subgrid"&&a(x).addClass("ui-state-hover")}).bind("mouseout",function(b){x=a(b.target).closest("tr.jqgrow");a(x).removeClass("ui-state-hover")});var Y,S;a(e).before(d.hDiv).click(function(b){H=b.target;x=a(H,e.rows).closest("tr.jqgrow");if(a(x).length===0||x[0].className.indexOf("ui-state-disabled")>-1)return this;var c=a(H).hasClass("cbox"),d=!0;a.isFunction(e.p.beforeSelectRow)&&(d=e.p.beforeSelectRow.call(e,x[0].id,b));if(H.tagName=="A"||(H.tagName==
100
+ "INPUT"||H.tagName=="TEXTAREA"||H.tagName=="OPTION"||H.tagName=="SELECT")&&!c)return this;if(d===!0){if(e.p.cellEdit===!0)if(e.p.multiselect&&c)a(e).jqGrid("setSelection",x[0].id,!0);else{Y=x[0].rowIndex;S=a.jgrid.getCellIndex(H);try{a(e).jqGrid("editCell",Y,S,!0)}catch(f){}}else if(e.p.multikey)b[e.p.multikey]?a(e).jqGrid("setSelection",x[0].id,!0):e.p.multiselect&&c&&(c=a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+x[0].id).attr("checked"),a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+x[0].id).attr("checked",!c));else{if(e.p.multiselect&&
101
+ e.p.multiboxonly&&!c)a(e.p.selarrrow).each(function(b,c){var d=e.rows.namedItem(c);a(d).removeClass("ui-state-highlight");a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+a.jgrid.jqID(c)).attr("checked",!1)}),e.p.selarrrow=[],a("#cb_"+a.jgrid.jqID(e.p.id),e.grid.hDiv).attr("checked",!1);a(e).jqGrid("setSelection",x[0].id,!0)}if(a.isFunction(e.p.onCellSelect))Y=x[0].id,S=a.jgrid.getCellIndex(H),e.p.onCellSelect.call(e,Y,S,a(H).html(),b)}return this}).bind("reloadGrid",function(b,c){if(e.p.treeGrid===!0)e.p.datatype=
102
+ e.p.treedatatype;c&&c.current&&e.grid.selectionPreserver(e);if(e.p.datatype=="local")a(e).jqGrid("resetSelection"),e.p.data.length&&B();else if(!e.p.treeGrid){e.p.selrow=null;if(e.p.multiselect)e.p.selarrrow=[],a("#cb_"+a.jgrid.jqID(e.p.id),e.grid.hDiv).attr("checked",!1);e.p.savedRow=[]}e.p.scroll&&y(e.grid.bDiv,!0,!1);if(c&&c.page){var d=c.page;if(d>e.p.lastpage)d=e.p.lastpage;d<1&&(d=1);e.p.page=d;e.grid.bDiv.scrollTop=e.grid.prevRowHeight?(d-1)*e.grid.prevRowHeight*e.p.rowNum:0}e.grid.prevRowHeight&&
103
+ e.p.scroll?(delete e.p.lastpage,e.grid.populateVisible()):e.grid.populate();return!1});a.isFunction(this.p.ondblClickRow)&&a(this).dblclick(function(b){H=b.target;x=a(H,e.rows).closest("tr.jqgrow");if(a(x).length===0)return!1;Y=x[0].rowIndex;S=a.jgrid.getCellIndex(H);e.p.ondblClickRow.call(e,a(x).attr("id"),Y,S,b);return!1});d.bDiv=document.createElement("div");if(n&&String(e.p.height).toLowerCase()==="auto")e.p.height="100%";a(d.bDiv).append(a('<div style="position:relative;'+(n&&a.browser.version<
104
+ 8?"height:0.01%;":"")+'"></div>').append("<div></div>").append(this)).addClass("ui-jqgrid-bdiv").css({height:e.p.height+(isNaN(e.p.height)?"":"px"),width:d.width+"px"}).scroll(d.scrollGrid);a("table:first",d.bDiv).css({width:e.p.tblwidth+"px"});n?(a("tbody",this).size()==2&&a("tbody:gt(0)",this).remove(),e.p.multikey&&a(d.bDiv).bind("selectstart",function(){return!1})):e.p.multikey&&a(d.bDiv).bind("mousedown",function(){return!1});I&&a(d.bDiv).hide();d.cDiv=document.createElement("div");var $=e.p.hidegrid===
105
+ !0?a("<a role='link' href='javascript:void(0)'/>").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){$.addClass("ui-state-hover")},function(){$.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css(j=="rtl"?"left":"right","0px"):"";a(d.cDiv).append($).append("<span class='ui-jqgrid-title"+(j=="rtl"?"-rtl":"")+"'>"+e.p.caption+"</span>").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");a(d.cDiv).insertBefore(d.hDiv);
106
+ if(e.p.toolbar[0])d.uDiv=document.createElement("div"),e.p.toolbar[1]=="top"?a(d.uDiv).insertBefore(d.hDiv):e.p.toolbar[1]=="bottom"&&a(d.uDiv).insertAfter(d.hDiv),e.p.toolbar[1]=="both"?(d.ubDiv=document.createElement("div"),a(d.uDiv).insertBefore(d.hDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id),a(d.ubDiv).insertAfter(d.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id),I&&a(d.ubDiv).hide()):a(d.uDiv).width(d.width).addClass("ui-userdata ui-state-default").attr("id",
107
+ "t_"+this.id),I&&a(d.uDiv).hide();if(e.p.toppager)e.p.toppager=a.jgrid.jqID(e.p.id)+"_toppager",d.topDiv=a("<div id='"+e.p.toppager+"'></div>")[0],e.p.toppager="#"+e.p.toppager,a(d.topDiv).insertBefore(d.hDiv).addClass("ui-state-default ui-jqgrid-toppager").width(d.width),k(e.p.toppager,"_t");if(e.p.footerrow){d.sDiv=a("<div class='ui-jqgrid-sdiv'></div>")[0];h=a("<div class='ui-jqgrid-hbox"+(j=="rtl"?"-rtl":"")+"'></div>");a(d.sDiv).append(h).insertAfter(d.hDiv).width(d.width);a(h).append(Q);d.footers=
108
+ a(".ui-jqgrid-ftable",d.sDiv)[0].rows[0].cells;if(e.p.rownumbers)d.footers[0].className="ui-state-default jqgrid-rownum";I&&a(d.sDiv).hide()}h=null;if(e.p.caption){var aa=e.p.datatype;if(e.p.hidegrid===!0&&(a(".ui-jqgrid-titlebar-close",d.cDiv).click(function(b){var c=a.isFunction(e.p.onHeaderClick),f=".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",j,h=this;e.p.toolbar[0]===!0&&(e.p.toolbar[1]=="both"&&(f+=", #"+a(d.ubDiv).attr("id")),f+=", #"+a(d.uDiv).attr("id"));j=a(f,"#gview_"+
109
+ a.jgrid.jqID(e.p.id)).length;e.p.gridstate=="visible"?a(f,"#gbox_"+a.jgrid.jqID(e.p.id)).slideUp("fast",function(){j--;if(j===0)a("span",h).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"),e.p.gridstate="hidden",a("#gbox_"+a.jgrid.jqID(e.p.id)).hasClass("ui-resizable")&&a(".ui-resizable-handle","#gbox_"+a.jgrid.jqID(e.p.id)).hide(),c&&(I||e.p.onHeaderClick.call(e,e.p.gridstate,b))}):e.p.gridstate=="hidden"&&a(f,"#gbox_"+a.jgrid.jqID(e.p.id)).slideDown("fast",function(){j--;
110
+ if(j===0){a("span",h).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");if(I)e.p.datatype=aa,M(),I=!1;e.p.gridstate="visible";a("#gbox_"+a.jgrid.jqID(e.p.id)).hasClass("ui-resizable")&&a(".ui-resizable-handle","#gbox_"+a.jgrid.jqID(e.p.id)).show();c&&(I||e.p.onHeaderClick.call(e,e.p.gridstate,b))}});return!1}),I))e.p.datatype="local",a(".ui-jqgrid-titlebar-close",d.cDiv).trigger("click")}else a(d.cDiv).hide();a(d.hDiv).after(d.bDiv).mousemove(function(a){if(d.resizing)return d.dragMove(a),
111
+ !1});a(".ui-jqgrid-labels",d.hDiv).bind("selectstart",function(){return!1});a(document).mouseup(function(){return d.resizing?(d.dragEnd(),!1):!0});e.formatCol=r;e.sortData=K;e.updatepager=function(b,c){var d,f,j,h,g,k,n,o="",l=e.p.pager?"_"+a.jgrid.jqID(e.p.pager.substr(1)):"",p=e.p.toppager?"_"+e.p.toppager.substr(1):"";j=parseInt(e.p.page,10)-1;j<0&&(j=0);j*=parseInt(e.p.rowNum,10);g=j+e.p.reccount;if(e.p.scroll){d=a("tbody:first > tr:gt(0)",e.grid.bDiv);j=g-d.length;e.p.reccount=d.length;if(f=
112
+ d.outerHeight()||e.grid.prevRowHeight)d=j*f,f*=parseInt(e.p.records,10),a(">div:first",e.grid.bDiv).css({height:f}).children("div:first").css({height:d,display:d?"":"none"});e.grid.bDiv.scrollLeft=e.grid.hDiv.scrollLeft}o=e.p.pager?e.p.pager:"";o+=e.p.toppager?o?","+e.p.toppager:e.p.toppager:"";if(o){n=a.jgrid.formatter.integer||{};d=m(e.p.page);f=m(e.p.lastpage);a(".selbox",o).attr("disabled",!1);e.p.pginput===!0&&(a(".ui-pg-input",o).val(e.p.page),h=e.p.toppager?"#sp_1"+l+",#sp_1"+p:"#sp_1"+l,a(h).html(a.fmatter?
113
+ a.fmatter.util.NumberFormat(e.p.lastpage,n):e.p.lastpage));if(e.p.viewrecords)e.p.reccount===0?a(".ui-paging-info",o).html(e.p.emptyrecords):(h=j+1,k=e.p.records,a.fmatter&&(h=a.fmatter.util.NumberFormat(h,n),g=a.fmatter.util.NumberFormat(g,n),k=a.fmatter.util.NumberFormat(k,n)),a(".ui-paging-info",o).html(a.jgrid.format(e.p.recordtext,h,g,k)));e.p.pgbuttons===!0&&(d<=0&&(d=f=0),d==1||d===0?(a("#first"+l+", #prev"+l).addClass("ui-state-disabled").removeClass("ui-state-hover"),e.p.toppager&&a("#first_t"+
114
+ p+", #prev_t"+p).addClass("ui-state-disabled").removeClass("ui-state-hover")):(a("#first"+l+", #prev"+l).removeClass("ui-state-disabled"),e.p.toppager&&a("#first_t"+p+", #prev_t"+p).removeClass("ui-state-disabled")),d==f||d===0?(a("#next"+l+", #last"+l).addClass("ui-state-disabled").removeClass("ui-state-hover"),e.p.toppager&&a("#next_t"+p+", #last_t"+p).addClass("ui-state-disabled").removeClass("ui-state-hover")):(a("#next"+l+", #last"+l).removeClass("ui-state-disabled"),e.p.toppager&&a("#next_t"+
115
+ p+", #last_t"+p).removeClass("ui-state-disabled")))}b===!0&&e.p.rownumbers===!0&&a("td.jqgrid-rownum",e.rows).each(function(b){a(this).html(j+1+b)});c&&e.p.jqgdnd&&a(e).jqGrid("gridDnD","updateDnD");a.isFunction(e.p.gridComplete)&&e.p.gridComplete.call(e)};e.refreshIndex=B;e.formatter=function(a,b,c,d,e){return s(a,b,c,d,e)};a.extend(d,{populate:M,emptyRows:y});this.grid=d;e.addXmlData=function(a){A(a,e.grid.bDiv)};e.addJSONData=function(a){u(a,e.grid.bDiv)};this.grid.cols=this.rows[0].cells;M();
116
+ e.p.hiddengrid=!1;a(window).unload(function(){e=null})}}}})};a.jgrid.extend({getGridParam:function(a){var d=this[0];if(d&&d.grid)return a?typeof d.p[a]!="undefined"?d.p[a]:null:d.p},setGridParam:function(b){return this.each(function(){this.grid&&typeof b==="object"&&a.extend(!0,this.p,b)})},getDataIDs:function(){var b=[],d=0,c,f=0;this.each(function(){if((c=this.rows.length)&&c>0)for(;d<c;){if(a(this.rows[d]).hasClass("jqgrow"))b[f]=this.rows[d].id,f++;d++}});return b},setSelection:function(b,d){return this.each(function(){function c(b){var c=
117
+ a(f.grid.bDiv)[0].clientHeight,d=a(f.grid.bDiv)[0].scrollTop,j=f.rows[b].offsetTop,b=f.rows[b].clientHeight;if(j+b>=c+d)a(f.grid.bDiv)[0].scrollTop=j-(c+d)+b+d;else if(j<c+d&&j<d)a(f.grid.bDiv)[0].scrollTop=j}var f=this,g,h,j;if(b!==void 0&&(d=d===!1?!1:!0,(h=f.rows.namedItem(b+""))&&!(h.className.indexOf("ui-state-disabled")>-1))){if(f.p.scrollrows===!0)g=f.rows.namedItem(b).rowIndex,g>=0&&c(g);if(f.p.multiselect)f.p.selrow=h.id,j=a.inArray(f.p.selrow,f.p.selarrrow),j===-1?(h.className!=="ui-subgrid"&&
118
+ a(h).addClass("ui-state-highlight").attr("aria-selected","true"),g=!0,a("#jqg_"+a.jgrid.jqID(f.p.id)+"_"+a.jgrid.jqID(f.p.selrow)).attr("checked",g),f.p.selarrrow.push(f.p.selrow)):(h.className!=="ui-subgrid"&&a(h).removeClass("ui-state-highlight").attr("aria-selected","false"),g=!1,a("#jqg_"+a.jgrid.jqID(f.p.id)+"_"+a.jgrid.jqID(f.p.selrow)).attr("checked",g),f.p.selarrrow.splice(j,1),j=f.p.selarrrow[0],f.p.selrow=j===void 0?null:j),f.p.onSelectRow&&d&&f.p.onSelectRow.call(f,h.id,g);else if(h.className!==
119
+ "ui-subgrid")f.p.selrow!=h.id?(a(f.rows.namedItem(f.p.selrow)).removeClass("ui-state-highlight").attr({"aria-selected":"false",tabindex:"-1"}),a(h).addClass("ui-state-highlight").attr({"aria-selected":!0,tabindex:"0"}),g=!0):g=!1,f.p.selrow=h.id,f.p.onSelectRow&&d&&f.p.onSelectRow.call(f,h.id,g)}})},resetSelection:function(b){return this.each(function(){var d=this,c,f;if(typeof b!=="undefined")f=b===d.p.selrow?d.p.selrow:b,a("#"+a.jgrid.jqID(d.p.id)+" tbody:first tr#"+a.jgrid.jqID(f)).removeClass("ui-state-highlight").attr("aria-selected",
120
+ "false"),d.p.multiselect&&(a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(f)).attr("checked",!1),a("#cb_"+a.jgrid.jqID(d.p.id)).attr("checked",!1)),f=null;else if(d.p.multiselect)a(d.p.selarrrow).each(function(b,f){c=d.rows.namedItem(f);a(c).removeClass("ui-state-highlight").attr("aria-selected","false");a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(f)).attr("checked",!1)}),a("#cb_"+a.jgrid.jqID(d.p.id)).attr("checked",!1),d.p.selarrrow=[];else if(d.p.selrow)a("#"+a.jgrid.jqID(d.p.id)+" tbody:first tr#"+
121
+ a.jgrid.jqID(d.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false"),d.p.selrow=null;d.p.cellEdit===!0&&parseInt(d.p.iCol,10)>=0&&parseInt(d.p.iRow,10)>=0&&(a("td:eq("+d.p.iCol+")",d.rows[d.p.iRow]).removeClass("edit-cell ui-state-highlight"),a(d.rows[d.p.iRow]).removeClass("selected-row ui-state-hover"));d.p.savedRow=[]})},getRowData:function(b){var d={},c,f=!1,g,h=0;this.each(function(){var j=this,e,l;if(typeof b=="undefined")f=!0,c=[],g=j.rows.length;else{l=j.rows.namedItem(b);
122
+ if(!l)return d;g=2}for(;h<g;)f&&(l=j.rows[h]),a(l).hasClass("jqgrow")&&(a("td",l).each(function(b){e=j.p.colModel[b].name;if(e!=="cb"&&e!=="subgrid"&&e!=="rn")if(j.p.treeGrid===!0&&e==j.p.ExpandColumn)d[e]=a.jgrid.htmlDecode(a("span:first",this).html());else try{d[e]=a.unformat(this,{rowId:l.id,colModel:j.p.colModel[b]},b)}catch(c){d[e]=a.jgrid.htmlDecode(a(this).html())}}),f&&(c.push(d),d={})),h++});return c?c:d},delRowData:function(b){var d=!1,c,f;this.each(function(){if(c=this.rows.namedItem(b)){if(a(c).remove(),
123
+ this.p.records--,this.p.reccount--,this.updatepager(!0,!1),d=!0,this.p.multiselect&&(f=a.inArray(b,this.p.selarrrow),f!=-1&&this.p.selarrrow.splice(f,1)),b==this.p.selrow)this.p.selrow=null}else return!1;if(this.p.datatype=="local"){var g=this.p._index[b];typeof g!="undefined"&&(this.p.data.splice(g,1),this.refreshIndex())}if(this.p.altRows===!0&&d){var h=this.p.altclass;a(this.rows).each(function(b){b%2==1?a(this).addClass(h):a(this).removeClass(h)})}});return d},setRowData:function(b,d,c){var f,
124
+ g=!0,h;this.each(function(){if(!this.grid)return!1;var j=this,e,l,k=typeof c,n={};l=j.rows.namedItem(b);if(!l)return!1;if(d)try{if(a(this.p.colModel).each(function(c){f=this.name;d[f]!==void 0&&(n[f]=this.formatter&&typeof this.formatter==="string"&&this.formatter=="date"?a.unformat.date(d[f],this):d[f],e=j.formatter(b,d[f],c,d,"edit"),h=this.title?{title:a.jgrid.stripHtml(e)}:{},j.p.treeGrid===!0&&f==j.p.ExpandColumn?a("td:eq("+c+") > span:first",l).html(e).attr(h):a("td:eq("+c+")",l).html(e).attr(h))}),
125
+ j.p.datatype=="local"){var o=j.p._index[b];if(j.p.treeGrid)for(var p in j.p.treeReader)n.hasOwnProperty(j.p.treeReader[p])&&delete n[j.p.treeReader[p]];typeof o!="undefined"&&(j.p.data[o]=a.extend(!0,j.p.data[o],n));n=null}}catch(m){g=!1}g&&(k==="string"?a(l).addClass(c):k==="object"&&a(l).css(c))});return g},addRowData:function(b,d,c,f){c||(c="last");var g=!1,h,j,e,l,k,n,o,p,m="",r,q,s,t,w;d&&(a.isArray(d)?(r=!0,c="last",q=b):(d=[d],r=!1),this.each(function(){var v=d.length;k=this.p.rownumbers===
126
+ !0?1:0;e=this.p.multiselect===!0?1:0;l=this.p.subGrid===!0?1:0;if(!r)if(typeof b!="undefined")b+="";else if(b=a.jgrid.randId(),this.p.keyIndex!==!1)q=this.p.colModel[this.p.keyIndex+e+l+k].name,typeof d[0][q]!="undefined"&&(b=d[0][q]);s=this.p.altclass;for(var z=0,D="",y={},B=a.isFunction(this.p.afterInsertRow)?!0:!1;z<v;){t=d[z];j="";if(r){try{b=t[q]}catch(A){b=a.jgrid.randId()}D=this.p.altRows===!0?(this.rows.length-1)%2===0?s:"":""}k&&(m=this.formatCol(0,1,"",null,b,!0),j+='<td role="gridcell" aria-describedby="'+
127
+ this.p.id+'_rn" class="ui-state-default jqgrid-rownum" '+m+">0</td>");e&&(p='<input role="checkbox" type="checkbox" id="jqg_'+this.p.id+"_"+b+'" class="cbox"/>',m=this.formatCol(k,1,"",null,b,!0),j+='<td role="gridcell" aria-describedby="'+this.p.id+'_cb" '+m+">"+p+"</td>");l&&(j+=a(this).jqGrid("addSubGridCell",e+k,1));for(o=e+l+k;o<this.p.colModel.length;o++)w=this.p.colModel[o],h=w.name,y[h]=w.formatter&&typeof w.formatter==="string"&&w.formatter=="date"?a.unformat.date(t[h],w):t[h],p=this.formatter(b,
128
+ a.jgrid.getAccessor(t,h),o,t,"edit"),m=this.formatCol(o,1,p,b,t,!0),j+='<td role="gridcell" aria-describedby="'+this.p.id+"_"+h+'" '+m+">"+p+"</td>";j='<tr id="'+b+'" role="row" tabindex="-1" class="ui-widget-content jqgrow ui-row-'+this.p.direction+" "+D+'">'+j+"</tr>";if(this.rows.length===0)a("table:first",this.grid.bDiv).append(j);else switch(c){case "last":a(this.rows[this.rows.length-1]).after(j);n=this.rows.length-1;break;case "first":a(this.rows[0]).after(j);n=1;break;case "after":(n=this.rows.namedItem(f))&&
129
+ (a(this.rows[n.rowIndex+1]).hasClass("ui-subgrid")?a(this.rows[n.rowIndex+1]).after(j):a(n).after(j));n++;break;case "before":if(n=this.rows.namedItem(f))a(n).before(j),n=n.rowIndex;n--}this.p.subGrid===!0&&a(this).jqGrid("addSubGrid",e+k,n);this.p.records++;this.p.reccount++;B&&this.p.afterInsertRow.call(this,b,t,t);z++;if(this.p.datatype=="local")y[this.p.localReader.id]=b,this.p._index[b]=this.p.data.length,this.p.data.push(y),y={}}this.p.altRows===!0&&!r&&(c=="last"?(this.rows.length-1)%2==1&&
130
+ a(this.rows[this.rows.length-1]).addClass(s):a(this.rows).each(function(b){b%2==1?a(this).addClass(s):a(this).removeClass(s)}));this.updatepager(!0,!0);g=!0}));return g},footerData:function(b,d,c){function f(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}var g,h=!1,j={},e;typeof b=="undefined"&&(b="get");typeof c!="boolean"&&(c=!0);b=b.toLowerCase();this.each(function(){var l=this,k;if(!l.grid||!l.p.footerrow)return!1;if(b=="set"&&f(d))return!1;h=!0;a(this.p.colModel).each(function(f){g=
131
+ this.name;b=="set"?d[g]!==void 0&&(k=c?l.formatter("",d[g],f,d,"edit"):d[g],e=this.title?{title:a.jgrid.stripHtml(k)}:{},a("tr.footrow td:eq("+f+")",l.grid.sDiv).html(k).attr(e),h=!0):b=="get"&&(j[g]=a("tr.footrow td:eq("+f+")",l.grid.sDiv).html())})});return b=="get"?j:h},showHideCol:function(b,d){return this.each(function(){var c=this,f=!1,g=a.browser.webkit||a.browser.safari?0:c.p.cellLayout,h;if(c.grid){typeof b==="string"&&(b=[b]);d=d!="none"?"":"none";var j=d===""?!0:!1;a(this.p.colModel).each(function(e){if(a.inArray(this.name,
132
+ b)!==-1&&this.hidden===j)a("tr",c.grid.hDiv).each(function(){a(this.cells[e]).css("display",d)}),a(c.rows).each(function(){a(this.cells[e]).css("display",d)}),c.p.footerrow&&a("tr.footrow td:eq("+e+")",c.grid.sDiv).css("display",d),h=this.widthOrg?this.widthOrg:parseInt(this.width,10),d==="none"?c.p.tblwidth-=h+g:c.p.tblwidth+=h+g,this.hidden=!j,f=!0});f===!0&&a(c).jqGrid("setGridWidth",c.p.tblwidth)}})},hideCol:function(b){return this.each(function(){a(this).jqGrid("showHideCol",b,"none")})},showCol:function(b){return this.each(function(){a(this).jqGrid("showHideCol",
133
+ b,"")})},remapColumns:function(b,d,c){function f(c){var d;d=c.length?a.makeArray(c):a.extend({},c);a.each(b,function(a){c[a]=d[this]})}function g(c,d){a(">tr"+(d||""),c).each(function(){var c=this,d=a.makeArray(c.cells);a.each(b,function(){var a=d[this];a&&c.appendChild(a)})})}var h=this.get(0);f(h.p.colModel);f(h.p.colNames);f(h.grid.headers);g(a("thead:first",h.grid.hDiv),c&&":not(.ui-jqgrid-labels)");d&&g(a("#"+a.jgrid.jqID(h.p.id)+" tbody:first"),".jqgfirstrow, tr.jqgrow, tr.jqfoot");h.p.footerrow&&
134
+ g(a("tbody:first",h.grid.sDiv));if(h.p.remapColumns)h.p.remapColumns.length?f(h.p.remapColumns):h.p.remapColumns=a.makeArray(b);h.p.lastsort=a.inArray(h.p.lastsort,b);if(h.p.treeGrid)h.p.expColInd=a.inArray(h.p.expColInd,b)},setGridWidth:function(b,d){return this.each(function(){if(this.grid){var c=this,f,g=0,h=a.browser.webkit||a.browser.safari?0:c.p.cellLayout,j,e=0,l=!1,k=c.p.scrollOffset,n,o=0,p=0,m;if(typeof d!="boolean")d=c.p.shrinkToFit;if(!isNaN(b)){b=parseInt(b,10);c.grid.width=c.p.width=
135
+ b;a("#gbox_"+a.jgrid.jqID(c.p.id)).css("width",b+"px");a("#gview_"+a.jgrid.jqID(c.p.id)).css("width",b+"px");a(c.grid.bDiv).css("width",b+"px");a(c.grid.hDiv).css("width",b+"px");c.p.pager&&a(c.p.pager).css("width",b+"px");c.p.toppager&&a(c.p.toppager).css("width",b+"px");c.p.toolbar[0]===!0&&(a(c.grid.uDiv).css("width",b+"px"),c.p.toolbar[1]=="both"&&a(c.grid.ubDiv).css("width",b+"px"));c.p.footerrow&&a(c.grid.sDiv).css("width",b+"px");if(d===!1&&c.p.forceFit===!0)c.p.forceFit=!1;if(d===!0){a.each(c.p.colModel,
136
+ function(){this.hidden===!1&&(f=this.widthOrg?this.widthOrg:parseInt(this.width,10),g+=f+h,this.fixed?o+=f+h:e++,p++)});if(e===0)return;c.p.tblwidth=g;n=b-h*e-o;if(!isNaN(c.p.height)&&(a(c.grid.bDiv)[0].clientHeight<a(c.grid.bDiv)[0].scrollHeight||c.rows.length===1))l=!0,n-=k;var g=0,r=c.grid.cols.length>0;a.each(c.p.colModel,function(a){if(this.hidden===!1&&!this.fixed&&(f=this.widthOrg?this.widthOrg:parseInt(this.width,10),f=Math.round(n*f/(c.p.tblwidth-h*e-o)),!(f<0))){this.width=f;g+=f;c.grid.headers[a].width=
137
+ f;c.grid.headers[a].el.style.width=f+"px";if(c.p.footerrow)c.grid.footers[a].style.width=f+"px";if(r)c.grid.cols[a].style.width=f+"px";j=a}});if(!j)return;m=0;l?b-o-(g+h*e)!==k&&(m=b-o-(g+h*e)-k):Math.abs(b-o-(g+h*e))!==1&&(m=b-o-(g+h*e));c.p.colModel[j].width+=m;c.p.tblwidth=g+m+h*e+o;c.p.tblwidth>b?(l=c.p.tblwidth-parseInt(b,10),c.p.tblwidth=b,f=c.p.colModel[j].width-=l):f=c.p.colModel[j].width;c.grid.headers[j].width=f;c.grid.headers[j].el.style.width=f+"px";if(r)c.grid.cols[j].style.width=f+"px";
138
+ if(c.p.footerrow)c.grid.footers[j].style.width=f+"px"}if(c.p.tblwidth)a("table:first",c.grid.bDiv).css("width",c.p.tblwidth+"px"),a("table:first",c.grid.hDiv).css("width",c.p.tblwidth+"px"),c.grid.hDiv.scrollLeft=c.grid.bDiv.scrollLeft,c.p.footerrow&&a("table:first",c.grid.sDiv).css("width",c.p.tblwidth+"px")}}})},setGridHeight:function(b){return this.each(function(){if(this.grid)a(this.grid.bDiv).css({height:b+(isNaN(b)?"":"px")}),this.p.height=b,this.p.scroll&&this.grid.populateVisible()})},setCaption:function(b){return this.each(function(){this.p.caption=
139
+ b;a("span.ui-jqgrid-title",this.grid.cDiv).html(b);a(this.grid.cDiv).show()})},setLabel:function(b,d,c,f){return this.each(function(){var g=-1;if(this.grid&&typeof b!="undefined"&&(a(this.p.colModel).each(function(a){if(this.name==b)return g=a,!1}),g>=0)){var h=a("tr.ui-jqgrid-labels th:eq("+g+")",this.grid.hDiv);if(d){var j=a(".s-ico",h);a("[id^=jqgh_]",h).empty().html(d).append(j);this.p.colNames[g]=d}c&&(typeof c==="string"?a(h).addClass(c):a(h).css(c));typeof f==="object"&&a(h).attr(f)}})},setCell:function(b,
140
+ d,c,f,g,h){return this.each(function(){var j=-1,e,l;if(this.grid&&(isNaN(d)?a(this.p.colModel).each(function(a){if(this.name==d)return j=a,!1}):j=parseInt(d,10),j>=0&&(e=this.rows.namedItem(b)))){var k=a("td:eq("+j+")",e);if(c!==""||h===!0)e=this.formatter(b,c,j,e,"edit"),l=this.p.colModel[j].title?{title:a.jgrid.stripHtml(e)}:{},this.p.treeGrid&&a(".tree-wrap",a(k)).length>0?a("span",a(k)).html(e).attr(l):a(k).html(e).attr(l),this.p.datatype=="local"&&(e=this.p.colModel[j],c=e.formatter&&typeof e.formatter===
141
+ "string"&&e.formatter=="date"?a.unformat.date(c,e):c,l=this.p._index[b],typeof l!="undefined"&&(this.p.data[l][e.name]=c));typeof f==="string"?a(k).addClass(f):f&&a(k).css(f);typeof g==="object"&&a(k).attr(g)}})},getCell:function(b,d){var c=!1;this.each(function(){var f=-1;if(this.grid&&(isNaN(d)?a(this.p.colModel).each(function(a){if(this.name===d)return f=a,!1}):f=parseInt(d,10),f>=0)){var g=this.rows.namedItem(b);if(g)try{c=a.unformat(a("td:eq("+f+")",g),{rowId:g.id,colModel:this.p.colModel[f]},
142
+ f)}catch(h){c=a.jgrid.htmlDecode(a("td:eq("+f+")",g).html())}}});return c},getCol:function(b,d,c){var f=[],g,h=0,j=0,e=0,l,d=typeof d!="boolean"?!1:d;typeof c=="undefined"&&(c=!1);this.each(function(){var k=-1;if(this.grid&&(isNaN(b)?a(this.p.colModel).each(function(a){if(this.name===b)return k=a,!1}):k=parseInt(b,10),k>=0)){var n=this.rows.length,o=0;if(n&&n>0){for(;o<n;){if(a(this.rows[o]).hasClass("jqgrow")){try{g=a.unformat(a(this.rows[o].cells[k]),{rowId:this.rows[o].id,colModel:this.p.colModel[k]},
143
+ k)}catch(p){g=a.jgrid.htmlDecode(this.rows[o].cells[k].innerHTML)}c?(l=parseFloat(g),h+=l,j=Math.min(j,l),e=Math.max(e,l)):d?f.push({id:this.rows[o].id,value:g}):f.push(g)}o++}if(c)switch(c.toLowerCase()){case "sum":f=h;break;case "avg":f=h/n;break;case "count":f=n;break;case "min":f=j;break;case "max":f=e}}}});return f},clearGridData:function(b){return this.each(function(){if(this.grid){typeof b!="boolean"&&(b=!1);if(this.p.deepempty)a("#"+a.jgrid.jqID(this.p.id)+" tbody:first tr:gt(0)").remove();
144
+ else{var d=a("#"+a.jgrid.jqID(this.p.id)+" tbody:first tr:first")[0];a("#"+a.jgrid.jqID(this.p.id)+" tbody:first").empty().append(d)}this.p.footerrow&&b&&a(".ui-jqgrid-ftable td",this.grid.sDiv).html("&#160;");this.p.selrow=null;this.p.selarrrow=[];this.p.savedRow=[];this.p.records=0;this.p.page=1;this.p.lastpage=0;this.p.reccount=0;this.p.data=[];this.p._index={};this.updatepager(!0,!1)}})},getInd:function(a,d){var c=!1,f;this.each(function(){(f=this.rows.namedItem(a))&&(c=d===!0?f:f.rowIndex)});
145
+ return c},bindKeys:function(b){var d=a.extend({onEnter:null,onSpace:null,onLeftKey:null,onRightKey:null,scrollingRows:!0},b||{});return this.each(function(){var b=this;a("body").is("[role]")||a("body").attr("role","application");b.p.scrollrows=d.scrollingRows;a(b).keydown(function(f){var g=a(b).find("tr[tabindex=0]")[0],h,j,e,l=b.p.treeReader.expanded_field;if(g)if(e=b.p._index[g.id],f.keyCode===37||f.keyCode===38||f.keyCode===39||f.keyCode===40){if(f.keyCode===38){j=g.previousSibling;h="";if(j)if(a(j).is(":hidden"))for(;j;){if(j=
146
+ j.previousSibling,!a(j).is(":hidden")&&a(j).hasClass("jqgrow")){h=j.id;break}}else h=j.id;a(b).jqGrid("setSelection",h)}if(f.keyCode===40){j=g.nextSibling;h="";if(j)if(a(j).is(":hidden"))for(;j;){if(j=j.nextSibling,!a(j).is(":hidden")&&a(j).hasClass("jqgrow")){h=j.id;break}}else h=j.id;a(b).jqGrid("setSelection",h)}f.keyCode===37&&(b.p.treeGrid&&b.p.data[e][l]&&a(g).find("div.treeclick").trigger("click"),a.isFunction(d.onLeftKey)&&d.onLeftKey.call(b,b.p.selrow));f.keyCode===39&&(b.p.treeGrid&&!b.p.data[e][l]&&
147
+ a(g).find("div.treeclick").trigger("click"),a.isFunction(d.onRightKey)&&d.onRightKey.call(b,b.p.selrow))}else f.keyCode===13?a.isFunction(d.onEnter)&&d.onEnter.call(b,b.p.selrow):f.keyCode===32&&a.isFunction(d.onSpace)&&d.onSpace.call(b,b.p.selrow)})})},unbindKeys:function(){return this.each(function(){a(this).unbind("keydown")})},getLocalRow:function(a){var d=!1,c;this.each(function(){typeof a!=="undefined"&&(c=this.p._index[a],c>=0&&(d=this.p.data[c]))});return d}})})(jQuery);
148
+ (function(a){a.jgrid.extend({getColProp:function(a){var d={},c=this[0];if(!c.grid)return!1;for(var c=c.p.colModel,f=0;f<c.length;f++)if(c[f].name==a){d=c[f];break}return d},setColProp:function(b,d){return this.each(function(){if(this.grid&&d)for(var c=this.p.colModel,f=0;f<c.length;f++)if(c[f].name==b){a.extend(this.p.colModel[f],d);break}})},sortGrid:function(a,d,c){return this.each(function(){var f=-1;if(this.grid){if(!a)a=this.p.sortname;for(var g=0;g<this.p.colModel.length;g++)if(this.p.colModel[g].index==
149
+ a||this.p.colModel[g].name==a){f=g;break}if(f!=-1)g=this.p.colModel[f].sortable,typeof g!=="boolean"&&(g=!0),typeof d!=="boolean"&&(d=!1),g&&this.sortData("jqgh_"+this.p.id+"_"+a,f,d,c)}})},GridDestroy:function(){return this.each(function(){if(this.grid){this.p.pager&&a(this.p.pager).remove();var b=this.id;try{a("#gbox_"+b).remove()}catch(d){}}})},GridUnload:function(){return this.each(function(){if(this.grid){var b={id:a(this).attr("id"),cl:a(this).attr("class")};this.p.pager&&a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom");
150
150
  var d=document.createElement("table");a(d).attr({id:b.id});d.className=b.cl;b=this.id;a(d).removeClass("ui-jqgrid-btable");a(this.p.pager).parents("#gbox_"+b).length===1?(a(d).insertBefore("#gbox_"+b).show(),a(this.p.pager).insertBefore("#gbox_"+b)):a(d).insertBefore("#gbox_"+b).show();a("#gbox_"+b).remove()}})},setGridState:function(b){return this.each(function(){if(this.grid)if(b=="hidden")a(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+this.p.id).slideUp("fast"),this.p.pager&&a(this.p.pager).slideUp("fast"),
151
151
  this.p.toppager&&a(this.p.toppager).slideUp("fast"),this.p.toolbar[0]===!0&&(this.p.toolbar[1]=="both"&&a(this.grid.ubDiv).slideUp("fast"),a(this.grid.uDiv).slideUp("fast")),this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+this.p.id).slideUp("fast"),a(".ui-jqgrid-titlebar-close span",this.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"),this.p.gridstate="hidden";else if(b=="visible")a(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+this.p.id).slideDown("fast"),
152
152
  this.p.pager&&a(this.p.pager).slideDown("fast"),this.p.toppager&&a(this.p.toppager).slideDown("fast"),this.p.toolbar[0]===!0&&(this.p.toolbar[1]=="both"&&a(this.grid.ubDiv).slideDown("fast"),a(this.grid.uDiv).slideDown("fast")),this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+this.p.id).slideDown("fast"),a(".ui-jqgrid-titlebar-close span",this.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n"),this.p.gridstate="visible"})},filterToolbar:function(b){b=a.extend({autosearch:!0,
153
- searchOnEnter:!0,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,searchurl:"",stringResult:!1,groupOp:"AND",defaultSearch:"bw"},b||{});return this.each(function(){function d(b,c){var d=a(b);d[0]&&jQuery.each(c,function(){this.data!==void 0?d.bind(this.type,this.data,this.fn):d.bind(this.type,this.fn)})}var c=this;if(!this.ftoolbar){var f=function(){var d={},e=0,f,g,h={},m;a.each(c.p.colModel,function(){g=this.index||this.name;switch(this.stype){case "select":m=this.searchoptions&&
154
- this.searchoptions.sopt?this.searchoptions.sopt[0]:"eq";if(f=a("#gs_"+a.jgrid.jqID(this.name),c.grid.hDiv).val())d[g]=f,h[g]=m,e++;else try{delete c.p.postData[g]}catch(n){}break;case "text":if(m=this.searchoptions&&this.searchoptions.sopt?this.searchoptions.sopt[0]:b.defaultSearch,f=a("#gs_"+a.jgrid.jqID(this.name),c.grid.hDiv).val())d[g]=f,h[g]=m,e++;else try{delete c.p.postData[g]}catch(p){}}});var n=e>0?!0:!1;if(b.stringResult===!0||c.p.datatype=="local"){var p='{"groupOp":"'+b.groupOp+'","rules":[',
155
- s=0;a.each(d,function(a,b){s>0&&(p+=",");p+='{"field":"'+a+'",';p+='"op":"'+h[a]+'",';b+="";p+='"data":"'+b.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';s++});p+="]}";a.extend(c.p.postData,{filters:p});a.each(["searchField","searchString","searchOper"],function(a,b){c.p.postData.hasOwnProperty(b)&&delete c.p.postData[b]})}else a.extend(c.p.postData,d);var q;if(c.p.searchurl)q=c.p.url,a(c).jqGrid("setGridParam",{url:c.p.searchurl});var r=!1;a.isFunction(b.beforeSearch)&&(r=b.beforeSearch.call(c));
156
- r||a(c).jqGrid("setGridParam",{search:n}).trigger("reloadGrid",[{page:1}]);q&&a(c).jqGrid("setGridParam",{url:q});a.isFunction(b.afterSearch)&&b.afterSearch()},h=a("<tr class='ui-search-toolbar' role='rowheader'></tr>"),g;a.each(c.p.colModel,function(){var j=this,e,l,k,o;l=a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+c.p.direction+"'></th>");e=a("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");this.hidden===!0&&a(l).css("display","none");
157
- this.search=this.search===!1?!1:!0;if(typeof this.stype=="undefined")this.stype="text";k=a.extend({},this.searchoptions||{});if(this.search)switch(this.stype){case "select":if(o=this.surl||k.dataUrl)a.ajax(a.extend({url:o,dataType:"html",complete:function(c){k.buildSelect!==void 0?(c=k.buildSelect(c))&&a(e).append(c):a(e).append(c.responseText);k.defaultValue&&a("select",e).val(k.defaultValue);a("select",e).attr({name:j.index||j.name,id:"gs_"+j.name});k.attr&&a("select",e).attr(k.attr);a("select",
158
- e).css({width:"100%"});k.dataInit!==void 0&&k.dataInit(a("select",e)[0]);k.dataEvents!==void 0&&d(a("select",e)[0],k.dataEvents);b.autosearch===!0&&a("select",e).change(function(){f();return!1});c=null}},a.jgrid.ajaxOptions,c.p.ajaxSelectOptions||{}));else{var m;if(j.searchoptions&&j.searchoptions.value)m=j.searchoptions.value;else if(j.editoptions&&j.editoptions.value)m=j.editoptions.value;if(m){o=document.createElement("select");o.style.width="100%";a(o).attr({name:j.index||j.name,id:"gs_"+j.name});
159
- var n,p;if(typeof m==="string"){m=m.split(";");for(var s=0;s<m.length;s++)n=m[s].split(":"),p=document.createElement("option"),p.value=n[0],p.innerHTML=n[1],o.appendChild(p)}else if(typeof m==="object")for(n in m)if(m.hasOwnProperty(n))p=document.createElement("option"),p.value=n,p.innerHTML=m[n],o.appendChild(p);k.defaultValue&&a(o).val(k.defaultValue);k.attr&&a(o).attr(k.attr);k.dataInit!==void 0&&k.dataInit(o);k.dataEvents!==void 0&&d(o,k.dataEvents);a(e).append(o);b.autosearch===!0&&a(o).change(function(){f();
160
- return!1})}}break;case "text":o=k.defaultValue?k.defaultValue:"",a(e).append("<input type='text' style='width:95%;padding:0px;' name='"+(j.index||j.name)+"' id='gs_"+j.name+"' value='"+o+"'/>"),k.attr&&a("input",e).attr(k.attr),k.dataInit!==void 0&&k.dataInit(a("input",e)[0]),k.dataEvents!==void 0&&d(a("input",e)[0],k.dataEvents),b.autosearch===!0&&(b.searchOnEnter?a("input",e).keypress(function(a){if((a.charCode?a.charCode:a.keyCode?a.keyCode:0)==13)return f(),!1;return this}):a("input",e).keydown(function(a){switch(a.which){case 13:return!1;
161
- case 9:case 16:case 37:case 38:case 39:case 40:case 27:break;default:g&&clearTimeout(g),g=setTimeout(function(){f()},500)}}))}a(l).append(e);a(h).append(l)});a("table thead",c.grid.hDiv).append(h);this.ftoolbar=!0;this.triggerToolbar=f;this.clearToolbar=function(d){var e={},f,g=0,h,d=typeof d!="boolean"?!0:d;a.each(c.p.colModel,function(){f=this.searchoptions&&this.searchoptions.defaultValue?this.searchoptions.defaultValue:"";h=this.index||this.name;switch(this.stype){case "select":var b;a("#gs_"+
162
- a.jgrid.jqID(h)+" option",c.grid.hDiv).each(function(c){if(c===0)this.selected=!0;if(a(this).text()==f)return this.selected=!0,b=a(this).val(),!1});if(b)e[h]=b,g++;else try{delete c.p.postData[h]}catch(d){}break;case "text":if(a("#gs_"+a.jgrid.jqID(h),c.grid.hDiv).val(f),f)e[h]=f,g++;else try{delete c.p.postData[h]}catch(j){}}});var m=g>0?!0:!1;if(b.stringResult===!0||c.p.datatype=="local"){var n='{"groupOp":"'+b.groupOp+'","rules":[',p=0;a.each(e,function(a,b){p>0&&(n+=",");n+='{"field":"'+a+'",';
163
- n+='"op":"eq",';b+="";n+='"data":"'+b.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';p++});n+="]}";a.extend(c.p.postData,{filters:n});a.each(["searchField","searchString","searchOper"],function(a,b){c.p.postData.hasOwnProperty(b)&&delete c.p.postData[b]})}else a.extend(c.p.postData,e);var s;if(c.p.searchurl)s=c.p.url,a(c).jqGrid("setGridParam",{url:c.p.searchurl});var q=!1;a.isFunction(b.beforeClear)&&(q=b.beforeClear.call(c));q||d&&a(c).jqGrid("setGridParam",{search:m}).trigger("reloadGrid",[{page:1}]);
164
- s&&a(c).jqGrid("setGridParam",{url:s});a.isFunction(b.afterClear)&&b.afterClear()};this.toggleToolbar=function(){var b=a("tr.ui-search-toolbar",c.grid.hDiv);b.css("display")=="none"?b.show():b.hide()}}})}})})(jQuery);
165
- (function(a){a.fn.jqm=function(c){var e={overlay:50,closeoverlay:!0,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:h,ajaxText:"",target:h,modal:h,toTop:h,onShow:h,onHide:h,onLoad:h};return this.each(function(){if(this._jqm)return d[this._jqm].c=a.extend({},d[this._jqm].c,c);b++;this._jqm=b;d[b]={c:a.extend(e,a.jqm.params,c),a:h,w:a(this).addClass("jqmID"+b),s:b};e.trigger&&a(this).jqmAddTrigger(e.trigger)})};a.fn.jqmAddClose=function(a){return k(this,a,"jqmHide")};a.fn.jqmAddTrigger=
166
- function(a){return k(this,a,"jqmShow")};a.fn.jqmShow=function(b){return this.each(function(){a.jqm.open(this._jqm,b)})};a.fn.jqmHide=function(b){return this.each(function(){a.jqm.close(this._jqm,b)})};a.jqm={hash:{},open:function(b,j){var k=d[b],p=k.c,l="."+p.closeClass,q=parseInt(k.w.css("z-index")),q=q>0?q:3E3,r=a("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":q-1,opacity:p.overlay/100});if(k.a)return h;k.t=j;k.a=!0;k.w.css("z-index",q);p.modal?(c[0]||setTimeout(function(){e("bind")},
167
- 1),c.push(b)):p.overlay>0?p.closeoverlay&&k.w.jqmAddClose(r):r=h;k.o=r?r.addClass(p.overlayClass).prependTo("body"):h;if(f&&(a("html,body").css({height:"100%",width:"100%"}),r)){var r=r.css({position:"absolute"})[0],t;for(t in{Top:1,Left:1})r.style.setExpression(t.toLowerCase(),"(_=(document.documentElement.scroll"+t+" || document.body.scroll"+t+"))+'px'")}p.ajax?(q=p.target||k.w,r=p.ajax,q=typeof q=="string"?a(q,k.w):a(q),r=r.substr(0,1)=="@"?a(j).attr(r.substring(1)):r,q.html(p.ajaxText).load(r,
168
- function(){p.onLoad&&p.onLoad.call(this,k);l&&k.w.jqmAddClose(a(l,k.w));g(k)})):l&&k.w.jqmAddClose(a(l,k.w));p.toTop&&k.o&&k.w.before('<span id="jqmP'+k.w[0]._jqm+'"></span>').insertAfter(k.o);p.onShow?p.onShow(k):k.w.show();g(k);return h},close:function(b){b=d[b];if(!b.a)return h;b.a=h;c[0]&&(c.pop(),c[0]||e("unbind"));b.c.toTop&&b.o&&a("#jqmP"+b.w[0]._jqm).after(b.w).remove();if(b.c.onHide)b.c.onHide(b);else b.w.hide(),b.o&&b.o.remove();return h},params:{}};var b=0,d=a.jqm.hash,c=[],f=a.browser.msie&&
169
- a.browser.version=="6.0",h=!1,g=function(b){var c=a('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0});f&&(b.o?b.o.html('<p style="width:100%;height:100%"/>').prepend(c):a("iframe.jqm",b.w)[0]||b.w.prepend(c));j(b)},j=function(b){try{a(":input:visible",b.w)[0].focus()}catch(c){}},e=function(b){a(document)[b]("keypress",l)[b]("keydown",l)[b]("mousedown",l)},l=function(b){var e=d[c[c.length-1]];(b=!a(b.target).parents(".jqmID"+e.s)[0])&&j(e);return!b},k=function(b,
170
- c,e){return b.each(function(){var b=this._jqm;a(c).each(function(){this[e]||(this[e]=[],a(this).click(function(){for(var a in{jqmShow:1,jqmHide:1})for(var b in this[a])if(d[this[a][b]])d[this[a][b]].w[a](this);return h}));this[e].push(b)})})}})(jQuery);
171
- (function(a){a.fn.jqDrag=function(a){return h(this,a,"d")};a.fn.jqResize=function(a,b){return h(this,a,"r",b)};a.jqDnR={dnr:{},e:0,drag:function(a){d.k=="d"?c.css({left:d.X+a.pageX-d.pX,top:d.Y+a.pageY-d.pY}):(c.css({width:Math.max(a.pageX-d.pX+d.W,0),height:Math.max(a.pageY-d.pY+d.H,0)}),M1&&f.css({width:Math.max(a.pageX-M1.pX+M1.W,0),height:Math.max(a.pageY-M1.pY+M1.H,0)}));return!1},stop:function(){a(document).unbind("mousemove",b.drag).unbind("mouseup",b.stop)}};var b=a.jqDnR,d=b.dnr,c=b.e,f,
172
- h=function(b,e,h,k){return b.each(function(){e=e?a(e,b):b;e.bind("mousedown",{e:b,k:h},function(b){var e=b.data,j={};c=e.e;f=k?a(k):!1;if(c.css("position")!="relative")try{c.position(j)}catch(h){}d={X:j.left||g("left")||0,Y:j.top||g("top")||0,W:g("width")||c[0].scrollWidth||0,H:g("height")||c[0].scrollHeight||0,pX:b.pageX,pY:b.pageY,k:e.k};M1=f&&e.k!="d"?{X:j.left||f1("left")||0,Y:j.top||f1("top")||0,W:f[0].offsetWidth||f1("width")||0,H:f[0].offsetHeight||f1("height")||0,pX:b.pageX,pY:b.pageY,k:e.k}:
173
- !1;if(a("input.hasDatepicker",c[0])[0])try{a("input.hasDatepicker",c[0]).datepicker("hide")}catch(l){}a(document).mousemove(a.jqDnR.drag).mouseup(a.jqDnR.stop);return!1})})},g=function(a){return parseInt(c.css(a))||!1};f1=function(a){return parseInt(f.css(a))||!1}})(jQuery);
174
- var xmlJsonClass={xml2json:function(a,b){if(a.nodeType===9)a=a.documentElement;var d=this.toJson(this.toObj(this.removeWhite(a)),a.nodeName,"\t");return"{\n"+b+(b?d.replace(/\t/g,b):d.replace(/\t|\n/g,""))+"\n}"},json2xml:function(a,b){var d=function(a,b,c){var e="",f,k;if(a instanceof Array)if(a.length===0)e+=c+"<"+b+">__EMPTY_ARRAY_</"+b+">\n";else{f=0;for(k=a.length;f<k;f+=1){var o=c+d(a[f],b,c+"\t")+"\n";e+=o}}else if(typeof a==="object"){f=!1;e+=c+"<"+b;for(k in a)a.hasOwnProperty(k)&&(k.charAt(0)===
175
- "@"?e+=" "+k.substr(1)+'="'+a[k].toString()+'"':f=!0);e+=f?">":"/>";if(f){for(k in a)a.hasOwnProperty(k)&&(k==="#text"?e+=a[k]:k==="#cdata"?e+="<![CDATA["+a[k]+"]]\>":k.charAt(0)!=="@"&&(e+=d(a[k],k,c+"\t")));e+=(e.charAt(e.length-1)==="\n"?c:"")+"</"+b+">"}}else e+=typeof a==="function"?c+"<"+b+"><![CDATA["+a+"]]\></"+b+">":a.toString()==='""'||a.toString().length===0?c+"<"+b+">__EMPTY_STRING_</"+b+">":c+"<"+b+">"+a.toString()+"</"+b+">";return e},c="",f;for(f in a)a.hasOwnProperty(f)&&(c+=d(a[f],
176
- f,""));return b?c.replace(/\t/g,b):c.replace(/\t|\n/g,"")},toObj:function(a){var b={},d=/function/i;if(a.nodeType===1){if(a.attributes.length){var c;for(c=0;c<a.attributes.length;c+=1)b["@"+a.attributes[c].nodeName]=(a.attributes[c].nodeValue||"").toString()}if(a.firstChild){var f=c=0,h=!1,g;for(g=a.firstChild;g;g=g.nextSibling)g.nodeType===1?h=!0:g.nodeType===3&&g.nodeValue.match(/[^ \f\n\r\t\v]/)?c+=1:g.nodeType===4&&(f+=1);if(h)if(c<2&&f<2){this.removeWhite(a);for(g=a.firstChild;g;g=g.nextSibling)g.nodeType===
177
- 3?b["#text"]=this.escape(g.nodeValue):g.nodeType===4?d.test(g.nodeValue)?b[g.nodeName]=[b[g.nodeName],g.nodeValue]:b["#cdata"]=this.escape(g.nodeValue):b[g.nodeName]?b[g.nodeName]instanceof Array?b[g.nodeName][b[g.nodeName].length]=this.toObj(g):b[g.nodeName]=[b[g.nodeName],this.toObj(g)]:b[g.nodeName]=this.toObj(g)}else a.attributes.length?b["#text"]=this.escape(this.innerXml(a)):b=this.escape(this.innerXml(a));else if(c)a.attributes.length?b["#text"]=this.escape(this.innerXml(a)):(b=this.escape(this.innerXml(a)),
178
- b==="__EMPTY_ARRAY_"?b="[]":b==="__EMPTY_STRING_"&&(b=""));else if(f)if(f>1)b=this.escape(this.innerXml(a));else for(g=a.firstChild;g;g=g.nextSibling)if(d.test(a.firstChild.nodeValue)){b=a.firstChild.nodeValue;break}else b["#cdata"]=this.escape(g.nodeValue)}!a.attributes.length&&!a.firstChild&&(b=null)}else a.nodeType===9?b=this.toObj(a.documentElement):alert("unhandled node type: "+a.nodeType);return b},toJson:function(a,b,d,c){c===void 0&&(c=!0);var f=b?'"'+b+'"':"",h="\t",g="\n";c||(g=h="");if(a===
179
- "[]")f+=b?":[]":"[]";else if(a instanceof Array){var j,e,l=[];e=0;for(j=a.length;e<j;e+=1)l[e]=this.toJson(a[e],"",d+h,c);f+=(b?":[":"[")+(l.length>1?g+d+h+l.join(","+g+d+h)+g+d:l.join(""))+"]"}else if(a===null)f+=(b&&":")+"null";else if(typeof a==="object"){j=[];for(e in a)a.hasOwnProperty(e)&&(j[j.length]=this.toJson(a[e],e,d+h,c));f+=(b?":{":"{")+(j.length>1?g+d+h+j.join(","+g+d+h)+g+d:j.join(""))+"}"}else f+=typeof a==="string"?(b&&":")+'"'+a.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"':(b&&
180
- ":")+'"'+a.toString()+'"';return f},innerXml:function(a){var b="";if("innerHTML"in a)b=a.innerHTML;else for(var d=function(a){var b="",h;if(a.nodeType===1){b+="<"+a.nodeName;for(h=0;h<a.attributes.length;h+=1)b+=" "+a.attributes[h].nodeName+'="'+(a.attributes[h].nodeValue||"").toString()+'"';if(a.firstChild){b+=">";for(h=a.firstChild;h;h=h.nextSibling)b+=d(h);b+="</"+a.nodeName+">"}else b+="/>"}else a.nodeType===3?b+=a.nodeValue:a.nodeType===4&&(b+="<![CDATA["+a.nodeValue+"]]\>");return b},a=a.firstChild;a;a=
181
- a.nextSibling)b+=d(a);return b},escape:function(a){return a.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(a){a.normalize();var b;for(b=a.firstChild;b;)if(b.nodeType===3)if(b.nodeValue.match(/[^ \f\n\r\t\v]/))b=b.nextSibling;else{var d=b.nextSibling;a.removeChild(b);b=d}else b.nodeType===1&&this.removeWhite(b),b=b.nextSibling;return a}};
153
+ searchOnEnter:!0,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,searchurl:"",stringResult:!1,groupOp:"AND",defaultSearch:"bw"},b||{});return this.each(function(){function d(b,c){var d=a(b);d[0]&&jQuery.each(c,function(){this.data!==void 0?d.bind(this.type,this.data,this.fn):d.bind(this.type,this.fn)})}var c=this;if(!this.ftoolbar){var f=function(){var d={},e=0,f,h,g={},o;a.each(c.p.colModel,function(){h=this.index||this.name;switch(this.stype){case "select":o=this.searchoptions&&
154
+ this.searchoptions.sopt?this.searchoptions.sopt[0]:"eq";if(f=a("#gs_"+a.jgrid.jqID(this.name),c.grid.hDiv).val())d[h]=f,g[h]=o,e++;else try{delete c.p.postData[h]}catch(m){}break;case "text":if(o=this.searchoptions&&this.searchoptions.sopt?this.searchoptions.sopt[0]:b.defaultSearch,f=a("#gs_"+a.jgrid.jqID(this.name),c.grid.hDiv).val())d[h]=f,g[h]=o,e++;else try{delete c.p.postData[h]}catch(p){}}});var p=e>0?!0:!1;if(b.stringResult===!0||c.p.datatype=="local"){var m='{"groupOp":"'+b.groupOp+'","rules":[',
155
+ r=0;a.each(d,function(a,b){r>0&&(m+=",");m+='{"field":"'+a+'",';m+='"op":"'+g[a]+'",';b+="";m+='"data":"'+b.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';r++});m+="]}";a.extend(c.p.postData,{filters:m});a.each(["searchField","searchString","searchOper"],function(a,b){c.p.postData.hasOwnProperty(b)&&delete c.p.postData[b]})}else a.extend(c.p.postData,d);var q;if(c.p.searchurl)q=c.p.url,a(c).jqGrid("setGridParam",{url:c.p.searchurl});var s=!1;a.isFunction(b.beforeSearch)&&(s=b.beforeSearch.call(c));
156
+ s||a(c).jqGrid("setGridParam",{search:p}).trigger("reloadGrid",[{page:1}]);q&&a(c).jqGrid("setGridParam",{url:q});a.isFunction(b.afterSearch)&&b.afterSearch()},g=a("<tr class='ui-search-toolbar' role='rowheader'></tr>"),h;a.each(c.p.colModel,function(){var j=this,e,l,k,n;l=a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+c.p.direction+"'></th>");e=a("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");this.hidden===!0&&a(l).css("display","none");
157
+ this.search=this.search===!1?!1:!0;if(typeof this.stype=="undefined")this.stype="text";k=a.extend({},this.searchoptions||{});if(this.search)switch(this.stype){case "select":if(n=this.surl||k.dataUrl)a.ajax(a.extend({url:n,dataType:"html",success:function(c){k.buildSelect!==void 0?(c=k.buildSelect(c))&&a(e).append(c):a(e).append(c);k.defaultValue&&a("select",e).val(k.defaultValue);a("select",e).attr({name:j.index||j.name,id:"gs_"+j.name});k.attr&&a("select",e).attr(k.attr);a("select",e).css({width:"100%"});
158
+ k.dataInit!==void 0&&k.dataInit(a("select",e)[0]);k.dataEvents!==void 0&&d(a("select",e)[0],k.dataEvents);b.autosearch===!0&&a("select",e).change(function(){f();return!1});c=null}},a.jgrid.ajaxOptions,c.p.ajaxSelectOptions||{}));else{var o;if(j.searchoptions&&j.searchoptions.value)o=j.searchoptions.value;else if(j.editoptions&&j.editoptions.value)o=j.editoptions.value;if(o){n=document.createElement("select");n.style.width="100%";a(n).attr({name:j.index||j.name,id:"gs_"+j.name});var p,m;if(typeof o===
159
+ "string"){o=o.split(";");for(var r=0;r<o.length;r++)p=o[r].split(":"),m=document.createElement("option"),m.value=p[0],m.innerHTML=p[1],n.appendChild(m)}else if(typeof o==="object")for(p in o)if(o.hasOwnProperty(p))m=document.createElement("option"),m.value=p,m.innerHTML=o[p],n.appendChild(m);k.defaultValue&&a(n).val(k.defaultValue);k.attr&&a(n).attr(k.attr);k.dataInit!==void 0&&k.dataInit(n);k.dataEvents!==void 0&&d(n,k.dataEvents);a(e).append(n);b.autosearch===!0&&a(n).change(function(){f();return!1})}}break;
160
+ case "text":n=k.defaultValue?k.defaultValue:"",a(e).append("<input type='text' style='width:95%;padding:0px;' name='"+(j.index||j.name)+"' id='gs_"+j.name+"' value='"+n+"'/>"),k.attr&&a("input",e).attr(k.attr),k.dataInit!==void 0&&k.dataInit(a("input",e)[0]),k.dataEvents!==void 0&&d(a("input",e)[0],k.dataEvents),b.autosearch===!0&&(b.searchOnEnter?a("input",e).keypress(function(a){return(a.charCode?a.charCode:a.keyCode?a.keyCode:0)==13?(f(),!1):this}):a("input",e).keydown(function(a){switch(a.which){case 13:return!1;
161
+ case 9:case 16:case 37:case 38:case 39:case 40:case 27:break;default:h&&clearTimeout(h),h=setTimeout(function(){f()},500)}}))}a(l).append(e);a(g).append(l)});a("table thead",c.grid.hDiv).append(g);this.ftoolbar=!0;this.triggerToolbar=f;this.clearToolbar=function(d){var e={},f,h=0,g,d=typeof d!="boolean"?!0:d;a.each(c.p.colModel,function(){f=this.searchoptions&&this.searchoptions.defaultValue?this.searchoptions.defaultValue:"";g=this.index||this.name;switch(this.stype){case "select":var b;a("#gs_"+
162
+ a.jgrid.jqID(g)+" option",c.grid.hDiv).each(function(c){if(c===0)this.selected=!0;if(a(this).text()==f)return this.selected=!0,b=a(this).val(),!1});if(b)e[g]=b,h++;else try{delete c.p.postData[g]}catch(d){}break;case "text":if(a("#gs_"+a.jgrid.jqID(g),c.grid.hDiv).val(f),f)e[g]=f,h++;else try{delete c.p.postData[g]}catch(j){}}});var o=h>0?!0:!1;if(b.stringResult===!0||c.p.datatype=="local"){var p='{"groupOp":"'+b.groupOp+'","rules":[',m=0;a.each(e,function(a,b){m>0&&(p+=",");p+='{"field":"'+a+'",';
163
+ p+='"op":"eq",';b+="";p+='"data":"'+b.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';m++});p+="]}";a.extend(c.p.postData,{filters:p});a.each(["searchField","searchString","searchOper"],function(a,b){c.p.postData.hasOwnProperty(b)&&delete c.p.postData[b]})}else a.extend(c.p.postData,e);var r;if(c.p.searchurl)r=c.p.url,a(c).jqGrid("setGridParam",{url:c.p.searchurl});var q=!1;a.isFunction(b.beforeClear)&&(q=b.beforeClear.call(c));q||d&&a(c).jqGrid("setGridParam",{search:o}).trigger("reloadGrid",[{page:1}]);
164
+ r&&a(c).jqGrid("setGridParam",{url:r});a.isFunction(b.afterClear)&&b.afterClear()};this.toggleToolbar=function(){var b=a("tr.ui-search-toolbar",c.grid.hDiv);b.css("display")=="none"?b.show():b.hide()}}})}})})(jQuery);
165
+ (function(a){a.fn.jqm=function(c){var e={overlay:50,closeoverlay:!0,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:g,ajaxText:"",target:g,modal:g,toTop:g,onShow:g,onHide:g,onLoad:g};return this.each(function(){if(this._jqm)return d[this._jqm].c=a.extend({},d[this._jqm].c,c);b++;this._jqm=b;d[b]={c:a.extend(e,a.jqm.params,c),a:g,w:a(this).addClass("jqmID"+b),s:b};e.trigger&&a(this).jqmAddTrigger(e.trigger)})};a.fn.jqmAddClose=function(a){return k(this,a,"jqmHide")};a.fn.jqmAddTrigger=
166
+ function(a){return k(this,a,"jqmShow")};a.fn.jqmShow=function(b){return this.each(function(){a.jqm.open(this._jqm,b)})};a.fn.jqmHide=function(b){return this.each(function(){a.jqm.close(this._jqm,b)})};a.jqm={hash:{},open:function(b,j){var k=d[b],m=k.c,l="."+m.closeClass,q=parseInt(k.w.css("z-index")),q=q>0?q:3E3,s=a("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":q-1,opacity:m.overlay/100});if(k.a)return g;k.t=j;k.a=!0;k.w.css("z-index",q);m.modal?(c[0]||setTimeout(function(){e("bind")},
167
+ 1),c.push(b)):m.overlay>0?m.closeoverlay&&k.w.jqmAddClose(s):s=g;k.o=s?s.addClass(m.overlayClass).prependTo("body"):g;if(f&&(a("html,body").css({height:"100%",width:"100%"}),s)){var s=s.css({position:"absolute"})[0],t;for(t in{Top:1,Left:1})s.style.setExpression(t.toLowerCase(),"(_=(document.documentElement.scroll"+t+" || document.body.scroll"+t+"))+'px'")}m.ajax?(q=m.target||k.w,s=m.ajax,q=typeof q=="string"?a(q,k.w):a(q),s=s.substr(0,1)=="@"?a(j).attr(s.substring(1)):s,q.html(m.ajaxText).load(s,
168
+ function(){m.onLoad&&m.onLoad.call(this,k);l&&k.w.jqmAddClose(a(l,k.w));h(k)})):l&&k.w.jqmAddClose(a(l,k.w));m.toTop&&k.o&&k.w.before('<span id="jqmP'+k.w[0]._jqm+'"></span>').insertAfter(k.o);m.onShow?m.onShow(k):k.w.show();h(k);return g},close:function(b){b=d[b];if(!b.a)return g;b.a=g;c[0]&&(c.pop(),c[0]||e("unbind"));b.c.toTop&&b.o&&a("#jqmP"+b.w[0]._jqm).after(b.w).remove();if(b.c.onHide)b.c.onHide(b);else b.w.hide(),b.o&&b.o.remove();return g},params:{}};var b=0,d=a.jqm.hash,c=[],f=a.browser.msie&&
169
+ a.browser.version=="6.0",g=!1,h=function(b){var c=a('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0});f&&(b.o?b.o.html('<p style="width:100%;height:100%"/>').prepend(c):a("iframe.jqm",b.w)[0]||b.w.prepend(c));j(b)},j=function(b){try{a(":input:visible",b.w)[0].focus()}catch(c){}},e=function(b){a(document)[b]("keypress",l)[b]("keydown",l)[b]("mousedown",l)},l=function(b){var e=d[c[c.length-1]];(b=!a(b.target).parents(".jqmID"+e.s)[0])&&j(e);return!b},k=function(b,
170
+ c,e){return b.each(function(){var b=this._jqm;a(c).each(function(){this[e]||(this[e]=[],a(this).click(function(){for(var a in{jqmShow:1,jqmHide:1})for(var b in this[a])if(d[this[a][b]])d[this[a][b]].w[a](this);return g}));this[e].push(b)})})}})(jQuery);
171
+ (function(a){a.fn.jqDrag=function(a){return g(this,a,"d")};a.fn.jqResize=function(a,b){return g(this,a,"r",b)};a.jqDnR={dnr:{},e:0,drag:function(a){d.k=="d"?c.css({left:d.X+a.pageX-d.pX,top:d.Y+a.pageY-d.pY}):(c.css({width:Math.max(a.pageX-d.pX+d.W,0),height:Math.max(a.pageY-d.pY+d.H,0)}),M1&&f.css({width:Math.max(a.pageX-M1.pX+M1.W,0),height:Math.max(a.pageY-M1.pY+M1.H,0)}));return!1},stop:function(){a(document).unbind("mousemove",b.drag).unbind("mouseup",b.stop)}};var b=a.jqDnR,d=b.dnr,c=b.e,f,
172
+ g=function(b,e,g,k){return b.each(function(){e=e?a(e,b):b;e.bind("mousedown",{e:b,k:g},function(b){var e=b.data,j={};c=e.e;f=k?a(k):!1;if(c.css("position")!="relative")try{c.position(j)}catch(g){}d={X:j.left||h("left")||0,Y:j.top||h("top")||0,W:h("width")||c[0].scrollWidth||0,H:h("height")||c[0].scrollHeight||0,pX:b.pageX,pY:b.pageY,k:e.k};M1=f&&e.k!="d"?{X:j.left||f1("left")||0,Y:j.top||f1("top")||0,W:f[0].offsetWidth||f1("width")||0,H:f[0].offsetHeight||f1("height")||0,pX:b.pageX,pY:b.pageY,k:e.k}:
173
+ !1;if(a("input.hasDatepicker",c[0])[0])try{a("input.hasDatepicker",c[0]).datepicker("hide")}catch(l){}a(document).mousemove(a.jqDnR.drag).mouseup(a.jqDnR.stop);return!1})})},h=function(a){return parseInt(c.css(a))||!1};f1=function(a){return parseInt(f.css(a))||!1}})(jQuery);
174
+ var xmlJsonClass={xml2json:function(a,b){if(a.nodeType===9)a=a.documentElement;var d=this.toJson(this.toObj(this.removeWhite(a)),a.nodeName,"\t");return"{\n"+b+(b?d.replace(/\t/g,b):d.replace(/\t|\n/g,""))+"\n}"},json2xml:function(a,b){var d=function(a,b,c){var e="",f,k;if(a instanceof Array)if(a.length===0)e+=c+"<"+b+">__EMPTY_ARRAY_</"+b+">\n";else{f=0;for(k=a.length;f<k;f+=1){var n=c+d(a[f],b,c+"\t")+"\n";e+=n}}else if(typeof a==="object"){f=!1;e+=c+"<"+b;for(k in a)a.hasOwnProperty(k)&&(k.charAt(0)===
175
+ "@"?e+=" "+k.substr(1)+'="'+a[k].toString()+'"':f=!0);e+=f?">":"/>";if(f){for(k in a)a.hasOwnProperty(k)&&(k==="#text"?e+=a[k]:k==="#cdata"?e+="<![CDATA["+a[k]+"]]\>":k.charAt(0)!=="@"&&(e+=d(a[k],k,c+"\t")));e+=(e.charAt(e.length-1)==="\n"?c:"")+"</"+b+">"}}else typeof a==="function"?e+=c+"<"+b+"><![CDATA["+a+"]]\></"+b+">":(a===void 0&&(a=""),e+=a.toString()==='""'||a.toString().length===0?c+"<"+b+">__EMPTY_STRING_</"+b+">":c+"<"+b+">"+a.toString()+"</"+b+">");return e},c="",f;for(f in a)a.hasOwnProperty(f)&&
176
+ (c+=d(a[f],f,""));return b?c.replace(/\t/g,b):c.replace(/\t|\n/g,"")},toObj:function(a){var b={},d=/function/i;if(a.nodeType===1){if(a.attributes.length){var c;for(c=0;c<a.attributes.length;c+=1)b["@"+a.attributes[c].nodeName]=(a.attributes[c].nodeValue||"").toString()}if(a.firstChild){var f=c=0,g=!1,h;for(h=a.firstChild;h;h=h.nextSibling)h.nodeType===1?g=!0:h.nodeType===3&&h.nodeValue.match(/[^ \f\n\r\t\v]/)?c+=1:h.nodeType===4&&(f+=1);if(g)if(c<2&&f<2){this.removeWhite(a);for(h=a.firstChild;h;h=
177
+ h.nextSibling)h.nodeType===3?b["#text"]=this.escape(h.nodeValue):h.nodeType===4?d.test(h.nodeValue)?b[h.nodeName]=[b[h.nodeName],h.nodeValue]:b["#cdata"]=this.escape(h.nodeValue):b[h.nodeName]?b[h.nodeName]instanceof Array?b[h.nodeName][b[h.nodeName].length]=this.toObj(h):b[h.nodeName]=[b[h.nodeName],this.toObj(h)]:b[h.nodeName]=this.toObj(h)}else a.attributes.length?b["#text"]=this.escape(this.innerXml(a)):b=this.escape(this.innerXml(a));else if(c)a.attributes.length?b["#text"]=this.escape(this.innerXml(a)):
178
+ (b=this.escape(this.innerXml(a)),b==="__EMPTY_ARRAY_"?b="[]":b==="__EMPTY_STRING_"&&(b=""));else if(f)if(f>1)b=this.escape(this.innerXml(a));else for(h=a.firstChild;h;h=h.nextSibling)if(d.test(a.firstChild.nodeValue)){b=a.firstChild.nodeValue;break}else b["#cdata"]=this.escape(h.nodeValue)}!a.attributes.length&&!a.firstChild&&(b=null)}else a.nodeType===9?b=this.toObj(a.documentElement):alert("unhandled node type: "+a.nodeType);return b},toJson:function(a,b,d,c){c===void 0&&(c=!0);var f=b?'"'+b+'"':
179
+ "",g="\t",h="\n";c||(h=g="");if(a==="[]")f+=b?":[]":"[]";else if(a instanceof Array){var j,e,l=[];e=0;for(j=a.length;e<j;e+=1)l[e]=this.toJson(a[e],"",d+g,c);f+=(b?":[":"[")+(l.length>1?h+d+g+l.join(","+h+d+g)+h+d:l.join(""))+"]"}else if(a===null)f+=(b&&":")+"null";else if(typeof a==="object"){j=[];for(e in a)a.hasOwnProperty(e)&&(j[j.length]=this.toJson(a[e],e,d+g,c));f+=(b?":{":"{")+(j.length>1?h+d+g+j.join(","+h+d+g)+h+d:j.join(""))+"}"}else f+=typeof a==="string"?(b&&":")+'"'+a.replace(/\\/g,
180
+ "\\\\").replace(/\"/g,'\\"')+'"':(b&&":")+'"'+a.toString()+'"';return f},innerXml:function(a){var b="";if("innerHTML"in a)b=a.innerHTML;else for(var d=function(a){var b="",g;if(a.nodeType===1){b+="<"+a.nodeName;for(g=0;g<a.attributes.length;g+=1)b+=" "+a.attributes[g].nodeName+'="'+(a.attributes[g].nodeValue||"").toString()+'"';if(a.firstChild){b+=">";for(g=a.firstChild;g;g=g.nextSibling)b+=d(g);b+="</"+a.nodeName+">"}else b+="/>"}else a.nodeType===3?b+=a.nodeValue:a.nodeType===4&&(b+="<![CDATA["+
181
+ a.nodeValue+"]]\>");return b},a=a.firstChild;a;a=a.nextSibling)b+=d(a);return b},escape:function(a){return a.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(a){a.normalize();var b;for(b=a.firstChild;b;)if(b.nodeType===3)if(b.nodeValue.match(/[^ \f\n\r\t\v]/))b=b.nextSibling;else{var d=b.nextSibling;a.removeChild(b);b=d}else b.nodeType===1&&this.removeWhite(b),b=b.nextSibling;return a}};
182
182
  (function(a){a.fmatter={};a.extend(a.fmatter,{isBoolean:function(a){return typeof a==="boolean"},isObject:function(b){return b&&(typeof b==="object"||a.isFunction(b))||!1},isString:function(a){return typeof a==="string"},isNumber:function(a){return typeof a==="number"&&isFinite(a)},isNull:function(a){return a===null},isUndefined:function(a){return typeof a==="undefined"},isValue:function(a){return this.isObject(a)||this.isString(a)||this.isNumber(a)||this.isBoolean(a)},isEmpty:function(b){if(!this.isString(b)&&
183
- this.isValue(b))return!1;else if(!this.isValue(b))return!0;b=a.trim(b).replace(/\&nbsp\;/ig,"").replace(/\&#160\;/ig,"");return b===""}});a.fn.fmatter=function(b,d,c,f,h){var g=d,c=a.extend({},a.jgrid.formatter,c);a.fn.fmatter[b]&&(g=a.fn.fmatter[b](d,c,f,h));return g};a.fmatter.util={NumberFormat:function(b,d){a.fmatter.isNumber(b)||(b*=1);if(a.fmatter.isNumber(b)){var c=b<0,f=b+"",h=d.decimalSeparator?d.decimalSeparator:".",g;if(a.fmatter.isNumber(d.decimalPlaces)){var j=d.decimalPlaces,f=Math.pow(10,
184
- j),f=Math.round(b*f)/f+"";g=f.lastIndexOf(".");if(j>0){g<0?(f+=h,g=f.length-1):h!=="."&&(f=f.replace(".",h));for(;f.length-1-g<j;)f+="0"}}if(d.thousandsSeparator){j=d.thousandsSeparator;g=f.lastIndexOf(h);g=g>-1?g:f.length;for(var h=f.substring(g),e=-1,l=g;l>0;l--){e++;if(e%3===0&&l!==g&&(!c||l>1))h=j+h;h=f.charAt(l-1)+h}f=h}f=d.prefix?d.prefix+f:f;return f=d.suffix?f+d.suffix:f}else return b},DateFormat:function(b,d,c,f){var h=/^\/Date\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\)\/$/,g=typeof d===
185
- "string"?d.match(h):null,h=function(a,b){a=String(a);for(b=parseInt(b,10)||2;a.length<b;)a="0"+a;return a},j={m:1,d:1,y:1970,h:0,i:0,s:0,u:0},e=0,l,k=["i18n"];k.i18n={dayNames:f.dayNames,monthNames:f.monthNames};b in f.masks&&(b=f.masks[b]);if(d.constructor===Number)String(b).toLowerCase()=="u"&&(d*=1E3),e=new Date(d);else if(d.constructor===Date)e=d;else if(g!==null)e=new Date(parseInt(g[1],10)),g[3]&&(b=Number(g[5])*60+Number(g[6]),b*=g[4]=="-"?1:-1,b-=e.getTimezoneOffset(),e.setTime(Number(Number(e)+
186
- b*6E4)));else{d=String(d).split(/[\\\/:_;.,\t\T\s-]/);b=b.split(/[\\\/:_;.,\t\T\s-]/);g=0;for(l=b.length;g<l;g++)b[g]=="M"&&(e=a.inArray(d[g],k.i18n.monthNames),e!==-1&&e<12&&(d[g]=e+1)),b[g]=="F"&&(e=a.inArray(d[g],k.i18n.monthNames),e!==-1&&e>11&&(d[g]=e+1-12)),d[g]&&(j[b[g].toLowerCase()]=parseInt(d[g],10));if(j.f)j.m=j.f;if(j.m===0&&j.y===0&&j.d===0)return"&#160;";j.m=parseInt(j.m,10)-1;e=j.y;if(e>=70&&e<=99)j.y=1900+j.y;else if(e>=0&&e<=69)j.y=2E3+j.y;e=new Date(j.y,j.m,j.d,j.h,j.i,j.s,j.u)}c in
187
- f.masks?c=f.masks[c]:c||(c="Y-m-d");b=e.getHours();d=e.getMinutes();j=e.getDate();g=e.getMonth()+1;l=e.getTimezoneOffset();var o=e.getSeconds(),m=e.getMilliseconds(),n=e.getDay(),p=e.getFullYear(),s=(n+6)%7+1,q=(new Date(p,g-1,j)-new Date(p,0,1))/864E5,r={d:h(j),D:k.i18n.dayNames[n],j:j,l:k.i18n.dayNames[n+7],N:s,S:f.S(j),w:n,z:q,W:s<5?Math.floor((q+s-1)/7)+1:Math.floor((q+s-1)/7)||(((new Date(p-1,0,1)).getDay()+6)%7<4?53:52),F:k.i18n.monthNames[g-1+12],m:h(g),M:k.i18n.monthNames[g-1],n:g,t:"?",L:"?",
188
- o:"?",Y:p,y:String(p).substring(2),a:b<12?f.AmPm[0]:f.AmPm[1],A:b<12?f.AmPm[2]:f.AmPm[3],B:"?",g:b%12||12,G:b,h:h(b%12||12),H:h(b),i:h(d),s:h(o),u:m,e:"?",I:"?",O:(l>0?"-":"+")+h(Math.floor(Math.abs(l)/60)*100+Math.abs(l)%60,4),P:"?",T:(String(e).match(/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g)||[""]).pop().replace(/[^-+\dA-Z]/g,""),Z:"?",c:"?",r:"?",U:Math.floor(e/1E3)};return c.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,
189
- function(a){return a in r?r[a]:a.substring(1)})}};a.fn.fmatter.defaultFormat=function(b,d){return a.fmatter.isValue(b)&&b!==""?b:d.defaultValue?d.defaultValue:"&#160;"};a.fn.fmatter.email=function(b,d){return a.fmatter.isEmpty(b)?a.fn.fmatter.defaultFormat(b,d):'<a href="mailto:'+b+'">'+b+"</a>"};a.fn.fmatter.checkbox=function(b,d){var c=a.extend({},d.checkbox),f;a.fmatter.isUndefined(d.colModel.formatoptions)||(c=a.extend({},c,d.colModel.formatoptions));f=c.disabled===!0?'disabled="disabled"':"";
183
+ this.isValue(b))return!1;else if(!this.isValue(b))return!0;b=a.trim(b).replace(/\&nbsp\;/ig,"").replace(/\&#160\;/ig,"");return b===""}});a.fn.fmatter=function(b,d,c,f,g){var h=d,c=a.extend({},a.jgrid.formatter,c);a.fn.fmatter[b]&&(h=a.fn.fmatter[b](d,c,f,g));return h};a.fmatter.util={NumberFormat:function(b,d){a.fmatter.isNumber(b)||(b*=1);if(a.fmatter.isNumber(b)){var c=b<0,f=b+"",g=d.decimalSeparator?d.decimalSeparator:".",h;if(a.fmatter.isNumber(d.decimalPlaces)){var j=d.decimalPlaces,f=Math.pow(10,
184
+ j),f=Math.round(b*f)/f+"";h=f.lastIndexOf(".");if(j>0){h<0?(f+=g,h=f.length-1):g!=="."&&(f=f.replace(".",g));for(;f.length-1-h<j;)f+="0"}}if(d.thousandsSeparator){j=d.thousandsSeparator;h=f.lastIndexOf(g);h=h>-1?h:f.length;for(var g=f.substring(h),e=-1,l=h;l>0;l--){e++;if(e%3===0&&l!==h&&(!c||l>1))g=j+g;g=f.charAt(l-1)+g}f=g}f=d.prefix?d.prefix+f:f;return f=d.suffix?f+d.suffix:f}else return b},DateFormat:function(b,d,c,f){var g=/^\/Date\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\)\/$/,h=typeof d===
185
+ "string"?d.match(g):null,g=function(a,b){a=String(a);for(b=parseInt(b,10)||2;a.length<b;)a="0"+a;return a},j={m:1,d:1,y:1970,h:0,i:0,s:0,u:0},e=0,l,k=["i18n"];k.i18n={dayNames:f.dayNames,monthNames:f.monthNames};b in f.masks&&(b=f.masks[b]);if(!isNaN(d-0)&&String(b).toLowerCase()=="u")e=new Date(parseFloat(d)*1E3);else if(d.constructor===Date)e=d;else if(h!==null)e=new Date(parseInt(h[1],10)),h[3]&&(b=Number(h[5])*60+Number(h[6]),b*=h[4]=="-"?1:-1,b-=e.getTimezoneOffset(),e.setTime(Number(Number(e)+
186
+ b*6E4)));else{d=String(d).split(/[\\\/:_;.,\t\T\s-]/);b=b.split(/[\\\/:_;.,\t\T\s-]/);h=0;for(l=b.length;h<l;h++)b[h]=="M"&&(e=a.inArray(d[h],k.i18n.monthNames),e!==-1&&e<12&&(d[h]=e+1)),b[h]=="F"&&(e=a.inArray(d[h],k.i18n.monthNames),e!==-1&&e>11&&(d[h]=e+1-12)),d[h]&&(j[b[h].toLowerCase()]=parseInt(d[h],10));if(j.f)j.m=j.f;if(j.m===0&&j.y===0&&j.d===0)return"&#160;";j.m=parseInt(j.m,10)-1;e=j.y;if(e>=70&&e<=99)j.y=1900+j.y;else if(e>=0&&e<=69)j.y=2E3+j.y;e=new Date(j.y,j.m,j.d,j.h,j.i,j.s,j.u)}c in
187
+ f.masks?c=f.masks[c]:c||(c="Y-m-d");b=e.getHours();d=e.getMinutes();j=e.getDate();h=e.getMonth()+1;l=e.getTimezoneOffset();var n=e.getSeconds(),o=e.getMilliseconds(),p=e.getDay(),m=e.getFullYear(),r=(p+6)%7+1,q=(new Date(m,h-1,j)-new Date(m,0,1))/864E5,s={d:g(j),D:k.i18n.dayNames[p],j:j,l:k.i18n.dayNames[p+7],N:r,S:f.S(j),w:p,z:q,W:r<5?Math.floor((q+r-1)/7)+1:Math.floor((q+r-1)/7)||(((new Date(m-1,0,1)).getDay()+6)%7<4?53:52),F:k.i18n.monthNames[h-1+12],m:g(h),M:k.i18n.monthNames[h-1],n:h,t:"?",L:"?",
188
+ o:"?",Y:m,y:String(m).substring(2),a:b<12?f.AmPm[0]:f.AmPm[1],A:b<12?f.AmPm[2]:f.AmPm[3],B:"?",g:b%12||12,G:b,h:g(b%12||12),H:g(b),i:g(d),s:g(n),u:o,e:"?",I:"?",O:(l>0?"-":"+")+g(Math.floor(Math.abs(l)/60)*100+Math.abs(l)%60,4),P:"?",T:(String(e).match(/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g)||[""]).pop().replace(/[^-+\dA-Z]/g,""),Z:"?",c:"?",r:"?",U:Math.floor(e/1E3)};return c.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,
189
+ function(a){return a in s?s[a]:a.substring(1)})}};a.fn.fmatter.defaultFormat=function(b,d){return a.fmatter.isValue(b)&&b!==""?b:d.defaultValue?d.defaultValue:"&#160;"};a.fn.fmatter.email=function(b,d){return a.fmatter.isEmpty(b)?a.fn.fmatter.defaultFormat(b,d):'<a href="mailto:'+b+'">'+b+"</a>"};a.fn.fmatter.checkbox=function(b,d){var c=a.extend({},d.checkbox),f;a.fmatter.isUndefined(d.colModel.formatoptions)||(c=a.extend({},c,d.colModel.formatoptions));f=c.disabled===!0?'disabled="disabled"':"";
190
190
  if(a.fmatter.isEmpty(b)||a.fmatter.isUndefined(b))b=a.fn.fmatter.defaultFormat(b,c);b+="";b=b.toLowerCase();return'<input type="checkbox" '+(b.search(/(false|0|no|off)/i)<0?" checked='checked' ":"")+' value="'+b+'" offval="no" '+f+"/>"};a.fn.fmatter.link=function(b,d){var c={target:d.target},f="";a.fmatter.isUndefined(d.colModel.formatoptions)||(c=a.extend({},c,d.colModel.formatoptions));c.target&&(f="target="+c.target);return a.fmatter.isEmpty(b)?a.fn.fmatter.defaultFormat(b,d):"<a "+f+' href="'+
191
191
  b+'">'+b+"</a>"};a.fn.fmatter.showlink=function(b,d){var c={baseLinkUrl:d.baseLinkUrl,showAction:d.showAction,addParam:d.addParam||"",target:d.target,idName:d.idName},f="";a.fmatter.isUndefined(d.colModel.formatoptions)||(c=a.extend({},c,d.colModel.formatoptions));c.target&&(f="target="+c.target);c=c.baseLinkUrl+c.showAction+"?"+c.idName+"="+d.rowId+c.addParam;return a.fmatter.isString(b)||a.fmatter.isNumber(b)?"<a "+f+' href="'+c+'">'+b+"</a>":a.fn.fmatter.defaultFormat(b,d)};a.fn.fmatter.integer=
192
- function(b,d){var c=a.extend({},d.integer);a.fmatter.isUndefined(d.colModel.formatoptions)||(c=a.extend({},c,d.colModel.formatoptions));if(a.fmatter.isEmpty(b))return c.defaultValue;return a.fmatter.util.NumberFormat(b,c)};a.fn.fmatter.number=function(b,d){var c=a.extend({},d.number);a.fmatter.isUndefined(d.colModel.formatoptions)||(c=a.extend({},c,d.colModel.formatoptions));if(a.fmatter.isEmpty(b))return c.defaultValue;return a.fmatter.util.NumberFormat(b,c)};a.fn.fmatter.currency=function(b,d){var c=
193
- a.extend({},d.currency);a.fmatter.isUndefined(d.colModel.formatoptions)||(c=a.extend({},c,d.colModel.formatoptions));if(a.fmatter.isEmpty(b))return c.defaultValue;return a.fmatter.util.NumberFormat(b,c)};a.fn.fmatter.date=function(b,d,c,f){c=a.extend({},d.date);a.fmatter.isUndefined(d.colModel.formatoptions)||(c=a.extend({},c,d.colModel.formatoptions));return!c.reformatAfterEdit&&f=="edit"?a.fn.fmatter.defaultFormat(b,d):a.fmatter.isEmpty(b)?a.fn.fmatter.defaultFormat(b,d):a.fmatter.util.DateFormat(c.srcformat,
194
- b,c.newformat,c)};a.fn.fmatter.select=function(b,d){b+="";var c=!1,f=[];if(a.fmatter.isUndefined(d.colModel.formatoptions)){if(!a.fmatter.isUndefined(d.colModel.editoptions))c=d.colModel.editoptions.value}else c=d.colModel.formatoptions.value;if(c){var h=d.colModel.editoptions.multiple===!0?!0:!1,g=[],j;h&&(g=b.split(","),g=a.map(g,function(b){return a.trim(b)}));if(a.fmatter.isString(c))for(var e=c.split(";"),l=0,k=0;k<e.length;k++)if(j=e[k].split(":"),j.length>2&&(j[1]=jQuery.map(j,function(a,b){if(b>
195
- 0)return a}).join(":")),h)jQuery.inArray(j[0],g)>-1&&(f[l]=j[1],l++);else{if(a.trim(j[0])==a.trim(b)){f[0]=j[1];break}}else a.fmatter.isObject(c)&&(h?f=jQuery.map(g,function(a){return c[a]}):f[0]=c[b]||"")}b=f.join(", ");return b===""?a.fn.fmatter.defaultFormat(b,d):b};a.fn.fmatter.rowactions=function(b,d,c,f){var h={keys:!1,onEdit:null,onSuccess:null,afterSave:null,onError:null,afterRestore:null,extraparam:{oper:"edit"},url:null,delOptions:{},editOptions:{}},f=a("#"+d)[0].p.colModel[f];a.fmatter.isUndefined(f.formatoptions)||
196
- (h=a.extend(h,f.formatoptions));if(!a.fmatter.isUndefined(a("#"+d)[0].p.editOptions))h.editOptions=a("#"+d)[0].p.editOptions;if(!a.fmatter.isUndefined(a("#"+d)[0].p.delOptions))h.delOptions=a("#"+d)[0].p.delOptions;var f=function(c){h.afterSave&&h.afterSave(c);a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del","#"+d).show();a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel","#"+d).hide()},g=function(c){h.afterRestore&&h.afterRestore(c);a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del",
197
- "#"+d).show();a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel","#"+d).hide()};switch(c){case "edit":a("#"+d).jqGrid("editRow",b,h.keys,h.onEdit,h.onSuccess,h.url,h.extraparam,f,h.onError,g);a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del","#"+d).hide();a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel","#"+d).show();break;case "save":a("#"+d).jqGrid("saveRow",b,h.onSuccess,h.url,h.extraparam,f,h.onError,g)&&(a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del",
198
- "#"+d).show(),a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel","#"+d).hide());break;case "cancel":a("#"+d).jqGrid("restoreRow",b,g);a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del","#"+d).show();a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel","#"+d).hide();break;case "del":a("#"+d).jqGrid("delGridRow",b,h.delOptions);break;case "formedit":a("#"+d).jqGrid("setSelection",b),a("#"+d).jqGrid("editGridRow",b,h.editOptions)}};a.fn.fmatter.actions=function(b,d){var c=
199
- {keys:!1,editbutton:!0,delbutton:!0,editformbutton:!1};a.fmatter.isUndefined(d.colModel.formatoptions)||(c=a.extend(c,d.colModel.formatoptions));var f=d.rowId,h="",g;if(typeof f=="undefined"||a.fmatter.isEmpty(f))return"";c.editformbutton?(g="onclick=$.fn.fmatter.rowactions('"+f+"','"+d.gid+"','formedit',"+d.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ",h=h+"<div style='margin-left:8px;'><div title='"+a.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+
200
- g+"><span class='ui-icon ui-icon-pencil'></span></div>"):c.editbutton&&(g="onclick=$.fn.fmatter.rowactions('"+f+"','"+d.gid+"','edit',"+d.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover') ",h=h+"<div style='margin-left:8px;'><div title='"+a.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+g+"><span class='ui-icon ui-icon-pencil'></span></div>");c.delbutton&&(g="onclick=$.fn.fmatter.rowactions('"+
201
- f+"','"+d.gid+"','del',"+d.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ",h=h+"<div title='"+a.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+g+"><span class='ui-icon ui-icon-trash'></span></div>");g="onclick=$.fn.fmatter.rowactions('"+f+"','"+d.gid+"','save',"+d.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";h=h+
202
- "<div title='"+a.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save'><span class='ui-icon ui-icon-disk' "+g+"></span></div>";g="onclick=$.fn.fmatter.rowactions('"+f+"','"+d.gid+"','cancel',"+d.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";return h=h+"<div title='"+a.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel'><span class='ui-icon ui-icon-cancel' "+
203
- g+"></span></div></div>"};a.unformat=function(b,d,c,f){var h,g=d.colModel.formatter,j=d.colModel.formatoptions||{},e=/([\.\*\_\'\(\)\{\}\+\?\\])/g,l=d.colModel.unformat||a.fn.fmatter[g]&&a.fn.fmatter[g].unformat;if(typeof l!=="undefined"&&a.isFunction(l))h=l(a(b).text(),d,b);else if(!a.fmatter.isUndefined(g)&&a.fmatter.isString(g))switch(h=a.jgrid.formatter||{},g){case "integer":j=a.extend({},h.integer,j);d=j.thousandsSeparator.replace(e,"\\$1");h=a(b).text().replace(RegExp(d,"g"),"");break;case "number":j=
204
- a.extend({},h.number,j);d=j.thousandsSeparator.replace(e,"\\$1");h=a(b).text().replace(RegExp(d,"g"),"").replace(j.decimalSeparator,".");break;case "currency":j=a.extend({},h.currency,j);d=j.thousandsSeparator.replace(e,"\\$1");h=a(b).text().replace(RegExp(d,"g"),"").replace(j.decimalSeparator,".").replace(j.prefix,"").replace(j.suffix,"");break;case "checkbox":j=d.colModel.editoptions?d.colModel.editoptions.value.split(":"):["Yes","No"];h=a("input",b).attr("checked")?j[0]:j[1];break;case "select":h=
205
- a.unformat.select(b,d,c,f);break;case "actions":return"";default:h=a(b).text()}return h?h:f===!0?a(b).text():a.jgrid.htmlDecode(a(b).html())};a.unformat.select=function(b,d,c,f){c=[];b=a(b).text();if(f===!0)return b;d=a.extend({},d.colModel.editoptions);if(d.value){var h=d.value,d=d.multiple===!0?!0:!1,f=[],g;d&&(f=b.split(","),f=a.map(f,function(b){return a.trim(b)}));if(a.fmatter.isString(h))for(var j=h.split(";"),e=0,l=0;l<j.length;l++)if(g=j[l].split(":"),g.length>2&&(g[1]=jQuery.map(g,function(a,
206
- b){if(b>0)return a}).join(":")),d)jQuery.inArray(g[1],f)>-1&&(c[e]=g[0],e++);else{if(a.trim(g[1])==a.trim(b)){c[0]=g[0];break}}else if(a.fmatter.isObject(h)||a.isArray(h))d||(f[0]=b),c=jQuery.map(f,function(b){var c;a.each(h,function(a,d){if(d==b)return c=a,!1});if(typeof c!="undefined")return c});return c.join(", ")}else return b||""};a.unformat.date=function(b,d){var c=a.jgrid.formatter.date||{};a.fmatter.isUndefined(d.formatoptions)||(c=a.extend({},c,d.formatoptions));return a.fmatter.isEmpty(b)?
207
- a.fn.fmatter.defaultFormat(b,d):a.fmatter.util.DateFormat(c.newformat,b,c.srcformat,c)}})(jQuery);
192
+ function(b,d){var c=a.extend({},d.integer);a.fmatter.isUndefined(d.colModel.formatoptions)||(c=a.extend({},c,d.colModel.formatoptions));return a.fmatter.isEmpty(b)?c.defaultValue:a.fmatter.util.NumberFormat(b,c)};a.fn.fmatter.number=function(b,d){var c=a.extend({},d.number);a.fmatter.isUndefined(d.colModel.formatoptions)||(c=a.extend({},c,d.colModel.formatoptions));return a.fmatter.isEmpty(b)?c.defaultValue:a.fmatter.util.NumberFormat(b,c)};a.fn.fmatter.currency=function(b,d){var c=a.extend({},d.currency);
193
+ a.fmatter.isUndefined(d.colModel.formatoptions)||(c=a.extend({},c,d.colModel.formatoptions));return a.fmatter.isEmpty(b)?c.defaultValue:a.fmatter.util.NumberFormat(b,c)};a.fn.fmatter.date=function(b,d,c,f){c=a.extend({},d.date);a.fmatter.isUndefined(d.colModel.formatoptions)||(c=a.extend({},c,d.colModel.formatoptions));return!c.reformatAfterEdit&&f=="edit"?a.fn.fmatter.defaultFormat(b,d):a.fmatter.isEmpty(b)?a.fn.fmatter.defaultFormat(b,d):a.fmatter.util.DateFormat(c.srcformat,b,c.newformat,c)};a.fn.fmatter.select=
194
+ function(b,d){b+="";var c=!1,f=[];if(a.fmatter.isUndefined(d.colModel.formatoptions)){if(!a.fmatter.isUndefined(d.colModel.editoptions))c=d.colModel.editoptions.value}else c=d.colModel.formatoptions.value;if(c){var g=d.colModel.editoptions.multiple===!0?!0:!1,h=[],j;g&&(h=b.split(","),h=a.map(h,function(b){return a.trim(b)}));if(a.fmatter.isString(c))for(var e=c.split(";"),l=0,k=0;k<e.length;k++)if(j=e[k].split(":"),j.length>2&&(j[1]=jQuery.map(j,function(a,b){if(b>0)return a}).join(":")),g)jQuery.inArray(j[0],
195
+ h)>-1&&(f[l]=j[1],l++);else{if(a.trim(j[0])==a.trim(b)){f[0]=j[1];break}}else a.fmatter.isObject(c)&&(g?f=jQuery.map(h,function(a){return c[a]}):f[0]=c[b]||"")}b=f.join(", ");return b===""?a.fn.fmatter.defaultFormat(b,d):b};a.fn.fmatter.rowactions=function(b,d,c,f){var g={keys:!1,onEdit:null,onSuccess:null,afterSave:null,onError:null,afterRestore:null,extraparam:{oper:"edit"},url:null,delOptions:{},editOptions:{}},b=a.jgrid.jqID(b),d=a.jgrid.jqID(d),f=a("#"+d)[0].p.colModel[f];a.fmatter.isUndefined(f.formatoptions)||
196
+ (g=a.extend(g,f.formatoptions));if(!a.fmatter.isUndefined(a("#"+d)[0].p.editOptions))g.editOptions=a("#"+d)[0].p.editOptions;if(!a.fmatter.isUndefined(a("#"+d)[0].p.delOptions))g.delOptions=a("#"+d)[0].p.delOptions;var f=function(c){g.afterSave&&g.afterSave(c);a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del","#"+d+".ui-jqgrid-btable:first").show();a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel","#"+d+".ui-jqgrid-btable:first").hide()},h=function(c){g.afterRestore&&g.afterRestore(c);
197
+ a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del","#"+d+".ui-jqgrid-btable:first").show();a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel","#"+d+".ui-jqgrid-btable:first").hide()};switch(c){case "edit":a("#"+d).jqGrid("editRow",b,g.keys,g.onEdit,g.onSuccess,g.url,g.extraparam,f,g.onError,h);a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del","#"+d+".ui-jqgrid-btable:first").hide();a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel","#"+d+".ui-jqgrid-btable:first").show();
198
+ break;case "save":a("#"+d).jqGrid("saveRow",b,g.onSuccess,g.url,g.extraparam,f,g.onError,h)&&(a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del","#"+d+".ui-jqgrid-btable:first").show(),a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel","#"+d+".ui-jqgrid-btable:first").hide());break;case "cancel":a("#"+d).jqGrid("restoreRow",b,h);a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del","#"+d+".ui-jqgrid-btable:first").show();a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel",
199
+ "#"+d+".ui-jqgrid-btable:first").hide();break;case "del":a("#"+d).jqGrid("delGridRow",b,g.delOptions);break;case "formedit":a("#"+d).jqGrid("setSelection",b),a("#"+d).jqGrid("editGridRow",b,g.editOptions)}};a.fn.fmatter.actions=function(b,d){var c={keys:!1,editbutton:!0,delbutton:!0,editformbutton:!1};a.fmatter.isUndefined(d.colModel.formatoptions)||(c=a.extend(c,d.colModel.formatoptions));var f=d.rowId,g="",h;if(typeof f=="undefined"||a.fmatter.isEmpty(f))return"";c.editformbutton?(h="onclick=jQuery.fn.fmatter.rowactions('"+
200
+ f+"','"+d.gid+"','formedit',"+d.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ",g=g+"<div title='"+a.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+h+"><span class='ui-icon ui-icon-pencil'></span></div>"):c.editbutton&&(h="onclick=jQuery.fn.fmatter.rowactions('"+f+"','"+d.gid+"','edit',"+d.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover') ",
201
+ g=g+"<div title='"+a.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+h+"><span class='ui-icon ui-icon-pencil'></span></div>");c.delbutton&&(h="onclick=jQuery.fn.fmatter.rowactions('"+f+"','"+d.gid+"','del',"+d.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ",g=g+"<div title='"+a.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+h+"><span class='ui-icon ui-icon-trash'></span></div>");
202
+ h="onclick=jQuery.fn.fmatter.rowactions('"+f+"','"+d.gid+"','save',"+d.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";g=g+"<div title='"+a.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save' "+h+"><span class='ui-icon ui-icon-disk'></span></div>";h="onclick=jQuery.fn.fmatter.rowactions('"+f+"','"+d.gid+"','cancel',"+d.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";
203
+ g=g+"<div title='"+a.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel' "+h+"><span class='ui-icon ui-icon-cancel'></span></div>";return"<div style='margin-left:8px;'>"+g+"</div>"};a.unformat=function(b,d,c,f){var g,h=d.colModel.formatter,j=d.colModel.formatoptions||{},e=/([\.\*\_\'\(\)\{\}\+\?\\])/g,l=d.colModel.unformat||a.fn.fmatter[h]&&a.fn.fmatter[h].unformat;if(typeof l!=="undefined"&&a.isFunction(l))g=l(a(b).text(),d,b);else if(!a.fmatter.isUndefined(h)&&
204
+ a.fmatter.isString(h))switch(g=a.jgrid.formatter||{},h){case "integer":j=a.extend({},g.integer,j);d=j.thousandsSeparator.replace(e,"\\$1");g=a(b).text().replace(RegExp(d,"g"),"");break;case "number":j=a.extend({},g.number,j);d=j.thousandsSeparator.replace(e,"\\$1");g=a(b).text().replace(RegExp(d,"g"),"").replace(j.decimalSeparator,".");break;case "currency":j=a.extend({},g.currency,j);d=j.thousandsSeparator.replace(e,"\\$1");g=a(b).text().replace(RegExp(d,"g"),"").replace(j.decimalSeparator,".").replace(j.prefix,
205
+ "").replace(j.suffix,"");break;case "checkbox":j=d.colModel.editoptions?d.colModel.editoptions.value.split(":"):["Yes","No"];g=a("input",b).attr("checked")?j[0]:j[1];break;case "select":g=a.unformat.select(b,d,c,f);break;case "actions":return"";default:g=a(b).text()}return g!==void 0?g:f===!0?a(b).text():a.jgrid.htmlDecode(a(b).html())};a.unformat.select=function(b,d,c,f){c=[];b=a(b).text();if(f===!0)return b;d=a.extend({},d.colModel.editoptions);if(d.value){var g=d.value,d=d.multiple===!0?!0:!1,
206
+ f=[],h;d&&(f=b.split(","),f=a.map(f,function(b){return a.trim(b)}));if(a.fmatter.isString(g))for(var j=g.split(";"),e=0,l=0;l<j.length;l++)if(h=j[l].split(":"),h.length>2&&(h[1]=jQuery.map(h,function(a,b){if(b>0)return a}).join(":")),d)jQuery.inArray(h[1],f)>-1&&(c[e]=h[0],e++);else{if(a.trim(h[1])==a.trim(b)){c[0]=h[0];break}}else if(a.fmatter.isObject(g)||a.isArray(g))d||(f[0]=b),c=jQuery.map(f,function(b){var c;a.each(g,function(a,d){if(d==b)return c=a,!1});if(typeof c!="undefined")return c});
207
+ return c.join(", ")}else return b||""};a.unformat.date=function(b,d){var c=a.jgrid.formatter.date||{};a.fmatter.isUndefined(d.formatoptions)||(c=a.extend({},c,d.formatoptions));return a.fmatter.isEmpty(b)?a.fn.fmatter.defaultFormat(b,d):a.fmatter.util.DateFormat(c.newformat,b,c.srcformat,c)}})(jQuery);
208
208
  (function(a){a.extend(a.jgrid,{showModal:function(a){a.w.show()},closeModal:function(a){a.w.hide().attr("aria-hidden","true");a.o&&a.o.remove()},hideModal:function(b,d){d=a.extend({jqm:!0,gb:""},d||{});if(d.onClose){var c=d.onClose(b);if(typeof c=="boolean"&&!c)return}if(a.fn.jqm&&d.jqm===!0)a(b).attr("aria-hidden","true").jqmHide();else{if(d.gb!=="")try{a(".jqgrid-overlay:first",d.gb).hide()}catch(f){}a(b).hide().attr("aria-hidden","true")}},findPos:function(a){var d=0,c=0;if(a.offsetParent){do d+=
209
- a.offsetLeft,c+=a.offsetTop;while(a=a.offsetParent)}return[d,c]},createModal:function(b,d,c,f,h,g,j){var e=document.createElement("div"),l,k=this,j=a.extend({},j||{});l=a(c.gbox).attr("dir")=="rtl"?!0:!1;e.className="ui-widget ui-widget-content ui-corner-all ui-jqdialog";e.id=b.themodal;var o=document.createElement("div");o.className="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";o.id=b.modalhead;a(o).append("<span class='ui-jqdialog-title'>"+c.caption+"</span>");var m=a("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>").hover(function(){m.addClass("ui-state-hover")},
210
- function(){m.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-closethick'></span>");a(o).append(m);l?(e.dir="rtl",a(".ui-jqdialog-title",o).css("float","right"),a(".ui-jqdialog-titlebar-close",o).css("left","0.3em")):(e.dir="ltr",a(".ui-jqdialog-title",o).css("float","left"),a(".ui-jqdialog-titlebar-close",o).css("right","0.3em"));var n=document.createElement("div");a(n).addClass("ui-jqdialog-content ui-widget-content").attr("id",b.modalcontent);a(n).append(d);e.appendChild(n);
211
- a(e).prepend(o);g===!0?a("body").append(e):typeof g=="string"?a(g).append(e):a(e).insertBefore(f);a(e).css(j);if(typeof c.jqModal==="undefined")c.jqModal=!0;d={};if(a.fn.jqm&&c.jqModal===!0){if(c.left===0&&c.top===0&&c.overlay)j=[],j=this.findPos(h),c.left=j[0]+4,c.top=j[1]+4;d.top=c.top+"px";d.left=c.left}else if(c.left!==0||c.top!==0)d.left=c.left,d.top=c.top+"px";a("a.ui-jqdialog-titlebar-close",o).click(function(){var d=a("#"+b.themodal).data("onClose")||c.onClose,e=a("#"+b.themodal).data("gbox")||
212
- c.gbox;k.hideModal("#"+b.themodal,{gb:e,jqm:c.jqModal,onClose:d});return!1});if(c.width===0||!c.width)c.width=300;if(c.height===0||!c.height)c.height=200;if(!c.zIndex)f=a(f).parents("*[role=dialog]").filter(":first").css("z-index"),c.zIndex=f?parseInt(f,10)+1:950;f=0;if(l&&d.left&&!g)f=a(c.gbox).width()-(!isNaN(c.width)?parseInt(c.width,10):0)-8,d.left=parseInt(d.left,10)+parseInt(f,10);d.left&&(d.left+="px");a(e).css(a.extend({width:isNaN(c.width)?"auto":c.width+"px",height:isNaN(c.height)?"auto":
213
- c.height+"px",zIndex:c.zIndex,overflow:"hidden"},d)).attr({tabIndex:"-1",role:"dialog","aria-labelledby":b.modalhead,"aria-hidden":"true"});if(typeof c.drag=="undefined")c.drag=!0;if(typeof c.resize=="undefined")c.resize=!0;if(c.drag)if(a(o).css("cursor","move"),a.fn.jqDrag)a(e).jqDrag(o);else try{a(e).draggable({handle:a("#"+o.id)})}catch(p){}if(c.resize)if(a.fn.jqResize)a(e).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>"),
214
- a("#"+b.themodal).jqResize(".jqResize",b.scrollelm?"#"+b.scrollelm:!1);else try{a(e).resizable({handles:"se, sw",alsoResize:b.scrollelm?"#"+b.scrollelm:!1})}catch(s){}c.closeOnEscape===!0&&a(e).keydown(function(d){d.which==27&&(d=a("#"+b.themodal).data("onClose")||c.onClose,k.hideModal(this,{gb:c.gbox,jqm:c.jqModal,onClose:d}))})},viewModal:function(b,d){d=a.extend({toTop:!0,overlay:10,modal:!1,onShow:this.showModal,onHide:this.closeModal,gbox:"",jqm:!0,jqM:!0},d||{});if(a.fn.jqm&&d.jqm===!0)d.jqM?
215
- a(b).attr("aria-hidden","false").jqm(d).jqmShow():a(b).attr("aria-hidden","false").jqmShow();else{d.gbox!==""&&(a(".jqgrid-overlay:first",d.gbox).show(),a(b).data("gbox",d.gbox));a(b).show().attr("aria-hidden","false");try{a(":input:visible",b)[0].focus()}catch(c){}}},info_dialog:function(b,d,c,f){var h={width:290,height:"auto",dataheight:"auto",drag:!0,resize:!1,caption:"<b>"+b+"</b>",left:250,top:170,zIndex:1E3,jqModal:!0,modal:!1,closeOnEscape:!0,align:"center",buttonalign:"center",buttons:[]};
216
- a.extend(h,f||{});var g=h.jqModal,j=this;a.fn.jqm&&!g&&(g=!1);b="";if(h.buttons.length>0)for(f=0;f<h.buttons.length;f++){if(typeof h.buttons[f].id=="undefined")h.buttons[f].id="info_button_"+f;b+="<a href='javascript:void(0)' id='"+h.buttons[f].id+"' class='fm-button ui-state-default ui-corner-all'>"+h.buttons[f].text+"</a>"}var f=isNaN(h.dataheight)?h.dataheight:h.dataheight+"px",e="<div id='info_id'>";e+="<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+
217
- f+";"+("text-align:"+h.align+";")+"'>"+d+"</div>";e+=c?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+h.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+c+"</a>"+b+"</div>":b!==""?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+h.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+
218
- b+"</div>":"";e+="</div>";try{a("#info_dialog").attr("aria-hidden")=="false"&&this.hideModal("#info_dialog",{jqm:g}),a("#info_dialog").remove()}catch(l){}this.createModal({themodal:"info_dialog",modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},e,h,"","",!0);b&&a.each(h.buttons,function(b){a("#"+this.id,"#info_id").bind("click",function(){h.buttons[b].onClick.call(a("#info_dialog"));return!1})});a("#closedialog","#info_id").click(function(){j.hideModal("#info_dialog",{jqm:g});
219
- return!1});a(".fm-button","#info_dialog").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a.isFunction(h.beforeOpen)&&h.beforeOpen();this.viewModal("#info_dialog",{onHide:function(a){a.w.hide().remove();a.o&&a.o.remove()},modal:h.modal,jqm:g});a.isFunction(h.afterOpen)&&h.afterOpen();try{a("#info_dialog").focus()}catch(k){}},createEl:function(b,d,c,f,h){function g(b,c){a.isFunction(c.dataInit)&&c.dataInit(b);c.dataEvents&&a.each(c.dataEvents,
209
+ a.offsetLeft,c+=a.offsetTop;while(a=a.offsetParent)}return[d,c]},createModal:function(b,d,c,f,g,h,j){var e=document.createElement("div"),l,k=this,j=a.extend({},j||{});l=a(c.gbox).attr("dir")=="rtl"?!0:!1;e.className="ui-widget ui-widget-content ui-corner-all ui-jqdialog";e.id=b.themodal;var n=document.createElement("div");n.className="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";n.id=b.modalhead;a(n).append("<span class='ui-jqdialog-title'>"+c.caption+"</span>");var o=a("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>").hover(function(){o.addClass("ui-state-hover")},
210
+ function(){o.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-closethick'></span>");a(n).append(o);l?(e.dir="rtl",a(".ui-jqdialog-title",n).css("float","right"),a(".ui-jqdialog-titlebar-close",n).css("left","0.3em")):(e.dir="ltr",a(".ui-jqdialog-title",n).css("float","left"),a(".ui-jqdialog-titlebar-close",n).css("right","0.3em"));var p=document.createElement("div");a(p).addClass("ui-jqdialog-content ui-widget-content").attr("id",b.modalcontent);a(p).append(d);e.appendChild(p);
211
+ a(e).prepend(n);h===!0?a("body").append(e):typeof h=="string"?a(h).append(e):a(e).insertBefore(f);a(e).css(j);if(typeof c.jqModal==="undefined")c.jqModal=!0;d={};if(a.fn.jqm&&c.jqModal===!0){if(c.left===0&&c.top===0&&c.overlay)j=[],j=this.findPos(g),c.left=j[0]+4,c.top=j[1]+4;d.top=c.top+"px";d.left=c.left}else if(c.left!==0||c.top!==0)d.left=c.left,d.top=c.top+"px";a("a.ui-jqdialog-titlebar-close",n).click(function(){var d=a("#"+b.themodal).data("onClose")||c.onClose,e=a("#"+b.themodal).data("gbox")||
212
+ c.gbox;k.hideModal("#"+b.themodal,{gb:e,jqm:c.jqModal,onClose:d});return!1});if(c.width===0||!c.width)c.width=300;if(c.height===0||!c.height)c.height=200;if(!c.zIndex)f=a(f).parents("*[role=dialog]").filter(":first").css("z-index"),c.zIndex=f?parseInt(f,10)+1:950;f=0;if(l&&d.left&&!h)f=a(c.gbox).width()-(!isNaN(c.width)?parseInt(c.width,10):0)-8,d.left=parseInt(d.left,10)+parseInt(f,10);d.left&&(d.left+="px");a(e).css(a.extend({width:isNaN(c.width)?"auto":c.width+"px",height:isNaN(c.height)?"auto":
213
+ c.height+"px",zIndex:c.zIndex,overflow:"hidden"},d)).attr({tabIndex:"-1",role:"dialog","aria-labelledby":b.modalhead,"aria-hidden":"true"});if(typeof c.drag=="undefined")c.drag=!0;if(typeof c.resize=="undefined")c.resize=!0;if(c.drag)if(a(n).css("cursor","move"),a.fn.jqDrag)a(e).jqDrag(n);else try{a(e).draggable({handle:a("#"+n.id)})}catch(m){}if(c.resize)if(a.fn.jqResize)a(e).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>"),
214
+ a("#"+b.themodal).jqResize(".jqResize",b.scrollelm?"#"+b.scrollelm:!1);else try{a(e).resizable({handles:"se, sw",alsoResize:b.scrollelm?"#"+b.scrollelm:!1})}catch(r){}c.closeOnEscape===!0&&a(e).keydown(function(d){d.which==27&&(d=a("#"+b.themodal).data("onClose")||c.onClose,k.hideModal(this,{gb:c.gbox,jqm:c.jqModal,onClose:d}))})},viewModal:function(b,d){d=a.extend({toTop:!0,overlay:10,modal:!1,overlayClass:"ui-widget-overlay",onShow:this.showModal,onHide:this.closeModal,gbox:"",jqm:!0,jqM:!0},d||
215
+ {});if(a.fn.jqm&&d.jqm===!0)d.jqM?a(b).attr("aria-hidden","false").jqm(d).jqmShow():a(b).attr("aria-hidden","false").jqmShow();else{d.gbox!==""&&(a(".jqgrid-overlay:first",d.gbox).show(),a(b).data("gbox",d.gbox));a(b).show().attr("aria-hidden","false");try{a(":input:visible",b)[0].focus()}catch(c){}}},info_dialog:function(b,d,c,f){var g={width:290,height:"auto",dataheight:"auto",drag:!0,resize:!1,caption:"<b>"+b+"</b>",left:250,top:170,zIndex:1E3,jqModal:!0,modal:!1,closeOnEscape:!0,align:"center",
216
+ buttonalign:"center",buttons:[]};a.extend(g,f||{});var h=g.jqModal,j=this;a.fn.jqm&&!h&&(h=!1);b="";if(g.buttons.length>0)for(f=0;f<g.buttons.length;f++){if(typeof g.buttons[f].id=="undefined")g.buttons[f].id="info_button_"+f;b+="<a href='javascript:void(0)' id='"+g.buttons[f].id+"' class='fm-button ui-state-default ui-corner-all'>"+g.buttons[f].text+"</a>"}var f=isNaN(g.dataheight)?g.dataheight:g.dataheight+"px",e="<div id='info_id'>";e+="<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+
217
+ f+";"+("text-align:"+g.align+";")+"'>"+d+"</div>";e+=c?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+g.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+c+"</a>"+b+"</div>":b!==""?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+g.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+
218
+ b+"</div>":"";e+="</div>";try{a("#info_dialog").attr("aria-hidden")=="false"&&this.hideModal("#info_dialog",{jqm:h}),a("#info_dialog").remove()}catch(l){}this.createModal({themodal:"info_dialog",modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},e,g,"","",!0);b&&a.each(g.buttons,function(b){a("#"+this.id,"#info_id").bind("click",function(){g.buttons[b].onClick.call(a("#info_dialog"));return!1})});a("#closedialog","#info_id").click(function(){j.hideModal("#info_dialog",{jqm:h});
219
+ return!1});a(".fm-button","#info_dialog").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a.isFunction(g.beforeOpen)&&g.beforeOpen();this.viewModal("#info_dialog",{onHide:function(a){a.w.hide().remove();a.o&&a.o.remove()},modal:g.modal,jqm:h});a.isFunction(g.afterOpen)&&g.afterOpen();try{a("#info_dialog").focus()}catch(k){}},createEl:function(b,d,c,f,g){function h(b,c){a.isFunction(c.dataInit)&&c.dataInit(b);c.dataEvents&&a.each(c.dataEvents,
220
220
  function(){this.data!==void 0?a(b).bind(this.type,this.data,this.fn):a(b).bind(this.type,this.fn)});return c}function j(b,c,d){var e=["dataInit","dataEvents","dataUrl","buildSelect","sopt","searchhidden","defaultValue","attr"];typeof d!="undefined"&&a.isArray(d)&&(e=a.extend(e,d));a.each(c,function(c,d){a.inArray(c,e)===-1&&a(b).attr(c,d)});c.hasOwnProperty("id")||a(b).attr("id",a.jgrid.randId())}var e="";switch(b){case "textarea":e=document.createElement("textarea");if(f)d.cols||a(e).css({width:"98%"});
221
- else if(!d.cols)d.cols=20;if(!d.rows)d.rows=2;if(c=="&nbsp;"||c=="&#160;"||c.length==1&&c.charCodeAt(0)==160)c="";e.value=c;j(e,d);d=g(e,d);a(e).attr({role:"textbox",multiline:"true"});break;case "checkbox":e=document.createElement("input");e.type="checkbox";if(d.value){b=d.value.split(":");if(c===b[0])e.checked=!0,e.defaultChecked=!0;e.value=b[0];a(e).attr("offval",b[1])}else b=c.toLowerCase(),b.search(/(false|0|no|off|undefined)/i)<0&&b!==""?(e.checked=!0,e.defaultChecked=!0,e.value=c):e.value=
222
- "on",a(e).attr("offval","off");j(e,d,["value"]);d=g(e,d);a(e).attr("role","checkbox");break;case "select":e=document.createElement("select");e.setAttribute("role","select");f=[];d.multiple===!0?(b=!0,e.multiple="multiple",a(e).attr("aria-multiselectable","true")):b=!1;if(typeof d.dataUrl!="undefined")a.ajax(a.extend({url:d.dataUrl,type:"GET",dataType:"html",context:{elem:e,options:d,vl:c},success:function(b){var c=[],d=this.elem,e=this.vl,f=a.extend({},this.options),h=f.multiple===!0;typeof f.buildSelect!=
223
- "undefined"&&(b=f.buildSelect(b));if(b=a(b).html()){a(d).append(b);j(d,f);f=g(d,f);if(typeof f.size==="undefined")f.size=h?3:1;h?(c=e.split(","),c=a.map(c,function(b){return a.trim(b)})):c[0]=a.trim(e);setTimeout(function(){a("option",d).each(function(){a(this).attr("role","option");if(a.inArray(a.trim(a(this).text()),c)>-1||a.inArray(a.trim(a(this).val()),c)>-1)this.selected="selected"})},0)}}},h||{}));else if(d.value){var l;if(b){if(f=c.split(","),f=a.map(f,function(b){return a.trim(b)}),typeof d.size===
224
- "undefined")d.size=3}else d.size=1;if(typeof d.value==="function")d.value=d.value();var k,o;if(typeof d.value==="string"){k=d.value.split(";");for(l=0;l<k.length;l++){o=k[l].split(":");o.length>2&&(o[1]=a.map(o,function(a,b){if(b>0)return a}).join(":"));h=document.createElement("option");h.setAttribute("role","option");h.value=o[0];h.innerHTML=o[1];if(!b&&(a.trim(o[0])==a.trim(c)||a.trim(o[1])==a.trim(c)))h.selected="selected";if(b&&(a.inArray(a.trim(o[1]),f)>-1||a.inArray(a.trim(o[0]),f)>-1))h.selected=
225
- "selected";e.appendChild(h)}}else if(typeof d.value==="object")for(l in k=d.value,k)if(k.hasOwnProperty(l)){h=document.createElement("option");h.setAttribute("role","option");h.value=l;h.innerHTML=k[l];if(!b&&(a.trim(l)==a.trim(c)||a.trim(k[l])==a.trim(c)))h.selected="selected";if(b&&(a.inArray(a.trim(k[l]),f)>-1||a.inArray(a.trim(l),f)>-1))h.selected="selected";e.appendChild(h)}j(e,d,["value"]);d=g(e,d)}break;case "text":case "password":case "button":l=b=="button"?"button":"textbox";e=document.createElement("input");
226
- e.type=b;e.value=c;j(e,d);d=g(e,d);if(b!="button")if(f)d.size||a(e).css({width:"98%"});else if(!d.size)d.size=20;a(e).attr("role",l);break;case "image":case "file":e=document.createElement("input");e.type=b;j(e,d);d=g(e,d);break;case "custom":e=document.createElement("span");try{if(a.isFunction(d.custom_element))if(k=d.custom_element.call(this,c,d))k=a(k).addClass("customelement").attr({id:d.id,name:d.name}),a(e).empty().append(k);else throw"e2";else throw"e1";}catch(m){m=="e1"&&this.info_dialog(a.jgrid.errors.errcap,
227
- "function 'custom_element' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose),m=="e2"?this.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):this.info_dialog(a.jgrid.errors.errcap,typeof m==="string"?m:m.message,a.jgrid.edit.bClose)}}return e},checkDate:function(a,d){var c={},f,a=a.toLowerCase();f=a.indexOf("/")!=-1?"/":a.indexOf("-")!=-1?"-":a.indexOf(".")!=-1?".":"/";a=a.split(f);d=d.split(f);if(d.length!=3)return!1;f=-1;for(var h,g=-1,j=
228
- -1,e=0;e<a.length;e++)h=isNaN(d[e])?0:parseInt(d[e],10),c[a[e]]=h,h=a[e],h.indexOf("y")!=-1&&(f=e),h.indexOf("m")!=-1&&(j=e),h.indexOf("d")!=-1&&(g=e);h=a[f]=="y"||a[f]=="yyyy"?4:a[f]=="yy"?2:-1;var e=function(a){for(var b=1;b<=a;b++){this[b]=31;if(b==4||b==6||b==9||b==11)this[b]=30;b==2&&(this[b]=29)}return this}(12),l;if(f===-1)return!1;else if(l=c[a[f]].toString(),h==2&&l.length==1&&(h=1),l.length!=h||c[a[f]]===0&&d[f]!="00")return!1;if(j===-1)return!1;else if(l=c[a[j]].toString(),l.length<1||
229
- c[a[j]]<1||c[a[j]]>12)return!1;if(g===-1)return!1;else if(l=c[a[g]].toString(),l.length<1||c[a[g]]<1||c[a[g]]>31||c[a[j]]==2&&c[a[g]]>(c[a[f]]%4===0&&(c[a[f]]%100!==0||c[a[f]]%400===0)?29:28)||c[a[g]]>e[c[a[j]]])return!1;return!0},isEmpty:function(a){return a.match(/^\s+$/)||a===""?!0:!1},checkTime:function(a){var d=/^(\d{1,2}):(\d{2})([ap]m)?$/;if(!this.isEmpty(a))if(a=a.match(d)){if(a[3]){if(a[1]<1||a[1]>12)return!1}else if(a[1]>23)return!1;if(a[2]>59)return!1}else return!1;return!0},checkValues:function(b,
230
- d,c,f,h){var g,j;if(typeof f==="undefined")if(typeof d=="string"){f=0;for(h=c.p.colModel.length;f<h;f++)if(c.p.colModel[f].name==d){g=c.p.colModel[f].editrules;d=f;try{j=c.p.colModel[f].formoptions.label}catch(e){}break}}else{if(d>=0)g=c.p.colModel[d].editrules}else g=f,j=h===void 0?"_":h;if(g){j||(j=c.p.colNames[d]);if(g.required===!0&&this.isEmpty(b))return[!1,j+": "+a.jgrid.edit.msg.required,""];f=g.required===!1?!1:!0;if(g.number===!0&&!(f===!1&&this.isEmpty(b))&&isNaN(b))return[!1,j+": "+a.jgrid.edit.msg.number,
231
- ""];if(typeof g.minValue!="undefined"&&!isNaN(g.minValue)&&parseFloat(b)<parseFloat(g.minValue))return[!1,j+": "+a.jgrid.edit.msg.minValue+" "+g.minValue,""];if(typeof g.maxValue!="undefined"&&!isNaN(g.maxValue)&&parseFloat(b)>parseFloat(g.maxValue))return[!1,j+": "+a.jgrid.edit.msg.maxValue+" "+g.maxValue,""];if(g.email===!0&&!(f===!1&&this.isEmpty(b))&&(h=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,
232
- !h.test(b)))return[!1,j+": "+a.jgrid.edit.msg.email,""];if(g.integer===!0&&!(f===!1&&this.isEmpty(b))){if(isNaN(b))return[!1,j+": "+a.jgrid.edit.msg.integer,""];if(b%1!==0||b.indexOf(".")!=-1)return[!1,j+": "+a.jgrid.edit.msg.integer,""]}if(g.date===!0&&!(f===!1&&this.isEmpty(b))&&(d=c.p.colModel[d].formatoptions&&c.p.colModel[d].formatoptions.newformat?c.p.colModel[d].formatoptions.newformat:c.p.colModel[d].datefmt||"Y-m-d",!this.checkDate(d,b)))return[!1,j+": "+a.jgrid.edit.msg.date+" - "+d,""];
233
- if(g.time===!0&&!(f===!1&&this.isEmpty(b))&&!this.checkTime(b))return[!1,j+": "+a.jgrid.edit.msg.date+" - hh:mm (am/pm)",""];if(g.url===!0&&!(f===!1&&this.isEmpty(b))&&(h=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i,!h.test(b)))return[!1,j+": "+a.jgrid.edit.msg.url,""];if(g.custom===!0&&!(f===!1&&this.isEmpty(b)))return a.isFunction(g.custom_func)?(b=g.custom_func.call(c,b,j),a.isArray(b)?b:[!1,a.jgrid.edit.msg.customarray,""]):
221
+ else if(!d.cols)d.cols=20;if(!d.rows)d.rows=2;if(c=="&nbsp;"||c=="&#160;"||c.length==1&&c.charCodeAt(0)==160)c="";e.value=c;j(e,d);d=h(e,d);a(e).attr({role:"textbox",multiline:"true"});break;case "checkbox":e=document.createElement("input");e.type="checkbox";if(d.value){b=d.value.split(":");if(c===b[0])e.checked=!0,e.defaultChecked=!0;e.value=b[0];a(e).attr("offval",b[1])}else b=c.toLowerCase(),b.search(/(false|0|no|off|undefined)/i)<0&&b!==""?(e.checked=!0,e.defaultChecked=!0,e.value=c):e.value=
222
+ "on",a(e).attr("offval","off");j(e,d,["value"]);d=h(e,d);a(e).attr("role","checkbox");break;case "select":e=document.createElement("select");e.setAttribute("role","select");f=[];d.multiple===!0?(b=!0,e.multiple="multiple",a(e).attr("aria-multiselectable","true")):b=!1;if(typeof d.dataUrl!="undefined")a.ajax(a.extend({url:d.dataUrl,type:"GET",dataType:"html",context:{elem:e,options:d,vl:c},success:function(b){var c=[],d=this.elem,e=this.vl,f=a.extend({},this.options),g=f.multiple===!0;typeof f.buildSelect!=
223
+ "undefined"&&(b=f.buildSelect(b));if(b=a(b).html()){a(d).append(b);j(d,f);f=h(d,f);if(typeof f.size==="undefined")f.size=g?3:1;g?(c=e.split(","),c=a.map(c,function(b){return a.trim(b)})):c[0]=a.trim(e);setTimeout(function(){a("option",d).each(function(){a(this).attr("role","option");if(a.inArray(a.trim(a(this).text()),c)>-1||a.inArray(a.trim(a(this).val()),c)>-1)this.selected="selected"})},0)}}},g||{}));else if(d.value){var l;if(typeof d.size==="undefined")d.size=b?3:1;b&&(f=c.split(","),f=a.map(f,
224
+ function(b){return a.trim(b)}));if(typeof d.value==="function")d.value=d.value();var k,n;if(typeof d.value==="string"){k=d.value.split(";");for(l=0;l<k.length;l++){n=k[l].split(":");n.length>2&&(n[1]=a.map(n,function(a,b){if(b>0)return a}).join(":"));g=document.createElement("option");g.setAttribute("role","option");g.value=n[0];g.innerHTML=n[1];e.appendChild(g);if(!b&&(a.trim(n[0])==a.trim(c)||a.trim(n[1])==a.trim(c)))g.selected="selected";if(b&&(a.inArray(a.trim(n[1]),f)>-1||a.inArray(a.trim(n[0]),
225
+ f)>-1))g.selected="selected"}}else if(typeof d.value==="object")for(l in k=d.value,k)if(k.hasOwnProperty(l)){g=document.createElement("option");g.setAttribute("role","option");g.value=l;g.innerHTML=k[l];e.appendChild(g);if(!b&&(a.trim(l)==a.trim(c)||a.trim(k[l])==a.trim(c)))g.selected="selected";if(b&&(a.inArray(a.trim(k[l]),f)>-1||a.inArray(a.trim(l),f)>-1))g.selected="selected"}j(e,d,["value"]);d=h(e,d)}break;case "text":case "password":case "button":l=b=="button"?"button":"textbox";e=document.createElement("input");
226
+ e.type=b;e.value=c;j(e,d);d=h(e,d);if(b!="button")if(f)d.size||a(e).css({width:"98%"});else if(!d.size)d.size=20;a(e).attr("role",l);break;case "image":case "file":e=document.createElement("input");e.type=b;j(e,d);d=h(e,d);break;case "custom":e=document.createElement("span");try{if(a.isFunction(d.custom_element))if(k=d.custom_element.call(this,c,d))k=a(k).addClass("customelement").attr({id:d.id,name:d.name}),a(e).empty().append(k);else throw"e2";else throw"e1";}catch(o){o=="e1"&&this.info_dialog(a.jgrid.errors.errcap,
227
+ "function 'custom_element' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose),o=="e2"?this.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):this.info_dialog(a.jgrid.errors.errcap,typeof o==="string"?o:o.message,a.jgrid.edit.bClose)}}return e},checkDate:function(a,d){var c={},f,a=a.toLowerCase();f=a.indexOf("/")!=-1?"/":a.indexOf("-")!=-1?"-":a.indexOf(".")!=-1?".":"/";a=a.split(f);d=d.split(f);if(d.length!=3)return!1;f=-1;for(var g,h=-1,j=
228
+ -1,e=0;e<a.length;e++)g=isNaN(d[e])?0:parseInt(d[e],10),c[a[e]]=g,g=a[e],g.indexOf("y")!=-1&&(f=e),g.indexOf("m")!=-1&&(j=e),g.indexOf("d")!=-1&&(h=e);g=a[f]=="y"||a[f]=="yyyy"?4:a[f]=="yy"?2:-1;var e=function(a){for(var b=1;b<=a;b++){this[b]=31;if(b==4||b==6||b==9||b==11)this[b]=30;b==2&&(this[b]=29)}return this}(12),l;if(f===-1)return!1;else if(l=c[a[f]].toString(),g==2&&l.length==1&&(g=1),l.length!=g||c[a[f]]===0&&d[f]!="00")return!1;if(j===-1)return!1;else if(l=c[a[j]].toString(),l.length<1||
229
+ c[a[j]]<1||c[a[j]]>12)return!1;if(h===-1)return!1;else if(l=c[a[h]].toString(),l.length<1||c[a[h]]<1||c[a[h]]>31||c[a[j]]==2&&c[a[h]]>(c[a[f]]%4===0&&(c[a[f]]%100!==0||c[a[f]]%400===0)?29:28)||c[a[h]]>e[c[a[j]]])return!1;return!0},isEmpty:function(a){return a.match(/^\s+$/)||a===""?!0:!1},checkTime:function(a){var d=/^(\d{1,2}):(\d{2})([ap]m)?$/;if(!this.isEmpty(a))if(a=a.match(d)){if(a[3]){if(a[1]<1||a[1]>12)return!1}else if(a[1]>23)return!1;if(a[2]>59)return!1}else return!1;return!0},checkValues:function(b,
230
+ d,c,f,g){var h,j;if(typeof f==="undefined")if(typeof d=="string"){f=0;for(g=c.p.colModel.length;f<g;f++)if(c.p.colModel[f].name==d){h=c.p.colModel[f].editrules;d=f;try{j=c.p.colModel[f].formoptions.label}catch(e){}break}}else{if(d>=0)h=c.p.colModel[d].editrules}else h=f,j=g===void 0?"_":g;if(h){j||(j=c.p.colNames[d]);if(h.required===!0&&this.isEmpty(b))return[!1,j+": "+a.jgrid.edit.msg.required,""];f=h.required===!1?!1:!0;if(h.number===!0&&!(f===!1&&this.isEmpty(b))&&isNaN(b))return[!1,j+": "+a.jgrid.edit.msg.number,
231
+ ""];if(typeof h.minValue!="undefined"&&!isNaN(h.minValue)&&parseFloat(b)<parseFloat(h.minValue))return[!1,j+": "+a.jgrid.edit.msg.minValue+" "+h.minValue,""];if(typeof h.maxValue!="undefined"&&!isNaN(h.maxValue)&&parseFloat(b)>parseFloat(h.maxValue))return[!1,j+": "+a.jgrid.edit.msg.maxValue+" "+h.maxValue,""];if(h.email===!0&&!(f===!1&&this.isEmpty(b))&&(g=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,
232
+ !g.test(b)))return[!1,j+": "+a.jgrid.edit.msg.email,""];if(h.integer===!0&&!(f===!1&&this.isEmpty(b))){if(isNaN(b))return[!1,j+": "+a.jgrid.edit.msg.integer,""];if(b%1!==0||b.indexOf(".")!=-1)return[!1,j+": "+a.jgrid.edit.msg.integer,""]}if(h.date===!0&&!(f===!1&&this.isEmpty(b))&&(d=c.p.colModel[d].formatoptions&&c.p.colModel[d].formatoptions.newformat?c.p.colModel[d].formatoptions.newformat:c.p.colModel[d].datefmt||"Y-m-d",!this.checkDate(d,b)))return[!1,j+": "+a.jgrid.edit.msg.date+" - "+d,""];
233
+ if(h.time===!0&&!(f===!1&&this.isEmpty(b))&&!this.checkTime(b))return[!1,j+": "+a.jgrid.edit.msg.date+" - hh:mm (am/pm)",""];if(h.url===!0&&!(f===!1&&this.isEmpty(b))&&(g=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i,!g.test(b)))return[!1,j+": "+a.jgrid.edit.msg.url,""];if(h.custom===!0&&!(f===!1&&this.isEmpty(b)))return a.isFunction(h.custom_func)?(b=h.custom_func.call(c,b,j),a.isArray(b)?b:[!1,a.jgrid.edit.msg.customarray,""]):
234
234
  [!1,a.jgrid.edit.msg.customfcheck,""]}return[!0,"",""]}})})(jQuery);
235
- (function(a){a.fn.jqFilter=function(b){if(typeof b==="string"){var d=a.fn.jqFilter[b];if(!d)throw"jqFilter - No such method: "+b;var c=a.makeArray(arguments).slice(1);return d.apply(this,c)}var f=a.extend(!0,{filter:null,columns:[],onChange:null,checkValues:null,error:!1,errmsg:"",errorcheck:!0,showQuery:!0,sopt:null,ops:[{name:"eq",description:"equal",operator:"="},{name:"ne",description:"not equal",operator:"<>"},{name:"lt",description:"less",operator:"<"},{name:"le",description:"less or equal",
235
+ (function(a){a.fn.jqFilter=function(b){if(typeof b==="string"){var d=a.fn.jqFilter[b];if(!d)throw"jqFilter - No such method: "+b;var c=a.makeArray(arguments).slice(1);return d.apply(this,c)}var f=a.extend(!0,{filter:null,columns:[],onChange:null,afterRedraw:null,checkValues:null,error:!1,errmsg:"",errorcheck:!0,showQuery:!0,sopt:null,ops:[{name:"eq",description:"equal",operator:"="},{name:"ne",description:"not equal",operator:"<>"},{name:"lt",description:"less",operator:"<"},{name:"le",description:"less or equal",
236
236
  operator:"<="},{name:"gt",description:"greater",operator:">"},{name:"ge",description:"greater or equal",operator:">="},{name:"bw",description:"begins with",operator:"LIKE"},{name:"bn",description:"does not begin with",operator:"NOT LIKE"},{name:"in",description:"in",operator:"IN"},{name:"ni",description:"not in",operator:"NOT IN"},{name:"ew",description:"ends with",operator:"LIKE"},{name:"en",description:"does not end with",operator:"NOT LIKE"},{name:"cn",description:"contains",operator:"LIKE"},{name:"nc",
237
- description:"does not contain",operator:"NOT LIKE"},{name:"nu",description:"is null",operator:"IS NULL"},{name:"nn",description:"is not null",operator:"IS NOT NULL"}],numopts:["eq","ne","lt","le","gt","ge","nu","nn","in","ni"],stropts:["eq","ne","bw","bn","ew","en","cn","nc","nu","nn","in","ni"],_gridsopt:[],groupOps:["AND","OR"],groupButton:!0},b||{});return this.each(function(){if(!this.filter){this.p=f;if(this.p.filter===null||this.p.filter===void 0)this.p.filter={groupOp:this.p.groupOps[0],rules:[],
238
- groups:[]};var b,c=this.p.columns.length,d,e=/msie/i.test(navigator.userAgent)&&!window.opera;if(this.p._gridsopt.length)for(b=0;b<this.p._gridsopt.length;b++)this.p.ops[b].description=this.p._gridsopt[b];this.p.initFilter=a.extend(!0,{},this.p.filter);if(c){for(b=0;b<c;b++){d=this.p.columns[b];if(d.stype)d.inputtype=d.stype;else if(!d.inputtype)d.inputtype="text";if(d.sorttype)d.searchtype=d.sorttype;else if(!d.searchtype)d.searchtype="string";if(d.hidden===void 0)d.hidden=!1;if(!d.label)d.label=
237
+ description:"does not contain",operator:"NOT LIKE"},{name:"nu",description:"is null",operator:"IS NULL"},{name:"nn",description:"is not null",operator:"IS NOT NULL"}],numopts:["eq","ne","lt","le","gt","ge","nu","nn","in","ni"],stropts:["eq","ne","bw","bn","ew","en","cn","nc","nu","nn","in","ni"],_gridsopt:[],groupOps:["AND","OR"],groupButton:!0,ruleButtons:!0},b||{});return this.each(function(){if(!this.filter){this.p=f;if(this.p.filter===null||this.p.filter===void 0)this.p.filter={groupOp:this.p.groupOps[0],
238
+ rules:[],groups:[]};var b,c=this.p.columns.length,d,e=/msie/i.test(navigator.userAgent)&&!window.opera;if(this.p._gridsopt.length)for(b=0;b<this.p._gridsopt.length;b++)this.p.ops[b].description=this.p._gridsopt[b];this.p.initFilter=a.extend(!0,{},this.p.filter);if(c){for(b=0;b<c;b++){d=this.p.columns[b];if(d.stype)d.inputtype=d.stype;else if(!d.inputtype)d.inputtype="text";if(d.sorttype)d.searchtype=d.sorttype;else if(!d.searchtype)d.searchtype="string";if(d.hidden===void 0)d.hidden=!1;if(!d.label)d.label=
239
239
  d.name;if(d.index)d.name=d.index;if(!d.hasOwnProperty("searchoptions"))d.searchoptions={};if(!d.hasOwnProperty("searchrules"))d.searchrules={}}this.p.showQuery&&a(this).append("<table class='queryresult ui-widget ui-widget-content' style='display:block;max-width:440px;border:0px none;'><tbody><tr><td class='query'></td></tr></tbody></table>");var l=function(b,c){var d=[!0,""];if(a.isFunction(c.searchrules))d=c.searchrules(b,c);else if(a.jgrid&&a.jgrid.checkValues)try{d=a.jgrid.checkValues(b,-1,null,
240
- c.searchrules,c.label)}catch(e){}if(d&&d.length&&d[0]===!1)f.error=!d[0],f.errmsg=d[1]};this.onchange=function(){this.p.error=!1;this.p.errmsg="";return a.isFunction(this.p.onChange)?this.p.onChange.call(this,this.p):!1};this.reDraw=function(){a("table.group:first",this).remove();var b=this.createTableForGroup(f.filter,null);a(this).append(b)};this.createTableForGroup=function(b,c){var d=this,e,g=a("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody></tbody></table>");
241
- c===null&&a(g).append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='left'></th></tr>");var j=a("<tr></tr>");a(g).append(j);var h=a("<th colspan='5' align='left'></th>");j.append(h);var l=a("<select class='opsel'></select>");h.append(l);var j="",t;for(e=0;e<f.groupOps.length;e++)t=b.groupOp===d.p.groupOps[e]?" selected='selected'":"",j+="<option value='"+d.p.groupOps[e]+"'"+t+">"+d.p.groupOps[e]+"</option>";l.append(j).bind("change",function(){b.groupOp=a(l).val();
242
- d.onchange()});j="<span></span>";this.p.groupButton&&(j=a("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>"),j.bind("click",function(){if(b.groups===void 0)b.groups=[];b.groups.push({groupOp:f.groupOps[0],rules:[],groups:[]});d.reDraw();d.onchange();return!1}));h.append(j);var j=a("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>"),v;j.bind("click",function(){if(b.rules===void 0)b.rules=[];for(e=0;e<d.p.columns.length;e++){var a=typeof d.p.columns[e].search===
243
- "undefined"?!0:d.p.columns[e].search,c=d.p.columns[e].hidden===!0;if(d.p.columns[e].searchoptions.searchhidden===!0&&a||a&&!c){v=d.p.columns[e];break}}b.rules.push({field:v.name,op:(v.searchoptions.sopt?v.searchoptions.sopt:d.p.sopt?d.p.sopt:v.searchtype==="string"?d.p.stropts:d.p.numopts)[0],data:""});d.reDraw();return!1});h.append(j);c!==null&&(j=a("<input type='button' value='-' title='Delete group' class='delete-group'/>"),h.append(j),j.bind("click",function(){for(e=0;e<c.groups.length;e++)if(c.groups[e]===
244
- b){c.groups.splice(e,1);break}d.reDraw();d.onchange();return!1}));if(b.groups!==void 0)for(e=0;e<b.groups.length;e++)h=a("<tr></tr>"),g.append(h),j=a("<td class='first'></td>"),h.append(j),j=a("<td colspan='4'></td>"),j.append(this.createTableForGroup(b.groups[e],b)),h.append(j);if(b.groupOp===void 0)b.groupOp=d.p.groupOps[0];if(b.rules!==void 0)for(e=0;e<b.rules.length;e++)g.append(this.createTableRowForRule(b.rules[e],b));return g};this.createTableRowForRule=function(b,c){var d=this,g=a("<tr></tr>"),
245
- j,h,l,r,t="",v;g.append("<td class='first'></td>");var w=a("<td class='columns'></td>");g.append(w);var z=a("<select></select>"),C,y=[];w.append(z);z.bind("change",function(){b.field=a(z).val();l=a(this).parents("tr:first");for(j=0;j<d.p.columns.length;j++)if(d.p.columns[j].name===b.field){r=d.p.columns[j];break}if(r){r.searchoptions.id=a.jgrid.randId();if(e&&r.inputtype==="text"&&!r.searchoptions.size)r.searchoptions.size=10;var c=a.jgrid.createEl(r.inputtype,r.searchoptions,"",!0,d.p.ajaxSelectOptions,
246
- !0);a(c).addClass("input-elm");h=r.searchoptions.sopt?r.searchoptions.sopt:d.p.sopt?d.p.sopt:r.searchtype==="string"?d.p.stropts:d.p.numopts;var f="",g="";y=[];a.each(d.p.ops,function(){y.push(this.name)});for(j=0;j<h.length;j++)if(C=a.inArray(h[j],y),C!==-1){g="";if(j===0)b.op=d.p.ops[C].name,g=" selected='selected'";f+="<option value='"+d.p.ops[C].name+"'"+g+">"+d.p.ops[C].description+"</option>"}a(".selectopts",l).empty().append(f);a(".data",l).empty().append(c);a(".input-elm",l).bind("change",
247
- function(){b.data=a(this).val();d.onchange()});setTimeout(function(){b.data=a(c).val();d.onchange()},0)}});for(j=w=0;j<d.p.columns.length;j++){v=typeof d.p.columns[j].search==="undefined"?!0:d.p.columns[j].search;var A=d.p.columns[j].hidden===!0;if(d.p.columns[j].searchoptions.searchhidden===!0&&v||v&&!A)v="",b.field===d.p.columns[j].name&&(v=" selected='selected'",w=j),t+="<option value='"+d.p.columns[j].name+"'"+v+">"+d.p.columns[j].label+"</option>"}z.append(t);t=a("<td class='operators'></td>");
248
- g.append(t);r=f.columns[w];r.searchoptions.id=a.jgrid.randId();if(e&&r.inputtype==="text"&&!r.searchoptions.size)r.searchoptions.size=10;var w=a.jgrid.createEl(r.inputtype,r.searchoptions,b.data,!0,d.p.ajaxSelectOptions,!0),B=a("<select class='selectopts'></select>");t.append(B);B.bind("change",function(){b.op=a(B).val();l=a(this).parents("tr:first");var c=a(".input-elm",l)[0];b.op==="nu"||b.op==="nn"?(b.data="",c.value="",c.setAttribute("readonly","true"),c.setAttribute("disabled","true")):(c.removeAttribute("readonly"),
249
- c.removeAttribute("disabled"));d.onchange()});h=r.searchoptions.sopt?r.searchoptions.sopt:d.p.sopt?d.p.sopt:r.searchtype==="string"?f.stropts:d.p.numopts;t="";a.each(d.p.ops,function(){y.push(this.name)});for(j=0;j<h.length;j++)C=a.inArray(h[j],y),C!==-1&&(v=b.op===d.p.ops[C].name?" selected='selected'":"",t+="<option value='"+d.p.ops[C].name+"'"+v+">"+d.p.ops[C].description+"</option>");B.append(t);t=a("<td class='data'></td>");g.append(t);t.append(w);a(w).addClass("input-elm").bind("change",function(){b.data=
250
- a(this).val();d.onchange()});t=a("<td></td>");g.append(t);w=a("<input type='button' value='-' title='Delete rule' class='delete-rule ui-del'/>");t.append(w);w.bind("click",function(){for(j=0;j<c.rules.length;j++)if(c.rules[j]===b){c.rules.splice(j,1);break}d.reDraw();d.onchange();return!1});return g};this.getStringForGroup=function(a){var b="(",c;if(a.groups!==void 0)for(c=0;c<a.groups.length;c++){b.length>1&&(b+=" "+a.groupOp+" ");try{b+=this.getStringForGroup(a.groups[c])}catch(d){alert(d)}}if(a.rules!==
251
- void 0)try{for(c=0;c<a.rules.length;c++)b.length>1&&(b+=" "+a.groupOp+" "),b+=this.getStringForRule(a.rules[c])}catch(e){alert(e)}b+=")";return b==="()"?"":b};this.getStringForRule=function(b){var c="",d="",e,g;for(e=0;e<this.p.ops.length;e++)if(this.p.ops[e].name===b.op){c=this.p.ops[e].operator;d=this.p.ops[e].name;break}for(e=0;e<this.p.columns.length;e++)if(this.p.columns[e].name===b.field){g=this.p.columns[e];break}e=b.data;if(d==="bw"||d==="bn")e+="%";if(d==="ew"||d==="en")e="%"+e;if(d==="cn"||
252
- d==="nc")e="%"+e+"%";if(d==="in"||d==="ni")e=" ("+e+")";f.errorcheck&&l(b.data,g);return a.inArray(g.searchtype,["int","integer","float","number","currency"])!==-1||d==="nn"||d==="nu"?b.field+" "+c+" "+e:b.field+" "+c+' "'+e+'"'};this.resetFilter=function(){this.p.filter=a.extend(!0,{},this.p.initFilter);this.reDraw();this.onchange()};this.hideError=function(){a("th.ui-state-error",this).html("");a("tr.error",this).hide()};this.showError=function(){a("th.ui-state-error",this).html(this.p.errmsg);
253
- a("tr.error",this).show()};this.toUserFriendlyString=function(){return this.getStringForGroup(f.filter)};this.toString=function(){function a(c){var d="(",e;if(c.groups!==void 0)for(e=0;e<c.groups.length;e++)d.length>1&&(d+=c.groupOp==="OR"?" || ":" && "),d+=a(c.groups[e]);if(c.rules!==void 0)for(e=0;e<c.rules.length;e++){d.length>1&&(d+=c.groupOp==="OR"?" || ":" && ");var f=c.rules[e];if(b.p.errorcheck){for(var g=void 0,j=void 0,g=0;g<b.p.columns.length;g++)if(b.p.columns[g].name===f.field){j=b.p.columns[g];
254
- break}j&&l(f.data,j)}d+=f.op+"(item."+f.field+",'"+f.data+"')"}d+=")";return d==="()"?"":d}var b=this;return a(this.p.filter)};this.reDraw();if(this.p.showQuery)this.onchange();this.filter=!0}}})};a.extend(a.fn.jqFilter,{toSQLString:function(){var a="";this.each(function(){a=this.toUserFriendlyString()});return a},filterData:function(){var a;this.each(function(){a=this.p.filter});return a},getParameter:function(a){if(a!==void 0&&this.p.hasOwnProperty(a))return this.p[a];return this.p},resetFilter:function(){return this.each(function(){this.resetFilter()})},
255
- addFilter:function(a){typeof a==="string"&&(a=jQuery.jgrid.parse(a));this.each(function(){this.p.filter=a;this.reDraw();this.onchange()})}})})(jQuery);
256
- (function(a){var b=null;a.jgrid.extend({searchGrid:function(b){b=a.extend({recreateFilter:!1,drag:!0,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",loadDefaults:!0,beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,closeAfterSearch:!1,closeAfterReset:!1,closeOnEscape:!1,multipleSearch:!1,multipleGroup:!1,top:0,left:0,jqModal:!0,modal:!1,resize:!1,width:450,height:"auto",dataheight:"auto",showQuery:!1,errorcheck:!0,sopt:null,stringResult:void 0,onClose:null,
257
- onSearch:null,onReset:null,toTop:!0,overlay:10,columns:[],tmplNames:null,tmplFilters:null,tmplLabel:" Template: ",showOnLoad:!1,layer:null},a.jgrid.search,b||{});return this.each(function(){function c(){a.isFunction(b.beforeShowSearch)&&(j=b.beforeShowSearch(a("#"+g)),typeof j==="undefined"&&(j=!0));j&&(a.jgrid.viewModal("#"+e.themodal,{gbox:"#gbox_"+g,jqm:b.jqModal,modal:b.modal,overlay:b.overlay,toTop:b.toTop}),a.isFunction(b.afterShowSearch)&&b.afterShowSearch(a("#"+g)))}function f(){a(".add-rule",
258
- "#"+g).hide();a(".delete-rule","#"+g).hide();a(".opsel","#"+g).hide()}var h=this;if(h.grid){var g="fbox_"+h.p.id,j=!0,e={themodal:"searchmod"+g,modalhead:"searchhd"+g,modalcontent:"searchcnt"+g,scrollelm:g},l=h.p.postData[b.sFilter];typeof l==="string"&&(l=a.jgrid.parse(l));b.recreateFilter===!0&&a("#"+e.themodal).remove();if(a("#"+e.themodal).html()!==null)c();else{var k=a("<span><div id='"+g+"' class='searchFilter' style='overflow:auto'></div></span>").insertBefore("#gview_"+h.p.id);if(a.isFunction(b.onInitializeSearch))b.onInitializeSearch(a("#"+
259
- g));var o=a.extend([],h.p.colModel),m="<a href='javascript:void(0)' id='"+g+"_search' class='fm-button ui-state-default ui-corner-all fm-button-icon-right ui-reset'><span class='ui-icon ui-icon-search'></span>"+b.Find+"</a>",n="<a href='javascript:void(0)' id='"+g+"_reset' class='fm-button ui-state-default ui-corner-all fm-button-icon-left ui-search'><span class='ui-icon ui-icon-arrowreturnthick-1-w'></span>"+b.Reset+"</a>",p="",s="",q,r=!1,t=-1;b.showQuery&&(p="<a href='javascript:void(0)' id='"+
260
- g+"_query' class='fm-button ui-state-default ui-corner-all fm-button-icon-left'><span class='ui-icon ui-icon-comment'></span>Query</a>");b.columns.length?o=b.columns:a.each(o,function(a,b){if(!b.label)b.label=h.p.colNames[a];if(!r){var c=typeof b.search==="undefined"?!0:b.search,d=b.hidden===!0;if(b.searchoptions&&b.searchoptions.searchhidden===!0&&c||c&&!d)r=!0,q=b.index||b.name,t=a}});if(!l&&q||b.multipleSearch===!1){var v="eq";t>=0&&o[t].searchoptions&&o[t].searchoptions.sopt?v=o[t].searchoptions.sopt[0]:
261
- b.sopt&&b.sopt.length&&(v=b.sopt[0]);l={groupOp:"AND",rules:[{field:q,op:v,data:""}]}}r=!1;if(b.tmplNames&&b.tmplNames.length)r=!0,s=b.tmplLabel,s+="<select class='ui-template'>",s+="<option value='default'>Default</option>",a.each(b.tmplNames,function(a,b){s+="<option value='"+a+"'>"+b+"</option>"}),s+="</select>";m="<table class='EditTable' style='border:0px none;margin-top:5px' id='"+g+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='EditButton' style='text-align:left'>"+
262
- n+s+"</td><td class='EditButton'>"+p+m+"</td></tr></tbody></table>";a("#"+g).jqFilter({columns:o,filter:b.loadDefaults?l:null,showQuery:b.showQuery,errorcheck:b.errorcheck,sopt:b.sopt,groupButton:b.multipleGroup,_gridsopt:a.jgrid.search.odata,onChange:function(){this.p.showQuery&&a(".query",this).html(this.toUserFriendlyString())}});k.append(m);r&&b.tmplFilters&&b.tmplFilters.length&&a(".ui-template",k).bind("change",function(){var c=a(this).val();c=="default"?a("#"+g).jqFilter("addFilter",l):a("#"+
263
- g).jqFilter("addFilter",b.tmplFilters[parseInt(c,10)]);return!1});b.multipleSearch===!1&&f();if(a.isFunction(b.onInitializeSearch))b.onInitializeSearch(a("#"+g));b.layer?a.jgrid.createModal(e,k,b,"#gview_"+h.p.id,a("#gbox_"+h.p.id)[0],"#"+b.layer,{position:"relative"}):a.jgrid.createModal(e,k,b,"#gview_"+h.p.id,a("#gbox_"+h.p.id)[0]);p&&a("#"+g+"_query").bind("click",function(){a(".queryresult",k).toggle();return!1});if(b.stringResult===void 0)b.stringResult=b.multipleSearch;a("#"+g+"_search").bind("click",
264
- function(){var c=a("#"+g),f={},j,k=c.jqFilter("filterData");if(b.errorcheck&&(c[0].hideError(),b.showQuery||c.jqFilter("toSQLString"),c[0].p.error))return c[0].showError(),!1;if(b.stringResult){try{j=xmlJsonClass.toJson(k,"","",!1)}catch(l){try{j=JSON.stringify(k)}catch(m){}}typeof j==="string"&&(f[b.sFilter]=j,a.each([b.sField,b.sValue,b.sOper],function(){f[this]=""}))}else b.multipleSearch?(f[b.sFilter]=k,a.each([b.sField,b.sValue,b.sOper],function(){f[this]=""})):(f[b.sField]=k.rules[0].field,
265
- f[b.sValue]=k.rules[0].data,f[b.sOper]=k.rules[0].op,f[b.sFilter]="");h.p.search=!0;a.extend(h.p.postData,f);if(a.isFunction(b.onSearch))b.onSearch();a(h).trigger("reloadGrid",[{page:1}]);b.closeAfterSearch&&a.jgrid.hideModal("#"+e.themodal,{gb:"#gbox_"+h.p.id,jqm:b.jqModal,onClose:b.onClose});return!1});a("#"+g+"_reset").bind("click",function(){var c={},e=a("#"+g);h.p.search=!1;b.multipleSearch===!1?c[b.sField]=c[b.sValue]=c[b.sOper]="":c[b.sFilter]="";e[0].resetFilter();r&&a(".ui-template",k).val("default");
266
- a.extend(h.p.postData,c);if(a.isFunction(b.onReset))b.onReset();b.multipleSearch===!1&&f();a(h).trigger("reloadGrid",[{page:1}]);return!1});c();a(".fm-button:not(.ui-state-disabled)",k).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},editGridRow:function(d,c){b=c=a.extend({top:0,left:0,width:300,height:"auto",dataheight:"auto",modal:!1,overlay:10,drag:!0,resize:!0,url:null,mtype:"POST",clearAfterAdd:!0,closeAfterEdit:!1,reloadAfterSubmit:!0,
267
- onInitializeForm:null,beforeInitData:null,beforeShowForm:null,afterShowForm:null,beforeSubmit:null,afterSubmit:null,onclickSubmit:null,afterComplete:null,onclickPgButtons:null,afterclickPgButtons:null,editData:{},recreateForm:!1,jqModal:!0,closeOnEscape:!1,addedrow:"first",topinfo:"",bottominfo:"",saveicon:[],closeicon:[],savekey:[!1,13],navkeys:[!1,38,40],checkOnSubmit:!1,checkOnUpdate:!1,_savedData:{},processing:!1,onClose:null,ajaxEditOptions:{},serializeEditData:null,viewPagerButtons:!0},a.jgrid.edit,
268
- c||{});return this.each(function(){function f(){a(".FormElement","#"+r).each(function(){var b=a(".customelement",this);if(b.length){var c=a(b[0]).attr("name");a.each(p.p.colModel,function(){if(this.name===c&&this.editoptions&&a.isFunction(this.editoptions.custom_value)){try{if(u[c]=this.editoptions.custom_value(a("#"+a.jgrid.jqID(c),"#"+r),"get"),u[c]===void 0)throw"e1";}catch(b){b==="e1"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):
269
- a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,b.message,jQuery.jgrid.edit.bClose)}return!0}})}else{switch(a(this).get(0).type){case "checkbox":a(this).attr("checked")?u[this.name]=a(this).val():(b=a(this).attr("offval"),u[this.name]=b);break;case "select-one":u[this.name]=a("option:selected",this).val();N[this.name]=a("option:selected",this).text();break;case "select-multiple":u[this.name]=a(this).val();u[this.name]=u[this.name]?u[this.name].join(","):"";var d=[];a("option:selected",this).each(function(b,
270
- c){d[b]=a(c).text()});N[this.name]=d.join(",");break;case "password":case "text":case "textarea":case "button":u[this.name]=a(this).val()}p.p.autoencode&&(u[this.name]=a.jgrid.htmlEncode(u[this.name]))}});return!0}function h(c,d,e,f){var g,j,h,k=0,l,m,n,o=[],s=!1,r="",q;for(q=1;q<=f;q++)r+="<td class='CaptionTD'>&#160;</td><td class='DataTD'>&#160;</td>";c!="_empty"&&(s=a(d).jqGrid("getInd",c));a(d.p.colModel).each(function(q){g=this.name;m=(j=this.editrules&&this.editrules.edithidden===!0?!1:this.hidden===
271
- !0?!0:!1)?"style='display:none'":"";if(g!=="cb"&&g!=="subgrid"&&this.editable===!0&&g!=="rn"){if(s===!1)l="";else if(g==d.p.ExpandColumn&&d.p.treeGrid===!0)l=a("td:eq("+q+")",d.rows[s]).text();else{try{l=a.unformat(a("td:eq("+q+")",d.rows[s]),{rowId:c,colModel:this},q)}catch(t){l=this.edittype&&this.edittype=="textarea"?a("td:eq("+q+")",d.rows[s]).text():a("td:eq("+q+")",d.rows[s]).html()}if(l=="&nbsp;"||l=="&#160;"||l.length==1&&l.charCodeAt(0)==160)l=""}var u=a.extend({},this.editoptions||{},{id:g,
272
- name:g}),A=a.extend({},{elmprefix:"",elmsuffix:"",rowabove:!1,rowcontent:""},this.formoptions||{}),v=parseInt(A.rowpos,10)||k+1,w=parseInt((parseInt(A.colpos,10)||1)*2,10);c=="_empty"&&u.defaultValue&&(l=a.isFunction(u.defaultValue)?u.defaultValue():u.defaultValue);if(!this.edittype)this.edittype="text";p.p.autoencode&&(l=a.jgrid.htmlDecode(l));n=a.jgrid.createEl(this.edittype,u,l,!1,a.extend({},a.jgrid.ajaxOptions,d.p.ajaxSelectOptions||{}));l===""&&this.edittype=="checkbox"&&(l=a(n).attr("offval"));
273
- l===""&&this.edittype=="select"&&(l=a("option:eq(0)",n).text());if(b.checkOnSubmit||b.checkOnUpdate)b._savedData[g]=l;a(n).addClass("FormElement");(this.edittype=="text"||this.edittype=="textarea")&&a(n).addClass("ui-widget-content ui-corner-all");h=a(e).find("tr[rowpos="+v+"]");if(A.rowabove)u=a("<tr><td class='contentinfo' colspan='"+f*2+"'>"+A.rowcontent+"</td></tr>"),a(e).append(u),u[0].rp=v;if(h.length===0)h=a("<tr "+m+" rowpos='"+v+"'></tr>").addClass("FormData").attr("id","tr_"+g),a(h).append(r),
274
- a(e).append(h),h[0].rp=v;a("td:eq("+(w-2)+")",h[0]).html(typeof A.label==="undefined"?d.p.colNames[q]:A.label);a("td:eq("+(w-1)+")",h[0]).append(A.elmprefix).append(n).append(A.elmsuffix);o[k]=q;k++}});if(k>0&&(q=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(f*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+d.p.id+"_id' value='"+c+"'/></td></tr>"),q[0].rp=k+999,a(e).append(q),b.checkOnSubmit||b.checkOnUpdate))b._savedData[d.p.id+
275
- "_id"]=c;return o}function g(c,d,e){var f,g=0,j,h,l,k,m;if(b.checkOnSubmit||b.checkOnUpdate)b._savedData={},b._savedData[d.p.id+"_id"]=c;var n=d.p.colModel;if(c=="_empty")a(n).each(function(){f=this.name;l=a.extend({},this.editoptions||{});if((h=a("#"+a.jgrid.jqID(f),"#"+e))&&h.length&&h[0]!==null)if(k="",l.defaultValue?(k=a.isFunction(l.defaultValue)?l.defaultValue():l.defaultValue,h[0].type=="checkbox"?(m=k.toLowerCase(),m.search(/(false|0|no|off|undefined)/i)<0&&m!==""?(h[0].checked=!0,h[0].defaultChecked=
276
- !0,h[0].value=k):h.attr({checked:"",defaultChecked:""})):h.val(k)):h[0].type=="checkbox"?(h[0].checked=!1,h[0].defaultChecked=!1,k=a(h).attr("offval")):h[0].type&&h[0].type.substr(0,6)=="select"?h[0].selectedIndex=0:h.val(k),b.checkOnSubmit===!0||b.checkOnUpdate)b._savedData[f]=k}),a("#id_g","#"+e).val(c);else{var o=a(d).jqGrid("getInd",c,!0);o&&(a("td",o).each(function(h){f=n[h].name;if(f!=="cb"&&f!=="subgrid"&&f!=="rn"&&n[h].editable===!0){if(f==d.p.ExpandColumn&&d.p.treeGrid===!0)j=a(this).text();
277
- else try{j=a.unformat(a(this),{rowId:c,colModel:n[h]},h)}catch(k){j=n[h].edittype=="textarea"?a(this).text():a(this).html()}p.p.autoencode&&(j=a.jgrid.htmlDecode(j));if(b.checkOnSubmit===!0||b.checkOnUpdate)b._savedData[f]=j;f=a.jgrid.jqID(f);switch(n[h].edittype){case "password":case "text":case "button":case "image":case "textarea":if(j=="&nbsp;"||j=="&#160;"||j.length==1&&j.charCodeAt(0)==160)j="";a("#"+f,"#"+e).val(j);break;case "select":var l=j.split(","),l=a.map(l,function(b){return a.trim(b)});
278
- a("#"+f+" option","#"+e).each(function(){this.selected=!n[h].editoptions.multiple&&(l[0]==a.trim(a(this).text())||l[0]==a.trim(a(this).val()))?!0:n[h].editoptions.multiple?a.inArray(a.trim(a(this).text()),l)>-1||a.inArray(a.trim(a(this).val()),l)>-1?!0:!1:!1});break;case "checkbox":j+="";n[h].editoptions&&n[h].editoptions.value?n[h].editoptions.value.split(":")[0]==j?(a("#"+f,"#"+e).attr("checked",!0),a("#"+f,"#"+e).attr("defaultChecked",!0)):(a("#"+f,"#"+e).attr("checked",!1),a("#"+f,"#"+e).attr("defaultChecked",
279
- "")):(j=j.toLowerCase(),j.search(/(false|0|no|off|undefined)/i)<0&&j!==""?(a("#"+f,"#"+e).attr("checked",!0),a("#"+f,"#"+e).attr("defaultChecked",!0)):(a("#"+f,"#"+e).attr("checked",!1),a("#"+f,"#"+e).attr("defaultChecked","")));break;case "custom":try{if(n[h].editoptions&&a.isFunction(n[h].editoptions.custom_value))n[h].editoptions.custom_value(a("#"+f,"#"+e),"set",j);else throw"e1";}catch(m){m=="e1"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,
280
- jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,m.message,jQuery.jgrid.edit.bClose)}}g++}}),g>0&&a("#id_g","#"+r).val(c))}}function j(){var d,e=[!0,"",""],f={},j=p.p.prmNames,h,l,k,m;if(a.isFunction(b.beforeCheckValues)){var n=b.beforeCheckValues(u,a("#"+q),u[p.p.id+"_id"]=="_empty"?j.addoper:j.editoper);n&&typeof n==="object"&&(u=n)}for(k in u)if(u.hasOwnProperty(k)&&(e=a.jgrid.checkValues(u[k],k,p),e[0]===!1))break;e[0]&&(a.isFunction(b.onclickSubmit)&&(f=b.onclickSubmit(b,
281
- u)||{}),a.isFunction(b.beforeSubmit)&&(e=b.beforeSubmit(u,a("#"+q))));if(e[0]&&!b.processing){b.processing=!0;a("#sData","#"+r+"_2").addClass("ui-state-active");l=j.oper;h=j.id;u[l]=a.trim(u[p.p.id+"_id"])=="_empty"?j.addoper:j.editoper;u[l]!=j.addoper?u[h]=u[p.p.id+"_id"]:u[h]===void 0&&(u[h]=u[p.p.id+"_id"]);delete u[p.p.id+"_id"];u=a.extend(u,b.editData,f);if(p.p.treeGrid===!0)for(i in u[l]==j.addoper&&(m=a(p).jqGrid("getGridParam","selrow"),u[p.p.treeGridModel=="adjacency"?p.p.treeReader.parent_id_field:
282
- "parent_id"]=m),p.p.treeReader)f=p.p.treeReader[i],u.hasOwnProperty(f)&&!(u[l]==j.addoper&&i==="parent_id_field")&&delete u[f];if(p.p.restful)b.mtype=u.id=="_empty"?"POST":"PUT",b.url=u.id=="_empty"?p.p.url:p.p.url+"/"+u.id;f=a.extend({url:b.url?b.url:a(p).jqGrid("getGridParam","editurl"),type:b.mtype,data:a.isFunction(b.serializeEditData)?b.serializeEditData(u):u,complete:function(f,k){k!="success"?(e[0]=!1,e[1]=a.isFunction(b.errorTextFormat)?b.errorTextFormat(f):k+" Status: '"+f.statusText+"'. Error code: "+
283
- f.status):a.isFunction(b.afterSubmit)&&(e=b.afterSubmit(f,u));if(e[0]===!1)a("#FormError>td","#"+r).html(e[1]),a("#FormError","#"+r).show();else if(a.each(p.p.colModel,function(){if(N[this.name]&&this.formatter&&this.formatter=="select")try{delete N[this.name]}catch(a){}}),u=a.extend(u,N),p.p.autoencode&&a.each(u,function(b,c){u[b]=a.jgrid.htmlDecode(c)}),b.reloadAfterSubmit=b.reloadAfterSubmit&&p.p.datatype!="local",u[l]==j.addoper?(e[2]||(e[2]=a.jgrid.randId()),u[h]=e[2],b.closeAfterAdd?(b.reloadAfterSubmit?
284
- a(p).trigger("reloadGrid"):p.p.treeGrid===!0?a(p).jqGrid("addChildNode",e[2],m,u):(a(p).jqGrid("addRowData",e[2],u,c.addedrow),a(p).jqGrid("setSelection",e[2])),a.jgrid.hideModal("#"+t.themodal,{gb:"#gbox_"+s,jqm:c.jqModal,onClose:b.onClose})):b.clearAfterAdd?(b.reloadAfterSubmit?a(p).trigger("reloadGrid"):p.p.treeGrid===!0?a(p).jqGrid("addChildNode",e[2],m,u):a(p).jqGrid("addRowData",e[2],u,c.addedrow),g("_empty",p,q)):b.reloadAfterSubmit?a(p).trigger("reloadGrid"):p.p.treeGrid===!0?a(p).jqGrid("addChildNode",
285
- e[2],m,u):a(p).jqGrid("addRowData",e[2],u,c.addedrow)):(b.reloadAfterSubmit?(a(p).trigger("reloadGrid"),b.closeAfterEdit||setTimeout(function(){a(p).jqGrid("setSelection",u[h])},1E3)):p.p.treeGrid===!0?a(p).jqGrid("setTreeRow",u[h],u):a(p).jqGrid("setRowData",u[h],u),b.closeAfterEdit&&a.jgrid.hideModal("#"+t.themodal,{gb:"#gbox_"+s,jqm:c.jqModal,onClose:b.onClose})),a.isFunction(b.afterComplete)&&(d=f,setTimeout(function(){b.afterComplete(d,u,a("#"+q));d=null},500)),b.checkOnSubmit||b.checkOnUpdate)if(a("#"+
286
- q).data("disabled",!1),b._savedData[p.p.id+"_id"]!="_empty")for(var n in b._savedData)u[n]&&(b._savedData[n]=u[n]);b.processing=!1;a("#sData","#"+r+"_2").removeClass("ui-state-active");try{a(":input:visible","#"+q)[0].focus()}catch(o){}}},a.jgrid.ajaxOptions,b.ajaxEditOptions);if(!f.url&&!b.useDataProxy)a.isFunction(p.p.dataProxy)?b.useDataProxy=!0:(e[0]=!1,e[1]+=" "+a.jgrid.errors.nourl);e[0]&&(b.useDataProxy?p.p.dataProxy.call(p,f,"set_"+p.p.id):a.ajax(f))}e[0]===!1&&(a("#FormError>td","#"+r).html(e[1]),
287
- a("#FormError","#"+r).show())}function e(a,b){var c=!1,d;for(d in a)if(a[d]!=b[d]){c=!0;break}return c}function l(){a.each(p.p.colModel,function(a,b){b.editoptions&&b.editoptions.NullIfEmpty===!0&&u.hasOwnProperty(b.name)&&u[b.name]==""&&(u[b.name]="null")})}function k(){var c=!0;a("#FormError","#"+r).hide();b.checkOnUpdate&&(u={},N={},f(),O=a.extend({},u,N),(S=e(O,b._savedData))?(a("#"+q).data("disabled",!0),a(".confirm","#"+t.themodal).show(),c=!1):l());return c}function o(){if(d!=="_empty"&&typeof p.p.savedRow!==
288
- "undefined"&&p.p.savedRow.length>0&&a.isFunction(a.fn.jqGrid.restoreRow))for(var b=0;b<p.p.savedRow.length;b++)if(p.p.savedRow[b].id==d){a(p).jqGrid("restoreRow",d);break}}function m(b,c){b===0?a("#pData","#"+r+"_2").addClass("ui-state-disabled"):a("#pData","#"+r+"_2").removeClass("ui-state-disabled");b==c?a("#nData","#"+r+"_2").addClass("ui-state-disabled"):a("#nData","#"+r+"_2").removeClass("ui-state-disabled")}function n(){var b=a(p).jqGrid("getDataIDs"),c=a("#id_g","#"+r).val();return[a.inArray(c,
289
- b),b]}var p=this;if(p.grid&&d){var s=p.p.id,q="FrmGrid_"+s,r="TblGrid_"+s,t={themodal:"editmod"+s,modalhead:"edithd"+s,modalcontent:"editcnt"+s,scrollelm:q},v=a.isFunction(b.beforeShowForm)?b.beforeShowForm:!1,w=a.isFunction(b.afterShowForm)?b.afterShowForm:!1,z=a.isFunction(b.beforeInitData)?b.beforeInitData:!1,C=a.isFunction(b.onInitializeForm)?b.onInitializeForm:!1,y=!0,A=1,B=0,u,N,O,S;d==="new"?(d="_empty",c.caption=b.addCaption):c.caption=b.editCaption;c.recreateForm===!0&&a("#"+t.themodal).html()!==
290
- null&&a("#"+t.themodal).remove();var L=!0;c.checkOnUpdate&&c.jqModal&&!c.modal&&(L=!1);if(a("#"+t.themodal).html()!==null){z&&(y=z(a("#"+q)),typeof y=="undefined"&&(y=!0));if(y===!1)return;o();a(".ui-jqdialog-title","#"+t.modalhead).html(c.caption);a("#FormError","#"+r).hide();b.topinfo?(a(".topinfo","#"+r+"_2").html(b.topinfo),a(".tinfo","#"+r+"_2").show()):a(".tinfo","#"+r+"_2").hide();b.bottominfo?(a(".bottominfo","#"+r+"_2").html(b.bottominfo),a(".binfo","#"+r+"_2").show()):a(".binfo","#"+r+"_2").hide();
291
- g(d,p,q);d=="_empty"||!b.viewPagerButtons?a("#pData, #nData","#"+r+"_2").hide():a("#pData, #nData","#"+r+"_2").show();if(b.processing===!0)b.processing=!1,a("#sData","#"+r+"_2").removeClass("ui-state-active");a("#"+q).data("disabled")===!0&&(a(".confirm","#"+t.themodal).hide(),a("#"+q).data("disabled",!1));v&&v(a("#"+q));a("#"+t.themodal).data("onClose",b.onClose);a.jgrid.viewModal("#"+t.themodal,{gbox:"#gbox_"+s,jqm:c.jqModal,jqM:!1,overlay:c.overlay,modal:c.modal});L||a(".jqmOverlay").click(function(){if(!k())return!1;
292
- a.jgrid.hideModal("#"+t.themodal,{gb:"#gbox_"+s,jqm:c.jqModal,onClose:b.onClose});return!1});w&&w(a("#"+q))}else{var G=isNaN(c.dataheight)?c.dataheight:c.dataheight+"px",G=a("<form name='FormPost' id='"+q+"' class='FormGrid' onSubmit='return false;' style='width:100%;overflow:auto;position:relative;height:"+G+";'></form>").data("disabled",!1),T=a("<table id='"+r+"' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>");z&&(y=z(a("#"+q)),typeof y=="undefined"&&(y=!0));
293
- if(y===!1)return;o();a(p.p.colModel).each(function(){var a=this.formoptions;A=Math.max(A,a?a.colpos||0:0);B=Math.max(B,a?a.rowpos||0:0)});a(G).append(T);z=a("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+A*2+"'></td></tr>");z[0].rp=0;a(T).append(z);z=a("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+A*2+"'>"+b.topinfo+"</td></tr>");z[0].rp=0;a(T).append(z);var y=(z=p.p.direction=="rtl"?!0:!1)?"nData":"pData",U=z?"pData":"nData";h(d,p,T,A);var y=
294
- "<a href='javascript:void(0)' id='"+y+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>",U="<a href='javascript:void(0)' id='"+U+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",Z="<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>"+c.bSubmit+"</a>",I="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+
295
- c.bCancel+"</a>",y="<table border='0' cellspacing='0' cellpadding='0' class='EditTable' id='"+r+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr id='Act_Buttons'><td class='navButton'>"+(z?U+y:y+U)+"</td><td class='EditButton'>"+Z+I+"</td></tr>";y+="<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+b.bottominfo+"</td></tr>";y+="</tbody></table>";if(B>0){var W=[];a.each(a(T)[0].rows,function(a,b){W[a]=b});W.sort(function(a,b){if(a.rp>
296
- b.rp)return 1;if(a.rp<b.rp)return-1;return 0});a.each(W,function(b,c){a("tbody",T).append(c)})}c.gbox="#gbox_"+s;var R=!1;if(c.closeOnEscape===!0)c.closeOnEscape=!1,R=!0;G=a("<span></span>").append(G).append(y);a.jgrid.createModal(t,G,c,"#gview_"+p.p.id,a("#gbox_"+p.p.id)[0]);z&&(a("#pData, #nData","#"+r+"_2").css("float","right"),a(".EditButton","#"+r+"_2").css("text-align","left"));b.topinfo&&a(".tinfo","#"+r+"_2").show();b.bottominfo&&a(".binfo","#"+r+"_2").show();y=G=null;a("#"+t.themodal).keydown(function(d){var e=
297
- d.target;if(a("#"+q).data("disabled")===!0)return!1;if(b.savekey[0]===!0&&d.which==b.savekey[1]&&e.tagName!="TEXTAREA")return a("#sData","#"+r+"_2").trigger("click"),!1;if(d.which===27){if(!k())return!1;R&&a.jgrid.hideModal(this,{gb:c.gbox,jqm:c.jqModal,onClose:b.onClose});return!1}if(b.navkeys[0]===!0){if(a("#id_g","#"+r).val()=="_empty")return!0;if(d.which==b.navkeys[1])return a("#pData","#"+r+"_2").trigger("click"),!1;if(d.which==b.navkeys[2])return a("#nData","#"+r+"_2").trigger("click"),!1}});
298
- c.checkOnUpdate&&(a("a.ui-jqdialog-titlebar-close span","#"+t.themodal).removeClass("jqmClose"),a("a.ui-jqdialog-titlebar-close","#"+t.themodal).unbind("click").click(function(){if(!k())return!1;a.jgrid.hideModal("#"+t.themodal,{gb:"#gbox_"+s,jqm:c.jqModal,onClose:b.onClose});return!1}));c.saveicon=a.extend([!0,"left","ui-icon-disk"],c.saveicon);c.closeicon=a.extend([!0,"left","ui-icon-close"],c.closeicon);c.saveicon[0]===!0&&a("#sData","#"+r+"_2").addClass(c.saveicon[1]=="right"?"fm-button-icon-right":
299
- "fm-button-icon-left").append("<span class='ui-icon "+c.saveicon[2]+"'></span>");c.closeicon[0]===!0&&a("#cData","#"+r+"_2").addClass(c.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.closeicon[2]+"'></span>");if(b.checkOnSubmit||b.checkOnUpdate)Z="<a href='javascript:void(0)' id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+c.bYes+"</a>",U="<a href='javascript:void(0)' id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+
300
- c.bNo+"</a>",I="<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+c.bExit+"</a>",G=c.zIndex||999,G++,a("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:"+G+";display:none;'>&#160;"+(a.browser.msie&&a.browser.version==6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':"")+"</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+
301
- (G+1)+"'>"+c.saveData+"<br/><br/>"+Z+U+I+"</div>").insertAfter("#"+q),a("#sNew","#"+t.themodal).click(function(){j();a("#"+q).data("disabled",!1);a(".confirm","#"+t.themodal).hide();return!1}),a("#nNew","#"+t.themodal).click(function(){a(".confirm","#"+t.themodal).hide();a("#"+q).data("disabled",!1);setTimeout(function(){a(":input","#"+q)[0].focus()},0);return!1}),a("#cNew","#"+t.themodal).click(function(){a(".confirm","#"+t.themodal).hide();a("#"+q).data("disabled",!1);a.jgrid.hideModal("#"+t.themodal,
302
- {gb:"#gbox_"+s,jqm:c.jqModal,onClose:b.onClose});return!1});C&&C(a("#"+q));d=="_empty"||!b.viewPagerButtons?a("#pData,#nData","#"+r+"_2").hide():a("#pData,#nData","#"+r+"_2").show();v&&v(a("#"+q));a("#"+t.themodal).data("onClose",b.onClose);a.jgrid.viewModal("#"+t.themodal,{gbox:"#gbox_"+s,jqm:c.jqModal,overlay:c.overlay,modal:c.modal});L||a(".jqmOverlay").click(function(){if(!k())return!1;a.jgrid.hideModal("#"+t.themodal,{gb:"#gbox_"+s,jqm:c.jqModal,onClose:b.onClose});return!1});w&&w(a("#"+q));
303
- a(".fm-button","#"+t.themodal).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a("#sData","#"+r+"_2").click(function(){u={};N={};a("#FormError","#"+r).hide();f();l();u[p.p.id+"_id"]=="_empty"?j():c.checkOnSubmit===!0?(O=a.extend({},u,N),(S=e(O,b._savedData))?(a("#"+q).data("disabled",!0),a(".confirm","#"+t.themodal).show()):j()):j();return!1});a("#cData","#"+r+"_2").click(function(){if(!k())return!1;a.jgrid.hideModal("#"+t.themodal,{gb:"#gbox_"+
304
- s,jqm:c.jqModal,onClose:b.onClose});return!1});a("#nData","#"+r+"_2").click(function(){if(!k())return!1;a("#FormError","#"+r).hide();var b=n();b[0]=parseInt(b[0],10);if(b[0]!=-1&&b[1][b[0]+1]){if(a.isFunction(c.onclickPgButtons))c.onclickPgButtons("next",a("#"+q),b[1][b[0]]);g(b[1][b[0]+1],p,q);a(p).jqGrid("setSelection",b[1][b[0]+1]);a.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons("next",a("#"+q),b[1][b[0]+1]);m(b[0]+1,b[1].length-1)}return!1});a("#pData","#"+r+"_2").click(function(){if(!k())return!1;
305
- a("#FormError","#"+r).hide();var b=n();if(b[0]!=-1&&b[1][b[0]-1]){if(a.isFunction(c.onclickPgButtons))c.onclickPgButtons("prev",a("#"+q),b[1][b[0]]);g(b[1][b[0]-1],p,q);a(p).jqGrid("setSelection",b[1][b[0]-1]);a.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons("prev",a("#"+q),b[1][b[0]-1]);m(b[0]-1,b[1].length-1)}return!1})}v=n();m(v[0],v[1].length-1)}})},viewGridRow:function(b,c){c=a.extend({top:0,left:0,width:0,height:"auto",dataheight:"auto",modal:!1,overlay:10,drag:!0,resize:!0,jqModal:!0,
306
- closeOnEscape:!1,labelswidth:"30%",closeicon:[],navkeys:[!1,38,40],onClose:null,beforeShowForm:null,beforeInitData:null,viewPagerButtons:!0},a.jgrid.view,c||{});return this.each(function(){function f(){(c.closeOnEscape===!0||c.navkeys[0]===!0)&&setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+n.modalhead).focus()},0)}function h(b,d,e,f){for(var g,j,h,l=0,k,m,p=[],n=!1,o="<td class='CaptionTD form-view-label ui-widget-content' width='"+c.labelswidth+"'>&#160;</td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'>&#160;</td>",
307
- s="",q=["integer","number","currency"],r=0,t=0,v,w,z,y=1;y<=f;y++)s+=y==1?o:"<td class='CaptionTD form-view-label ui-widget-content'>&#160;</td><td class='DataTD form-view-data ui-widget-content'>&#160;</td>";a(d.p.colModel).each(function(){j=this.editrules&&this.editrules.edithidden===!0?!1:this.hidden===!0?!0:!1;!j&&this.align==="right"&&(this.formatter&&a.inArray(this.formatter,q)!==-1?r=Math.max(r,parseInt(this.width,10)):t=Math.max(t,parseInt(this.width,10)))});v=r!==0?r:t!==0?t:0;n=a(d).jqGrid("getInd",
308
- b);a(d.p.colModel).each(function(b){g=this.name;w=!1;m=(j=this.editrules&&this.editrules.edithidden===!0?!1:this.hidden===!0?!0:!1)?"style='display:none'":"";z=typeof this.viewable!="boolean"?!0:this.viewable;if(g!=="cb"&&g!=="subgrid"&&g!=="rn"&&z){k=n===!1?"":g==d.p.ExpandColumn&&d.p.treeGrid===!0?a("td:eq("+b+")",d.rows[n]).text():a("td:eq("+b+")",d.rows[n]).html();w=this.align==="right"&&v!==0?!0:!1;a.extend({},this.editoptions||{},{id:g,name:g});var c=a.extend({},{rowabove:!1,rowcontent:""},
309
- this.formoptions||{}),o=parseInt(c.rowpos,10)||l+1,r=parseInt((parseInt(c.colpos,10)||1)*2,10);if(c.rowabove){var q=a("<tr><td class='contentinfo' colspan='"+f*2+"'>"+c.rowcontent+"</td></tr>");a(e).append(q);q[0].rp=o}h=a(e).find("tr[rowpos="+o+"]");if(h.length===0)h=a("<tr "+m+" rowpos='"+o+"'></tr>").addClass("FormData").attr("id","trv_"+g),a(h).append(s),a(e).append(h),h[0].rp=o;a("td:eq("+(r-2)+")",h[0]).html("<b>"+(typeof c.label==="undefined"?d.p.colNames[b]:c.label)+"</b>");a("td:eq("+(r-
310
- 1)+")",h[0]).append("<span>"+k+"</span>").attr("id","v_"+g);w&&a("td:eq("+(r-1)+") span",h[0]).css({"text-align":"right",width:v+"px"});p[l]=b;l++}});if(l>0)b=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(f*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+b+"'/></td></tr>"),b[0].rp=l+99,a(e).append(b);return p}function g(b,c){var d,e,f=0,g,j;if(j=a(c).jqGrid("getInd",b,!0))a("td",j).each(function(b){d=c.p.colModel[b].name;
311
- e=c.p.colModel[b].editrules&&c.p.colModel[b].editrules.edithidden===!0?!1:c.p.colModel[b].hidden===!0?!0:!1;d!=="cb"&&d!=="subgrid"&&d!=="rn"&&(g=d==c.p.ExpandColumn&&c.p.treeGrid===!0?a(this).text():a(this).html(),a.extend({},c.p.colModel[b].editoptions||{}),d=a.jgrid.jqID("v_"+d),a("#"+d+" span","#"+m).html(g),e&&a("#"+d,"#"+m).parents("tr:first").hide(),f++)}),f>0&&a("#id_g","#"+m).val(b)}function j(b,c){b===0?a("#pData","#"+m+"_2").addClass("ui-state-disabled"):a("#pData","#"+m+"_2").removeClass("ui-state-disabled");
312
- b==c?a("#nData","#"+m+"_2").addClass("ui-state-disabled"):a("#nData","#"+m+"_2").removeClass("ui-state-disabled")}function e(){var b=a(l).jqGrid("getDataIDs"),c=a("#id_g","#"+m).val();return[a.inArray(c,b),b]}var l=this;if(l.grid&&b){if(!c.imgpath)c.imgpath=l.p.imgpath;var k=l.p.id,o="ViewGrid_"+k,m="ViewTbl_"+k,n={themodal:"viewmod"+k,modalhead:"viewhd"+k,modalcontent:"viewcnt"+k,scrollelm:o},p=a.isFunction(c.beforeInitData)?c.beforeInitData:!1,s=!0,q=1,r=0;if(a("#"+n.themodal).html()!==null){p&&
313
- (s=p(a("#"+o)),typeof s=="undefined"&&(s=!0));if(s===!1)return;a(".ui-jqdialog-title","#"+n.modalhead).html(c.caption);a("#FormError","#"+m).hide();g(b,l);a.isFunction(c.beforeShowForm)&&c.beforeShowForm(a("#"+o));a.jgrid.viewModal("#"+n.themodal,{gbox:"#gbox_"+k,jqm:c.jqModal,jqM:!1,overlay:c.overlay,modal:c.modal});f()}else{var t=isNaN(c.dataheight)?c.dataheight:c.dataheight+"px",t=a("<form name='FormPost' id='"+o+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+t+
314
- ";'></form>"),v=a("<table id='"+m+"' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");p&&(s=p(a("#"+o)),typeof s=="undefined"&&(s=!0));if(s===!1)return;a(l.p.colModel).each(function(){var a=this.formoptions;q=Math.max(q,a?a.colpos||0:0);r=Math.max(r,a?a.rowpos||0:0)});a(t).append(v);h(b,l,v,q);var p=l.p.direction=="rtl"?!0:!1,s="<a href='javascript:void(0)' id='"+(p?"nData":"pData")+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>",
315
- w="<a href='javascript:void(0)' id='"+(p?"pData":"nData")+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",z="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+c.bClose+"</a>";if(r>0){var C=[];a.each(a(v)[0].rows,function(a,b){C[a]=b});C.sort(function(a,b){if(a.rp>b.rp)return 1;if(a.rp<b.rp)return-1;return 0});a.each(C,function(b,c){a("tbody",v).append(c)})}c.gbox="#gbox_"+k;var y=!1;if(c.closeOnEscape===
316
- !0)c.closeOnEscape=!1,y=!0;t=a("<span></span>").append(t).append("<table border='0' class='EditTable' id='"+m+"_2'><tbody><tr id='Act_Buttons'><td class='navButton' width='"+c.labelswidth+"'>"+(p?w+s:s+w)+"</td><td class='EditButton'>"+z+"</td></tr></tbody></table>");a.jgrid.createModal(n,t,c,"#gview_"+l.p.id,a("#gview_"+l.p.id)[0]);p&&(a("#pData, #nData","#"+m+"_2").css("float","right"),a(".EditButton","#"+m+"_2").css("text-align","left"));c.viewPagerButtons||a("#pData, #nData","#"+m+"_2").hide();
317
- t=null;a("#"+n.themodal).keydown(function(b){if(b.which===27)return y&&a.jgrid.hideModal(this,{gb:c.gbox,jqm:c.jqModal,onClose:c.onClose}),!1;if(c.navkeys[0]===!0){if(b.which===c.navkeys[1])return a("#pData","#"+m+"_2").trigger("click"),!1;if(b.which===c.navkeys[2])return a("#nData","#"+m+"_2").trigger("click"),!1}});c.closeicon=a.extend([!0,"left","ui-icon-close"],c.closeicon);c.closeicon[0]===!0&&a("#cData","#"+m+"_2").addClass(c.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+
318
- c.closeicon[2]+"'></span>");a.isFunction(c.beforeShowForm)&&c.beforeShowForm(a("#"+o));a.jgrid.viewModal("#"+n.themodal,{gbox:"#gbox_"+k,jqm:c.jqModal,modal:c.modal});a(".fm-button:not(.ui-state-disabled)","#"+m+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});f();a("#cData","#"+m+"_2").click(function(){a.jgrid.hideModal("#"+n.themodal,{gb:"#gbox_"+k,jqm:c.jqModal,onClose:c.onClose});return!1});a("#nData","#"+m+"_2").click(function(){a("#FormError",
319
- "#"+m).hide();var b=e();b[0]=parseInt(b[0],10);if(b[0]!=-1&&b[1][b[0]+1]){if(a.isFunction(c.onclickPgButtons))c.onclickPgButtons("next",a("#"+o),b[1][b[0]]);g(b[1][b[0]+1],l);a(l).jqGrid("setSelection",b[1][b[0]+1]);a.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons("next",a("#"+o),b[1][b[0]+1]);j(b[0]+1,b[1].length-1)}f();return!1});a("#pData","#"+m+"_2").click(function(){a("#FormError","#"+m).hide();var b=e();if(b[0]!=-1&&b[1][b[0]-1]){if(a.isFunction(c.onclickPgButtons))c.onclickPgButtons("prev",
320
- a("#"+o),b[1][b[0]]);g(b[1][b[0]-1],l);a(l).jqGrid("setSelection",b[1][b[0]-1]);a.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons("prev",a("#"+o),b[1][b[0]-1]);j(b[0]-1,b[1].length-1)}f();return!1})}t=e();j(t[0],t[1].length-1)}})},delGridRow:function(d,c){b=c=a.extend({top:0,left:0,width:240,height:"auto",dataheight:"auto",modal:!1,overlay:10,drag:!0,resize:!0,url:"",mtype:"POST",reloadAfterSubmit:!0,beforeShowForm:null,beforeInitData:null,afterShowForm:null,beforeSubmit:null,onclickSubmit:null,
321
- afterSubmit:null,jqModal:!0,closeOnEscape:!1,delData:{},delicon:[],cancelicon:[],onClose:null,ajaxDelOptions:{},processing:!1,serializeDelData:null,useDataProxy:!1},a.jgrid.del,c||{});return this.each(function(){var f=this;if(f.grid&&d){var h=a.isFunction(c.beforeShowForm),g=a.isFunction(c.afterShowForm),j=a.isFunction(c.beforeInitData)?c.beforeInitData:!1,e=f.p.id,l={},k=!0,o="DelTbl_"+e,m,n,p,s,q={themodal:"delmod"+e,modalhead:"delhd"+e,modalcontent:"delcnt"+e,scrollelm:o};jQuery.isArray(d)&&(d=
322
- d.join());if(a("#"+q.themodal).html()!==null){j&&(k=j(a("#"+o)),typeof k=="undefined"&&(k=!0));if(k===!1)return;a("#DelData>td","#"+o).text(d);a("#DelError","#"+o).hide();if(b.processing===!0)b.processing=!1,a("#dData","#"+o).removeClass("ui-state-active");h&&c.beforeShowForm(a("#"+o));a.jgrid.viewModal("#"+q.themodal,{gbox:"#gbox_"+e,jqm:c.jqModal,jqM:!1,overlay:c.overlay,modal:c.modal})}else{var r=isNaN(c.dataheight)?c.dataheight:c.dataheight+"px",r="<div id='"+o+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+
323
- r+";'>";r+="<table class='DelTable'><tbody>";r+="<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>";r+="<tr id='DelData' style='display:none'><td >"+d+"</td></tr>";r+='<tr><td class="delmsg" style="white-space:pre;">'+c.msg+"</td></tr><tr><td >&#160;</td></tr>";r+="</tbody></table></div>";r+="<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+o+"_2'><tbody><tr><td><hr class='ui-widget-content' style='margin:1px'/></td></tr></tr><tr><td class='DelButton EditButton'>"+
324
- ("<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+c.bSubmit+"</a>")+"&#160;"+("<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+c.bCancel+"</a>")+"</td></tr></tbody></table>";c.gbox="#gbox_"+e;a.jgrid.createModal(q,r,c,"#gview_"+f.p.id,a("#gview_"+f.p.id)[0]);j&&(k=j(a("#"+o)),typeof k=="undefined"&&(k=!0));if(k===!1)return;a(".fm-button","#"+o+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});
325
- c.delicon=a.extend([!0,"left","ui-icon-scissors"],c.delicon);c.cancelicon=a.extend([!0,"left","ui-icon-cancel"],c.cancelicon);c.delicon[0]===!0&&a("#dData","#"+o+"_2").addClass(c.delicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.delicon[2]+"'></span>");c.cancelicon[0]===!0&&a("#eData","#"+o+"_2").addClass(c.cancelicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.cancelicon[2]+"'></span>");a("#dData","#"+
326
- o+"_2").click(function(){var d=[!0,""];l={};var g=a("#DelData>td","#"+o).text();a.isFunction(c.onclickSubmit)&&(l=c.onclickSubmit(b,g)||{});a.isFunction(c.beforeSubmit)&&(d=c.beforeSubmit(g));if(d[0]&&!b.processing){b.processing=!0;a(this).addClass("ui-state-active");p=f.p.prmNames;m=a.extend({},b.delData,l);s=p.oper;m[s]=p.deloper;n=p.id;m[n]=g;if(f.p.restful)c.mtype="DELETE",b.url=f.p.url+"/"+g;var j=a.extend({url:b.url?b.url:a(f).jqGrid("getGridParam","editurl"),type:c.mtype,data:a.isFunction(c.serializeDelData)?
327
- c.serializeDelData(m):m,complete:function(j,h){h!="success"?(d[0]=!1,d[1]=a.isFunction(b.errorTextFormat)?b.errorTextFormat(j):h+" Status: '"+j.statusText+"'. Error code: "+j.status):a.isFunction(b.afterSubmit)&&(d=b.afterSubmit(j,m));if(d[0]===!1)a("#DelError>td","#"+o).html(d[1]),a("#DelError","#"+o).show();else{if(b.reloadAfterSubmit&&f.p.datatype!="local")a(f).trigger("reloadGrid");else{var l=[],l=g.split(",");if(f.p.treeGrid===!0)try{a(f).jqGrid("delTreeNode",l[0])}catch(k){}else for(var n=0;n<
328
- l.length;n++)a(f).jqGrid("delRowData",l[n]);f.p.selrow=null;f.p.selarrrow=[]}a.isFunction(b.afterComplete)&&setTimeout(function(){b.afterComplete(j,g)},500)}b.processing=!1;a("#dData","#"+o+"_2").removeClass("ui-state-active");d[0]&&a.jgrid.hideModal("#"+q.themodal,{gb:"#gbox_"+e,jqm:c.jqModal,onClose:b.onClose})}},a.jgrid.ajaxOptions,c.ajaxDelOptions);if(!j.url&&!b.useDataProxy)a.isFunction(f.p.dataProxy)?b.useDataProxy=!0:(d[0]=!1,d[1]+=" "+a.jgrid.errors.nourl);d[0]&&(b.useDataProxy?f.p.dataProxy.call(f,
329
- j,"del_"+f.p.id):a.ajax(j))}d[0]===!1&&(a("#DelError>td","#"+o).html(d[1]),a("#DelError","#"+o).show());return!1});a("#eData","#"+o+"_2").click(function(){a.jgrid.hideModal("#"+q.themodal,{gb:"#gbox_"+e,jqm:c.jqModal,onClose:b.onClose});return!1});h&&c.beforeShowForm(a("#"+o));a.jgrid.viewModal("#"+q.themodal,{gbox:"#gbox_"+e,jqm:c.jqModal,overlay:c.overlay,modal:c.modal})}g&&c.afterShowForm(a("#"+o));c.closeOnEscape===!0&&setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+q.modalhead).focus()},
330
- 0)}})},navGrid:function(b,c,f,h,g,j,e){c=a.extend({edit:!0,editicon:"ui-icon-pencil",add:!0,addicon:"ui-icon-plus",del:!0,delicon:"ui-icon-trash",search:!0,searchicon:"ui-icon-search",refresh:!0,refreshicon:"ui-icon-refresh",refreshstate:"firstpage",view:!1,viewicon:"ui-icon-document",position:"left",closeOnEscape:!0,beforeRefresh:null,afterRefresh:null,cloneToTop:!1},a.jgrid.nav,c||{});return this.each(function(){if(!this.nav){var l={themodal:"alertmod",modalhead:"alerthd",modalcontent:"alertcnt"},
331
- k=this,o,m,n;if(k.grid&&typeof b=="string"){if(a("#"+l.themodal).html()===null)typeof window.innerWidth!="undefined"?(o=window.innerWidth,m=window.innerHeight):typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!==0?(o=document.documentElement.clientWidth,m=document.documentElement.clientHeight):(o=1024,m=768),a.jgrid.createModal(l,"<div>"+c.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",
332
- {gbox:"#gbox_"+k.p.id,jqModal:!0,drag:!0,resize:!0,caption:c.alertcap,top:m/2-25,left:o/2-100,width:200,height:"auto",closeOnEscape:c.closeOnEscape},"","",!0);o=1;c.cloneToTop&&k.p.toppager&&(o=2);for(m=0;m<o;m++){var p=a("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),s,q;m===0?(s=b,q=k.p.id,s==k.p.toppager&&(q+="_top",o=1)):(s=k.p.toppager,q=k.p.id+"_top");k.p.direction=="rtl"&&a(p).attr("dir",
333
- "rtl").css("float","right");c.add&&(h=h||{},n=a("<td class='ui-pg-button ui-corner-all'></td>"),a(n).append("<div class='ui-pg-div'><span class='ui-icon "+c.addicon+"'></span>"+c.addtext+"</div>"),a("tr",p).append(n),a(n,p).attr({title:c.addtitle||"",id:h.id||"add_"+q}).click(function(){a(this).hasClass("ui-state-disabled")||(a.isFunction(c.addfunc)?c.addfunc():a(k).jqGrid("editGridRow","new",h));return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},
334
- function(){a(this).removeClass("ui-state-hover")}),n=null);c.edit&&(n=a("<td class='ui-pg-button ui-corner-all'></td>"),f=f||{},a(n).append("<div class='ui-pg-div'><span class='ui-icon "+c.editicon+"'></span>"+c.edittext+"</div>"),a("tr",p).append(n),a(n,p).attr({title:c.edittitle||"",id:f.id||"edit_"+q}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var b=k.p.selrow;b?a.isFunction(c.editfunc)?c.editfunc(b):a(k).jqGrid("editGridRow",b,f):(a.jgrid.viewModal("#"+l.themodal,{gbox:"#gbox_"+
335
- k.p.id,jqm:!0}),a("#jqg_alrt").focus())}return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),n=null);c.view&&(n=a("<td class='ui-pg-button ui-corner-all'></td>"),e=e||{},a(n).append("<div class='ui-pg-div'><span class='ui-icon "+c.viewicon+"'></span>"+c.viewtext+"</div>"),a("tr",p).append(n),a(n,p).attr({title:c.viewtitle||"",id:e.id||"view_"+q}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var b=
336
- k.p.selrow;b?a.isFunction(c.viewfunc)?c.viewfunc(b):a(k).jqGrid("viewGridRow",b,e):(a.jgrid.viewModal("#"+l.themodal,{gbox:"#gbox_"+k.p.id,jqm:!0}),a("#jqg_alrt").focus())}return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),n=null);c.del&&(n=a("<td class='ui-pg-button ui-corner-all'></td>"),g=g||{},a(n).append("<div class='ui-pg-div'><span class='ui-icon "+c.delicon+"'></span>"+c.deltext+"</div>"),
337
- a("tr",p).append(n),a(n,p).attr({title:c.deltitle||"",id:g.id||"del_"+q}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var b;k.p.multiselect?(b=k.p.selarrrow,b.length===0&&(b=null)):b=k.p.selrow;b?"function"==typeof c.delfunc?c.delfunc(b):a(k).jqGrid("delGridRow",b,g):(a.jgrid.viewModal("#"+l.themodal,{gbox:"#gbox_"+k.p.id,jqm:!0}),a("#jqg_alrt").focus())}return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),
338
- n=null);(c.add||c.edit||c.del||c.view)&&a("tr",p).append("<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>");c.search&&(n=a("<td class='ui-pg-button ui-corner-all'></td>"),j=j||{},a(n).append("<div class='ui-pg-div'><span class='ui-icon "+c.searchicon+"'></span>"+c.searchtext+"</div>"),a("tr",p).append(n),a(n,p).attr({title:c.searchtitle||"",id:j.id||"search_"+q}).click(function(){a(this).hasClass("ui-state-disabled")||a(k).jqGrid("searchGrid",
339
- j);return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),j.showOnLoad&&j.showOnLoad===!0&&a(n,p).click(),n=null);c.refresh&&(n=a("<td class='ui-pg-button ui-corner-all'></td>"),a(n).append("<div class='ui-pg-div'><span class='ui-icon "+c.refreshicon+"'></span>"+c.refreshtext+"</div>"),a("tr",p).append(n),a(n,p).attr({title:c.refreshtitle||"",id:"refresh_"+q}).click(function(){if(!a(this).hasClass("ui-state-disabled")){a.isFunction(c.beforeRefresh)&&
340
- c.beforeRefresh();k.p.search=!1;try{var b=k.p.id;k.p.postData.filters="";a("#fbox_"+b).jqFilter("resetFilter");a.isFunction(k.clearToolbar)&&k.clearToolbar(!1)}catch(d){}switch(c.refreshstate){case "firstpage":a(k).trigger("reloadGrid",[{page:1}]);break;case "current":a(k).trigger("reloadGrid",[{current:!0}])}a.isFunction(c.afterRefresh)&&c.afterRefresh()}return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),
341
- n=null);n=a(".ui-jqgrid").css("font-size")||"11px";a("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+n+";visibility:hidden;' ></div>");n=a(p).clone().appendTo("#testpg2").width();a("#testpg2").remove();a(s+"_"+c.position,s).append(p);k.p._nvtd&&(n>k.p._nvtd[0]&&(a(s+"_"+c.position,s).width(n),k.p._nvtd[0]=n),k.p._nvtd[1]=n);p=n=n=null;this.nav=!0}}}})},navButtonAdd:function(b,c){c=a.extend({caption:"newButton",title:"",buttonicon:"ui-icon-newwin",
342
- onClickButton:null,position:"last",cursor:"pointer"},c||{});return this.each(function(){if(this.grid){b.indexOf("#")!==0&&(b="#"+b);var f=a(".navtable",b)[0],h=this;if(f&&!(c.id&&a("#"+c.id,f).html()!==null)){var g=a("<td></td>");c.buttonicon.toString().toUpperCase()=="NONE"?a(g).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'>"+c.caption+"</div>"):a(g).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'><span class='ui-icon "+c.buttonicon+"'></span>"+c.caption+
343
- "</div>");c.id&&a(g).attr("id",c.id);c.position=="first"?f.rows[0].cells.length===0?a("tr",f).append(g):a("tr td:eq(0)",f).before(g):a("tr",f).append(g);a(g,f).attr("title",c.title||"").click(function(b){a(this).hasClass("ui-state-disabled")||a.isFunction(c.onClickButton)&&c.onClickButton.call(h,b);return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},navSeparatorAdd:function(b,c){c=a.extend({sepclass:"ui-separator",
344
- sepcontent:""},c||{});return this.each(function(){if(this.grid){b.indexOf("#")!==0&&(b="#"+b);var f=a(".navtable",b)[0];if(f){var h="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+c.sepclass+"'></span>"+c.sepcontent+"</td>";a("tr",f).append(h)}}})},GridToForm:function(b,c){return this.each(function(){if(this.grid){var f=a(this).jqGrid("getRowData",b);if(f)for(var h in f)a("[name="+a.jgrid.jqID(h)+"]",c).is("input:radio")||a("[name="+a.jgrid.jqID(h)+"]",c).is("input:checkbox")?
345
- a("[name="+a.jgrid.jqID(h)+"]",c).each(function(){a(this).val()==f[h]?a(this).attr("checked","checked"):a(this).attr("checked","")}):a("[name="+a.jgrid.jqID(h)+"]",c).val(f[h])}})},FormToGrid:function(b,c,f,h){return this.each(function(){if(this.grid){f||(f="set");h||(h="first");var g=a(c).serializeArray(),j={};a.each(g,function(a,b){j[b.name]=b.value});f=="add"?a(this).jqGrid("addRowData",b,j,h):f=="set"&&a(this).jqGrid("setRowData",b,j)}})}})})(jQuery);
346
- (function(a){a.jgrid.extend({editRow:function(b,d,c,f,h,g,j,e,l){var k={keys:d||!1,oneditfunc:c||null,successfunc:f||null,url:h||null,extraparam:g||{},aftersavefunc:j||null,errorfunc:e||null,afterrestorefunc:l||null,restoreAfterErorr:!0},o=a.makeArray(arguments).slice(1),m;m=o[0]&&typeof o[0]=="object"&&!a.isFunction(o[0])?a.extend(k,o[0]):k;return this.each(function(){var c=this,d,e,f=0,g=null,j={},h,k;if(c.grid&&(h=a(c).jqGrid("getInd",b,!0),h!==!1&&(a(h).attr("editable")||"0")=="0"&&!a(h).hasClass("not-editable-row")))if(k=
347
- c.p.colModel,a("td",h).each(function(h){d=k[h].name;var l=c.p.treeGrid===!0&&d==c.p.ExpandColumn;if(l)e=a("span:first",this).html();else try{e=a.unformat(this,{rowId:b,colModel:k[h]},h)}catch(m){e=k[h].edittype&&k[h].edittype=="textarea"?a(this).text():a(this).html()}if(d!="cb"&&d!="subgrid"&&d!="rn"&&(c.p.autoencode&&(e=a.jgrid.htmlDecode(e)),j[d]=e,k[h].editable===!0)){g===null&&(g=h);l?a("span:first",this).html(""):a(this).html("");var o=a.extend({},k[h].editoptions||{},{id:b+"_"+d,name:d});if(!k[h].edittype)k[h].edittype=
348
- "text";if(e=="&nbsp;"||e=="&#160;"||e.length==1&&e.charCodeAt(0)==160)e="";o=a.jgrid.createEl(k[h].edittype,o,e,!0,a.extend({},a.jgrid.ajaxOptions,c.p.ajaxSelectOptions||{}));a(o).addClass("editable");l?a("span:first",this).append(o):a(this).append(o);k[h].edittype=="select"&&k[h].editoptions.multiple===!0&&a.browser.msie&&a(o).width(a(o).width());f++}}),f>0)j.id=b,c.p.savedRow.push(j),a(h).attr("editable","1"),a("td:eq("+g+") input",h).focus(),m.keys===!0&&a(h).bind("keydown",function(d){d.keyCode===
349
- 27&&a(c).jqGrid("restoreRow",b,l);if(d.keyCode===13){if(d.target.tagName=="TEXTAREA")return!0;a(c).jqGrid("saveRow",b,m);return!1}d.stopPropagation()}),a.isFunction(m.oneditfunc)&&m.oneditfunc.call(c,b)})},saveRow:function(b,d,c,f,h,g,j){var e={successfunc:d||null,url:c||null,extraparam:f||{},aftersavefunc:h||null,errorfunc:g||null,afterrestorefunc:j||null,restoreAfterErorr:!0},l=a.makeArray(arguments).slice(1),k;k=l[0]&&typeof l[0]=="object"&&!a.isFunction(l[0])?a.extend(e,l[0]):e;var o=!1,m=this[0],
350
- n,p={},s={},q={},r,t,v;if(!m.grid)return o;v=a(m).jqGrid("getInd",b,!0);if(v===!1)return o;e=a(v).attr("editable");k.url=k.url?k.url:m.p.editurl;if(e==="1"){var w;a("td",v).each(function(b){w=m.p.colModel[b];n=w.name;if(n!="cb"&&n!="subgrid"&&w.editable===!0&&n!="rn"&&!a(this).hasClass("not-editable-cell")){switch(w.edittype){case "checkbox":var c=["Yes","No"];w.editoptions&&(c=w.editoptions.value.split(":"));p[n]=a("input",this).attr("checked")?c[0]:c[1];break;case "text":case "password":case "textarea":case "button":p[n]=
351
- a("input, textarea",this).val();break;case "select":if(w.editoptions.multiple){var c=a("select",this),d=[];p[n]=a(c).val();p[n]=p[n]?p[n].join(","):"";a("select > option:selected",this).each(function(b,c){d[b]=a(c).text()});s[n]=d.join(",")}else p[n]=a("select>option:selected",this).val(),s[n]=a("select>option:selected",this).text();w.formatter&&w.formatter=="select"&&(s={});break;case "custom":try{if(w.editoptions&&a.isFunction(w.editoptions.custom_value)){if(p[n]=w.editoptions.custom_value.call(m,
352
- a(".customelement",this),"get"),p[n]===void 0)throw"e2";}else throw"e1";}catch(e){e=="e1"&&a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose),e=="e2"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose)}}t=a.jgrid.checkValues(p[n],b,m);if(t[0]===!1)return t[1]=p[n]+" "+
353
- t[1],!1;m.p.autoencode&&(p[n]=a.jgrid.htmlEncode(p[n]));k.url!=="clientArray"&&w.editoptions&&w.editoptions.NullIfEmpty===!0&&p[n]==""&&(q[n]="null")}});if(t[0]===!1){try{var z=a.jgrid.findPos(a("#"+a.jgrid.jqID(b),m.grid.bDiv)[0]);a.jgrid.info_dialog(a.jgrid.errors.errcap,t[1],a.jgrid.edit.bClose,{left:z[0],top:z[1]})}catch(C){alert(t[1])}return o}if(p){e=m.p.prmNames;l=e.oper;z=e.id;p[l]=e.editoper;p[z]=b;if(typeof m.p.inlineData=="undefined")m.p.inlineData={};p=a.extend({},p,m.p.inlineData,k.extraparam)}if(k.url==
354
- "clientArray"){p=a.extend({},p,s);m.p.autoencode&&a.each(p,function(b,c){p[b]=a.jgrid.htmlDecode(c)});z=a(m).jqGrid("setRowData",b,p);a(v).attr("editable","0");for(e=0;e<m.p.savedRow.length;e++)if(m.p.savedRow[e].id==b){r=e;break}r>=0&&m.p.savedRow.splice(r,1);a.isFunction(k.aftersavefunc)&&k.aftersavefunc.call(m,b,z);o=!0}else a("#lui_"+m.p.id).show(),m.p.restful?(mtype="PUT",k.url=k.url+"/"+b):mtype="POST",q=a.extend({},p,q),a.ajax(a.extend({url:k.url,data:a.isFunction(m.p.serializeRowData)?m.p.serializeRowData.call(m,
355
- q):q,type:mytype,async:!1,complete:function(c,d){a("#lui_"+m.p.id).hide();if(d==="success")if((a.isFunction(k.successfunc)?k.successfunc.call(m,c):!0)===!0){m.p.autoencode&&a.each(p,function(b,c){p[b]=a.jgrid.htmlDecode(c)});p=a.extend({},p,s);a(m).jqGrid("setRowData",b,p);a(v).attr("editable","0");for(var e=0;e<m.p.savedRow.length;e++)if(m.p.savedRow[e].id==b){r=e;break}r>=0&&m.p.savedRow.splice(r,1);a.isFunction(k.aftersavefunc)&&k.aftersavefunc.call(m,b,c);o=!0}else a.isFunction(k.errorfunc)&&
356
- k.errorfunc.call(m,b,c,d),k.restoreAfterError===!0&&a(m).jqGrid("restoreRow",b,k.afterrestorefunc)},error:function(c,d){a("#lui_"+m.p.id).hide();if(a.isFunction(k.errorfunc))k.errorfunc.call(m,b,c,d);else try{jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class="ui-state-error">'+c.responseText+"</div>",jQuery.jgrid.edit.bClose,{buttonalign:"right"})}catch(e){alert(c.responseText)}k.restoreAfterError===!0&&a(m).jqGrid("restoreRow",b,k.afterrestorefunc)}},a.jgrid.ajaxOptions,m.p.ajaxRowOptions||
357
- {}));a(v).unbind("keydown")}return o},restoreRow:function(b,d){return this.each(function(){var c=this,f,h,g={};if(c.grid&&(h=a(c).jqGrid("getInd",b,!0),h!==!1)){for(var j=0;j<c.p.savedRow.length;j++)if(c.p.savedRow[j].id==b){f=j;break}if(f>=0){if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker","#"+a.jgrid.jqID(h.id)).datepicker("hide")}catch(e){}a.each(c.p.colModel,function(){this.editable===!0&&this.name in c.p.savedRow[f]&&!a(this).hasClass("not-editable-cell")&&(g[this.name]=c.p.savedRow[f][this.name])});
358
- a(c).jqGrid("setRowData",b,g);a(h).attr("editable","0").unbind("keydown");c.p.savedRow.splice(f,1)}a.isFunction(d)&&d.call(c,b)}})}})})(jQuery);
359
- (function(a){a.jgrid.extend({editCell:function(b,d,c){return this.each(function(){var f=this,h,g,j,e;if(f.grid&&f.p.cellEdit===!0){d=parseInt(d,10);f.p.selrow=f.rows[b].id;f.p.knv||a(f).jqGrid("GridNav");if(f.p.savedRow.length>0){if(c===!0&&b==f.p.iRow&&d==f.p.iCol)return;a(f).jqGrid("saveCell",f.p.savedRow[0].id,f.p.savedRow[0].ic)}else window.setTimeout(function(){a("#"+f.p.knv).attr("tabindex","-1").focus()},0);e=f.p.colModel[d];h=e.name;if(!(h=="subgrid"||h=="cb"||h=="rn")){j=a("td:eq("+d+")",
360
- f.rows[b]);if(e.editable===!0&&c===!0&&!j.hasClass("not-editable-cell")){parseInt(f.p.iCol,10)>=0&&parseInt(f.p.iRow,10)>=0&&(a("td:eq("+f.p.iCol+")",f.rows[f.p.iRow]).removeClass("edit-cell ui-state-highlight"),a(f.rows[f.p.iRow]).removeClass("selected-row ui-state-hover"));a(j).addClass("edit-cell ui-state-highlight");a(f.rows[b]).addClass("selected-row ui-state-hover");try{g=a.unformat(j,{rowId:f.rows[b].id,colModel:e},d)}catch(l){g=e.edittype&&e.edittype=="textarea"?a(j).text():a(j).html()}f.p.autoencode&&
361
- (g=a.jgrid.htmlDecode(g));if(!e.edittype)e.edittype="text";f.p.savedRow.push({id:b,ic:d,name:h,v:g});if(g=="&nbsp;"||g=="&#160;"||g.length==1&&g.charCodeAt(0)==160)g="";if(a.isFunction(f.p.formatCell)){var k=f.p.formatCell.call(f,f.rows[b].id,h,g,b,d);k!==void 0&&(g=k)}var k=a.extend({},e.editoptions||{},{id:b+"_"+h,name:h}),o=a.jgrid.createEl(e.edittype,k,g,!0,a.extend({},a.jgrid.ajaxOptions,f.p.ajaxSelectOptions||{}));a.isFunction(f.p.beforeEditCell)&&f.p.beforeEditCell.call(f,f.rows[b].id,h,g,
362
- b,d);a(j).html("").append(o).attr("tabindex","0");window.setTimeout(function(){a(o).focus()},0);a("input, select, textarea",j).bind("keydown",function(c){c.keyCode===27&&(a("input.hasDatepicker",j).length>0?a(".ui-datepicker").is(":hidden")?a(f).jqGrid("restoreCell",b,d):a("input.hasDatepicker",j).datepicker("hide"):a(f).jqGrid("restoreCell",b,d));c.keyCode===13&&a(f).jqGrid("saveCell",b,d);if(c.keyCode==9)if(f.grid.hDiv.loading)return!1;else c.shiftKey?a(f).jqGrid("prevCell",b,d):a(f).jqGrid("nextCell",
363
- b,d);c.stopPropagation()});a.isFunction(f.p.afterEditCell)&&f.p.afterEditCell.call(f,f.rows[b].id,h,g,b,d)}else parseInt(f.p.iCol,10)>=0&&parseInt(f.p.iRow,10)>=0&&(a("td:eq("+f.p.iCol+")",f.rows[f.p.iRow]).removeClass("edit-cell ui-state-highlight"),a(f.rows[f.p.iRow]).removeClass("selected-row ui-state-hover")),j.addClass("edit-cell ui-state-highlight"),a(f.rows[b]).addClass("selected-row ui-state-hover"),a.isFunction(f.p.onSelectCell)&&(g=j.html().replace(/\&#160\;/ig,""),f.p.onSelectCell.call(f,
364
- f.rows[b].id,h,g,b,d));f.p.iCol=d;f.p.iRow=b}}})},saveCell:function(b,d){return this.each(function(){var c=this,f;if(c.grid&&c.p.cellEdit===!0){f=c.p.savedRow.length>=1?0:null;if(f!==null){var h=a("td:eq("+d+")",c.rows[b]),g,j,e=c.p.colModel[d],l=e.name,k=a.jgrid.jqID(l);switch(e.edittype){case "select":if(e.editoptions.multiple){var k=a("#"+b+"_"+k,c.rows[b]),o=[];(g=a(k).val())?g.join(","):g="";a("option:selected",k).each(function(b,c){o[b]=a(c).text()});j=o.join(",")}else g=a("#"+b+"_"+k+">option:selected",
365
- c.rows[b]).val(),j=a("#"+b+"_"+k+">option:selected",c.rows[b]).text();e.formatter&&(j=g);break;case "checkbox":var m=["Yes","No"];e.editoptions&&(m=e.editoptions.value.split(":"));j=g=a("#"+b+"_"+k,c.rows[b]).attr("checked")?m[0]:m[1];break;case "password":case "text":case "textarea":case "button":j=g=a("#"+b+"_"+k,c.rows[b]).val();break;case "custom":try{if(e.editoptions&&a.isFunction(e.editoptions.custom_value))if(g=e.editoptions.custom_value.call(c,a(".customelement",h),"get"),g===void 0)throw"e2";
366
- else j=g;else throw"e1";}catch(n){n=="e1"&&a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose),n=="e2"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,n.message,jQuery.jgrid.edit.bClose)}}if(j!=c.p.savedRow[f].v){if(a.isFunction(c.p.beforeSaveCell)&&(f=c.p.beforeSaveCell.call(c,c.rows[b].id,l,g,b,d)))j=
367
- g=f;var p=a.jgrid.checkValues(g,d,c);if(p[0]===!0){f={};a.isFunction(c.p.beforeSubmitCell)&&((f=c.p.beforeSubmitCell.call(c,c.rows[b].id,l,g,b,d))||(f={}));a("input.hasDatepicker",h).length>0&&a("input.hasDatepicker",h).datepicker("hide");if(c.p.cellsubmit=="remote")if(c.p.cellurl){var s={};c.p.autoencode&&(g=a.jgrid.htmlEncode(g));s[l]=g;m=c.p.prmNames;e=m.id;k=m.oper;s[e]=c.rows[b].id;s[k]=m.editoper;s=a.extend(f,s);a("#lui_"+c.p.id).show();c.grid.hDiv.loading=!0;a.ajax(a.extend({url:c.p.cellurl,
368
- data:a.isFunction(c.p.serializeCellData)?c.p.serializeCellData.call(c,s):s,type:"POST",complete:function(e,f){a("#lui_"+c.p.id).hide();c.grid.hDiv.loading=!1;if(f=="success")if(a.isFunction(c.p.afterSubmitCell)){var k=c.p.afterSubmitCell.call(c,e,s.id,l,g,b,d);k[0]===!0?(a(h).empty(),a(c).jqGrid("setCell",c.rows[b].id,d,j,!1,!1,!0),a(h).addClass("dirty-cell"),a(c.rows[b]).addClass("edited"),a.isFunction(c.p.afterSaveCell)&&c.p.afterSaveCell.call(c,c.rows[b].id,l,g,b,d),c.p.savedRow.splice(0,1)):(a.jgrid.info_dialog(a.jgrid.errors.errcap,
369
- k[1],a.jgrid.edit.bClose),a(c).jqGrid("restoreCell",b,d))}else a(h).empty(),a(c).jqGrid("setCell",c.rows[b].id,d,j,!1,!1,!0),a(h).addClass("dirty-cell"),a(c.rows[b]).addClass("edited"),a.isFunction(c.p.afterSaveCell)&&c.p.afterSaveCell.call(c,c.rows[b].id,l,g,b,d),c.p.savedRow.splice(0,1)},error:function(e,f){a("#lui_"+c.p.id).hide();c.grid.hDiv.loading=!1;a.isFunction(c.p.errorCell)?c.p.errorCell.call(c,e,f):a.jgrid.info_dialog(a.jgrid.errors.errcap,e.status+" : "+e.statusText+"<br/>"+f,a.jgrid.edit.bClose);
370
- a(c).jqGrid("restoreCell",b,d)}},a.jgrid.ajaxOptions,c.p.ajaxCellOptions||{}))}else try{a.jgrid.info_dialog(a.jgrid.errors.errcap,a.jgrid.errors.nourl,a.jgrid.edit.bClose),a(c).jqGrid("restoreCell",b,d)}catch(q){}c.p.cellsubmit=="clientArray"&&(a(h).empty(),a(c).jqGrid("setCell",c.rows[b].id,d,j,!1,!1,!0),a(h).addClass("dirty-cell"),a(c.rows[b]).addClass("edited"),a.isFunction(c.p.afterSaveCell)&&c.p.afterSaveCell.call(c,c.rows[b].id,l,g,b,d),c.p.savedRow.splice(0,1))}else try{window.setTimeout(function(){a.jgrid.info_dialog(a.jgrid.errors.errcap,
371
- g+" "+p[1],a.jgrid.edit.bClose)},100),a(c).jqGrid("restoreCell",b,d)}catch(r){}}else a(c).jqGrid("restoreCell",b,d)}a.browser.opera?a("#"+c.p.knv).attr("tabindex","-1").focus():window.setTimeout(function(){a("#"+c.p.knv).attr("tabindex","-1").focus()},0)}})},restoreCell:function(b,d){return this.each(function(){var c=this,f;if(c.grid&&c.p.cellEdit===!0){f=c.p.savedRow.length>=1?0:null;if(f!==null){var h=a("td:eq("+d+")",c.rows[b]);if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker",h).datepicker("hide")}catch(g){}a(h).empty().attr("tabindex",
240
+ c.searchrules,c.label)}catch(e){}if(d&&d.length&&d[0]===!1)f.error=!d[0],f.errmsg=d[1]};this.onchange=function(){this.p.error=!1;this.p.errmsg="";return a.isFunction(this.p.onChange)?this.p.onChange.call(this,this.p):!1};this.reDraw=function(){a("table.group:first",this).remove();var b=this.createTableForGroup(f.filter,null);a(this).append(b);a.isFunction(this.p.afterRedraw)&&this.p.afterRedraw.call(this,this.p)};this.createTableForGroup=function(b,c){var d=this,e,h=a("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody></tbody></table>");
241
+ c===null&&a(h).append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='left'></th></tr>");var j=a("<tr></tr>");a(h).append(j);var g=a("<th colspan='5' align='left'></th>");j.append(g);if(this.p.ruleButtons===!0){var l=a("<select class='opsel'></select>");g.append(l);var j="",t;for(e=0;e<f.groupOps.length;e++)t=b.groupOp===d.p.groupOps[e]?" selected='selected'":"",j+="<option value='"+d.p.groupOps[e]+"'"+t+">"+d.p.groupOps[e]+"</option>";l.append(j).bind("change",
242
+ function(){b.groupOp=a(l).val();d.onchange()})}j="<span></span>";this.p.groupButton&&(j=a("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>"),j.bind("click",function(){if(b.groups===void 0)b.groups=[];b.groups.push({groupOp:f.groupOps[0],rules:[],groups:[]});d.reDraw();d.onchange();return!1}));g.append(j);if(this.p.ruleButtons===!0){var j=a("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>"),w;j.bind("click",function(){if(b.rules===void 0)b.rules=
243
+ [];for(e=0;e<d.p.columns.length;e++){var a=typeof d.p.columns[e].search==="undefined"?!0:d.p.columns[e].search,c=d.p.columns[e].hidden===!0;if(d.p.columns[e].searchoptions.searchhidden===!0&&a||a&&!c){w=d.p.columns[e];break}}b.rules.push({field:w.name,op:(w.searchoptions.sopt?w.searchoptions.sopt:d.p.sopt?d.p.sopt:w.searchtype==="string"?d.p.stropts:d.p.numopts)[0],data:""});d.reDraw();return!1});g.append(j)}c!==null&&(j=a("<input type='button' value='-' title='Delete group' class='delete-group'/>"),
244
+ g.append(j),j.bind("click",function(){for(e=0;e<c.groups.length;e++)if(c.groups[e]===b){c.groups.splice(e,1);break}d.reDraw();d.onchange();return!1}));if(b.groups!==void 0)for(e=0;e<b.groups.length;e++)g=a("<tr></tr>"),h.append(g),j=a("<td class='first'></td>"),g.append(j),j=a("<td colspan='4'></td>"),j.append(this.createTableForGroup(b.groups[e],b)),g.append(j);if(b.groupOp===void 0)b.groupOp=d.p.groupOps[0];if(b.rules!==void 0)for(e=0;e<b.rules.length;e++)h.append(this.createTableRowForRule(b.rules[e],
245
+ b));return h};this.createTableRowForRule=function(b,c){var d=this,h=a("<tr></tr>"),j,g,l,s,t="",w;h.append("<td class='first'></td>");var v=a("<td class='columns'></td>");h.append(v);var z=a("<select></select>"),D,y=[];v.append(z);z.bind("change",function(){b.field=a(z).val();l=a(this).parents("tr:first");for(j=0;j<d.p.columns.length;j++)if(d.p.columns[j].name===b.field){s=d.p.columns[j];break}if(s){s.searchoptions.id=a.jgrid.randId();if(e&&s.inputtype==="text"&&!s.searchoptions.size)s.searchoptions.size=
246
+ 10;var c=a.jgrid.createEl(s.inputtype,s.searchoptions,"",!0,d.p.ajaxSelectOptions,!0);a(c).addClass("input-elm");g=s.searchoptions.sopt?s.searchoptions.sopt:d.p.sopt?d.p.sopt:s.searchtype==="string"?d.p.stropts:d.p.numopts;var f="",h=0;y=[];a.each(d.p.ops,function(){y.push(this.name)});for(j=0;j<g.length;j++)if(D=a.inArray(g[j],y),D!==-1){if(h===0)b.op=d.p.ops[D].name;f+="<option value='"+d.p.ops[D].name+"'>"+d.p.ops[D].description+"</option>";h++}a(".selectopts",l).empty().append(f);a(".selectopts",
247
+ l)[0].selectedIndex=0;a.browser.msie&&a.browser.version<9&&(f=parseInt(a("select.selectopts",l)[0].offsetWidth)+1,a(".selectopts",l).width(f),a(".selectopts",l).css("width","auto"));a(".data",l).empty().append(c);a(".input-elm",l).bind("change",function(){b.data=a(this).val();d.onchange()});setTimeout(function(){b.data=a(c).val();d.onchange()},0)}});for(j=v=0;j<d.p.columns.length;j++){w=typeof d.p.columns[j].search==="undefined"?!0:d.p.columns[j].search;var B=d.p.columns[j].hidden===!0;if(d.p.columns[j].searchoptions.searchhidden===
248
+ !0&&w||w&&!B)w="",b.field===d.p.columns[j].name&&(w=" selected='selected'",v=j),t+="<option value='"+d.p.columns[j].name+"'"+w+">"+d.p.columns[j].label+"</option>"}z.append(t);t=a("<td class='operators'></td>");h.append(t);s=f.columns[v];s.searchoptions.id=a.jgrid.randId();if(e&&s.inputtype==="text"&&!s.searchoptions.size)s.searchoptions.size=10;var v=a.jgrid.createEl(s.inputtype,s.searchoptions,b.data,!0,d.p.ajaxSelectOptions,!0),A=a("<select class='selectopts'></select>");t.append(A);A.bind("change",
249
+ function(){b.op=a(A).val();l=a(this).parents("tr:first");var c=a(".input-elm",l)[0];b.op==="nu"||b.op==="nn"?(b.data="",c.value="",c.setAttribute("readonly","true"),c.setAttribute("disabled","true")):(c.removeAttribute("readonly"),c.removeAttribute("disabled"));d.onchange()});g=s.searchoptions.sopt?s.searchoptions.sopt:d.p.sopt?d.p.sopt:s.searchtype==="string"?f.stropts:d.p.numopts;t="";a.each(d.p.ops,function(){y.push(this.name)});for(j=0;j<g.length;j++)D=a.inArray(g[j],y),D!==-1&&(w=b.op===d.p.ops[D].name?
250
+ " selected='selected'":"",t+="<option value='"+d.p.ops[D].name+"'"+w+">"+d.p.ops[D].description+"</option>");A.append(t);t=a("<td class='data'></td>");h.append(t);t.append(v);a(v).addClass("input-elm").bind("change",function(){b.data=a(this).val();d.onchange()});t=a("<td></td>");h.append(t);this.p.ruleButtons===!0&&(v=a("<input type='button' value='-' title='Delete rule' class='delete-rule ui-del'/>"),t.append(v),v.bind("click",function(){for(j=0;j<c.rules.length;j++)if(c.rules[j]===b){c.rules.splice(j,
251
+ 1);break}d.reDraw();d.onchange();return!1}));return h};this.getStringForGroup=function(a){var b="(",c;if(a.groups!==void 0)for(c=0;c<a.groups.length;c++){b.length>1&&(b+=" "+a.groupOp+" ");try{b+=this.getStringForGroup(a.groups[c])}catch(d){alert(d)}}if(a.rules!==void 0)try{for(c=0;c<a.rules.length;c++)b.length>1&&(b+=" "+a.groupOp+" "),b+=this.getStringForRule(a.rules[c])}catch(e){alert(e)}b+=")";return b==="()"?"":b};this.getStringForRule=function(b){var c="",d="",e,j;for(e=0;e<this.p.ops.length;e++)if(this.p.ops[e].name===
252
+ b.op){c=this.p.ops[e].operator;d=this.p.ops[e].name;break}for(e=0;e<this.p.columns.length;e++)if(this.p.columns[e].name===b.field){j=this.p.columns[e];break}e=b.data;if(d==="bw"||d==="bn")e+="%";if(d==="ew"||d==="en")e="%"+e;if(d==="cn"||d==="nc")e="%"+e+"%";if(d==="in"||d==="ni")e=" ("+e+")";f.errorcheck&&l(b.data,j);return a.inArray(j.searchtype,["int","integer","float","number","currency"])!==-1||d==="nn"||d==="nu"?b.field+" "+c+" "+e:b.field+" "+c+' "'+e+'"'};this.resetFilter=function(){this.p.filter=
253
+ a.extend(!0,{},this.p.initFilter);this.reDraw();this.onchange()};this.hideError=function(){a("th.ui-state-error",this).html("");a("tr.error",this).hide()};this.showError=function(){a("th.ui-state-error",this).html(this.p.errmsg);a("tr.error",this).show()};this.toUserFriendlyString=function(){return this.getStringForGroup(f.filter)};this.toString=function(){function a(c){var d="(",e;if(c.groups!==void 0)for(e=0;e<c.groups.length;e++)d.length>1&&(d+=c.groupOp==="OR"?" || ":" && "),d+=a(c.groups[e]);
254
+ if(c.rules!==void 0)for(e=0;e<c.rules.length;e++){d.length>1&&(d+=c.groupOp==="OR"?" || ":" && ");var f=c.rules[e];if(b.p.errorcheck){for(var j=void 0,h=void 0,j=0;j<b.p.columns.length;j++)if(b.p.columns[j].name===f.field){h=b.p.columns[j];break}h&&l(f.data,h)}d+=f.op+"(item."+f.field+",'"+f.data+"')"}d+=")";return d==="()"?"":d}var b=this;return a(this.p.filter)};this.reDraw();if(this.p.showQuery)this.onchange();this.filter=!0}}})};a.extend(a.fn.jqFilter,{toSQLString:function(){var a="";this.each(function(){a=
255
+ this.toUserFriendlyString()});return a},filterData:function(){var a;this.each(function(){a=this.p.filter});return a},getParameter:function(a){return a!==void 0&&this.p.hasOwnProperty(a)?this.p[a]:this.p},resetFilter:function(){return this.each(function(){this.resetFilter()})},addFilter:function(a){typeof a==="string"&&(a=jQuery.jgrid.parse(a));this.each(function(){this.p.filter=a;this.reDraw();this.onchange()})}})})(jQuery);
256
+ (function(a){var b={};a.jgrid.extend({searchGrid:function(b){b=a.extend({recreateFilter:!1,drag:!0,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",loadDefaults:!0,beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,afterRedraw:null,closeAfterSearch:!1,closeAfterReset:!1,closeOnEscape:!1,multipleSearch:!1,multipleGroup:!1,top:0,left:0,jqModal:!0,modal:!1,resize:!0,width:450,height:"auto",dataheight:"auto",showQuery:!1,errorcheck:!0,sopt:null,stringResult:void 0,
257
+ onClose:null,onSearch:null,onReset:null,toTop:!0,overlay:30,columns:[],tmplNames:null,tmplFilters:null,tmplLabel:" Template: ",showOnLoad:!1,layer:null},a.jgrid.search,b||{});return this.each(function(){function c(){a.isFunction(b.beforeShowSearch)&&(h=b.beforeShowSearch(a("#"+g)),typeof h==="undefined"&&(h=!0));h&&(a.jgrid.viewModal("#"+j.themodal,{gbox:"#gbox_"+g,jqm:b.jqModal,modal:b.modal,overlay:b.overlay,toTop:b.toTop}),a.isFunction(b.afterShowSearch)&&b.afterShowSearch(a("#"+g)))}var f=this;
258
+ if(f.grid){var g="fbox_"+f.p.id,h=!0,j={themodal:"searchmod"+g,modalhead:"searchhd"+g,modalcontent:"searchcnt"+g,scrollelm:g},e=f.p.postData[b.sFilter];typeof e==="string"&&(e=a.jgrid.parse(e));b.recreateFilter===!0&&a("#"+j.themodal).remove();if(a("#"+j.themodal).html()!==null)c();else{var l=a("<span><div id='"+g+"' class='searchFilter' style='overflow:auto'></div></span>").insertBefore("#gview_"+f.p.id);if(a.isFunction(b.onInitializeSearch))b.onInitializeSearch(a("#"+g));var k=a.extend([],f.p.colModel),
259
+ n="<a href='javascript:void(0)' id='"+g+"_search' class='fm-button ui-state-default ui-corner-all fm-button-icon-right ui-reset'><span class='ui-icon ui-icon-search'></span>"+b.Find+"</a>",o="<a href='javascript:void(0)' id='"+g+"_reset' class='fm-button ui-state-default ui-corner-all fm-button-icon-left ui-search'><span class='ui-icon ui-icon-arrowreturnthick-1-w'></span>"+b.Reset+"</a>",p="",m="",r,q=!1,s=-1;b.showQuery&&(p="<a href='javascript:void(0)' id='"+g+"_query' class='fm-button ui-state-default ui-corner-all fm-button-icon-left'><span class='ui-icon ui-icon-comment'></span>Query</a>");
260
+ b.columns.length?k=b.columns:a.each(k,function(a,b){if(!b.label)b.label=f.p.colNames[a];if(!q){var c=typeof b.search==="undefined"?!0:b.search,d=b.hidden===!0;if(b.searchoptions&&b.searchoptions.searchhidden===!0&&c||c&&!d)q=!0,r=b.index||b.name,s=a}});if(!e&&r||b.multipleSearch===!1){var t="eq";s>=0&&k[s].searchoptions&&k[s].searchoptions.sopt?t=k[s].searchoptions.sopt[0]:b.sopt&&b.sopt.length&&(t=b.sopt[0]);e={groupOp:"AND",rules:[{field:r,op:t,data:""}]}}q=!1;if(b.tmplNames&&b.tmplNames.length)q=
261
+ !0,m=b.tmplLabel,m+="<select class='ui-template'>",m+="<option value='default'>Default</option>",a.each(b.tmplNames,function(a,b){m+="<option value='"+a+"'>"+b+"</option>"}),m+="</select>";n="<table class='EditTable' style='border:0px none;margin-top:5px' id='"+g+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='EditButton' style='text-align:left'>"+o+m+"</td><td class='EditButton'>"+p+n+"</td></tr></tbody></table>";a("#"+g).jqFilter({columns:k,
262
+ filter:b.loadDefaults?e:null,showQuery:b.showQuery,errorcheck:b.errorcheck,sopt:b.sopt,groupButton:b.multipleGroup,ruleButtons:b.multipleSearch,afterRedraw:b.afterRedraw,_gridsopt:a.jgrid.search.odata,onChange:function(){this.p.showQuery&&a(".query",this).html(this.toUserFriendlyString())}});l.append(n);q&&b.tmplFilters&&b.tmplFilters.length&&a(".ui-template",l).bind("change",function(){var c=a(this).val();c=="default"?a("#"+g).jqFilter("addFilter",e):a("#"+g).jqFilter("addFilter",b.tmplFilters[parseInt(c,
263
+ 10)]);return!1});if(b.multipleGroup===!0)b.multipleSearch=!0;if(a.isFunction(b.onInitializeSearch))b.onInitializeSearch(a("#"+g));b.layer?a.jgrid.createModal(j,l,b,"#gview_"+f.p.id,a("#gbox_"+f.p.id)[0],"#"+b.layer,{position:"relative"}):a.jgrid.createModal(j,l,b,"#gview_"+f.p.id,a("#gbox_"+f.p.id)[0]);p&&a("#"+g+"_query").bind("click",function(){a(".queryresult",l).toggle();return!1});if(b.stringResult===void 0)b.stringResult=b.multipleSearch;a("#"+g+"_search").bind("click",function(){var c=a("#"+
264
+ g),e={},h,k=c.jqFilter("filterData");if(b.errorcheck&&(c[0].hideError(),b.showQuery||c.jqFilter("toSQLString"),c[0].p.error))return c[0].showError(),!1;if(b.stringResult){try{h=xmlJsonClass.toJson(k,"","",!1)}catch(m){try{h=JSON.stringify(k)}catch(l){}}typeof h==="string"&&(e[b.sFilter]=h,a.each([b.sField,b.sValue,b.sOper],function(){e[this]=""}))}else b.multipleSearch?(e[b.sFilter]=k,a.each([b.sField,b.sValue,b.sOper],function(){e[this]=""})):(e[b.sField]=k.rules[0].field,e[b.sValue]=k.rules[0].data,
265
+ e[b.sOper]=k.rules[0].op,e[b.sFilter]="");f.p.search=!0;a.extend(f.p.postData,e);if(a.isFunction(b.onSearch))b.onSearch();a(f).trigger("reloadGrid",[{page:1}]);b.closeAfterSearch&&a.jgrid.hideModal("#"+j.themodal,{gb:"#gbox_"+f.p.id,jqm:b.jqModal,onClose:b.onClose});return!1});a("#"+g+"_reset").bind("click",function(){var c={},e=a("#"+g);f.p.search=!1;b.multipleSearch===!1?c[b.sField]=c[b.sValue]=c[b.sOper]="":c[b.sFilter]="";e[0].resetFilter();q&&a(".ui-template",l).val("default");a.extend(f.p.postData,
266
+ c);if(a.isFunction(b.onReset))b.onReset();a(f).trigger("reloadGrid",[{page:1}]);return!1});c();a(".fm-button:not(.ui-state-disabled)",l).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},editGridRow:function(d,c){c=a.extend({top:0,left:0,width:300,height:"auto",dataheight:"auto",modal:!1,overlay:30,drag:!0,resize:!0,url:null,mtype:"POST",clearAfterAdd:!0,closeAfterEdit:!1,reloadAfterSubmit:!0,onInitializeForm:null,beforeInitData:null,beforeShowForm:null,
267
+ afterShowForm:null,beforeSubmit:null,afterSubmit:null,onclickSubmit:null,afterComplete:null,onclickPgButtons:null,afterclickPgButtons:null,editData:{},recreateForm:!1,jqModal:!0,closeOnEscape:!1,addedrow:"first",topinfo:"",bottominfo:"",saveicon:[],closeicon:[],savekey:[!1,13],navkeys:[!1,38,40],checkOnSubmit:!1,checkOnUpdate:!1,_savedData:{},processing:!1,onClose:null,ajaxEditOptions:{},serializeEditData:null,viewPagerButtons:!0},a.jgrid.edit,c||{});b[a(this)[0].p.id]=c;return this.each(function(){function f(){a("#"+
268
+ s+" > tbody > tr > td > .FormElement").each(function(){var b=a(".customelement",this);if(b.length){var c=a(b[0]).attr("name");a.each(m.p.colModel,function(){if(this.name===c&&this.editoptions&&a.isFunction(this.editoptions.custom_value)){try{if(u[c]=this.editoptions.custom_value(a("#"+a.jgrid.jqID(c),"#"+s),"get"),u[c]===void 0)throw"e1";}catch(b){b==="e1"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,
269
+ b.message,jQuery.jgrid.edit.bClose)}return!0}})}else{switch(a(this).get(0).type){case "checkbox":a(this).attr("checked")?u[this.name]=a(this).val():(b=a(this).attr("offval"),u[this.name]=b);break;case "select-one":u[this.name]=a("option:selected",this).val();J[this.name]=a("option:selected",this).text();break;case "select-multiple":u[this.name]=a(this).val();u[this.name]=u[this.name]?u[this.name].join(","):"";var d=[];a("option:selected",this).each(function(b,c){d[b]=a(c).text()});J[this.name]=d.join(",");
270
+ break;case "password":case "text":case "textarea":case "button":u[this.name]=a(this).val()}m.p.autoencode&&(u[this.name]=a.jgrid.htmlEncode(u[this.name]))}});return!0}function g(c,d,e,f){var j,h,g,k=0,l,o,n,p=[],q=!1,s="",r;for(r=1;r<=f;r++)s+="<td class='CaptionTD'>&#160;</td><td class='DataTD'>&#160;</td>";c!="_empty"&&(q=a(d).jqGrid("getInd",c));a(d.p.colModel).each(function(r){j=this.name;o=(h=this.editrules&&this.editrules.edithidden===!0?!1:this.hidden===!0?!0:!1)?"style='display:none'":"";
271
+ if(j!=="cb"&&j!=="subgrid"&&this.editable===!0&&j!=="rn"){if(q===!1)l="";else if(j==d.p.ExpandColumn&&d.p.treeGrid===!0)l=a("td:eq("+r+")",d.rows[q]).text();else{try{l=a.unformat(a("td:eq("+r+")",d.rows[q]),{rowId:c,colModel:this},r)}catch(t){l=this.edittype&&this.edittype=="textarea"?a("td:eq("+r+")",d.rows[q]).text():a("td:eq("+r+")",d.rows[q]).html()}if(!l||l=="&nbsp;"||l=="&#160;"||l.length==1&&l.charCodeAt(0)==160)l=""}var B=a.extend({},this.editoptions||{},{id:j,name:j}),u=a.extend({},{elmprefix:"",
272
+ elmsuffix:"",rowabove:!1,rowcontent:""},this.formoptions||{}),w=parseInt(u.rowpos,10)||k+1,v=parseInt((parseInt(u.colpos,10)||1)*2,10);c=="_empty"&&B.defaultValue&&(l=a.isFunction(B.defaultValue)?B.defaultValue():B.defaultValue);if(!this.edittype)this.edittype="text";m.p.autoencode&&(l=a.jgrid.htmlDecode(l));n=a.jgrid.createEl(this.edittype,B,l,!1,a.extend({},a.jgrid.ajaxOptions,d.p.ajaxSelectOptions||{}));l===""&&this.edittype=="checkbox"&&(l=a(n).attr("offval"));l===""&&this.edittype=="select"&&
273
+ (l=a("option:eq(0)",n).text());if(b[m.p.id].checkOnSubmit||b[m.p.id].checkOnUpdate)b[m.p.id]._savedData[j]=l;a(n).addClass("FormElement");(this.edittype=="text"||this.edittype=="textarea")&&a(n).addClass("ui-widget-content ui-corner-all");g=a(e).find("tr[rowpos="+w+"]");if(u.rowabove)B=a("<tr><td class='contentinfo' colspan='"+f*2+"'>"+u.rowcontent+"</td></tr>"),a(e).append(B),B[0].rp=w;if(g.length===0)g=a("<tr "+o+" rowpos='"+w+"'></tr>").addClass("FormData").attr("id","tr_"+j),a(g).append(s),a(e).append(g),
274
+ g[0].rp=w;a("td:eq("+(v-2)+")",g[0]).html(typeof u.label==="undefined"?d.p.colNames[r]:u.label);a("td:eq("+(v-1)+")",g[0]).append(u.elmprefix).append(n).append(u.elmsuffix);p[k]=r;k++}});if(k>0&&(r=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(f*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+d.p.id+"_id' value='"+c+"'/></td></tr>"),r[0].rp=k+999,a(e).append(r),b[m.p.id].checkOnSubmit||b[m.p.id].checkOnUpdate))b[m.p.id]._savedData[d.p.id+
275
+ "_id"]=c;return p}function h(c,d,e){var f,j=0,h,g,k,l,o;if(b[m.p.id].checkOnSubmit||b[m.p.id].checkOnUpdate)b[m.p.id]._savedData={},b[m.p.id]._savedData[d.p.id+"_id"]=c;var n=d.p.colModel;if(c=="_empty")a(n).each(function(){f=this.name;k=a.extend({},this.editoptions||{});if((g=a("#"+a.jgrid.jqID(f),"#"+e))&&g.length&&g[0]!==null)if(l="",k.defaultValue?(l=a.isFunction(k.defaultValue)?k.defaultValue():k.defaultValue,g[0].type=="checkbox"?(o=l.toLowerCase(),o.search(/(false|0|no|off|undefined)/i)<0&&
276
+ o!==""?(g[0].checked=!0,g[0].defaultChecked=!0,g[0].value=l):g.attr({checked:"",defaultChecked:""})):g.val(l)):g[0].type=="checkbox"?(g[0].checked=!1,g[0].defaultChecked=!1,l=a(g).attr("offval")):g[0].type&&g[0].type.substr(0,6)=="select"?g[0].selectedIndex=0:g.val(l),b[m.p.id].checkOnSubmit===!0||b[m.p.id].checkOnUpdate)b[m.p.id]._savedData[f]=l}),a("#id_g","#"+e).val(c);else{var p=a(d).jqGrid("getInd",c,!0);p&&(a("td",p).each(function(g){f=n[g].name;if(f!=="cb"&&f!=="subgrid"&&f!=="rn"&&n[g].editable===
277
+ !0){if(f==d.p.ExpandColumn&&d.p.treeGrid===!0)h=a(this).text();else try{h=a.unformat(a(this),{rowId:c,colModel:n[g]},g)}catch(k){h=n[g].edittype=="textarea"?a(this).text():a(this).html()}m.p.autoencode&&(h=a.jgrid.htmlDecode(h));if(b[m.p.id].checkOnSubmit===!0||b[m.p.id].checkOnUpdate)b[m.p.id]._savedData[f]=h;f=a.jgrid.jqID(f);switch(n[g].edittype){case "password":case "text":case "button":case "image":case "textarea":if(h=="&nbsp;"||h=="&#160;"||h.length==1&&h.charCodeAt(0)==160)h="";a("#"+f,"#"+
278
+ e).val(h);break;case "select":var l=h.split(","),l=a.map(l,function(b){return a.trim(b)});a("#"+f+" option","#"+e).each(function(){this.selected=!n[g].editoptions.multiple&&(a.trim(h)==a.trim(a(this).text())||l[0]==a.trim(a(this).text())||l[0]==a.trim(a(this).val()))?!0:n[g].editoptions.multiple?a.inArray(a.trim(a(this).text()),l)>-1||a.inArray(a.trim(a(this).val()),l)>-1?!0:!1:!1});break;case "checkbox":h+="";n[g].editoptions&&n[g].editoptions.value?n[g].editoptions.value.split(":")[0]==h?(a("#"+
279
+ f,"#"+e).attr("checked",!0),a("#"+f,"#"+e).attr("defaultChecked",!0)):(a("#"+f,"#"+e).attr("checked",!1),a("#"+f,"#"+e).attr("defaultChecked","")):(h=h.toLowerCase(),h.search(/(false|0|no|off|undefined)/i)<0&&h!==""?(a("#"+f,"#"+e).attr("checked",!0),a("#"+f,"#"+e).attr("defaultChecked",!0)):(a("#"+f,"#"+e).attr("checked",!1),a("#"+f,"#"+e).attr("defaultChecked","")));break;case "custom":try{if(n[g].editoptions&&a.isFunction(n[g].editoptions.custom_value))n[g].editoptions.custom_value(a("#"+f,"#"+
280
+ e),"set",h);else throw"e1";}catch(o){o=="e1"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,o.message,jQuery.jgrid.edit.bClose)}}j++}}),j>0&&a("#id_g","#"+s).val(c))}}function j(){var d,e=[!0,"",""],f={},j=m.p.prmNames,g,k,o,n;if(a.isFunction(b[m.p.id].beforeCheckValues)){var p=b[m.p.id].beforeCheckValues(u,a("#"+q),u[m.p.id+"_id"]=="_empty"?j.addoper:j.editoper);p&&typeof p===
281
+ "object"&&(u=p)}for(o in u)if(u.hasOwnProperty(o)&&(e=a.jgrid.checkValues(u[o],o,m),e[0]===!1))break;l();e[0]&&(a.isFunction(b[m.p.id].onclickSubmit)&&(f=b[m.p.id].onclickSubmit(b[m.p.id],u)||{}),a.isFunction(b[m.p.id].beforeSubmit)&&(e=b[m.p.id].beforeSubmit(u,a("#"+q))));if(e[0]&&!b[m.p.id].processing){b[m.p.id].processing=!0;a("#sData","#"+s+"_2").addClass("ui-state-active");k=j.oper;g=j.id;u[k]=a.trim(u[m.p.id+"_id"])=="_empty"?j.addoper:j.editoper;u[k]!=j.addoper?u[g]=u[m.p.id+"_id"]:u[g]===
282
+ void 0&&(u[g]=u[m.p.id+"_id"]);delete u[m.p.id+"_id"];u=a.extend(u,b[m.p.id].editData,f);if(m.p.treeGrid===!0)for(i in u[k]==j.addoper&&(n=a(m).jqGrid("getGridParam","selrow"),u[m.p.treeGridModel=="adjacency"?m.p.treeReader.parent_id_field:"parent_id"]=n),m.p.treeReader)f=m.p.treeReader[i],u.hasOwnProperty(f)&&!(u[k]==j.addoper&&i==="parent_id_field")&&delete u[f];if(m.p.restful)b.mtype=u.id=="_empty"?"POST":"PUT",b.url=u.id=="_empty"?m.p.url:m.p.url+"/"+u.id;f=a.extend({url:b[m.p.id].url?b[m.p.id].url:
283
+ a(m).jqGrid("getGridParam","editurl"),type:b[m.p.id].mtype,data:a.isFunction(b[m.p.id].serializeEditData)?b[m.p.id].serializeEditData(u):u,complete:function(f,l){l!="success"?(e[0]=!1,e[1]=a.isFunction(b[m.p.id].errorTextFormat)?b[m.p.id].errorTextFormat(f):l+" Status: '"+f.statusText+"'. Error code: "+f.status):a.isFunction(b[m.p.id].afterSubmit)&&(e=b[m.p.id].afterSubmit(f,u));if(e[0]===!1)a("#FormError>td","#"+s).html(e[1]),a("#FormError","#"+s).show();else if(a.each(m.p.colModel,function(){if(J[this.name]&&
284
+ this.formatter&&this.formatter=="select")try{delete J[this.name]}catch(a){}}),u=a.extend(u,J),m.p.autoencode&&a.each(u,function(b,c){u[b]=a.jgrid.htmlDecode(c)}),u[k]==j.addoper?(e[2]||(e[2]=a.jgrid.randId()),u[g]=e[2],b[m.p.id].closeAfterAdd?(b[m.p.id].reloadAfterSubmit?a(m).trigger("reloadGrid"):m.p.treeGrid===!0?a(m).jqGrid("addChildNode",e[2],n,u):(a(m).jqGrid("addRowData",e[2],u,c.addedrow),a(m).jqGrid("setSelection",e[2])),a.jgrid.hideModal("#"+t.themodal,{gb:"#gbox_"+r,jqm:c.jqModal,onClose:b[m.p.id].onClose})):
285
+ b[m.p.id].clearAfterAdd?(b[m.p.id].reloadAfterSubmit?a(m).trigger("reloadGrid"):m.p.treeGrid===!0?a(m).jqGrid("addChildNode",e[2],n,u):a(m).jqGrid("addRowData",e[2],u,c.addedrow),h("_empty",m,q)):b[m.p.id].reloadAfterSubmit?a(m).trigger("reloadGrid"):m.p.treeGrid===!0?a(m).jqGrid("addChildNode",e[2],n,u):a(m).jqGrid("addRowData",e[2],u,c.addedrow)):(b[m.p.id].reloadAfterSubmit?(a(m).trigger("reloadGrid"),b[m.p.id].closeAfterEdit||setTimeout(function(){a(m).jqGrid("setSelection",u[g])},1E3)):m.p.treeGrid===
286
+ !0?a(m).jqGrid("setTreeRow",u[g],u):a(m).jqGrid("setRowData",u[g],u),b[m.p.id].closeAfterEdit&&a.jgrid.hideModal("#"+t.themodal,{gb:"#gbox_"+r,jqm:c.jqModal,onClose:b[m.p.id].onClose})),a.isFunction(b[m.p.id].afterComplete)&&(d=f,setTimeout(function(){b[m.p.id].afterComplete(d,u,a("#"+q));d=null},500)),b[m.p.id].checkOnSubmit||b[m.p.id].checkOnUpdate)if(a("#"+q).data("disabled",!1),b[m.p.id]._savedData[m.p.id+"_id"]!="_empty")for(var o in b[m.p.id]._savedData)u[o]&&(b[m.p.id]._savedData[o]=u[o]);
287
+ b[m.p.id].processing=!1;a("#sData","#"+s+"_2").removeClass("ui-state-active");try{a(":input:visible","#"+q)[0].focus()}catch(p){}}},a.jgrid.ajaxOptions,b[m.p.id].ajaxEditOptions);if(!f.url&&!b[m.p.id].useDataProxy)a.isFunction(m.p.dataProxy)?b[m.p.id].useDataProxy=!0:(e[0]=!1,e[1]+=" "+a.jgrid.errors.nourl);e[0]&&(b[m.p.id].useDataProxy?m.p.dataProxy.call(m,f,"set_"+m.p.id):a.ajax(f))}e[0]===!1&&(a("#FormError>td","#"+s).html(e[1]),a("#FormError","#"+s).show())}function e(a,b){var c=!1,d;for(d in a)if(a[d]!=
288
+ b[d]){c=!0;break}return c}function l(){a.each(m.p.colModel,function(a,b){b.editoptions&&b.editoptions.NullIfEmpty===!0&&u.hasOwnProperty(b.name)&&u[b.name]==""&&(u[b.name]="null")})}function k(){var c=!0;a("#FormError","#"+s).hide();if(b[m.p.id].checkOnUpdate&&(u={},J={},f(),N=a.extend({},u,J),T=e(N,b[m.p.id]._savedData)))a("#"+q).data("disabled",!0),a(".confirm","#"+t.themodal).show(),c=!1;return c}function n(){if(d!=="_empty"&&typeof m.p.savedRow!=="undefined"&&m.p.savedRow.length>0&&a.isFunction(a.fn.jqGrid.restoreRow))for(var b=
289
+ 0;b<m.p.savedRow.length;b++)if(m.p.savedRow[b].id==d){a(m).jqGrid("restoreRow",d);break}}function o(b,c){b===0?a("#pData","#"+s+"_2").addClass("ui-state-disabled"):a("#pData","#"+s+"_2").removeClass("ui-state-disabled");b==c?a("#nData","#"+s+"_2").addClass("ui-state-disabled"):a("#nData","#"+s+"_2").removeClass("ui-state-disabled")}function p(){var b=a(m).jqGrid("getDataIDs"),c=a("#id_g","#"+s).val();return[a.inArray(c,b),b]}var m=this;if(m.grid&&d){var r=m.p.id,q="FrmGrid_"+r,s="TblGrid_"+r,t={themodal:"editmod"+
290
+ r,modalhead:"edithd"+r,modalcontent:"editcnt"+r,scrollelm:q},w=a.isFunction(b[m.p.id].beforeShowForm)?b[m.p.id].beforeShowForm:!1,v=a.isFunction(b[m.p.id].afterShowForm)?b[m.p.id].afterShowForm:!1,z=a.isFunction(b[m.p.id].beforeInitData)?b[m.p.id].beforeInitData:!1,D=a.isFunction(b[m.p.id].onInitializeForm)?b[m.p.id].onInitializeForm:!1,y=!0,B=1,A=0,u,J,N,T;d==="new"?(d="_empty",c.caption=b[m.p.id].addCaption):c.caption=b[m.p.id].editCaption;c.recreateForm===!0&&a("#"+t.themodal).html()!==null&&a("#"+
291
+ t.themodal).remove();var M=!0;c.checkOnUpdate&&c.jqModal&&!c.modal&&(M=!1);if(a("#"+t.themodal).html()!==null){z&&(y=z(a("#"+q)),typeof y=="undefined"&&(y=!0));if(y===!1)return;n();a(".ui-jqdialog-title","#"+t.modalhead).html(c.caption);a("#FormError","#"+s).hide();b[m.p.id].topinfo?(a(".topinfo","#"+s+"_2").html(b[m.p.id].topinfo),a(".tinfo","#"+s+"_2").show()):a(".tinfo","#"+s+"_2").hide();b[m.p.id].bottominfo?(a(".bottominfo","#"+s+"_2").html(b[m.p.id].bottominfo),a(".binfo","#"+s+"_2").show()):
292
+ a(".binfo","#"+s+"_2").hide();h(d,m,q);d=="_empty"||!b[m.p.id].viewPagerButtons?a("#pData, #nData","#"+s+"_2").hide():a("#pData, #nData","#"+s+"_2").show();if(b[m.p.id].processing===!0)b[m.p.id].processing=!1,a("#sData","#"+s+"_2").removeClass("ui-state-active");a("#"+q).data("disabled")===!0&&(a(".confirm","#"+t.themodal).hide(),a("#"+q).data("disabled",!1));w&&w(a("#"+q));a("#"+t.themodal).data("onClose",b[m.p.id].onClose);a.jgrid.viewModal("#"+t.themodal,{gbox:"#gbox_"+r,jqm:c.jqModal,jqM:!1,overlay:c.overlay,
293
+ modal:c.modal});M||a(".jqmOverlay").click(function(){if(!k())return!1;a.jgrid.hideModal("#"+t.themodal,{gb:"#gbox_"+r,jqm:c.jqModal,onClose:b[m.p.id].onClose});return!1});v&&v(a("#"+q))}else{var K=isNaN(c.dataheight)?c.dataheight:c.dataheight+"px",K=a("<form name='FormPost' id='"+q+"' class='FormGrid' onSubmit='return false;' style='width:100%;overflow:auto;position:relative;height:"+K+";'></form>").data("disabled",!1),U=a("<table id='"+s+"' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>");
294
+ z&&(y=z(a("#"+q)),typeof y=="undefined"&&(y=!0));if(y===!1)return;n();a(m.p.colModel).each(function(){var a=this.formoptions;B=Math.max(B,a?a.colpos||0:0);A=Math.max(A,a?a.rowpos||0:0)});a(K).append(U);z=a("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+B*2+"'></td></tr>");z[0].rp=0;a(U).append(z);z=a("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+B*2+"'>"+b[m.p.id].topinfo+"</td></tr>");z[0].rp=0;a(U).append(z);var y=(z=m.p.direction=="rtl"?
295
+ !0:!1)?"nData":"pData",V=z?"pData":"nData";g(d,m,U,B);var y="<a href='javascript:void(0)' id='"+y+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>",V="<a href='javascript:void(0)' id='"+V+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",Z="<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>"+c.bSubmit+"</a>",G="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+
296
+ c.bCancel+"</a>",y="<table border='0' cellspacing='0' cellpadding='0' class='EditTable' id='"+s+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr id='Act_Buttons'><td class='navButton'>"+(z?V+y:y+V)+"</td><td class='EditButton'>"+Z+G+"</td></tr>";y+="<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+b[m.p.id].bottominfo+"</td></tr>";y+="</tbody></table>";if(A>0){var X=[],R={};a.each(a(U)[0].rows,function(a,b){X[a]=b});X.sort(function(a,
297
+ b){return a.rp>b.rp?1:a.rp<b.rp?-1:0});a.each(X,function(a,b){R.html+=b});a("tbody",U).append(R.html)}c.gbox="#gbox_"+r;var W=!1;if(c.closeOnEscape===!0)c.closeOnEscape=!1,W=!0;K=a("<span></span>").append(K).append(y);a.jgrid.createModal(t,K,c,"#gview_"+m.p.id,a("#gbox_"+m.p.id)[0]);z&&(a("#pData, #nData","#"+s+"_2").css("float","right"),a(".EditButton","#"+s+"_2").css("text-align","left"));b[m.p.id].topinfo&&a(".tinfo","#"+s+"_2").show();b[m.p.id].bottominfo&&a(".binfo","#"+s+"_2").show();y=K=null;
298
+ a("#"+t.themodal).keydown(function(d){var e=d.target;if(a("#"+q).data("disabled")===!0)return!1;if(b[m.p.id].savekey[0]===!0&&d.which==b[m.p.id].savekey[1]&&e.tagName!="TEXTAREA")return a("#sData","#"+s+"_2").trigger("click"),!1;if(d.which===27){if(!k())return!1;W&&a.jgrid.hideModal(this,{gb:c.gbox,jqm:c.jqModal,onClose:b[m.p.id].onClose});return!1}if(b[m.p.id].navkeys[0]===!0){if(a("#id_g","#"+s).val()=="_empty")return!0;if(d.which==b[m.p.id].navkeys[1])return a("#pData","#"+s+"_2").trigger("click"),
299
+ !1;if(d.which==b[m.p.id].navkeys[2])return a("#nData","#"+s+"_2").trigger("click"),!1}});c.checkOnUpdate&&(a("a.ui-jqdialog-titlebar-close span","#"+t.themodal).removeClass("jqmClose"),a("a.ui-jqdialog-titlebar-close","#"+t.themodal).unbind("click").click(function(){if(!k())return!1;a.jgrid.hideModal("#"+t.themodal,{gb:"#gbox_"+r,jqm:c.jqModal,onClose:b[m.p.id].onClose});return!1}));c.saveicon=a.extend([!0,"left","ui-icon-disk"],c.saveicon);c.closeicon=a.extend([!0,"left","ui-icon-close"],c.closeicon);
300
+ c.saveicon[0]===!0&&a("#sData","#"+s+"_2").addClass(c.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.saveicon[2]+"'></span>");c.closeicon[0]===!0&&a("#cData","#"+s+"_2").addClass(c.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.closeicon[2]+"'></span>");if(b[m.p.id].checkOnSubmit||b[m.p.id].checkOnUpdate)Z="<a href='javascript:void(0)' id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+
301
+ c.bYes+"</a>",V="<a href='javascript:void(0)' id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+c.bNo+"</a>",G="<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+c.bExit+"</a>",K=c.zIndex||999,K++,a("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:"+K+";display:none;'>&#160;"+(a.browser.msie&&a.browser.version==6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':
302
+ "")+"</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+(K+1)+"'>"+c.saveData+"<br/><br/>"+Z+V+G+"</div>").insertAfter("#"+q),a("#sNew","#"+t.themodal).click(function(){j();a("#"+q).data("disabled",!1);a(".confirm","#"+t.themodal).hide();return!1}),a("#nNew","#"+t.themodal).click(function(){a(".confirm","#"+t.themodal).hide();a("#"+q).data("disabled",!1);setTimeout(function(){a(":input","#"+q)[0].focus()},0);return!1}),a("#cNew","#"+t.themodal).click(function(){a(".confirm",
303
+ "#"+t.themodal).hide();a("#"+q).data("disabled",!1);a.jgrid.hideModal("#"+t.themodal,{gb:"#gbox_"+r,jqm:c.jqModal,onClose:b[m.p.id].onClose});return!1});D&&D(a("#"+q));d=="_empty"||!b[m.p.id].viewPagerButtons?a("#pData,#nData","#"+s+"_2").hide():a("#pData,#nData","#"+s+"_2").show();w&&w(a("#"+q));a("#"+t.themodal).data("onClose",b[m.p.id].onClose);a.jgrid.viewModal("#"+t.themodal,{gbox:"#gbox_"+r,jqm:c.jqModal,overlay:c.overlay,modal:c.modal});M||a(".jqmOverlay").click(function(){if(!k())return!1;
304
+ a.jgrid.hideModal("#"+t.themodal,{gb:"#gbox_"+r,jqm:c.jqModal,onClose:b[m.p.id].onClose});return!1});v&&v(a("#"+q));a(".fm-button","#"+t.themodal).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a("#sData","#"+s+"_2").click(function(){u={};J={};a("#FormError","#"+s).hide();f();u[m.p.id+"_id"]=="_empty"?j():c.checkOnSubmit===!0?(N=a.extend({},u,J),(T=e(N,b[m.p.id]._savedData))?(a("#"+q).data("disabled",!0),a(".confirm","#"+t.themodal).show()):
305
+ j()):j();return!1});a("#cData","#"+s+"_2").click(function(){if(!k())return!1;a.jgrid.hideModal("#"+t.themodal,{gb:"#gbox_"+r,jqm:c.jqModal,onClose:b[m.p.id].onClose});return!1});a("#nData","#"+s+"_2").click(function(){if(!k())return!1;a("#FormError","#"+s).hide();var b=p();b[0]=parseInt(b[0],10);if(b[0]!=-1&&b[1][b[0]+1]){if(a.isFunction(c.onclickPgButtons))c.onclickPgButtons("next",a("#"+q),b[1][b[0]]);h(b[1][b[0]+1],m,q);a(m).jqGrid("setSelection",b[1][b[0]+1]);a.isFunction(c.afterclickPgButtons)&&
306
+ c.afterclickPgButtons("next",a("#"+q),b[1][b[0]+1]);o(b[0]+1,b[1].length-1)}return!1});a("#pData","#"+s+"_2").click(function(){if(!k())return!1;a("#FormError","#"+s).hide();var b=p();if(b[0]!=-1&&b[1][b[0]-1]){if(a.isFunction(c.onclickPgButtons))c.onclickPgButtons("prev",a("#"+q),b[1][b[0]]);h(b[1][b[0]-1],m,q);a(m).jqGrid("setSelection",b[1][b[0]-1]);a.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons("prev",a("#"+q),b[1][b[0]-1]);o(b[0]-1,b[1].length-1)}return!1})}w=p();o(w[0],w[1].length-
307
+ 1)}})},viewGridRow:function(b,c){c=a.extend({top:0,left:0,width:0,height:"auto",dataheight:"auto",modal:!1,overlay:30,drag:!0,resize:!0,jqModal:!0,closeOnEscape:!1,labelswidth:"30%",closeicon:[],navkeys:[!1,38,40],onClose:null,beforeShowForm:null,beforeInitData:null,viewPagerButtons:!0},a.jgrid.view,c||{});return this.each(function(){function f(){(c.closeOnEscape===!0||c.navkeys[0]===!0)&&setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+p.modalhead).focus()},0)}function g(b,d,e,f){for(var j,
308
+ h,g,k=0,l,m,o=[],n=!1,p="<td class='CaptionTD form-view-label ui-widget-content' width='"+c.labelswidth+"'>&#160;</td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'>&#160;</td>",q="",s=["integer","number","currency"],r=0,t=0,w,v,z,y=1;y<=f;y++)q+=y==1?p:"<td class='CaptionTD form-view-label ui-widget-content'>&#160;</td><td class='DataTD form-view-data ui-widget-content'>&#160;</td>";a(d.p.colModel).each(function(){h=this.editrules&&this.editrules.edithidden===!0?!1:this.hidden===
309
+ !0?!0:!1;!h&&this.align==="right"&&(this.formatter&&a.inArray(this.formatter,s)!==-1?r=Math.max(r,parseInt(this.width,10)):t=Math.max(t,parseInt(this.width,10)))});w=r!==0?r:t!==0?t:0;n=a(d).jqGrid("getInd",b);a(d.p.colModel).each(function(b){j=this.name;v=!1;m=(h=this.editrules&&this.editrules.edithidden===!0?!1:this.hidden===!0?!0:!1)?"style='display:none'":"";z=typeof this.viewable!="boolean"?!0:this.viewable;if(j!=="cb"&&j!=="subgrid"&&j!=="rn"&&z){l=n===!1?"":j==d.p.ExpandColumn&&d.p.treeGrid===
310
+ !0?a("td:eq("+b+")",d.rows[n]).text():a("td:eq("+b+")",d.rows[n]).html();v=this.align==="right"&&w!==0?!0:!1;a.extend({},this.editoptions||{},{id:j,name:j});var c=a.extend({},{rowabove:!1,rowcontent:""},this.formoptions||{}),p=parseInt(c.rowpos,10)||k+1,s=parseInt((parseInt(c.colpos,10)||1)*2,10);if(c.rowabove){var r=a("<tr><td class='contentinfo' colspan='"+f*2+"'>"+c.rowcontent+"</td></tr>");a(e).append(r);r[0].rp=p}g=a(e).find("tr[rowpos="+p+"]");if(g.length===0)g=a("<tr "+m+" rowpos='"+p+"'></tr>").addClass("FormData").attr("id",
311
+ "trv_"+j),a(g).append(q),a(e).append(g),g[0].rp=p;a("td:eq("+(s-2)+")",g[0]).html("<b>"+(typeof c.label==="undefined"?d.p.colNames[b]:c.label)+"</b>");a("td:eq("+(s-1)+")",g[0]).append("<span>"+l+"</span>").attr("id","v_"+j);v&&a("td:eq("+(s-1)+") span",g[0]).css({"text-align":"right",width:w+"px"});o[k]=b;k++}});if(k>0)b=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(f*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+
312
+ b+"'/></td></tr>"),b[0].rp=k+99,a(e).append(b);return o}function h(b,c){var d,e,f=0,j,h;if(h=a(c).jqGrid("getInd",b,!0))a("td",h).each(function(b){d=c.p.colModel[b].name;e=c.p.colModel[b].editrules&&c.p.colModel[b].editrules.edithidden===!0?!1:c.p.colModel[b].hidden===!0?!0:!1;d!=="cb"&&d!=="subgrid"&&d!=="rn"&&(j=d==c.p.ExpandColumn&&c.p.treeGrid===!0?a(this).text():a(this).html(),a.extend({},c.p.colModel[b].editoptions||{}),d=a.jgrid.jqID("v_"+d),a("#"+d+" span","#"+o).html(j),e&&a("#"+d,"#"+o).parents("tr:first").hide(),
313
+ f++)}),f>0&&a("#id_g","#"+o).val(b)}function j(b,c){b===0?a("#pData","#"+o+"_2").addClass("ui-state-disabled"):a("#pData","#"+o+"_2").removeClass("ui-state-disabled");b==c?a("#nData","#"+o+"_2").addClass("ui-state-disabled"):a("#nData","#"+o+"_2").removeClass("ui-state-disabled")}function e(){var b=a(l).jqGrid("getDataIDs"),c=a("#id_g","#"+o).val();return[a.inArray(c,b),b]}var l=this;if(l.grid&&b){if(!c.imgpath)c.imgpath=l.p.imgpath;var k=l.p.id,n="ViewGrid_"+k,o="ViewTbl_"+k,p={themodal:"viewmod"+
314
+ k,modalhead:"viewhd"+k,modalcontent:"viewcnt"+k,scrollelm:n},m=a.isFunction(c.beforeInitData)?c.beforeInitData:!1,r=!0,q=1,s=0;if(a("#"+p.themodal).html()!==null){m&&(r=m(a("#"+n)),typeof r=="undefined"&&(r=!0));if(r===!1)return;a(".ui-jqdialog-title","#"+p.modalhead).html(c.caption);a("#FormError","#"+o).hide();h(b,l);a.isFunction(c.beforeShowForm)&&c.beforeShowForm(a("#"+n));a.jgrid.viewModal("#"+p.themodal,{gbox:"#gbox_"+k,jqm:c.jqModal,jqM:!1,overlay:c.overlay,modal:c.modal});f()}else{var t=isNaN(c.dataheight)?
315
+ c.dataheight:c.dataheight+"px",t=a("<form name='FormPost' id='"+n+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+t+";'></form>"),w=a("<table id='"+o+"' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");m&&(r=m(a("#"+n)),typeof r=="undefined"&&(r=!0));if(r===!1)return;a(l.p.colModel).each(function(){var a=this.formoptions;q=Math.max(q,a?a.colpos||0:0);s=Math.max(s,a?a.rowpos||0:0)});a(t).append(w);g(b,l,
316
+ w,q);var m=l.p.direction=="rtl"?!0:!1,r="<a href='javascript:void(0)' id='"+(m?"nData":"pData")+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>",v="<a href='javascript:void(0)' id='"+(m?"pData":"nData")+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",z="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+c.bClose+"</a>";if(s>0){var D=[];a.each(a(w)[0].rows,
317
+ function(a,b){D[a]=b});D.sort(function(a,b){return a.rp>b.rp?1:a.rp<b.rp?-1:0});a.each(D,function(b,c){a("tbody",w).append(c)})}c.gbox="#gbox_"+k;var y=!1;if(c.closeOnEscape===!0)c.closeOnEscape=!1,y=!0;t=a("<span></span>").append(t).append("<table border='0' class='EditTable' id='"+o+"_2'><tbody><tr id='Act_Buttons'><td class='navButton' width='"+c.labelswidth+"'>"+(m?v+r:r+v)+"</td><td class='EditButton'>"+z+"</td></tr></tbody></table>");a.jgrid.createModal(p,t,c,"#gview_"+l.p.id,a("#gview_"+l.p.id)[0]);
318
+ m&&(a("#pData, #nData","#"+o+"_2").css("float","right"),a(".EditButton","#"+o+"_2").css("text-align","left"));c.viewPagerButtons||a("#pData, #nData","#"+o+"_2").hide();t=null;a("#"+p.themodal).keydown(function(b){if(b.which===27)return y&&a.jgrid.hideModal(this,{gb:c.gbox,jqm:c.jqModal,onClose:c.onClose}),!1;if(c.navkeys[0]===!0){if(b.which===c.navkeys[1])return a("#pData","#"+o+"_2").trigger("click"),!1;if(b.which===c.navkeys[2])return a("#nData","#"+o+"_2").trigger("click"),!1}});c.closeicon=a.extend([!0,
319
+ "left","ui-icon-close"],c.closeicon);c.closeicon[0]===!0&&a("#cData","#"+o+"_2").addClass(c.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.closeicon[2]+"'></span>");a.isFunction(c.beforeShowForm)&&c.beforeShowForm(a("#"+n));a.jgrid.viewModal("#"+p.themodal,{gbox:"#gbox_"+k,jqm:c.jqModal,modal:c.modal});a(".fm-button:not(.ui-state-disabled)","#"+o+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});
320
+ f();a("#cData","#"+o+"_2").click(function(){a.jgrid.hideModal("#"+p.themodal,{gb:"#gbox_"+k,jqm:c.jqModal,onClose:c.onClose});return!1});a("#nData","#"+o+"_2").click(function(){a("#FormError","#"+o).hide();var b=e();b[0]=parseInt(b[0],10);if(b[0]!=-1&&b[1][b[0]+1]){if(a.isFunction(c.onclickPgButtons))c.onclickPgButtons("next",a("#"+n),b[1][b[0]]);h(b[1][b[0]+1],l);a(l).jqGrid("setSelection",b[1][b[0]+1]);a.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons("next",a("#"+n),b[1][b[0]+1]);j(b[0]+
321
+ 1,b[1].length-1)}f();return!1});a("#pData","#"+o+"_2").click(function(){a("#FormError","#"+o).hide();var b=e();if(b[0]!=-1&&b[1][b[0]-1]){if(a.isFunction(c.onclickPgButtons))c.onclickPgButtons("prev",a("#"+n),b[1][b[0]]);h(b[1][b[0]-1],l);a(l).jqGrid("setSelection",b[1][b[0]-1]);a.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons("prev",a("#"+n),b[1][b[0]-1]);j(b[0]-1,b[1].length-1)}f();return!1})}t=e();j(t[0],t[1].length-1)}})},delGridRow:function(d,c){c=a.extend({top:0,left:0,width:240,height:"auto",
322
+ dataheight:"auto",modal:!1,overlay:30,drag:!0,resize:!0,url:"",mtype:"POST",reloadAfterSubmit:!0,beforeShowForm:null,beforeInitData:null,afterShowForm:null,beforeSubmit:null,onclickSubmit:null,afterSubmit:null,jqModal:!0,closeOnEscape:!1,delData:{},delicon:[],cancelicon:[],onClose:null,ajaxDelOptions:{},processing:!1,serializeDelData:null,useDataProxy:!1},a.jgrid.del,c||{});b[a(this)[0].p.id]=c;return this.each(function(){var f=this;if(f.grid&&d){var g=a.isFunction(b[f.p.id].beforeShowForm),h=a.isFunction(b[f.p.id].afterShowForm),
323
+ j=a.isFunction(b[f.p.id].beforeInitData)?b[f.p.id].beforeInitData:!1,e=f.p.id,l={},k=!0,n="DelTbl_"+e,o,p,m,r,q={themodal:"delmod"+e,modalhead:"delhd"+e,modalcontent:"delcnt"+e,scrollelm:n};jQuery.isArray(d)&&(d=d.join());if(a("#"+q.themodal).html()!==null){j&&(k=j(a("#"+n)),typeof k=="undefined"&&(k=!0));if(k===!1)return;a("#DelData>td","#"+n).text(d);a("#DelError","#"+n).hide();if(b[f.p.id].processing===!0)b[f.p.id].processing=!1,a("#dData","#"+n).removeClass("ui-state-active");g&&b[f.p.id].beforeShowForm(a("#"+
324
+ n));a.jgrid.viewModal("#"+q.themodal,{gbox:"#gbox_"+e,jqm:b[f.p.id].jqModal,jqM:!1,overlay:b[f.p.id].overlay,modal:b[f.p.id].modal})}else{var s=isNaN(b[f.p.id].dataheight)?b[f.p.id].dataheight:b[f.p.id].dataheight+"px",s="<div id='"+n+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+s+";'>";s+="<table class='DelTable'><tbody>";s+="<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>";s+="<tr id='DelData' style='display:none'><td >"+d+"</td></tr>";
325
+ s+='<tr><td class="delmsg" style="white-space:pre;">'+b[f.p.id].msg+"</td></tr><tr><td >&#160;</td></tr>";s+="</tbody></table></div>";s+="<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+n+"_2'><tbody><tr><td><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='DelButton EditButton'>"+("<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+c.bSubmit+"</a>")+"&#160;"+("<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+
326
+ c.bCancel+"</a>")+"</td></tr></tbody></table>";c.gbox="#gbox_"+e;a.jgrid.createModal(q,s,c,"#gview_"+f.p.id,a("#gview_"+f.p.id)[0]);j&&(k=j(a("#"+n)),typeof k=="undefined"&&(k=!0));if(k===!1)return;a(".fm-button","#"+n+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});c.delicon=a.extend([!0,"left","ui-icon-scissors"],b[f.p.id].delicon);c.cancelicon=a.extend([!0,"left","ui-icon-cancel"],b[f.p.id].cancelicon);c.delicon[0]===!0&&a("#dData",
327
+ "#"+n+"_2").addClass(c.delicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.delicon[2]+"'></span>");c.cancelicon[0]===!0&&a("#eData","#"+n+"_2").addClass(c.cancelicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.cancelicon[2]+"'></span>");a("#dData","#"+n+"_2").click(function(){var d=[!0,""];l={};var j=a("#DelData>td","#"+n).text();a.isFunction(b[f.p.id].onclickSubmit)&&(l=b[f.p.id].onclickSubmit(b[f.p.id],
328
+ j)||{});a.isFunction(b[f.p.id].beforeSubmit)&&(d=b[f.p.id].beforeSubmit(j));if(d[0]&&!b[f.p.id].processing){b[f.p.id].processing=!0;a(this).addClass("ui-state-active");m=f.p.prmNames;o=a.extend({},b[f.p.id].delData,l);r=m.oper;o[r]=m.deloper;p=m.id;o[p]=j;if(f.p.restful)c.mtype="DELETE",b.url=f.p.url+"/"+j;var h=a.extend({url:b[f.p.id].url?b[f.p.id].url:a(f).jqGrid("getGridParam","editurl"),type:b[f.p.id].mtype,data:a.isFunction(b[f.p.id].serializeDelData)?b[f.p.id].serializeDelData(o):o,complete:function(h,
329
+ g){g!="success"?(d[0]=!1,d[1]=a.isFunction(b[f.p.id].errorTextFormat)?b[f.p.id].errorTextFormat(h):g+" Status: '"+h.statusText+"'. Error code: "+h.status):a.isFunction(b[f.p.id].afterSubmit)&&(d=b[f.p.id].afterSubmit(h,o));if(d[0]===!1)a("#DelError>td","#"+n).html(d[1]),a("#DelError","#"+n).show();else{if(b[f.p.id].reloadAfterSubmit&&f.p.datatype!="local")a(f).trigger("reloadGrid");else{var k=[],k=j.split(",");if(f.p.treeGrid===!0)try{a(f).jqGrid("delTreeNode",k[0])}catch(l){}else for(var m=0;m<k.length;m++)a(f).jqGrid("delRowData",
330
+ k[m]);f.p.selrow=null;f.p.selarrrow=[]}a.isFunction(b[f.p.id].afterComplete)&&setTimeout(function(){b[f.p.id].afterComplete(h,j)},500)}b[f.p.id].processing=!1;a("#dData","#"+n+"_2").removeClass("ui-state-active");d[0]&&a.jgrid.hideModal("#"+q.themodal,{gb:"#gbox_"+e,jqm:c.jqModal,onClose:b[f.p.id].onClose})}},a.jgrid.ajaxOptions,b[f.p.id].ajaxDelOptions);if(!h.url&&!b[f.p.id].useDataProxy)a.isFunction(f.p.dataProxy)?b[f.p.id].useDataProxy=!0:(d[0]=!1,d[1]+=" "+a.jgrid.errors.nourl);d[0]&&(b[f.p.id].useDataProxy?
331
+ f.p.dataProxy.call(f,h,"del_"+f.p.id):a.ajax(h))}d[0]===!1&&(a("#DelError>td","#"+n).html(d[1]),a("#DelError","#"+n).show());return!1});a("#eData","#"+n+"_2").click(function(){a.jgrid.hideModal("#"+q.themodal,{gb:"#gbox_"+e,jqm:b[f.p.id].jqModal,onClose:b[f.p.id].onClose});return!1});g&&b[f.p.id].beforeShowForm(a("#"+n));a.jgrid.viewModal("#"+q.themodal,{gbox:"#gbox_"+e,jqm:b[f.p.id].jqModal,overlay:b[f.p.id].overlay,modal:b[f.p.id].modal})}h&&b[f.p.id].afterShowForm(a("#"+n));b[f.p.id].closeOnEscape===
332
+ !0&&setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+q.modalhead).focus()},0)}})},navGrid:function(b,c,f,g,h,j,e){c=a.extend({edit:!0,editicon:"ui-icon-pencil",add:!0,addicon:"ui-icon-plus",del:!0,delicon:"ui-icon-trash",search:!0,searchicon:"ui-icon-search",refresh:!0,refreshicon:"ui-icon-refresh",refreshstate:"firstpage",view:!1,viewicon:"ui-icon-document",position:"left",closeOnEscape:!0,beforeRefresh:null,afterRefresh:null,cloneToTop:!1,alertwidth:200,alertheight:"auto",alerttop:null,
333
+ alertleft:null,alertzIndex:null},a.jgrid.nav,c||{});return this.each(function(){if(!this.nav){var l={themodal:"alertmod",modalhead:"alerthd",modalcontent:"alertcnt"},k=this,n;if(k.grid&&typeof b=="string"){if(a("#"+l.themodal).html()===null){if(!c.alerttop&&!c.alertleft)typeof window.innerWidth!="undefined"?(c.alertleft=window.innerWidth,c.alerttop=window.innerHeight):typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!==
334
+ 0?(c.alertleft=document.documentElement.clientWidth,c.alerttop=document.documentElement.clientHeight):(c.alertleft=1024,c.alerttop=768),c.alertleft=c.alertleft/2-parseInt(c.alertwidth,10)/2,c.alerttop=c.alerttop/2-25;a.jgrid.createModal(l,"<div>"+c.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{gbox:"#gbox_"+k.p.id,jqModal:!0,drag:!0,resize:!0,caption:c.alertcap,top:c.alerttop,left:c.alertleft,width:c.alertwidth,height:c.alertheight,closeOnEscape:c.closeOnEscape,
335
+ zIndex:c.alertzIndex},"","",!0)}var o=1;c.cloneToTop&&k.p.toppager&&(o=2);for(var p=0;p<o;p++){var m=a("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),r,q;p===0?(r=b,q=k.p.id,r==k.p.toppager&&(q+="_top",o=1)):(r=k.p.toppager,q=k.p.id+"_top");k.p.direction=="rtl"&&a(m).attr("dir","rtl").css("float","right");c.add&&(g=g||{},n=a("<td class='ui-pg-button ui-corner-all'></td>"),a(n).append("<div class='ui-pg-div'><span class='ui-icon "+
336
+ c.addicon+"'></span>"+c.addtext+"</div>"),a("tr",m).append(n),a(n,m).attr({title:c.addtitle||"",id:g.id||"add_"+q}).click(function(){a(this).hasClass("ui-state-disabled")||(a.isFunction(c.addfunc)?c.addfunc():a(k).jqGrid("editGridRow","new",g));return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),n=null);c.edit&&(n=a("<td class='ui-pg-button ui-corner-all'></td>"),f=f||{},a(n).append("<div class='ui-pg-div'><span class='ui-icon "+
337
+ c.editicon+"'></span>"+c.edittext+"</div>"),a("tr",m).append(n),a(n,m).attr({title:c.edittitle||"",id:f.id||"edit_"+q}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var b=k.p.selrow;b?a.isFunction(c.editfunc)?c.editfunc(b):a(k).jqGrid("editGridRow",b,f):(a.jgrid.viewModal("#"+l.themodal,{gbox:"#gbox_"+k.p.id,jqm:!0}),a("#jqg_alrt").focus())}return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),
338
+ n=null);c.view&&(n=a("<td class='ui-pg-button ui-corner-all'></td>"),e=e||{},a(n).append("<div class='ui-pg-div'><span class='ui-icon "+c.viewicon+"'></span>"+c.viewtext+"</div>"),a("tr",m).append(n),a(n,m).attr({title:c.viewtitle||"",id:e.id||"view_"+q}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var b=k.p.selrow;b?a.isFunction(c.viewfunc)?c.viewfunc(b):a(k).jqGrid("viewGridRow",b,e):(a.jgrid.viewModal("#"+l.themodal,{gbox:"#gbox_"+k.p.id,jqm:!0}),a("#jqg_alrt").focus())}return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||
339
+ a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),n=null);c.del&&(n=a("<td class='ui-pg-button ui-corner-all'></td>"),h=h||{},a(n).append("<div class='ui-pg-div'><span class='ui-icon "+c.delicon+"'></span>"+c.deltext+"</div>"),a("tr",m).append(n),a(n,m).attr({title:c.deltitle||"",id:h.id||"del_"+q}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var b;k.p.multiselect?(b=k.p.selarrrow,b.length===0&&(b=null)):b=k.p.selrow;b?"function"==typeof c.delfunc?
340
+ c.delfunc(b):a(k).jqGrid("delGridRow",b,h):(a.jgrid.viewModal("#"+l.themodal,{gbox:"#gbox_"+k.p.id,jqm:!0}),a("#jqg_alrt").focus())}return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),n=null);(c.add||c.edit||c.del||c.view)&&a("tr",m).append("<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>");c.search&&(n=a("<td class='ui-pg-button ui-corner-all'></td>"),
341
+ j=j||{},a(n).append("<div class='ui-pg-div'><span class='ui-icon "+c.searchicon+"'></span>"+c.searchtext+"</div>"),a("tr",m).append(n),a(n,m).attr({title:c.searchtitle||"",id:j.id||"search_"+q}).click(function(){a(this).hasClass("ui-state-disabled")||a(k).jqGrid("searchGrid",j);return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),j.showOnLoad&&j.showOnLoad===!0&&a(n,m).click(),n=null);c.refresh&&(n=
342
+ a("<td class='ui-pg-button ui-corner-all'></td>"),a(n).append("<div class='ui-pg-div'><span class='ui-icon "+c.refreshicon+"'></span>"+c.refreshtext+"</div>"),a("tr",m).append(n),a(n,m).attr({title:c.refreshtitle||"",id:"refresh_"+q}).click(function(){if(!a(this).hasClass("ui-state-disabled")){a.isFunction(c.beforeRefresh)&&c.beforeRefresh();k.p.search=!1;try{var b=k.p.id;k.p.postData.filters="";a("#fbox_"+b).jqFilter("resetFilter");a.isFunction(k.clearToolbar)&&k.clearToolbar(!1)}catch(d){}switch(c.refreshstate){case "firstpage":a(k).trigger("reloadGrid",
343
+ [{page:1}]);break;case "current":a(k).trigger("reloadGrid",[{current:!0}])}a.isFunction(c.afterRefresh)&&c.afterRefresh()}return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}),n=null);n=a(".ui-jqgrid").css("font-size")||"11px";a("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+n+";visibility:hidden;' ></div>");n=a(m).clone().appendTo("#testpg2").width();
344
+ a("#testpg2").remove();a(r+"_"+c.position,r).append(m);k.p._nvtd&&(n>k.p._nvtd[0]&&(a(r+"_"+c.position,r).width(n),k.p._nvtd[0]=n),k.p._nvtd[1]=n);m=n=n=null;this.nav=!0}}}})},navButtonAdd:function(b,c){c=a.extend({caption:"newButton",title:"",buttonicon:"ui-icon-newwin",onClickButton:null,position:"last",cursor:"pointer"},c||{});return this.each(function(){if(this.grid){b.indexOf("#")!==0&&(b="#"+b);var f=a(".navtable",b)[0],g=this;if(f&&!(c.id&&a("#"+c.id,f).html()!==null)){var h=a("<td></td>");
345
+ c.buttonicon.toString().toUpperCase()=="NONE"?a(h).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'>"+c.caption+"</div>"):a(h).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'><span class='ui-icon "+c.buttonicon+"'></span>"+c.caption+"</div>");c.id&&a(h).attr("id",c.id);c.position=="first"?f.rows[0].cells.length===0?a("tr",f).append(h):a("tr td:eq(0)",f).before(h):a("tr",f).append(h);a(h,f).attr("title",c.title||"").click(function(b){a(this).hasClass("ui-state-disabled")||
346
+ a.isFunction(c.onClickButton)&&c.onClickButton.call(g,b);return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},navSeparatorAdd:function(b,c){c=a.extend({sepclass:"ui-separator",sepcontent:""},c||{});return this.each(function(){if(this.grid){b.indexOf("#")!==0&&(b="#"+b);var f=a(".navtable",b)[0];if(f){var g="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+c.sepclass+
347
+ "'></span>"+c.sepcontent+"</td>";a("tr",f).append(g)}}})},GridToForm:function(b,c){return this.each(function(){if(this.grid){var f=a(this).jqGrid("getRowData",b);if(f)for(var g in f)a("[name="+a.jgrid.jqID(g)+"]",c).is("input:radio")||a("[name="+a.jgrid.jqID(g)+"]",c).is("input:checkbox")?a("[name="+a.jgrid.jqID(g)+"]",c).each(function(){a(this).val()==f[g]?a(this).attr("checked","checked"):a(this).attr("checked","")}):a("[name="+a.jgrid.jqID(g)+"]",c).val(f[g])}})},FormToGrid:function(b,c,f,g){return this.each(function(){if(this.grid){f||
348
+ (f="set");g||(g="first");var h=a(c).serializeArray(),j={};a.each(h,function(a,b){j[b.name]=b.value});f=="add"?a(this).jqGrid("addRowData",b,j,g):f=="set"&&a(this).jqGrid("setRowData",b,j)}})}})})(jQuery);
349
+ (function(a){a.jgrid.extend({editRow:function(b,d,c,f,g,h,j,e,l){var k={keys:d||!1,oneditfunc:c||null,successfunc:f||null,url:g||null,extraparam:h||{},aftersavefunc:j||null,errorfunc:e||null,afterrestorefunc:l||null,restoreAfterError:!0,mtype:"POST"},n=a.makeArray(arguments).slice(1),o;o=n[0]&&typeof n[0]=="object"&&!a.isFunction(n[0])?a.extend(k,n[0]):k;return this.each(function(){var c=this,d,e,f=0,j=null,h={},g,k;if(c.grid&&(g=a(c).jqGrid("getInd",b,!0),g!==!1&&(a(g).attr("editable")||"0")=="0"&&
350
+ !a(g).hasClass("not-editable-row")))if(k=c.p.colModel,a("td",g).each(function(g){d=k[g].name;var l=c.p.treeGrid===!0&&d==c.p.ExpandColumn;if(l)e=a("span:first",this).html();else try{e=a.unformat(this,{rowId:b,colModel:k[g]},g)}catch(o){e=k[g].edittype&&k[g].edittype=="textarea"?a(this).text():a(this).html()}if(d!="cb"&&d!="subgrid"&&d!="rn"&&(c.p.autoencode&&(e=a.jgrid.htmlDecode(e)),h[d]=e,k[g].editable===!0)){j===null&&(j=g);l?a("span:first",this).html(""):a(this).html("");var n=a.extend({},k[g].editoptions||
351
+ {},{id:b+"_"+d,name:d});if(!k[g].edittype)k[g].edittype="text";if(e=="&nbsp;"||e=="&#160;"||e.length==1&&e.charCodeAt(0)==160)e="";n=a.jgrid.createEl(k[g].edittype,n,e,!0,a.extend({},a.jgrid.ajaxOptions,c.p.ajaxSelectOptions||{}));a(n).addClass("editable");l?a("span:first",this).append(n):a(this).append(n);k[g].edittype=="select"&&typeof k[g].editoptions!=="undefined"&&k[g].editoptions.multiple===!0&&typeof k[g].editoptions.dataUrl==="undefined"&&a.browser.msie&&a(n).width(a(n).width());f++}}),f>
352
+ 0)h.id=b,c.p.savedRow.push(h),a(g).attr("editable","1"),a("td:eq("+j+") input",g).focus(),o.keys===!0&&a(g).bind("keydown",function(d){d.keyCode===27&&a(c).jqGrid("restoreRow",b,l);if(d.keyCode===13){if(d.target.tagName=="TEXTAREA")return!0;a(c).jqGrid("saveRow",b,o);return!1}d.stopPropagation()}),a.isFunction(o.oneditfunc)&&o.oneditfunc.call(c,b)})},saveRow:function(b,d,c,f,g,h,j){var e={successfunc:d||null,url:c||null,extraparam:f||{},aftersavefunc:g||null,errorfunc:h||null,afterrestorefunc:j||
353
+ null,restoreAfterError:!0,mtype:"POST"},l=a.makeArray(arguments).slice(1),k;k=l[0]&&typeof l[0]=="object"&&!a.isFunction(l[0])?a.extend(e,l[0]):e;var n=!1,o=this[0],p,m={},r={},q={},s,t,w;if(!o.grid)return n;w=a(o).jqGrid("getInd",b,!0);if(w===!1)return n;e=a(w).attr("editable");k.url=k.url?k.url:o.p.editurl;if(e==="1"){var v;a("td",w).each(function(b){v=o.p.colModel[b];p=v.name;if(p!="cb"&&p!="subgrid"&&v.editable===!0&&p!="rn"&&!a(this).hasClass("not-editable-cell")){switch(v.edittype){case "checkbox":var c=
354
+ ["Yes","No"];v.editoptions&&(c=v.editoptions.value.split(":"));m[p]=a("input",this).attr("checked")?c[0]:c[1];break;case "text":case "password":case "textarea":case "button":m[p]=a("input, textarea",this).val();break;case "select":if(v.editoptions.multiple){var c=a("select",this),d=[];m[p]=a(c).val();m[p]=m[p]?m[p].join(","):"";a("select option:selected",this).each(function(b,c){d[b]=a(c).text()});r[p]=d.join(",")}else m[p]=a("select option:selected",this).val(),r[p]=a("select option:selected",this).text();
355
+ v.formatter&&v.formatter=="select"&&(r={});break;case "custom":try{if(v.editoptions&&a.isFunction(v.editoptions.custom_value)){if(m[p]=v.editoptions.custom_value.call(o,a(".customelement",this),"get"),m[p]===void 0)throw"e2";}else throw"e1";}catch(e){e=="e1"&&a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose),e=="e2"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):
356
+ a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,e.message,jQuery.jgrid.edit.bClose)}}t=a.jgrid.checkValues(m[p],b,o);if(t[0]===!1)return t[1]=m[p]+" "+t[1],!1;o.p.autoencode&&(m[p]=a.jgrid.htmlEncode(m[p]));k.url!=="clientArray"&&v.editoptions&&v.editoptions.NullIfEmpty===!0&&m[p]==""&&(q[p]="null")}});if(t[0]===!1){try{var z=a.jgrid.findPos(a("#"+a.jgrid.jqID(b),o.grid.bDiv)[0]);a.jgrid.info_dialog(a.jgrid.errors.errcap,t[1],a.jgrid.edit.bClose,{left:z[0],top:z[1]})}catch(D){alert(t[1])}return n}if(m){e=
357
+ o.p.prmNames;l=e.oper;z=e.id;m[l]=e.editoper;m[z]=b;if(typeof o.p.inlineData=="undefined")o.p.inlineData={};m=a.extend({},m,o.p.inlineData,k.extraparam)}if(k.url=="clientArray"){m=a.extend({},m,r);o.p.autoencode&&a.each(m,function(b,c){m[b]=a.jgrid.htmlDecode(c)});z=a(o).jqGrid("setRowData",b,m);a(w).attr("editable","0");for(e=0;e<o.p.savedRow.length;e++)if(o.p.savedRow[e].id==b){s=e;break}s>=0&&o.p.savedRow.splice(s,1);a.isFunction(k.aftersavefunc)&&k.aftersavefunc.call(o,b,z);n=!0;a(w).unbind("keydown")}else a("#lui_"+
358
+ o.p.id).show(),o.p.restful?(mtype="PUT",k.url=k.url+"/"+b):mtype="POST",q=a.extend({},m,q),a.ajax(a.extend({url:k.url,data:a.isFunction(o.p.serializeRowData)?o.p.serializeRowData.call(o,q):q,type:mytype,async:!1,complete:function(c,d){a("#lui_"+o.p.id).hide();if(d==="success")if((a.isFunction(k.successfunc)?k.successfunc.call(o,c):!0)===!0){o.p.autoencode&&a.each(m,function(b,c){m[b]=a.jgrid.htmlDecode(c)});m=a.extend({},m,r);a(o).jqGrid("setRowData",b,m);a(w).attr("editable","0");for(var e=0;e<o.p.savedRow.length;e++)if(o.p.savedRow[e].id==
359
+ b){s=e;break}s>=0&&o.p.savedRow.splice(s,1);a.isFunction(k.aftersavefunc)&&k.aftersavefunc.call(o,b,c);n=!0;a(w).unbind("keydown")}else a.isFunction(k.errorfunc)&&k.errorfunc.call(o,b,c,d),k.restoreAfterError===!0&&a(o).jqGrid("restoreRow",b,k.afterrestorefunc)},error:function(c,d){a("#lui_"+o.p.id).hide();if(a.isFunction(k.errorfunc))k.errorfunc.call(o,b,c,d);else try{jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'<div class="ui-state-error">'+c.responseText+"</div>",jQuery.jgrid.edit.bClose,
360
+ {buttonalign:"right"})}catch(e){alert(c.responseText)}k.restoreAfterError===!0&&a(o).jqGrid("restoreRow",b,k.afterrestorefunc)}},a.jgrid.ajaxOptions,o.p.ajaxRowOptions||{}))}return n},restoreRow:function(b,d){return this.each(function(){var c=this,f,g,h={};if(c.grid&&(g=a(c).jqGrid("getInd",b,!0),g!==!1)){for(var j=0;j<c.p.savedRow.length;j++)if(c.p.savedRow[j].id==b){f=j;break}if(f>=0){if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker","#"+a.jgrid.jqID(g.id)).datepicker("hide")}catch(e){}a.each(c.p.colModel,
361
+ function(){this.editable===!0&&this.name in c.p.savedRow[f]&&!a(this).hasClass("not-editable-cell")&&(h[this.name]=c.p.savedRow[f][this.name])});a(c).jqGrid("setRowData",b,h);a(g).attr("editable","0").unbind("keydown");c.p.savedRow.splice(f,1)}a.isFunction(d)&&d.call(c,b)}})}})})(jQuery);
362
+ (function(a){a.jgrid.extend({editCell:function(b,d,c){return this.each(function(){var f=this,g,h,j,e;if(f.grid&&f.p.cellEdit===!0){d=parseInt(d,10);f.p.selrow=f.rows[b].id;f.p.knv||a(f).jqGrid("GridNav");if(f.p.savedRow.length>0){if(c===!0&&b==f.p.iRow&&d==f.p.iCol)return;a(f).jqGrid("saveCell",f.p.savedRow[0].id,f.p.savedRow[0].ic)}else window.setTimeout(function(){a("#"+f.p.knv).attr("tabindex","-1").focus()},0);e=f.p.colModel[d];g=e.name;if(!(g=="subgrid"||g=="cb"||g=="rn")){j=a("td:eq("+d+")",
363
+ f.rows[b]);if(e.editable===!0&&c===!0&&!j.hasClass("not-editable-cell")){parseInt(f.p.iCol,10)>=0&&parseInt(f.p.iRow,10)>=0&&(a("td:eq("+f.p.iCol+")",f.rows[f.p.iRow]).removeClass("edit-cell ui-state-highlight"),a(f.rows[f.p.iRow]).removeClass("selected-row ui-state-hover"));a(j).addClass("edit-cell ui-state-highlight");a(f.rows[b]).addClass("selected-row ui-state-hover");try{h=a.unformat(j,{rowId:f.rows[b].id,colModel:e},d)}catch(l){h=e.edittype&&e.edittype=="textarea"?a(j).text():a(j).html()}f.p.autoencode&&
364
+ (h=a.jgrid.htmlDecode(h));if(!e.edittype)e.edittype="text";f.p.savedRow.push({id:b,ic:d,name:g,v:h});if(h=="&nbsp;"||h=="&#160;"||h.length==1&&h.charCodeAt(0)==160)h="";if(a.isFunction(f.p.formatCell)){var k=f.p.formatCell.call(f,f.rows[b].id,g,h,b,d);k!==void 0&&(h=k)}var k=a.extend({},e.editoptions||{},{id:b+"_"+g,name:g}),n=a.jgrid.createEl(e.edittype,k,h,!0,a.extend({},a.jgrid.ajaxOptions,f.p.ajaxSelectOptions||{}));a.isFunction(f.p.beforeEditCell)&&f.p.beforeEditCell.call(f,f.rows[b].id,g,h,
365
+ b,d);a(j).html("").append(n).attr("tabindex","0");window.setTimeout(function(){a(n).focus()},0);a("input, select, textarea",j).bind("keydown",function(c){c.keyCode===27&&(a("input.hasDatepicker",j).length>0?a(".ui-datepicker").is(":hidden")?a(f).jqGrid("restoreCell",b,d):a("input.hasDatepicker",j).datepicker("hide"):a(f).jqGrid("restoreCell",b,d));c.keyCode===13&&a(f).jqGrid("saveCell",b,d);if(c.keyCode==9)if(f.grid.hDiv.loading)return!1;else c.shiftKey?a(f).jqGrid("prevCell",b,d):a(f).jqGrid("nextCell",
366
+ b,d);c.stopPropagation()});a.isFunction(f.p.afterEditCell)&&f.p.afterEditCell.call(f,f.rows[b].id,g,h,b,d)}else parseInt(f.p.iCol,10)>=0&&parseInt(f.p.iRow,10)>=0&&(a("td:eq("+f.p.iCol+")",f.rows[f.p.iRow]).removeClass("edit-cell ui-state-highlight"),a(f.rows[f.p.iRow]).removeClass("selected-row ui-state-hover")),j.addClass("edit-cell ui-state-highlight"),a(f.rows[b]).addClass("selected-row ui-state-hover"),a.isFunction(f.p.onSelectCell)&&(h=j.html().replace(/\&#160\;/ig,""),f.p.onSelectCell.call(f,
367
+ f.rows[b].id,g,h,b,d));f.p.iCol=d;f.p.iRow=b}}})},saveCell:function(b,d){return this.each(function(){var c=this,f;if(c.grid&&c.p.cellEdit===!0){f=c.p.savedRow.length>=1?0:null;if(f!==null){var g=a("td:eq("+d+")",c.rows[b]),h,j,e=c.p.colModel[d],l=e.name,k=a.jgrid.jqID(l);switch(e.edittype){case "select":if(e.editoptions.multiple){var k=a("#"+b+"_"+k,c.rows[b]),n=[];(h=a(k).val())?h.join(","):h="";a("option:selected",k).each(function(b,c){n[b]=a(c).text()});j=n.join(",")}else h=a("#"+b+"_"+k+">option:selected",
368
+ c.rows[b]).val(),j=a("#"+b+"_"+k+">option:selected",c.rows[b]).text();e.formatter&&(j=h);break;case "checkbox":var o=["Yes","No"];e.editoptions&&(o=e.editoptions.value.split(":"));j=h=a("#"+b+"_"+k,c.rows[b]).attr("checked")?o[0]:o[1];break;case "password":case "text":case "textarea":case "button":j=h=a("#"+b+"_"+k,c.rows[b]).val();break;case "custom":try{if(e.editoptions&&a.isFunction(e.editoptions.custom_value))if(h=e.editoptions.custom_value.call(c,a(".customelement",g),"get"),h===void 0)throw"e2";
369
+ else j=h;else throw"e1";}catch(p){p=="e1"&&a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose),p=="e2"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,p.message,jQuery.jgrid.edit.bClose)}}if(j!==c.p.savedRow[f].v){if(a.isFunction(c.p.beforeSaveCell)&&(f=c.p.beforeSaveCell.call(c,c.rows[b].id,l,h,b,d)))j=
370
+ h=f;var m=a.jgrid.checkValues(h,d,c);if(m[0]===!0){f={};a.isFunction(c.p.beforeSubmitCell)&&((f=c.p.beforeSubmitCell.call(c,c.rows[b].id,l,h,b,d))||(f={}));a("input.hasDatepicker",g).length>0&&a("input.hasDatepicker",g).datepicker("hide");if(c.p.cellsubmit=="remote")if(c.p.cellurl){var r={};c.p.autoencode&&(h=a.jgrid.htmlEncode(h));r[l]=h;o=c.p.prmNames;e=o.id;k=o.oper;r[e]=c.rows[b].id;r[k]=o.editoper;r=a.extend(f,r);a("#lui_"+c.p.id).show();c.grid.hDiv.loading=!0;a.ajax(a.extend({url:c.p.cellurl,
371
+ data:a.isFunction(c.p.serializeCellData)?c.p.serializeCellData.call(c,r):r,type:"POST",complete:function(e,f){a("#lui_"+c.p.id).hide();c.grid.hDiv.loading=!1;if(f=="success")if(a.isFunction(c.p.afterSubmitCell)){var k=c.p.afterSubmitCell.call(c,e,r.id,l,h,b,d);k[0]===!0?(a(g).empty(),a(c).jqGrid("setCell",c.rows[b].id,d,j,!1,!1,!0),a(g).addClass("dirty-cell"),a(c.rows[b]).addClass("edited"),a.isFunction(c.p.afterSaveCell)&&c.p.afterSaveCell.call(c,c.rows[b].id,l,h,b,d),c.p.savedRow.splice(0,1)):(a.jgrid.info_dialog(a.jgrid.errors.errcap,
372
+ k[1],a.jgrid.edit.bClose),a(c).jqGrid("restoreCell",b,d))}else a(g).empty(),a(c).jqGrid("setCell",c.rows[b].id,d,j,!1,!1,!0),a(g).addClass("dirty-cell"),a(c.rows[b]).addClass("edited"),a.isFunction(c.p.afterSaveCell)&&c.p.afterSaveCell.call(c,c.rows[b].id,l,h,b,d),c.p.savedRow.splice(0,1)},error:function(e,f){a("#lui_"+c.p.id).hide();c.grid.hDiv.loading=!1;a.isFunction(c.p.errorCell)?c.p.errorCell.call(c,e,f):a.jgrid.info_dialog(a.jgrid.errors.errcap,e.status+" : "+e.statusText+"<br/>"+f,a.jgrid.edit.bClose);
373
+ a(c).jqGrid("restoreCell",b,d)}},a.jgrid.ajaxOptions,c.p.ajaxCellOptions||{}))}else try{a.jgrid.info_dialog(a.jgrid.errors.errcap,a.jgrid.errors.nourl,a.jgrid.edit.bClose),a(c).jqGrid("restoreCell",b,d)}catch(q){}c.p.cellsubmit=="clientArray"&&(a(g).empty(),a(c).jqGrid("setCell",c.rows[b].id,d,j,!1,!1,!0),a(g).addClass("dirty-cell"),a(c.rows[b]).addClass("edited"),a.isFunction(c.p.afterSaveCell)&&c.p.afterSaveCell.call(c,c.rows[b].id,l,h,b,d),c.p.savedRow.splice(0,1))}else try{window.setTimeout(function(){a.jgrid.info_dialog(a.jgrid.errors.errcap,
374
+ h+" "+m[1],a.jgrid.edit.bClose)},100),a(c).jqGrid("restoreCell",b,d)}catch(s){}}else a(c).jqGrid("restoreCell",b,d)}a.browser.opera?a("#"+c.p.knv).attr("tabindex","-1").focus():window.setTimeout(function(){a("#"+c.p.knv).attr("tabindex","-1").focus()},0)}})},restoreCell:function(b,d){return this.each(function(){var c=this,f;if(c.grid&&c.p.cellEdit===!0){f=c.p.savedRow.length>=1?0:null;if(f!==null){var g=a("td:eq("+d+")",c.rows[b]);if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker",g).datepicker("hide")}catch(h){}a(g).empty().attr("tabindex",
372
375
  "-1");a(c).jqGrid("setCell",c.rows[b].id,d,c.p.savedRow[f].v,!1,!1,!0);a.isFunction(c.p.afterRestoreCell)&&c.p.afterRestoreCell.call(c,c.rows[b].id,c.p.savedRow[f].v,b,d);c.p.savedRow.splice(0,1)}window.setTimeout(function(){a("#"+c.p.knv).attr("tabindex","-1").focus()},0)}})},nextCell:function(b,d){return this.each(function(){var c=!1;if(this.grid&&this.p.cellEdit===!0){for(var f=d+1;f<this.p.colModel.length;f++)if(this.p.colModel[f].editable===!0){c=f;break}c!==!1?a(this).jqGrid("editCell",b,c,
373
- !0):this.p.savedRow.length>0&&a(this).jqGrid("saveCell",b,d)}})},prevCell:function(b,d){return this.each(function(){var c=!1;if(this.grid&&this.p.cellEdit===!0){for(var f=d-1;f>=0;f--)if(this.p.colModel[f].editable===!0){c=f;break}c!==!1?a(this).jqGrid("editCell",b,c,!0):this.p.savedRow.length>0&&a(this).jqGrid("saveCell",b,d)}})},GridNav:function(){return this.each(function(){function b(b,d,f){if(f.substr(0,1)=="v"){var g=a(c.grid.bDiv)[0].clientHeight,h=a(c.grid.bDiv)[0].scrollTop,m=c.rows[b].offsetTop+
374
- c.rows[b].clientHeight,n=c.rows[b].offsetTop;if(f=="vd"&&m>=g)a(c.grid.bDiv)[0].scrollTop=a(c.grid.bDiv)[0].scrollTop+c.rows[b].clientHeight;if(f=="vu"&&n<h)a(c.grid.bDiv)[0].scrollTop=a(c.grid.bDiv)[0].scrollTop-c.rows[b].clientHeight}if(f=="h")if(f=a(c.grid.bDiv)[0].clientWidth,g=a(c.grid.bDiv)[0].scrollLeft,h=c.rows[b].cells[d].offsetLeft,c.rows[b].cells[d].offsetLeft+c.rows[b].cells[d].clientWidth>=f+parseInt(g,10))a(c.grid.bDiv)[0].scrollLeft=a(c.grid.bDiv)[0].scrollLeft+c.rows[b].cells[d].clientWidth;
375
- else if(h<g)a(c.grid.bDiv)[0].scrollLeft=a(c.grid.bDiv)[0].scrollLeft-c.rows[b].cells[d].clientWidth}function d(a,b){var d,f;if(b=="lft"){d=a+1;for(f=a;f>=0;f--)if(c.p.colModel[f].hidden!==!0){d=f;break}}if(b=="rgt"){d=a-1;for(f=a;f<c.p.colModel.length;f++)if(c.p.colModel[f].hidden!==!0){d=f;break}}return d}var c=this;if(c.grid&&c.p.cellEdit===!0){c.p.knv=c.p.id+"_kn";var f=a("<span style='width:0px;height:0px;background-color:black;' tabindex='0'><span tabindex='-1' style='width:0px;height:0px;background-color:grey' id='"+
376
- c.p.knv+"'></span></span>"),h,g;a(f).insertBefore(c.grid.cDiv);a("#"+c.p.knv).focus().keydown(function(f){g=f.keyCode;c.p.direction=="rtl"&&(g==37?g=39:g==39&&(g=37));switch(g){case 38:c.p.iRow-1>0&&(b(c.p.iRow-1,c.p.iCol,"vu"),a(c).jqGrid("editCell",c.p.iRow-1,c.p.iCol,!1));break;case 40:c.p.iRow+1<=c.rows.length-1&&(b(c.p.iRow+1,c.p.iCol,"vd"),a(c).jqGrid("editCell",c.p.iRow+1,c.p.iCol,!1));break;case 37:c.p.iCol-1>=0&&(h=d(c.p.iCol-1,"lft"),b(c.p.iRow,h,"h"),a(c).jqGrid("editCell",c.p.iRow,h,!1));
377
- break;case 39:c.p.iCol+1<=c.p.colModel.length-1&&(h=d(c.p.iCol+1,"rgt"),b(c.p.iRow,h,"h"),a(c).jqGrid("editCell",c.p.iRow,h,!1));break;case 13:parseInt(c.p.iCol,10)>=0&&parseInt(c.p.iRow,10)>=0&&a(c).jqGrid("editCell",c.p.iRow,c.p.iCol,!0)}return!1})}})},getChangedCells:function(b){var d=[];b||(b="all");this.each(function(){var c=this,f;c.grid&&c.p.cellEdit===!0&&a(c.rows).each(function(h){var g={};if(a(this).hasClass("edited"))a("td",this).each(function(d){f=c.p.colModel[d].name;if(f!=="cb"&&f!==
378
- "subgrid")if(b=="dirty"){if(a(this).hasClass("dirty-cell"))try{g[f]=a.unformat(this,{rowId:c.rows[h].id,colModel:c.p.colModel[d]},d)}catch(e){g[f]=a.jgrid.htmlDecode(a(this).html())}}else try{g[f]=a.unformat(this,{rowId:c.rows[h].id,colModel:c.p.colModel[d]},d)}catch(l){g[f]=a.jgrid.htmlDecode(a(this).html())}}),g.id=this.id,d.push(g)})});return d}})})(jQuery);
376
+ !0):this.p.savedRow.length>0&&a(this).jqGrid("saveCell",b,d)}})},prevCell:function(b,d){return this.each(function(){var c=!1;if(this.grid&&this.p.cellEdit===!0){for(var f=d-1;f>=0;f--)if(this.p.colModel[f].editable===!0){c=f;break}c!==!1?a(this).jqGrid("editCell",b,c,!0):this.p.savedRow.length>0&&a(this).jqGrid("saveCell",b,d)}})},GridNav:function(){return this.each(function(){function b(b,d,f){if(f.substr(0,1)=="v"){var h=a(c.grid.bDiv)[0].clientHeight,g=a(c.grid.bDiv)[0].scrollTop,o=c.rows[b].offsetTop+
377
+ c.rows[b].clientHeight,p=c.rows[b].offsetTop;if(f=="vd"&&o>=h)a(c.grid.bDiv)[0].scrollTop=a(c.grid.bDiv)[0].scrollTop+c.rows[b].clientHeight;if(f=="vu"&&p<g)a(c.grid.bDiv)[0].scrollTop=a(c.grid.bDiv)[0].scrollTop-c.rows[b].clientHeight}if(f=="h")if(f=a(c.grid.bDiv)[0].clientWidth,h=a(c.grid.bDiv)[0].scrollLeft,g=c.rows[b].cells[d].offsetLeft,c.rows[b].cells[d].offsetLeft+c.rows[b].cells[d].clientWidth>=f+parseInt(h,10))a(c.grid.bDiv)[0].scrollLeft=a(c.grid.bDiv)[0].scrollLeft+c.rows[b].cells[d].clientWidth;
378
+ else if(g<h)a(c.grid.bDiv)[0].scrollLeft=a(c.grid.bDiv)[0].scrollLeft-c.rows[b].cells[d].clientWidth}function d(a,b){var d,f;if(b=="lft"){d=a+1;for(f=a;f>=0;f--)if(c.p.colModel[f].hidden!==!0){d=f;break}}if(b=="rgt"){d=a-1;for(f=a;f<c.p.colModel.length;f++)if(c.p.colModel[f].hidden!==!0){d=f;break}}return d}var c=this;if(c.grid&&c.p.cellEdit===!0){c.p.knv=c.p.id+"_kn";var f=a("<span style='width:0px;height:0px;background-color:black;' tabindex='0'><span tabindex='-1' style='width:0px;height:0px;background-color:grey' id='"+
379
+ c.p.knv+"'></span></span>"),g,h;a(f).insertBefore(c.grid.cDiv);a("#"+c.p.knv).focus().keydown(function(f){h=f.keyCode;c.p.direction=="rtl"&&(h==37?h=39:h==39&&(h=37));switch(h){case 38:c.p.iRow-1>0&&(b(c.p.iRow-1,c.p.iCol,"vu"),a(c).jqGrid("editCell",c.p.iRow-1,c.p.iCol,!1));break;case 40:c.p.iRow+1<=c.rows.length-1&&(b(c.p.iRow+1,c.p.iCol,"vd"),a(c).jqGrid("editCell",c.p.iRow+1,c.p.iCol,!1));break;case 37:c.p.iCol-1>=0&&(g=d(c.p.iCol-1,"lft"),b(c.p.iRow,g,"h"),a(c).jqGrid("editCell",c.p.iRow,g,!1));
380
+ break;case 39:c.p.iCol+1<=c.p.colModel.length-1&&(g=d(c.p.iCol+1,"rgt"),b(c.p.iRow,g,"h"),a(c).jqGrid("editCell",c.p.iRow,g,!1));break;case 13:parseInt(c.p.iCol,10)>=0&&parseInt(c.p.iRow,10)>=0&&a(c).jqGrid("editCell",c.p.iRow,c.p.iCol,!0)}return!1})}})},getChangedCells:function(b){var d=[];b||(b="all");this.each(function(){var c=this,f;c.grid&&c.p.cellEdit===!0&&a(c.rows).each(function(g){var h={};if(a(this).hasClass("edited"))a("td",this).each(function(d){f=c.p.colModel[d].name;if(f!=="cb"&&f!==
381
+ "subgrid")if(b=="dirty"){if(a(this).hasClass("dirty-cell"))try{h[f]=a.unformat(this,{rowId:c.rows[g].id,colModel:c.p.colModel[d]},d)}catch(e){h[f]=a.jgrid.htmlDecode(a(this).html())}}else try{h[f]=a.unformat(this,{rowId:c.rows[g].id,colModel:c.p.colModel[d]},d)}catch(l){h[f]=a.jgrid.htmlDecode(a(this).html())}}),h.id=this.id,d.push(h)})});return d}})})(jQuery);
379
382
  (function(a){a.jgrid.extend({setSubGrid:function(){return this.each(function(){var b;this.p.subGridOptions=a.extend({plusicon:"ui-icon-plus",minusicon:"ui-icon-minus",openicon:"ui-icon-carat-1-sw",expandOnLoad:!1,delayOnLoad:50,selectOnExpand:!1,reloadOnExpand:!0},this.p.subGridOptions||{});this.p.colNames.unshift("");this.p.colModel.unshift({name:"subgrid",width:a.browser.safari?this.p.subGridWidth+this.p.cellLayout:this.p.subGridWidth,sortable:!1,resizable:!1,hidedlg:!0,search:!1,fixed:!0});b=this.p.subGridModel;
380
- if(b[0]){b[0].align=a.extend([],b[0].align||[]);for(var d=0;d<b[0].name.length;d++)b[0].align[d]=b[0].align[d]||"left"}})},addSubGridCell:function(a,d){var c="",f,h;this.each(function(){c=this.formatCol(a,d);h=this.p.id;f=this.p.subGridOptions.plusicon});return'<td role="grid" aria-describedby="'+h+'_subgrid" class="ui-sgcollapsed sgcollapsed" '+c+"><a href='javascript:void(0);'><span class='ui-icon "+f+"'></span></a></td>"},addSubGrid:function(b){return this.each(function(){var d=this;if(d.grid){var c=
381
- function(b,c,e){c=a("<td align='"+d.p.subGridModel[0].align[e]+"'></td>").html(c);a(b).append(c)},f=function(b,e){var f,g,j,h=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),k=a("<tr></tr>");for(g=0;g<d.p.subGridModel[0].name.length;g++)f=a("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+d.p.direction+"'></th>"),a(f).html(d.p.subGridModel[0].name[g]),a(f).width(d.p.subGridModel[0].width[g]),a(k).append(f);a(h).append(k);if(b)j=d.p.xmlReader.subgrid,a(j.root+
382
- " "+j.row,b).each(function(){k=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(j.repeatitems===!0)a(j.cell,this).each(function(b){c(k,a(this).text()||"&#160;",b)});else{var b=d.p.subGridModel[0].mapping||d.p.subGridModel[0].name;if(b)for(g=0;g<b.length;g++)c(k,a(b[g],this).text()||"&#160;",g)}a(h).append(k)});f=a("table:first",d.grid.bDiv).attr("id")+"_";a("#"+f+e).append(h);d.grid.hDiv.loading=!1;a("#load_"+d.p.id).hide();return!1},h=function(b,e){var f,g,j,h,k,l=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
383
- m=a("<tr></tr>");for(g=0;g<d.p.subGridModel[0].name.length;g++)f=a("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+d.p.direction+"'></th>"),a(f).html(d.p.subGridModel[0].name[g]),a(f).width(d.p.subGridModel[0].width[g]),a(m).append(f);a(l).append(m);if(b&&(h=d.p.jsonReader.subgrid,f=b[h.root],typeof f!=="undefined"))for(g=0;g<f.length;g++){j=f[g];m=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(h.repeatitems===!0){h.cell&&(j=j[h.cell]);for(k=0;k<j.length;k++)c(m,j[k]||"&#160;",
384
- k)}else{var o=d.p.subGridModel[0].mapping||d.p.subGridModel[0].name;if(o.length)for(k=0;k<o.length;k++)c(m,j[o[k]]||"&#160;",k)}a(l).append(m)}g=a("table:first",d.grid.bDiv).attr("id")+"_";a("#"+g+e).append(l);d.grid.hDiv.loading=!1;a("#load_"+d.p.id).hide();return!1},g=function(b){var c,e,g,j;c=a(b).attr("id");e={nd_:(new Date).getTime()};e[d.p.prmNames.subgridid]=c;if(!d.p.subGridModel[0])return!1;if(d.p.subGridModel[0].params)for(j=0;j<d.p.subGridModel[0].params.length;j++)for(g=0;g<d.p.colModel.length;g++)d.p.colModel[g].name==
385
- d.p.subGridModel[0].params[j]&&(e[d.p.colModel[g].name]=a("td:eq("+g+")",b).text().replace(/\&#160\;/ig,""));if(!d.grid.hDiv.loading){d.grid.hDiv.loading=!0;a("#load_"+d.p.id).show();if(!d.p.subgridtype)d.p.subgridtype=d.p.datatype;a.isFunction(d.p.subgridtype)?d.p.subgridtype.call(d,e):d.p.subgridtype=d.p.subgridtype.toLowerCase();switch(d.p.subgridtype){case "xml":case "json":a.ajax(a.extend({type:d.p.mtype,url:d.p.subGridUrl,dataType:d.p.subgridtype,data:a.isFunction(d.p.serializeSubGridData)?
386
- d.p.serializeSubGridData.call(d,e):e,complete:function(b){d.p.subgridtype=="xml"?f(b.responseXML,c):h(a.jgrid.parse(b.responseText),c)}},a.jgrid.ajaxOptions,d.p.ajaxSubgridOptions||{}))}}return!1},j,e,l,k=0,o,m;a.each(d.p.colModel,function(){(this.hidden===!0||this.name=="rn"||this.name=="cb")&&k++});a(d.rows).each(function(c){var f=this;a(f).hasClass("jqgrow")&&(a(this.cells[b]).bind("click",function(){m=f.nextSibling;if(a(this).hasClass("sgcollapsed")){e=d.p.id;j=f.id;if(d.p.subGridOptions.reloadOnExpand===
387
- !0||d.p.subGridOptions.reloadOnExpand===!1&&!a(m).hasClass("ui-subgrid")){l=b>=1?"<td colspan='"+b+"'>&#160;</td>":"";o=!0;a.isFunction(d.p.subGridBeforeExpand)&&(o=d.p.subGridBeforeExpand.call(d,e+"_"+j,j));if(o===!1)return!1;a(f).after("<tr role='row' class='ui-subgrid'>"+l+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon "+d.p.subGridOptions.openicon+"'></span></td><td colspan='"+parseInt(d.p.colNames.length-1-k,10)+"' class='ui-widget-content subgrid-data'><div id="+e+"_"+j+" class='tablediv'></div></td></tr>");
388
- a.isFunction(d.p.subGridRowExpanded)?d.p.subGridRowExpanded.call(d,e+"_"+j,j):g(f)}else a(m).show();a(this).html("<a href='javascript:void(0);'><span class='ui-icon "+d.p.subGridOptions.minusicon+"'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");d.p.subGridOptions.selectOnExpand&&a(d).jqGrid("setSelection",j)}else if(a(this).hasClass("sgexpanded")){o=!0;if(a.isFunction(d.p.subGridRowColapsed))j=f.id,o=d.p.subGridRowColapsed.call(d,e+"_"+j,j);if(o===!1)return!1;d.p.subGridOptions.reloadOnExpand===
389
- !0?a(m).remove(".ui-subgrid"):a(m).hasClass("ui-subgrid")&&a(m).hide();a(this).html("<a href='javascript:void(0);'><span class='ui-icon "+d.p.subGridOptions.plusicon+"'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed")}return!1}),d.p.subGridOptions.expandOnLoad===!0&&setTimeout(function(){a(f.cells[b]).trigger("click")},c*d.p.subGridOptions.delayOnLoad))});d.subGridXml=function(a,b){f(a,b)};d.subGridJson=function(a,b){h(a,b)}}})},expandSubGridRow:function(b){return this.each(function(){if((this.grid||
383
+ if(b[0]){b[0].align=a.extend([],b[0].align||[]);for(var d=0;d<b[0].name.length;d++)b[0].align[d]=b[0].align[d]||"left"}})},addSubGridCell:function(a,d){var c="",f,g;this.each(function(){c=this.formatCol(a,d);g=this.p.id;f=this.p.subGridOptions.plusicon});return'<td role="grid" aria-describedby="'+g+'_subgrid" class="ui-sgcollapsed sgcollapsed" '+c+"><a href='javascript:void(0);'><span class='ui-icon "+f+"'></span></a></td>"},addSubGrid:function(b,d){return this.each(function(){var c=this;if(c.grid){var f=
384
+ function(b,d,e){d=a("<td align='"+c.p.subGridModel[0].align[e]+"'></td>").html(d);a(b).append(d)},g=function(b,d){var e,h,j,g=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),k=a("<tr></tr>");for(h=0;h<c.p.subGridModel[0].name.length;h++)e=a("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+c.p.direction+"'></th>"),a(e).html(c.p.subGridModel[0].name[h]),a(e).width(c.p.subGridModel[0].width[h]),a(k).append(e);a(g).append(k);if(b)j=c.p.xmlReader.subgrid,a(j.root+
385
+ " "+j.row,b).each(function(){k=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(j.repeatitems===!0)a(j.cell,this).each(function(b){f(k,a(this).text()||"&#160;",b)});else{var b=c.p.subGridModel[0].mapping||c.p.subGridModel[0].name;if(b)for(h=0;h<b.length;h++)f(k,a(b[h],this).text()||"&#160;",h)}a(g).append(k)});e=a("table:first",c.grid.bDiv).attr("id")+"_";a("#"+e+d).append(g);c.grid.hDiv.loading=!1;a("#load_"+c.p.id).hide();return!1},h=function(b,d){var e,h,j,g,k,l=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),
386
+ m=a("<tr></tr>");for(h=0;h<c.p.subGridModel[0].name.length;h++)e=a("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+c.p.direction+"'></th>"),a(e).html(c.p.subGridModel[0].name[h]),a(e).width(c.p.subGridModel[0].width[h]),a(m).append(e);a(l).append(m);if(b&&(g=c.p.jsonReader.subgrid,e=b[g.root],typeof e!=="undefined"))for(h=0;h<e.length;h++){j=e[h];m=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(g.repeatitems===!0){g.cell&&(j=j[g.cell]);for(k=0;k<j.length;k++)f(m,j[k]||"&#160;",
387
+ k)}else{var o=c.p.subGridModel[0].mapping||c.p.subGridModel[0].name;if(o.length)for(k=0;k<o.length;k++)f(m,j[o[k]]||"&#160;",k)}a(l).append(m)}h=a("table:first",c.grid.bDiv).attr("id")+"_";a("#"+h+d).append(l);c.grid.hDiv.loading=!1;a("#load_"+c.p.id).hide();return!1},j=function(b){var d,e,f,j;d=a(b).attr("id");e={nd_:(new Date).getTime()};e[c.p.prmNames.subgridid]=d;if(!c.p.subGridModel[0])return!1;if(c.p.subGridModel[0].params)for(j=0;j<c.p.subGridModel[0].params.length;j++)for(f=0;f<c.p.colModel.length;f++)c.p.colModel[f].name==
388
+ c.p.subGridModel[0].params[j]&&(e[c.p.colModel[f].name]=a("td:eq("+f+")",b).text().replace(/\&#160\;/ig,""));if(!c.grid.hDiv.loading){c.grid.hDiv.loading=!0;a("#load_"+c.p.id).show();if(!c.p.subgridtype)c.p.subgridtype=c.p.datatype;a.isFunction(c.p.subgridtype)?c.p.subgridtype.call(c,e):c.p.subgridtype=c.p.subgridtype.toLowerCase();switch(c.p.subgridtype){case "xml":case "json":a.ajax(a.extend({type:c.p.mtype,url:c.p.subGridUrl,dataType:c.p.subgridtype,data:a.isFunction(c.p.serializeSubGridData)?
389
+ c.p.serializeSubGridData.call(c,e):e,complete:function(b){c.p.subgridtype=="xml"?g(b.responseXML,d):h(a.jgrid.parse(b.responseText),d)}},a.jgrid.ajaxOptions,c.p.ajaxSubgridOptions||{}))}}return!1},e,l,k,n=0,o,p;a.each(c.p.colModel,function(){(this.hidden===!0||this.name=="rn"||this.name=="cb")&&n++});var m=c.rows.length,r=1;d!==void 0&&d>0&&(r=d,m=d+1);for(;r<m;)a(c.rows[r]).hasClass("jqgrow")&&a(c.rows[r].cells[b]).bind("click",function(){var d=a(this).parent("tr")[0];p=d.nextSibling;if(a(this).hasClass("sgcollapsed")){l=
390
+ c.p.id;e=d.id;if(c.p.subGridOptions.reloadOnExpand===!0||c.p.subGridOptions.reloadOnExpand===!1&&!a(p).hasClass("ui-subgrid")){k=b>=1?"<td colspan='"+b+"'>&#160;</td>":"";o=!0;a.isFunction(c.p.subGridBeforeExpand)&&(o=c.p.subGridBeforeExpand.call(c,l+"_"+e,e));if(o===!1)return!1;a(d).after("<tr role='row' class='ui-subgrid'>"+k+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon "+c.p.subGridOptions.openicon+"'></span></td><td colspan='"+parseInt(c.p.colNames.length-1-n,10)+"' class='ui-widget-content subgrid-data'><div id="+
391
+ l+"_"+e+" class='tablediv'></div></td></tr>");a.isFunction(c.p.subGridRowExpanded)?c.p.subGridRowExpanded.call(c,l+"_"+e,e):j(d)}else a(p).show();a(this).html("<a href='javascript:void(0);'><span class='ui-icon "+c.p.subGridOptions.minusicon+"'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");c.p.subGridOptions.selectOnExpand&&a(c).jqGrid("setSelection",e)}else if(a(this).hasClass("sgexpanded")){o=!0;if(a.isFunction(c.p.subGridRowColapsed))e=d.id,o=c.p.subGridRowColapsed.call(c,l+"_"+
392
+ e,e);if(o===!1)return!1;c.p.subGridOptions.reloadOnExpand===!0?a(p).remove(".ui-subgrid"):a(p).hasClass("ui-subgrid")&&a(p).hide();a(this).html("<a href='javascript:void(0);'><span class='ui-icon "+c.p.subGridOptions.plusicon+"'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed")}return!1}),c.p.subGridOptions.expandOnLoad===!0&&a(c.rows[r].cells[b]).trigger("click"),r++;c.subGridXml=function(a,b){g(a,b)};c.subGridJson=function(a,b){h(a,b)}}})},expandSubGridRow:function(b){return this.each(function(){if((this.grid||
390
393
  b)&&this.p.subGrid===!0){var d=a(this).jqGrid("getInd",b,!0);d&&(d=a("td.sgcollapsed",d)[0])&&a(d).trigger("click")}})},collapseSubGridRow:function(b){return this.each(function(){if((this.grid||b)&&this.p.subGrid===!0){var d=a(this).jqGrid("getInd",b,!0);d&&(d=a("td.sgexpanded",d)[0])&&a(d).trigger("click")}})},toggleSubGridRow:function(b){return this.each(function(){if((this.grid||b)&&this.p.subGrid===!0){var d=a(this).jqGrid("getInd",b,!0);if(d){var c=a("td.sgcollapsed",d)[0];c?a(c).trigger("click"):
391
394
  (c=a("td.sgexpanded",d)[0])&&a(c).trigger("click")}}})}})})(jQuery);
392
- (function(a){a.jgrid.extend({setTreeNode:function(b,d){return this.each(function(){var c=this;if(c.grid&&c.p.treeGrid)for(var f=c.p.expColInd,h=c.p.treeReader.expanded_field,g=c.p.treeReader.leaf_field,j=c.p.treeReader.level_field,e=c.p.treeReader.icon_field,l=c.p.treeReader.loaded,k,o,m,n;b<d;){n=c.p.data[c.p._index[c.rows[b].id]];if(c.p.treeGridModel=="nested"&&!n[g])k=parseInt(n[c.p.treeReader.left_field],10),o=parseInt(n[c.p.treeReader.right_field],10),n[g]=o===k+1?"true":"false",c.rows[b].cells[c.p._treeleafpos].innerHTML=
393
- n[g];k=parseInt(n[j],10);c.p.tree_root_level===0?(m=k+1,o=k):(m=k,o=k-1);m="<div class='tree-wrap tree-wrap-"+c.p.direction+"' style='width:"+m*18+"px;'>";m+="<div style='"+(c.p.direction=="rtl"?"right:":"left:")+o*18+"px;' class='ui-icon ";n[l]!==void 0&&(n[l]=n[l]=="true"||n[l]===!0?!0:!1);n[g]=="true"||n[g]===!0?(m+=(n[e]!==void 0&&n[e]!==""?n[e]:c.p.treeIcons.leaf)+" tree-leaf treeclick'",n[g]=!0,o="leaf"):(n[g]=!1,o="");n[h]=(n[h]=="true"||n[h]===!0?!0:!1)&&n[l];m+=n[h]===!0?c.p.treeIcons.minus+
394
- " tree-minus treeclick'":c.p.treeIcons.plus+" tree-plus treeclick'";m+="</div></div>";a(c.rows[b].cells[f]).wrapInner("<span class='cell-wrapper"+o+"'></span>").prepend(m);k!==parseInt(c.p.tree_root_level,10)&&((n=(n=a(c).jqGrid("getNodeParent",n))&&n.hasOwnProperty(h)?n[h]:!0)||a(c.rows[b]).css("display","none"));a(c.rows[b].cells[f]).find("div.treeclick").bind("click",function(b){b=a(b.target||b.srcElement,c.rows).closest("tr.jqgrow")[0].id;b=c.p._index[b];c.p.data[b][g]||(c.p.data[b][h]?(a(c).jqGrid("collapseRow",
395
- c.p.data[b]),a(c).jqGrid("collapseNode",c.p.data[b])):(a(c).jqGrid("expandRow",c.p.data[b]),a(c).jqGrid("expandNode",c.p.data[b])));return!1});c.p.ExpandColClick===!0&&a(c.rows[b].cells[f]).find("span.cell-wrapper").css("cursor","pointer").bind("click",function(b){var b=a(b.target||b.srcElement,c.rows).closest("tr.jqgrow")[0].id,d=c.p._index[b];c.p.data[d][g]||(c.p.data[d][h]?(a(c).jqGrid("collapseRow",c.p.data[d]),a(c).jqGrid("collapseNode",c.p.data[d])):(a(c).jqGrid("expandRow",c.p.data[d]),a(c).jqGrid("expandNode",
396
- c.p.data[d])));a(c).jqGrid("setSelection",b);return!1});b++}})},setTreeGrid:function(){return this.each(function(){var b=this,d=0,c=!1,f,h,g=[];if(b.p.treeGrid){b.p.treedatatype||a.extend(b.p,{treedatatype:b.p.datatype});b.p.subGrid=!1;b.p.altRows=!1;b.p.pgbuttons=!1;b.p.pginput=!1;b.p.gridview=!0;b.p.multiselect=!1;b.p.rowList=[];b.p.expColInd=0;b.p.treeIcons=a.extend({plus:"ui-icon-triangle-1-"+(b.p.direction=="rtl"?"w":"e"),minus:"ui-icon-triangle-1-s",leaf:"ui-icon-radio-off"},b.p.treeIcons||
397
- {});if(b.p.treeGridModel=="nested")b.p.treeReader=a.extend({level_field:"level",left_field:"lft",right_field:"rgt",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},b.p.treeReader);else if(b.p.treeGridModel=="adjacency")b.p.treeReader=a.extend({level_field:"level",parent_id_field:"parent",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},b.p.treeReader);for(h in b.p.colModel)if(b.p.colModel.hasOwnProperty(h)){f=b.p.colModel[h].name;if(f==
398
- b.p.ExpandColumn&&!c)c=!0,b.p.expColInd=d;d++;for(var j in b.p.treeReader)b.p.treeReader[j]==f&&g.push(f)}a.each(b.p.treeReader,function(c,f){if(f&&a.inArray(f,g)===-1){if(c==="leaf_field")b.p._treeleafpos=d;d++;b.p.colNames.push(f);b.p.colModel.push({name:f,width:1,hidden:!0,sortable:!1,resizable:!1,hidedlg:!0,editable:!0,search:!1})}})}})},expandRow:function(b){this.each(function(){var d=this;if(d.grid&&d.p.treeGrid){var c=a(d).jqGrid("getNodeChildren",b),f=d.p.treeReader.expanded_field;a(c).each(function(){var b=
399
- a.jgrid.getAccessor(this,d.p.localReader.id);a("#"+b,d.grid.bDiv).css("display","");this[f]&&a(d).jqGrid("expandRow",this)})}})},collapseRow:function(b){this.each(function(){var d=this;if(d.grid&&d.p.treeGrid){var c=a(d).jqGrid("getNodeChildren",b),f=d.p.treeReader.expanded_field;a(c).each(function(){var b=a.jgrid.getAccessor(this,d.p.localReader.id);a("#"+b,d.grid.bDiv).css("display","none");this[f]&&a(d).jqGrid("collapseRow",this)})}})},getRootNodes:function(){var b=[];this.each(function(){var d=
400
- this;if(d.grid&&d.p.treeGrid)switch(d.p.treeGridModel){case "nested":var c=d.p.treeReader.level_field;a(d.p.data).each(function(){parseInt(this[c],10)===parseInt(d.p.tree_root_level,10)&&b.push(this)});break;case "adjacency":var f=d.p.treeReader.parent_id_field;a(d.p.data).each(function(){(this[f]===null||String(this[f]).toLowerCase()=="null")&&b.push(this)})}});return b},getNodeDepth:function(b){var d=null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":d=
401
- parseInt(b[this.p.treeReader.level_field],10)-parseInt(this.p.tree_root_level,10);break;case "adjacency":d=a(this).jqGrid("getNodeAncestors",b).length}});return d},getNodeParent:function(b){var d=null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var c=this.p.treeReader.left_field,f=this.p.treeReader.right_field,h=this.p.treeReader.level_field,g=parseInt(b[c],10),j=parseInt(b[f],10),e=parseInt(b[h],10);a(this.p.data).each(function(){if(parseInt(this[h],
402
- 10)===e-1&&parseInt(this[c],10)<g&&parseInt(this[f],10)>j)return d=this,!1});break;case "adjacency":var l=this.p.treeReader.parent_id_field,k=this.p.localReader.id;a(this.p.data).each(function(){if(this[k]==b[l])return d=this,!1})}});return d},getNodeChildren:function(b){var d=[];this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var c=this.p.treeReader.left_field,f=this.p.treeReader.right_field,h=this.p.treeReader.level_field,g=parseInt(b[c],10),j=parseInt(b[f],
403
- 10),e=parseInt(b[h],10);a(this.p.data).each(function(){parseInt(this[h],10)===e+1&&parseInt(this[c],10)>g&&parseInt(this[f],10)<j&&d.push(this)});break;case "adjacency":var l=this.p.treeReader.parent_id_field,k=this.p.localReader.id;a(this.p.data).each(function(){this[l]==b[k]&&d.push(this)})}});return d},getFullTreeNode:function(b){var d=[];this.each(function(){var c;if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var f=this.p.treeReader.left_field,h=this.p.treeReader.right_field,
404
- g=this.p.treeReader.level_field,j=parseInt(b[f],10),e=parseInt(b[h],10),l=parseInt(b[g],10);a(this.p.data).each(function(){parseInt(this[g],10)>=l&&parseInt(this[f],10)>=j&&parseInt(this[f],10)<=e&&d.push(this)});break;case "adjacency":if(b){d.push(b);var k=this.p.treeReader.parent_id_field,o=this.p.localReader.id;a(this.p.data).each(function(a){c=d.length;for(a=0;a<c;a++)if(d[a][o]==this[k]){d.push(this);break}})}}});return d},getNodeAncestors:function(b){var d=[];this.each(function(){if(this.grid&&
395
+ (function(a){a.jgrid.extend({setTreeNode:function(b,d){return this.each(function(){var c=this;if(c.grid&&c.p.treeGrid)for(var f=c.p.expColInd,g=c.p.treeReader.expanded_field,h=c.p.treeReader.leaf_field,j=c.p.treeReader.level_field,e=c.p.treeReader.icon_field,l=c.p.treeReader.loaded,k,n,o,p;b<d;){p=c.p.data[c.p._index[c.rows[b].id]];if(c.p.treeGridModel=="nested"&&!p[h])k=parseInt(p[c.p.treeReader.left_field],10),n=parseInt(p[c.p.treeReader.right_field],10),p[h]=n===k+1?"true":"false",c.rows[b].cells[c.p._treeleafpos].innerHTML=
396
+ p[h];k=parseInt(p[j],10);c.p.tree_root_level===0?(o=k+1,n=k):(o=k,n=k-1);o="<div class='tree-wrap tree-wrap-"+c.p.direction+"' style='width:"+o*18+"px;'>";o+="<div style='"+(c.p.direction=="rtl"?"right:":"left:")+n*18+"px;' class='ui-icon ";p[l]!==void 0&&(p[l]=p[l]=="true"||p[l]===!0?!0:!1);p[h]=="true"||p[h]===!0?(o+=(p[e]!==void 0&&p[e]!==""?p[e]:c.p.treeIcons.leaf)+" tree-leaf treeclick'",p[h]=!0,n="leaf"):(p[h]=!1,n="");p[g]=(p[g]=="true"||p[g]===!0?!0:!1)&&p[l];o+=p[g]===!1?p[h]===!0?"'":c.p.treeIcons.plus+
397
+ " tree-plus treeclick'":p[h]===!0?"'":c.p.treeIcons.minus+" tree-minus treeclick'";o+="></div></div>";a(c.rows[b].cells[f]).wrapInner("<span class='cell-wrapper"+n+"'></span>").prepend(o);k!==parseInt(c.p.tree_root_level,10)&&((p=(p=a(c).jqGrid("getNodeParent",p))&&p.hasOwnProperty(g)?p[g]:!0)||a(c.rows[b]).css("display","none"));a(c.rows[b].cells[f]).find("div.treeclick").bind("click",function(b){b=a(b.target||b.srcElement,c.rows).closest("tr.jqgrow")[0].id;b=c.p._index[b];c.p.data[b][h]||(c.p.data[b][g]?
398
+ (a(c).jqGrid("collapseRow",c.p.data[b]),a(c).jqGrid("collapseNode",c.p.data[b])):(a(c).jqGrid("expandRow",c.p.data[b]),a(c).jqGrid("expandNode",c.p.data[b])));return!1});c.p.ExpandColClick===!0&&a(c.rows[b].cells[f]).find("span.cell-wrapper").css("cursor","pointer").bind("click",function(b){var b=a(b.target||b.srcElement,c.rows).closest("tr.jqgrow")[0].id,d=c.p._index[b];c.p.data[d][h]||(c.p.data[d][g]?(a(c).jqGrid("collapseRow",c.p.data[d]),a(c).jqGrid("collapseNode",c.p.data[d])):(a(c).jqGrid("expandRow",
399
+ c.p.data[d]),a(c).jqGrid("expandNode",c.p.data[d])));a(c).jqGrid("setSelection",b);return!1});b++}})},setTreeGrid:function(){return this.each(function(){var b=this,d=0,c=!1,f,g,h=[];if(b.p.treeGrid){b.p.treedatatype||a.extend(b.p,{treedatatype:b.p.datatype});b.p.subGrid=!1;b.p.altRows=!1;b.p.pgbuttons=!1;b.p.pginput=!1;b.p.gridview=!0;if(b.p.rowTotal===null)b.p.rowNum=1E4;b.p.multiselect=!1;b.p.rowList=[];b.p.expColInd=0;b.p.treeIcons=a.extend({plus:"ui-icon-triangle-1-"+(b.p.direction=="rtl"?"w":
400
+ "e"),minus:"ui-icon-triangle-1-s",leaf:"ui-icon-radio-off"},b.p.treeIcons||{});if(b.p.treeGridModel=="nested")b.p.treeReader=a.extend({level_field:"level",left_field:"lft",right_field:"rgt",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},b.p.treeReader);else if(b.p.treeGridModel=="adjacency")b.p.treeReader=a.extend({level_field:"level",parent_id_field:"parent",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},b.p.treeReader);for(g in b.p.colModel)if(b.p.colModel.hasOwnProperty(g)){f=
401
+ b.p.colModel[g].name;if(f==b.p.ExpandColumn&&!c)c=!0,b.p.expColInd=d;d++;for(var j in b.p.treeReader)b.p.treeReader[j]==f&&h.push(f)}a.each(b.p.treeReader,function(c,f){if(f&&a.inArray(f,h)===-1){if(c==="leaf_field")b.p._treeleafpos=d;d++;b.p.colNames.push(f);b.p.colModel.push({name:f,width:1,hidden:!0,sortable:!1,resizable:!1,hidedlg:!0,editable:!0,search:!1})}})}})},expandRow:function(b){this.each(function(){var d=this;if(d.grid&&d.p.treeGrid){var c=a(d).jqGrid("getNodeChildren",b),f=d.p.treeReader.expanded_field;
402
+ a(c).each(function(){var b=a.jgrid.getAccessor(this,d.p.localReader.id);a("#"+b,d.grid.bDiv).css("display","");this[f]&&a(d).jqGrid("expandRow",this)})}})},collapseRow:function(b){this.each(function(){var d=this;if(d.grid&&d.p.treeGrid){var c=a(d).jqGrid("getNodeChildren",b),f=d.p.treeReader.expanded_field;a(c).each(function(){var b=a.jgrid.getAccessor(this,d.p.localReader.id);a("#"+b,d.grid.bDiv).css("display","none");this[f]&&a(d).jqGrid("collapseRow",this)})}})},getRootNodes:function(){var b=[];
403
+ this.each(function(){var d=this;if(d.grid&&d.p.treeGrid)switch(d.p.treeGridModel){case "nested":var c=d.p.treeReader.level_field;a(d.p.data).each(function(){parseInt(this[c],10)===parseInt(d.p.tree_root_level,10)&&b.push(this)});break;case "adjacency":var f=d.p.treeReader.parent_id_field;a(d.p.data).each(function(){(this[f]===null||String(this[f]).toLowerCase()=="null")&&b.push(this)})}});return b},getNodeDepth:function(b){var d=null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":d=
404
+ parseInt(b[this.p.treeReader.level_field],10)-parseInt(this.p.tree_root_level,10);break;case "adjacency":d=a(this).jqGrid("getNodeAncestors",b).length}});return d},getNodeParent:function(b){var d=null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var c=this.p.treeReader.left_field,f=this.p.treeReader.right_field,g=this.p.treeReader.level_field,h=parseInt(b[c],10),j=parseInt(b[f],10),e=parseInt(b[g],10);a(this.p.data).each(function(){if(parseInt(this[g],
405
+ 10)===e-1&&parseInt(this[c],10)<h&&parseInt(this[f],10)>j)return d=this,!1});break;case "adjacency":var l=this.p.treeReader.parent_id_field,k=this.p.localReader.id;a(this.p.data).each(function(){if(this[k]==b[l])return d=this,!1})}});return d},getNodeChildren:function(b){var d=[];this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var c=this.p.treeReader.left_field,f=this.p.treeReader.right_field,g=this.p.treeReader.level_field,h=parseInt(b[c],10),j=parseInt(b[f],
406
+ 10),e=parseInt(b[g],10);a(this.p.data).each(function(){parseInt(this[g],10)===e+1&&parseInt(this[c],10)>h&&parseInt(this[f],10)<j&&d.push(this)});break;case "adjacency":var l=this.p.treeReader.parent_id_field,k=this.p.localReader.id;a(this.p.data).each(function(){this[l]==b[k]&&d.push(this)})}});return d},getFullTreeNode:function(b){var d=[];this.each(function(){var c;if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var f=this.p.treeReader.left_field,g=this.p.treeReader.right_field,
407
+ h=this.p.treeReader.level_field,j=parseInt(b[f],10),e=parseInt(b[g],10),l=parseInt(b[h],10);a(this.p.data).each(function(){parseInt(this[h],10)>=l&&parseInt(this[f],10)>=j&&parseInt(this[f],10)<=e&&d.push(this)});break;case "adjacency":if(b){d.push(b);var k=this.p.treeReader.parent_id_field,n=this.p.localReader.id;a(this.p.data).each(function(a){c=d.length;for(a=0;a<c;a++)if(d[a][n]==this[k]){d.push(this);break}})}}});return d},getNodeAncestors:function(b){var d=[];this.each(function(){if(this.grid&&
405
408
  this.p.treeGrid)for(var c=a(this).jqGrid("getNodeParent",b);c;)d.push(c),c=a(this).jqGrid("getNodeParent",c)});return d},isVisibleNode:function(b){var d=!0;this.each(function(){if(this.grid&&this.p.treeGrid){var c=a(this).jqGrid("getNodeAncestors",b),f=this.p.treeReader.expanded_field;a(c).each(function(){d=d&&this[f];if(!d)return!1})}});return d},isNodeLoaded:function(b){var d;this.each(function(){if(this.grid&&this.p.treeGrid){var c=this.p.treeReader.leaf_field;d=b!==void 0?b.loaded!==void 0?b.loaded:
406
- b[c]||a(this).jqGrid("getNodeChildren",b).length>0?!0:!1:!1}});return d},expandNode:function(b){return this.each(function(){if(this.grid&&this.p.treeGrid){var d=this.p.treeReader.expanded_field,c=this.p.treeReader.parent_id_field,f=this.p.treeReader.loaded,h=this.p.treeReader.level_field,g=this.p.treeReader.left_field,j=this.p.treeReader.right_field;if(!b[d]){var e=a.jgrid.getAccessor(b,this.p.localReader.id),l=a("#"+e,this.grid.bDiv)[0],k=this.p._index[e];a(this).jqGrid("isNodeLoaded",this.p.data[k])?
407
- (b[d]=!0,a("div.treeclick",l).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus")):(b[d]=!0,a("div.treeclick",l).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus"),this.p.treeANode=l.rowIndex,this.p.datatype=this.p.treedatatype,this.p.treeGridModel=="nested"?a(this).jqGrid("setGridParam",{postData:{nodeid:e,n_left:b[g],n_right:b[j],n_level:b[h]}}):a(this).jqGrid("setGridParam",{postData:{nodeid:e,parentid:b[c],
408
- n_level:b[h]}}),a(this).trigger("reloadGrid"),b[f]=!0,this.p.treeGridModel=="nested"?a(this).jqGrid("setGridParam",{postData:{nodeid:"",n_left:"",n_right:"",n_level:""}}):a(this).jqGrid("setGridParam",{postData:{nodeid:"",parentid:"",n_level:""}}))}}})},collapseNode:function(b){return this.each(function(){if(this.grid&&this.p.treeGrid&&b.expanded){b.expanded=!1;var d=a.jgrid.getAccessor(b,this.p.localReader.id),d=a("#"+d,this.grid.bDiv)[0];a("div.treeclick",d).removeClass(this.p.treeIcons.minus+" tree-minus").addClass(this.p.treeIcons.plus+
409
- " tree-plus")}})},SortTree:function(b,d,c,f){return this.each(function(){if(this.grid&&this.p.treeGrid){var h,g,j,e=[],l=this,k;h=a(this).jqGrid("getRootNodes");h=a.jgrid.from(h);h.orderBy(b,d,c,f);k=h.select();h=0;for(g=k.length;h<g;h++)j=k[h],e.push(j),a(this).jqGrid("collectChildrenSortTree",e,j,b,d,c,f);a.each(e,function(b){var c=a.jgrid.getAccessor(this,l.p.localReader.id);a("#"+l.p.id+" tbody tr:eq("+b+")").after(a("tr#"+c,l.grid.bDiv))});e=k=h=null}})},collectChildrenSortTree:function(b,d,
410
- c,f,h,g){return this.each(function(){if(this.grid&&this.p.treeGrid){var j,e,l,k;j=a(this).jqGrid("getNodeChildren",d);j=a.jgrid.from(j);j.orderBy(c,f,h,g);k=j.select();j=0;for(e=k.length;j<e;j++)l=k[j],b.push(l),a(this).jqGrid("collectChildrenSortTree",b,l,c,f,h,g)}})},setTreeRow:function(b,d){var c=!1;this.each(function(){this.grid&&this.p.treeGrid&&(c=a(this).jqGrid("setRowData",b,d))});return c},delTreeNode:function(b){return this.each(function(){var d=this.p.localReader.id,c=this.p.treeReader.left_field,
411
- f=this.p.treeReader.right_field,h,g,j;if(this.grid&&this.p.treeGrid){var e=this.p._index[b];if(e!==void 0){h=parseInt(this.p.data[e][f],10);g=h-parseInt(this.p.data[e][c],10)+1;e=a(this).jqGrid("getFullTreeNode",this.p.data[e]);if(e.length>0)for(var l=0;l<e.length;l++)a(this).jqGrid("delRowData",e[l][d]);if(this.p.treeGridModel==="nested"){d=a.jgrid.from(this.p.data).greater(c,h,{stype:"integer"}).select();if(d.length)for(j in d)d[j][c]=parseInt(d[j][c],10)-g;d=a.jgrid.from(this.p.data).greater(f,
412
- h,{stype:"integer"}).select();if(d.length)for(j in d)d[j][f]=parseInt(d[j][f],10)-g}}}})},addChildNode:function(b,d,c){var f=this[0];if(c){var h=f.p.treeReader.expanded_field,g=f.p.treeReader.leaf_field,j=f.p.treeReader.level_field,e=f.p.treeReader.parent_id_field,l=f.p.treeReader.left_field,k=f.p.treeReader.right_field,o=f.p.treeReader.loaded,m,n,p,s,q;m=0;var r=d,t;if(!b){q=f.p.data.length-1;if(q>=0)for(;q>=0;)m=Math.max(m,parseInt(f.p.data[q][f.p.localReader.id],10)),q--;b=m+1}var v=a(f).jqGrid("getInd",
413
- d);t=!1;d===void 0||d===null||d===""?(r=d=null,m="last",s=f.p.tree_root_level,q=f.p.data.length+1):(m="after",n=f.p._index[d],p=f.p.data[n],d=p[f.p.localReader.id],s=parseInt(p[j],10)+1,q=a(f).jqGrid("getFullTreeNode",p),q.length?(r=q=q[q.length-1][f.p.localReader.id],q=a(f).jqGrid("getInd",r)+1):q=a(f).jqGrid("getInd",d)+1,p[g]&&(t=!0,p[h]=!0,a(f.rows[v]).find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper").end().find("div.tree-leaf").removeClass(f.p.treeIcons.leaf+
414
- " tree-leaf").addClass(f.p.treeIcons.minus+" tree-minus"),f.p.data[n][g]=!1,p[o]=!0));n=q+1;c[h]=!1;c[o]=!0;c[j]=s;c[g]=!0;f.p.treeGridModel==="adjacency"&&(c[e]=d);if(f.p.treeGridModel==="nested"){var w;if(d!==null){g=parseInt(p[k],10);j=a.jgrid.from(f.p.data);j=j.greaterOrEquals(k,g,{stype:"integer"});j=j.select();if(j.length)for(w in j)j[w][l]=j[w][l]>g?parseInt(j[w][l],10)+2:j[w][l],j[w][k]=j[w][k]>=g?parseInt(j[w][k],10)+2:j[w][k];c[l]=g;c[k]=g+1}else{g=parseInt(a(f).jqGrid("getCol",k,!1,"max"),
415
- 10);j=a.jgrid.from(f.p.data).greater(l,g,{stype:"integer"}).select();if(j.length)for(w in j)j[w][l]=parseInt(j[w][l],10)+2;j=a.jgrid.from(f.p.data).greater(k,g,{stype:"integer"}).select();if(j.length)for(w in j)j[w][k]=parseInt(j[w][k],10)+2;c[l]=g+1;c[k]=g+2}}if(d===null||a(f).jqGrid("isNodeLoaded",p)||t)a(f).jqGrid("addRowData",b,c,m,r),a(f).jqGrid("setTreeNode",q,n);p&&!p[h]&&a(f.rows[v]).find("div.treeclick").click()}}})})(jQuery);
409
+ b[c]||a(this).jqGrid("getNodeChildren",b).length>0?!0:!1:!1}});return d},expandNode:function(b){return this.each(function(){if(this.grid&&this.p.treeGrid){var d=this.p.treeReader.expanded_field,c=this.p.treeReader.parent_id_field,f=this.p.treeReader.loaded,g=this.p.treeReader.level_field,h=this.p.treeReader.left_field,j=this.p.treeReader.right_field;if(!b[d]){var e=a.jgrid.getAccessor(b,this.p.localReader.id),l=a("#"+e,this.grid.bDiv)[0],k=this.p._index[e];a(this).jqGrid("isNodeLoaded",this.p.data[k])?
410
+ (b[d]=!0,a("div.treeclick",l).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus")):(b[d]=!0,a("div.treeclick",l).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus"),this.p.treeANode=l.rowIndex,this.p.datatype=this.p.treedatatype,this.p.treeGridModel=="nested"?a(this).jqGrid("setGridParam",{postData:{nodeid:e,n_left:b[h],n_right:b[j],n_level:b[g]}}):a(this).jqGrid("setGridParam",{postData:{nodeid:e,parentid:b[c],
411
+ n_level:b[g]}}),a(this).trigger("reloadGrid"),b[f]=!0,this.p.treeGridModel=="nested"?a(this).jqGrid("setGridParam",{postData:{nodeid:"",n_left:"",n_right:"",n_level:""}}):a(this).jqGrid("setGridParam",{postData:{nodeid:"",parentid:"",n_level:""}}))}}})},collapseNode:function(b){return this.each(function(){if(this.grid&&this.p.treeGrid&&b.expanded){b.expanded=!1;var d=a.jgrid.getAccessor(b,this.p.localReader.id),d=a("#"+d,this.grid.bDiv)[0];a("div.treeclick",d).removeClass(this.p.treeIcons.minus+" tree-minus").addClass(this.p.treeIcons.plus+
412
+ " tree-plus")}})},SortTree:function(b,d,c,f){return this.each(function(){if(this.grid&&this.p.treeGrid){var g,h,j,e=[],l=this,k;g=a(this).jqGrid("getRootNodes");g=a.jgrid.from(g);g.orderBy(b,d,c,f);k=g.select();g=0;for(h=k.length;g<h;g++)j=k[g],e.push(j),a(this).jqGrid("collectChildrenSortTree",e,j,b,d,c,f);a.each(e,function(b){var c=a.jgrid.getAccessor(this,l.p.localReader.id);a("#"+l.p.id+" tbody tr:eq("+b+")").after(a("tr#"+c,l.grid.bDiv))});e=k=g=null}})},collectChildrenSortTree:function(b,d,
413
+ c,f,g,h){return this.each(function(){if(this.grid&&this.p.treeGrid){var j,e,l,k;j=a(this).jqGrid("getNodeChildren",d);j=a.jgrid.from(j);j.orderBy(c,f,g,h);k=j.select();j=0;for(e=k.length;j<e;j++)l=k[j],b.push(l),a(this).jqGrid("collectChildrenSortTree",b,l,c,f,g,h)}})},setTreeRow:function(b,d){var c=!1;this.each(function(){this.grid&&this.p.treeGrid&&(c=a(this).jqGrid("setRowData",b,d))});return c},delTreeNode:function(b){return this.each(function(){var d=this.p.localReader.id,c=this.p.treeReader.left_field,
414
+ f=this.p.treeReader.right_field,g,h,j;if(this.grid&&this.p.treeGrid){var e=this.p._index[b];if(e!==void 0){g=parseInt(this.p.data[e][f],10);h=g-parseInt(this.p.data[e][c],10)+1;e=a(this).jqGrid("getFullTreeNode",this.p.data[e]);if(e.length>0)for(var l=0;l<e.length;l++)a(this).jqGrid("delRowData",e[l][d]);if(this.p.treeGridModel==="nested"){d=a.jgrid.from(this.p.data).greater(c,g,{stype:"integer"}).select();if(d.length)for(j in d)d[j][c]=parseInt(d[j][c],10)-h;d=a.jgrid.from(this.p.data).greater(f,
415
+ g,{stype:"integer"}).select();if(d.length)for(j in d)d[j][f]=parseInt(d[j][f],10)-h}}}})},addChildNode:function(b,d,c){var f=this[0];if(c){var g=f.p.treeReader.expanded_field,h=f.p.treeReader.leaf_field,j=f.p.treeReader.level_field,e=f.p.treeReader.parent_id_field,l=f.p.treeReader.left_field,k=f.p.treeReader.right_field,n=f.p.treeReader.loaded,o,p,m,r,q;o=0;var s=d,t;if(!b){q=f.p.data.length-1;if(q>=0)for(;q>=0;)o=Math.max(o,parseInt(f.p.data[q][f.p.localReader.id],10)),q--;b=o+1}var w=a(f).jqGrid("getInd",
416
+ d);t=!1;d===void 0||d===null||d===""?(s=d=null,o="last",r=f.p.tree_root_level,q=f.p.data.length+1):(o="after",p=f.p._index[d],m=f.p.data[p],d=m[f.p.localReader.id],r=parseInt(m[j],10)+1,q=a(f).jqGrid("getFullTreeNode",m),q.length?(s=q=q[q.length-1][f.p.localReader.id],q=a(f).jqGrid("getInd",s)+1):q=a(f).jqGrid("getInd",d)+1,m[h]&&(t=!0,m[g]=!0,a(f.rows[w]).find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper").end().find("div.tree-leaf").removeClass(f.p.treeIcons.leaf+
417
+ " tree-leaf").addClass(f.p.treeIcons.minus+" tree-minus"),f.p.data[p][h]=!1,m[n]=!0));p=q+1;c[g]=!1;c[n]=!0;c[j]=r;c[h]=!0;f.p.treeGridModel==="adjacency"&&(c[e]=d);if(f.p.treeGridModel==="nested"){var v;if(d!==null){h=parseInt(m[k],10);j=a.jgrid.from(f.p.data);j=j.greaterOrEquals(k,h,{stype:"integer"});j=j.select();if(j.length)for(v in j)j[v][l]=j[v][l]>h?parseInt(j[v][l],10)+2:j[v][l],j[v][k]=j[v][k]>=h?parseInt(j[v][k],10)+2:j[v][k];c[l]=h;c[k]=h+1}else{h=parseInt(a(f).jqGrid("getCol",k,!1,"max"),
418
+ 10);j=a.jgrid.from(f.p.data).greater(l,h,{stype:"integer"}).select();if(j.length)for(v in j)j[v][l]=parseInt(j[v][l],10)+2;j=a.jgrid.from(f.p.data).greater(k,h,{stype:"integer"}).select();if(j.length)for(v in j)j[v][k]=parseInt(j[v][k],10)+2;c[l]=h+1;c[k]=h+2}}if(d===null||a(f).jqGrid("isNodeLoaded",m)||t)a(f).jqGrid("addRowData",b,c,o,s),a(f).jqGrid("setTreeNode",q,p);m&&!m[g]&&a(f.rows[w]).find("div.treeclick").click()}}})})(jQuery);
416
419
  (function(a){a.jgrid.extend({groupingSetup:function(){return this.each(function(){var b=this.p.groupingView;if(b!==null&&(typeof b==="object"||a.isFunction(b)))if(b.groupField.length){if(typeof b.visibiltyOnNextGrouping=="undefined")b.visibiltyOnNextGrouping=[];for(var d=0;d<b.groupField.length;d++)if(b.groupOrder[d]||(b.groupOrder[d]="asc"),b.groupText[d]||(b.groupText[d]="{0}"),typeof b.groupColumnShow[d]!="boolean"&&(b.groupColumnShow[d]=!0),typeof b.groupSummary[d]!="boolean"&&(b.groupSummary[d]=
417
- !1),b.groupColumnShow[d]===!0?(b.visibiltyOnNextGrouping[d]=!0,a(this).jqGrid("showCol",b.groupField[d])):(b.visibiltyOnNextGrouping[d]=a("#"+this.p.id+"_"+b.groupField[d]).is(":visible"),a(this).jqGrid("hideCol",b.groupField[d])),b.sortitems[d]=[],b.sortnames[d]=[],b.summaryval[d]=[],b.groupSummary[d]){b.summary[d]=[];for(var c=this.p.colModel,f=0,h=c.length;f<h;f++)c[f].summaryType&&b.summary[d].push({nm:c[f].name,st:c[f].summaryType,v:""})}this.p.scroll=!1;this.p.rownumbers=!1;this.p.subGrid=!1;
418
- this.p.treeGrid=!1;this.p.gridview=!0}else this.p.grouping=!1;else this.p.grouping=!1})},groupingPrepare:function(b,d,c,f){this.each(function(){d[0]+="";var h=d[0].toString().split(" ").join(""),g=this.p.groupingView,j=this;c.hasOwnProperty(h)?c[h].push(b):(c[h]=[],c[h].push(b),g.sortitems[0].push(h),g.sortnames[0].push(a.trim(d[0].toString())),g.summaryval[0][h]=a.extend(!0,[],g.summary[0]));g.groupSummary[0]&&a.each(g.summaryval[0][h],function(){this.v=a.isFunction(this.st)?this.st.call(j,this.v,
419
- this.nm,f):a(j).jqGrid("groupingCalculations."+this.st,this.v,this.nm,f)})});return c},groupingToggle:function(b){this.each(function(){var d=this.p.groupingView,c=b.lastIndexOf("_"),f=b.substring(0,c+1),c=parseInt(b.substring(c+1),10)+1,h=d.minusicon,g=d.plusicon,j=a("#"+b)[0].nextSibling,e=a("#"+b+" span.tree-wrap-"+this.p.direction),l=!1;if(e.hasClass(h)){if(d.showSummaryOnHide&&d.groupSummary[0]){if(j)for(;j;){if(a(j).hasClass("jqfoot"))break;a(j).hide();j=j.nextSibling}}else if(j)for(;j;){if(a(j).attr("id")==
420
- f+String(c))break;a(j).hide();j=j.nextSibling}e.removeClass(h).addClass(g);l=!0}else{if(j)for(;j;){if(a(j).attr("id")==f+String(c))break;a(j).show();j=j.nextSibling}e.removeClass(g).addClass(h);l=!1}a.isFunction(this.p.onClickGroup)&&this.p.onClickGroup.call(this,b,l)});return!1},groupingRender:function(b,d){return this.each(function(){var c=this,f=c.p.groupingView,h="",g="",j,e="",l,k,o;f.groupDataSorted||(f.sortitems[0].sort(),f.sortnames[0].sort(),f.groupOrder[0].toLowerCase()=="desc"&&(f.sortitems[0].reverse(),
421
- f.sortnames[0].reverse()));e=f.groupCollapse?f.plusicon:f.minusicon;e+=" tree-wrap-"+c.p.direction;for(o=0;o<d;){if(c.p.colModel[o].name==f.groupField[0]){k=o;break}o++}a.each(f.sortitems[0],function(m,n){j=c.p.id+"ghead_"+m;g="<span style='cursor:pointer;' class='ui-icon "+e+"' onclick=\"jQuery('#"+c.p.id+"').jqGrid('groupingToggle','"+j+"');return false;\"></span>";try{l=c.formatter(j,f.sortnames[0][m],k,f.sortitems[0])}catch(o){l=f.sortnames[0][m]}h+='<tr id="'+j+'" role="row" class= "ui-widget-content jqgroup ui-row-'+
422
- c.p.direction+'"><td colspan="'+d+'">'+g+a.jgrid.format(f.groupText[0],l,b[n].length)+"</td></tr>";for(var s=0;s<b[n].length;s++)h+=b[n][s].join("");if(f.groupSummary[0]){s="";f.groupCollapse&&!f.showSummaryOnHide&&(s=' style="display:none;"');h+="<tr"+s+' role="row" class="ui-widget-content jqfoot ui-row-'+c.p.direction+'">';for(var s=f.summaryval[0][n],q=c.p.colModel,r,t=b[n].length,v=0;v<d;v++){var w="<td "+c.formatCol(v,1,"")+">&#160;</td>",z="{0}";a.each(s,function(){if(this.nm==q[v].name){if(q[v].summaryTpl)z=
423
- q[v].summaryTpl;this.st=="avg"&&this.v&&t>0&&(this.v/=t);try{r=c.formatter("",this.v,v,this)}catch(b){r=this.v}w="<td "+c.formatCol(v,1,"")+">"+a.jgrid.format(z,r)+"</td>";return!1}});h+=w}h+="</tr>"}});a("#"+c.p.id+" tbody:first").append(h);h=null})},groupingGroupBy:function(b,d){return this.each(function(){typeof b=="string"&&(b=[b]);var c=this.p.groupingView;this.p.grouping=!0;for(var f=0;f<c.groupField.length;f++)!c.groupColumnShow[f]&&c.visibiltyOnNextGrouping[f]&&a(this).jqGrid("showCol",c.groupField[f]);
424
- for(f=0;f<b.length;f++)c.visibiltyOnNextGrouping[f]=a("#"+this.p.id+"_"+b[f]).is(":visible");this.p.groupingView=a.extend(this.p.groupingView,d||{});c.groupField=b;a(this).trigger("reloadGrid")})},groupingRemove:function(b){return this.each(function(){typeof b=="undefined"&&(b=!0);this.p.grouping=!1;if(b===!0){for(var d=this.p.groupingView,c=0;c<d.groupField.length;c++)!d.groupColumnShow[c]&&d.visibiltyOnNextGrouping[c]&&a(this).jqGrid("showCol",d.groupField);a("tr.jqgroup, tr.jqfoot","#"+this.p.id+
425
- " tbody:first").remove();a("tr.jqgrow:hidden","#"+this.p.id+" tbody:first").show()}else a(this).trigger("reloadGrid")})},groupingCalculations:{sum:function(a,d,c){return parseFloat(a||0)+parseFloat(c[d]||0)},min:function(a,d,c){if(a==="")return parseFloat(c[d]||0);return Math.min(parseFloat(a),parseFloat(c[d]||0))},max:function(a,d,c){if(a==="")return parseFloat(c[d]||0);return Math.max(parseFloat(a),parseFloat(c[d]||0))},count:function(a,d,c){a===""&&(a=0);return c.hasOwnProperty(d)?a+1:0},avg:function(a,
426
- d,c){return parseFloat(a||0)+parseFloat(c[d]||0)}}})})(jQuery);
427
- (function(a){a.jgrid.extend({jqGridImport:function(b){b=a.extend({imptype:"xml",impstring:"",impurl:"",mtype:"GET",impData:{},xmlGrid:{config:"roots>grid",data:"roots>rows"},jsonGrid:{config:"grid",data:"data"},ajaxOptions:{}},b||{});return this.each(function(){var d=this,c=function(b,c){var e=a(c.xmlGrid.config,b)[0],f=a(c.xmlGrid.data,b)[0],h;if(xmlJsonClass.xml2json&&a.jgrid.parse){var e=xmlJsonClass.xml2json(e," "),e=a.jgrid.parse(e),o;for(o in e)e.hasOwnProperty(o)&&(h=e[o]);f?(f=e.grid.datatype,
428
- e.grid.datatype="xmlstring",e.grid.datastr=b,a(d).jqGrid(h).jqGrid("setGridParam",{datatype:f})):a(d).jqGrid(h)}else alert("xml2json or parse are not present")},f=function(b,c){if(b&&typeof b=="string"){var e=a.jgrid.parse(b),f=e[c.jsonGrid.config];if(e=e[c.jsonGrid.data]){var h=f.datatype;f.datatype="jsonstring";f.datastr=e;a(d).jqGrid(f).jqGrid("setGridParam",{datatype:h})}else a(d).jqGrid(f)}};switch(b.imptype){case "xml":a.ajax(a.extend({url:b.impurl,type:b.mtype,data:b.impData,dataType:"xml",
429
- complete:function(d,f){f=="success"&&(c(d.responseXML,b),a.isFunction(b.importComplete)&&b.importComplete(d))}},b.ajaxOptions));break;case "xmlstring":if(b.impstring&&typeof b.impstring=="string"){var h=a.jgrid.stringToDoc(b.impstring);if(h)c(h,b),a.isFunction(b.importComplete)&&b.importComplete(h),b.impstring=null;h=null}break;case "json":a.ajax(a.extend({url:b.impurl,type:b.mtype,data:b.impData,dataType:"json",complete:function(c,d){d=="success"&&(f(c.responseText,b),a.isFunction(b.importComplete)&&
420
+ !1),b.groupColumnShow[d]===!0?(b.visibiltyOnNextGrouping[d]=!0,a(this).jqGrid("showCol",b.groupField[d])):(b.visibiltyOnNextGrouping[d]=a("#"+this.p.id+"_"+b.groupField[d]).is(":visible"),a(this).jqGrid("hideCol",b.groupField[d])),b.sortitems[d]=[],b.sortnames[d]=[],b.summaryval[d]=[],b.groupSummary[d]){b.summary[d]=[];for(var c=this.p.colModel,f=0,g=c.length;f<g;f++)c[f].summaryType&&b.summary[d].push({nm:c[f].name,st:c[f].summaryType,v:""})}this.p.scroll=!1;this.p.rownumbers=!1;this.p.subGrid=!1;
421
+ this.p.treeGrid=!1;this.p.gridview=!0}else this.p.grouping=!1;else this.p.grouping=!1})},groupingPrepare:function(b,d,c,f){this.each(function(){d[0]+="";var g=d[0].toString().split(" ").join(""),h=this.p.groupingView,j=this;c.hasOwnProperty(g)?c[g].push(b):(c[g]=[],c[g].push(b),h.sortitems[0].push(g),h.sortnames[0].push(a.trim(d[0].toString())),h.summaryval[0][g]=a.extend(!0,[],h.summary[0]));h.groupSummary[0]&&a.each(h.summaryval[0][g],function(){this.v=a.isFunction(this.st)?this.st.call(j,this.v,
422
+ this.nm,f):a(j).jqGrid("groupingCalculations."+this.st,this.v,this.nm,f)})});return c},groupingToggle:function(b){this.each(function(){var d=this.p.groupingView,c=b.lastIndexOf("_"),f=b.substring(0,c+1),c=parseInt(b.substring(c+1),10)+1,g=d.minusicon,h=d.plusicon,j=a("#"+b),j=j.length?j[0].nextSibling:null,e=a("#"+b+" span.tree-wrap-"+this.p.direction),l=!1;if(e.hasClass(g)){if(d.showSummaryOnHide&&d.groupSummary[0]){if(j)for(;j;){if(a(j).hasClass("jqfoot"))break;a(j).hide();j=j.nextSibling}}else if(j)for(;j;){if(a(j).attr("id")==
423
+ f+String(c))break;a(j).hide();j=j.nextSibling}e.removeClass(g).addClass(h);l=!0}else{if(j)for(;j;){if(a(j).attr("id")==f+String(c))break;a(j).show();j=j.nextSibling}e.removeClass(h).addClass(g)}a.isFunction(this.p.onClickGroup)&&this.p.onClickGroup.call(this,b,l)});return!1},groupingRender:function(b,d){return this.each(function(){var c=this,f=c.p.groupingView,g="",h="",j,e=f.groupCollapse?f.plusicon:f.minusicon,l,k,n;f.groupDataSorted||(f.sortitems[0].sort(),f.sortnames[0].sort(),f.groupOrder[0].toLowerCase()==
424
+ "desc"&&(f.sortitems[0].reverse(),f.sortnames[0].reverse()));e+=" tree-wrap-"+c.p.direction;for(n=0;n<d;){if(c.p.colModel[n].name==f.groupField[0]){k=n;break}n++}a.each(f.sortitems[0],function(o,n){j=c.p.id+"ghead_"+o;h="<span style='cursor:pointer;' class='ui-icon "+e+"' onclick=\"jQuery('#"+c.p.id+"').jqGrid('groupingToggle','"+j+"');return false;\"></span>";try{l=c.formatter(j,f.sortnames[0][o],k,f.sortitems[0])}catch(m){l=f.sortnames[0][o]}g+='<tr id="'+j+'" role="row" class= "ui-widget-content jqgroup ui-row-'+
425
+ c.p.direction+'"><td colspan="'+d+'">'+h+a.jgrid.format(f.groupText[0],l,b[n].length)+"</td></tr>";for(var r=0;r<b[n].length;r++)g+=b[n][r].join("");if(f.groupSummary[0]){r="";f.groupCollapse&&!f.showSummaryOnHide&&(r=' style="display:none;"');g+="<tr"+r+' role="row" class="ui-widget-content jqfoot ui-row-'+c.p.direction+'">';for(var r=f.summaryval[0][n],q=c.p.colModel,s,t=b[n].length,w=0;w<d;w++){var v="<td "+c.formatCol(w,1,"")+">&#160;</td>",z="{0}";a.each(r,function(){if(this.nm==q[w].name){if(q[w].summaryTpl)z=
426
+ q[w].summaryTpl;this.st=="avg"&&this.v&&t>0&&(this.v/=t);try{s=c.formatter("",this.v,w,this)}catch(b){s=this.v}v="<td "+c.formatCol(w,1,"")+">"+a.jgrid.format(z,s)+"</td>";return!1}});g+=v}g+="</tr>"}});a("#"+c.p.id+" tbody:first").append(g);g=null})},groupingGroupBy:function(b,d){return this.each(function(){typeof b=="string"&&(b=[b]);var c=this.p.groupingView;this.p.grouping=!0;if(typeof c.visibiltyOnNextGrouping=="undefined")c.visibiltyOnNextGrouping=[];var f;for(f=0;f<c.groupField.length;f++)!c.groupColumnShow[f]&&
427
+ c.visibiltyOnNextGrouping[f]&&a(this).jqGrid("showCol",c.groupField[f]);for(f=0;f<b.length;f++)c.visibiltyOnNextGrouping[f]=a("#"+this.p.id+"_"+b[f]).is(":visible");this.p.groupingView=a.extend(this.p.groupingView,d||{});c.groupField=b;a(this).trigger("reloadGrid")})},groupingRemove:function(b){return this.each(function(){typeof b=="undefined"&&(b=!0);this.p.grouping=!1;if(b===!0){for(var d=this.p.groupingView,c=0;c<d.groupField.length;c++)!d.groupColumnShow[c]&&d.visibiltyOnNextGrouping[c]&&a(this).jqGrid("showCol",
428
+ d.groupField);a("tr.jqgroup, tr.jqfoot","#"+this.p.id+" tbody:first").remove();a("tr.jqgrow:hidden","#"+this.p.id+" tbody:first").show()}else a(this).trigger("reloadGrid")})},groupingCalculations:{sum:function(a,d,c){return parseFloat(a||0)+parseFloat(c[d]||0)},min:function(a,d,c){return a===""?parseFloat(c[d]||0):Math.min(parseFloat(a),parseFloat(c[d]||0))},max:function(a,d,c){return a===""?parseFloat(c[d]||0):Math.max(parseFloat(a),parseFloat(c[d]||0))},count:function(a,d,c){a===""&&(a=0);return c.hasOwnProperty(d)?
429
+ a+1:0},avg:function(a,d,c){return parseFloat(a||0)+parseFloat(c[d]||0)}}})})(jQuery);
430
+ (function(a){a.jgrid.extend({jqGridImport:function(b){b=a.extend({imptype:"xml",impstring:"",impurl:"",mtype:"GET",impData:{},xmlGrid:{config:"roots>grid",data:"roots>rows"},jsonGrid:{config:"grid",data:"data"},ajaxOptions:{}},b||{});return this.each(function(){var d=this,c=function(b,c){var e=a(c.xmlGrid.config,b)[0],f=a(c.xmlGrid.data,b)[0],g;if(xmlJsonClass.xml2json&&a.jgrid.parse){var e=xmlJsonClass.xml2json(e," "),e=a.jgrid.parse(e),n;for(n in e)e.hasOwnProperty(n)&&(g=e[n]);f?(f=e.grid.datatype,
431
+ e.grid.datatype="xmlstring",e.grid.datastr=b,a(d).jqGrid(g).jqGrid("setGridParam",{datatype:f})):a(d).jqGrid(g)}else alert("xml2json or parse are not present")},f=function(b,c){if(b&&typeof b=="string"){var e=a.jgrid.parse(b),f=e[c.jsonGrid.config];if(e=e[c.jsonGrid.data]){var g=f.datatype;f.datatype="jsonstring";f.datastr=e;a(d).jqGrid(f).jqGrid("setGridParam",{datatype:g})}else a(d).jqGrid(f)}};switch(b.imptype){case "xml":a.ajax(a.extend({url:b.impurl,type:b.mtype,data:b.impData,dataType:"xml",
432
+ complete:function(d,f){f=="success"&&(c(d.responseXML,b),a.isFunction(b.importComplete)&&b.importComplete(d))}},b.ajaxOptions));break;case "xmlstring":if(b.impstring&&typeof b.impstring=="string"){var g=a.jgrid.stringToDoc(b.impstring);if(g)c(g,b),a.isFunction(b.importComplete)&&b.importComplete(g),b.impstring=null;g=null}break;case "json":a.ajax(a.extend({url:b.impurl,type:b.mtype,data:b.impData,dataType:"json",complete:function(c,d){d=="success"&&(f(c.responseText,b),a.isFunction(b.importComplete)&&
430
433
  b.importComplete(c))}},b.ajaxOptions));break;case "jsonstring":if(b.impstring&&typeof b.impstring=="string")f(b.impstring,b),a.isFunction(b.importComplete)&&b.importComplete(b.impstring),b.impstring=null}})},jqGridExport:function(b){var b=a.extend({exptype:"xmlstring",root:"grid",ident:"\t"},b||{}),d=null;this.each(function(){if(this.grid){var c=a.extend({},a(this).jqGrid("getGridParam"));c.rownumbers&&(c.colNames.splice(0,1),c.colModel.splice(0,1));c.multiselect&&(c.colNames.splice(0,1),c.colModel.splice(0,
431
434
  1));c.subGrid&&(c.colNames.splice(0,1),c.colModel.splice(0,1));c.knv=null;if(c.treeGrid)for(var f in c.treeReader)c.treeReader.hasOwnProperty(f)&&(c.colNames.splice(c.colNames.length-1),c.colModel.splice(c.colModel.length-1));switch(b.exptype){case "xmlstring":d="<"+b.root+">"+xmlJsonClass.json2xml(c,b.ident)+"</"+b.root+">";break;case "jsonstring":d="{"+xmlJsonClass.toJson(c,b.root,b.ident,!1)+"}",c.postData.filters!==void 0&&(d=d.replace(/filters":"/,'filters":'),d=d.replace(/}]}"/,"}]}"))}}});
432
435
  return d},excelExport:function(b){b=a.extend({exptype:"remote",url:null,oper:"oper",tag:"excel",exportOptions:{}},b||{});return this.each(function(){if(this.grid){var d;if(b.exptype=="remote")d=a.extend({},this.p.postData),d[b.oper]=b.tag,d=jQuery.param(d),d=b.url.indexOf("?")!=-1?b.url+"&"+d:b.url+"?"+d,window.location=d}})}})})(jQuery);
433
- (function(a){if(a.browser.msie&&a.browser.version==8)a.expr[":"].hidden=function(a){return a.offsetWidth===0||a.offsetHeight===0||a.style.display=="none"};a.jgrid._multiselect=!1;if(a.ui&&a.ui.multiselect){if(a.ui.multiselect.prototype._setSelected){var b=a.ui.multiselect.prototype._setSelected;a.ui.multiselect.prototype._setSelected=function(d,c){var f=b.call(this,d,c);if(c&&this.selectedList){var h=this.element;this.selectedList.find("li").each(function(){a(this).data("optionLink")&&a(this).data("optionLink").remove().appendTo(h)})}return f}}if(a.ui.multiselect.prototype.destroy)a.ui.multiselect.prototype.destroy=
434
- function(){this.element.show();this.container.remove();a.Widget===void 0?a.widget.prototype.destroy.apply(this,arguments):a.Widget.prototype.destroy.apply(this,arguments)};a.jgrid._multiselect=!0}a.jgrid.extend({sortableColumns:function(b){return this.each(function(){function c(){f.p.disableClick=!0}var f=this,h=f.p.id,h={tolerance:"pointer",axis:"x",scrollSensitivity:"1",items:">th:not(:has(#jqgh_"+h+"_cb,#jqgh_"+h+"_rn,#jqgh_"+h+"_subgrid),:hidden)",placeholder:{element:function(b){return a(document.createElement(b[0].nodeName)).addClass(b[0].className+
435
- " ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]},update:function(a,b){b.height(a.currentItem.innerHeight()-parseInt(a.currentItem.css("paddingTop")||0,10)-parseInt(a.currentItem.css("paddingBottom")||0,10));b.width(a.currentItem.innerWidth()-parseInt(a.currentItem.css("paddingLeft")||0,10)-parseInt(a.currentItem.css("paddingRight")||0,10))}},update:function(b,c){var d=a(c.item).parent(),d=a(">th",d),g={},h=f.p.id+"_";a.each(f.p.colModel,function(a){g[this.name]=
436
- a});var m=[];d.each(function(){var b=a(">div",this).get(0).id.replace(/^jqgh_/,"").replace(h,"");b in g&&m.push(g[b])});a(f).jqGrid("remapColumns",m,!0,!0);a.isFunction(f.p.sortable.update)&&f.p.sortable.update(m);setTimeout(function(){f.p.disableClick=!1},50)}};if(f.p.sortable.options)a.extend(h,f.p.sortable.options);else if(a.isFunction(f.p.sortable))f.p.sortable={update:f.p.sortable};if(h.start){var g=h.start;h.start=function(a,b){c();g.call(this,a,b)}}else h.start=c;f.p.sortable.exclude&&(h.items+=
437
- ":not("+f.p.sortable.exclude+")");b.sortable(h).data("sortable").floating=!0})},columnChooser:function(b){function c(b,c){b&&(typeof b=="string"?a.fn[b]&&a.fn[b].apply(c,a.makeArray(arguments).slice(2)):a.isFunction(b)&&b.apply(c,a.makeArray(arguments).slice(2)))}var f=this;if(!a("#colchooser_"+f[0].p.id).length){var h=a('<div id="colchooser_'+f[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>'),g=a("select",h),b=a.extend({width:420,height:240,
438
- classname:null,done:function(a){a&&f.jqGrid("remapColumns",a,!0)},msel:"multiselect",dlog:"dialog",dlog_opts:function(a){var b={};b[a.bSubmit]=function(){a.apply_perm();a.cleanup(!1)};b[a.bCancel]=function(){a.cleanup(!0)};return{buttons:b,close:function(){a.cleanup(!0)},modal:a.modal?a.modal:!1,resizable:a.resizable?a.resizable:!0,width:a.width+20}},apply_perm:function(){a("option",g).each(function(){this.selected?f.jqGrid("showCol",j[this.value].name):f.jqGrid("hideCol",j[this.value].name)});var c=
439
- [];a("option[selected]",g).each(function(){c.push(parseInt(this.value,10))});a.each(c,function(){delete l[j[parseInt(this,10)].name]});a.each(l,function(){var a=parseInt(this,10);var b=c,d=a;if(d>=0){var e=b.slice(),f=e.splice(d,Math.max(b.length-d,d));if(d>b.length)d=b.length;e[d]=a;c=e.concat(f)}else c=void 0});b.done&&b.done.call(f,c)},cleanup:function(a){c(b.dlog,h,"destroy");c(b.msel,g,"destroy");h.remove();a&&b.done&&b.done.call(f)},msel_opts:{}},a.jgrid.col,b||{});if(a.ui&&a.ui.multiselect&&
440
- b.msel=="multiselect"){if(!a.jgrid._multiselect){alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");return}b.msel_opts=a.extend(a.ui.multiselect.defaults,b.msel_opts)}b.caption&&h.attr("title",b.caption);b.classname&&(h.addClass(b.classname),g.addClass(b.classname));b.width&&(a(">div",h).css({width:b.width,margin:"0 auto"}),g.css("width",b.width));b.height&&(a(">div",h).css("height",b.height),g.css("height",b.height-10));var j=f.jqGrid("getGridParam","colModel"),
441
- e=f.jqGrid("getGridParam","colNames"),l={},k=[];g.empty();a.each(j,function(a){l[this.name]=a;this.hidedlg?this.hidden||k.push(a):g.append("<option value='"+a+"' "+(this.hidden?"":"selected='selected'")+">"+e[a]+"</option>")});var o=a.isFunction(b.dlog_opts)?b.dlog_opts.call(f,b):b.dlog_opts;c(b.dlog,h,o);o=a.isFunction(b.msel_opts)?b.msel_opts.call(f,b):b.msel_opts;c(b.msel,g,o)}},sortableRows:function(b){return this.each(function(){var c=this;if(c.grid&&!c.p.treeGrid&&a.fn.sortable)b=a.extend({cursor:"move",
442
- axis:"y",items:".jqgrow"},b||{}),b.start&&a.isFunction(b.start)?(b._start_=b.start,delete b.start):b._start_=!1,b.update&&a.isFunction(b.update)?(b._update_=b.update,delete b.update):b._update_=!1,b.start=function(f,h){a(h.item).css("border-width","0px");a("td",h.item).each(function(a){this.style.width=c.grid.cols[a].style.width});if(c.p.subGrid){var g=a(h.item).attr("id");try{a(c).jqGrid("collapseSubGridRow",g)}catch(j){}}b._start_&&b._start_.apply(this,[f,h])},b.update=function(f,h){a(h.item).css("border-width",
443
- "");c.p.rownumbers===!0&&a("td.jqgrid-rownum",c.rows).each(function(b){a(this).html(b+1)});b._update_&&b._update_.apply(this,[f,h])},a("tbody:first",c).sortable(b),a("tbody:first",c).disableSelection()})},gridDnD:function(b){return this.each(function(){function c(){var b=a.data(f,"dnd");a("tr.jqgrow:not(.ui-draggable)",f).draggable(a.isFunction(b.drag)?b.drag.call(a(f),b):b.drag)}var f=this;if(f.grid&&!f.p.treeGrid&&a.fn.draggable&&a.fn.droppable)if(a("#jqgrid_dnd").html()===null&&a("body").append("<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>"),
444
- typeof b=="string"&&b=="updateDnD"&&f.p.jqgdnd===!0)c();else if(b=a.extend({drag:function(b){return a.extend({start:function(c,d){if(f.p.subGrid){var h=a(d.helper).attr("id");try{a(f).jqGrid("collapseSubGridRow",h)}catch(k){}}for(h=0;h<a.data(f,"dnd").connectWith.length;h++)a(a.data(f,"dnd").connectWith[h]).jqGrid("getGridParam","reccount")=="0"&&a(a.data(f,"dnd").connectWith[h]).jqGrid("addRowData","jqg_empty_row",{});d.helper.addClass("ui-state-highlight");a("td",d.helper).each(function(a){this.style.width=
445
- f.grid.headers[a].width+"px"});b.onstart&&a.isFunction(b.onstart)&&b.onstart.call(a(f),c,d)},stop:function(c,d){if(d.helper.dropped){var h=a(d.helper).attr("id");a(f).jqGrid("delRowData",h)}for(h=0;h<a.data(f,"dnd").connectWith.length;h++)a(a.data(f,"dnd").connectWith[h]).jqGrid("delRowData","jqg_empty_row");b.onstop&&a.isFunction(b.onstop)&&b.onstop.call(a(f),c,d)}},b.drag_opts||{})},drop:function(b){return a.extend({accept:function(b){if(!a(b).hasClass("jqgrow"))return b;var c=a(b).closest("table.ui-jqgrid-btable");
446
- if(c.length>0&&a.data(c[0],"dnd")!==void 0)return b=a.data(c[0],"dnd").connectWith,a.inArray("#"+this.id,b)!=-1?!0:!1;return b},drop:function(c,d){if(a(d.draggable).hasClass("jqgrow")){var h=a(d.draggable).attr("id"),h=d.draggable.parent().parent().jqGrid("getRowData",h);if(!b.dropbyname){var k=0,o={},m,n=a("#"+this.id).jqGrid("getGridParam","colModel");try{for(var p in h){if(h.hasOwnProperty(p)&&n[k])m=n[k].name,o[m]=h[p];k++}h=o}catch(s){}}d.helper.dropped=!0;b.beforedrop&&a.isFunction(b.beforedrop)&&
447
- (m=b.beforedrop.call(this,c,d,h,a("#"+f.id),a(this)),typeof m!="undefined"&&m!==null&&typeof m=="object"&&(h=m));if(d.helper.dropped){var q;b.autoid&&(a.isFunction(b.autoid)?q=b.autoid.call(this,h):(q=Math.ceil(Math.random()*1E3),q=b.autoidprefix+q));a("#"+this.id).jqGrid("addRowData",q,h,b.droppos)}b.ondrop&&a.isFunction(b.ondrop)&&b.ondrop.call(this,c,d,h)}}},b.drop_opts||{})},onstart:null,onstop:null,beforedrop:null,ondrop:null,drop_opts:{activeClass:"ui-state-active",hoverClass:"ui-state-hover"},
448
- drag_opts:{revert:"invalid",helper:"clone",cursor:"move",appendTo:"#jqgrid_dnd",zIndex:5E3},dropbyname:!1,droppos:"first",autoid:!0,autoidprefix:"dnd_"},b||{}),b.connectWith){b.connectWith=b.connectWith.split(",");b.connectWith=a.map(b.connectWith,function(b){return a.trim(b)});a.data(f,"dnd",b);f.p.reccount!="0"&&!f.p.jqgdnd&&c();f.p.jqgdnd=!0;for(var h=0;h<b.connectWith.length;h++)a(b.connectWith[h]).droppable(a.isFunction(b.drop)?b.drop.call(a(f),b):b.drop)}})},gridResize:function(b){return this.each(function(){var c=
449
- this;if(c.grid&&a.fn.resizable)b=a.extend({},b||{}),b.alsoResize?(b._alsoResize_=b.alsoResize,delete b.alsoResize):b._alsoResize_=!1,b.stop&&a.isFunction(b.stop)?(b._stop_=b.stop,delete b.stop):b._stop_=!1,b.stop=function(f,h){a(c).jqGrid("setGridParam",{height:a("#gview_"+c.p.id+" .ui-jqgrid-bdiv").height()});a(c).jqGrid("setGridWidth",h.size.width,b.shrinkToFit);b._stop_&&b._stop_.call(c,f,h)},b.alsoResize=b._alsoResize_?eval("("+("{'#gview_"+c.p.id+" .ui-jqgrid-bdiv':true,'"+b._alsoResize_+"':true}")+
450
- ")"):a(".ui-jqgrid-bdiv","#gview_"+c.p.id),delete b._alsoResize_,a("#gbox_"+c.p.id).resizable(b)})}})})(jQuery);
451
- function tableToGrid(a,b){jQuery(a).each(function(){if(!this.grid){jQuery(this).width("99%");var a=jQuery(this).width(),c=jQuery("input[type=checkbox]:first",jQuery(this)),f=jQuery("input[type=radio]:first",jQuery(this)),c=c.length>0,f=!c&&f.length>0,h=c||f,g=[],j=[];jQuery("th",jQuery(this)).each(function(){g.length===0&&h?(g.push({name:"__selection__",index:"__selection__",width:0,hidden:!0}),j.push("__selection__")):(g.push({name:jQuery(this).attr("id")||jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),
452
- index:jQuery(this).attr("id")||jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),width:jQuery(this).width()||150}),j.push(jQuery(this).html()))});var e=[],l=[],k=[];jQuery("tbody > tr",jQuery(this)).each(function(){var a={},b=0;jQuery("td",jQuery(this)).each(function(){if(b===0&&h){var c=jQuery("input",jQuery(this)),d=c.attr("value");l.push(d||e.length);c.attr("checked")&&k.push(d);a[g[b].name]=c.attr("value")}else a[g[b].name]=jQuery(this).html();b++});b>0&&e.push(a)});
453
- jQuery(this).empty();jQuery(this).addClass("scroll");jQuery(this).jqGrid(jQuery.extend({datatype:"local",width:a,colNames:j,colModel:g,multiselect:c},b||{}));for(a=0;a<e.length;a++)f=null,l.length>0&&(f=l[a])&&f.replace&&(f=encodeURIComponent(f).replace(/[.\-%]/g,"_")),f===null&&(f=a+1),jQuery(this).jqGrid("addRowData",f,e[a]);for(a=0;a<k.length;a++)jQuery(this).jqGrid("setSelection",k[a])}})}(function(a){a.jgrid.extend({contextMenu:function(){alert("ContextMenu extension");return!1}})})(jQuery);
454
- (function(a){a.jgrid.extend({getPostData:function(){var a=this[0];if(a.grid)return a.p.postData},setPostData:function(a){var d=this[0];if(d.grid)typeof a==="object"?d.p.postData=a:alert("Error: cannot add a non-object postData value. postData unchanged.")},appendPostData:function(b){var d=this[0];d.grid&&(typeof b==="object"?a.extend(d.p.postData,b):alert("Error: cannot append a non-object postData value. postData unchanged."))},setPostDataItem:function(a,d){var c=this[0];c.grid&&(c.p.postData[a]=
455
- d)},getPostDataItem:function(a){var d=this[0];if(d.grid)return d.p.postData[a]},removePostDataItem:function(a){var d=this[0];d.grid&&delete d.p.postData[a]},getUserData:function(){var a=this[0];if(a.grid)return a.p.userData},getUserDataItem:function(a){var d=this[0];if(d.grid)return d.p.userData[a]}})})(jQuery);
436
+ (function(a){if(a.browser.msie&&a.browser.version==8)a.expr[":"].hidden=function(a){return a.offsetWidth===0||a.offsetHeight===0||a.style.display=="none"};a.jgrid._multiselect=!1;if(a.ui&&a.ui.multiselect){if(a.ui.multiselect.prototype._setSelected){var b=a.ui.multiselect.prototype._setSelected;a.ui.multiselect.prototype._setSelected=function(d,c){var f=b.call(this,d,c);if(c&&this.selectedList){var g=this.element;this.selectedList.find("li").each(function(){a(this).data("optionLink")&&a(this).data("optionLink").remove().appendTo(g)})}return f}}if(a.ui.multiselect.prototype.destroy)a.ui.multiselect.prototype.destroy=
437
+ function(){this.element.show();this.container.remove();a.Widget===void 0?a.widget.prototype.destroy.apply(this,arguments):a.Widget.prototype.destroy.apply(this,arguments)};a.jgrid._multiselect=!0}a.jgrid.extend({sortableColumns:function(b){return this.each(function(){function c(){f.p.disableClick=!0}var f=this,g=f.p.id,g={tolerance:"pointer",axis:"x",scrollSensitivity:"1",items:">th:not(:has(#jqgh_"+g+"_cb,#jqgh_"+g+"_rn,#jqgh_"+g+"_subgrid),:hidden)",placeholder:{element:function(b){return a(document.createElement(b[0].nodeName)).addClass(b[0].className+
438
+ " ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]},update:function(a,b){b.height(a.currentItem.innerHeight()-parseInt(a.currentItem.css("paddingTop")||0,10)-parseInt(a.currentItem.css("paddingBottom")||0,10));b.width(a.currentItem.innerWidth()-parseInt(a.currentItem.css("paddingLeft")||0,10)-parseInt(a.currentItem.css("paddingRight")||0,10))}},update:function(b,c){var d=a(c.item).parent(),d=a(">th",d),h={},g=f.p.id+"_";a.each(f.p.colModel,function(a){h[this.name]=
439
+ a});var o=[];d.each(function(){var b=a(">div",this).get(0).id.replace(/^jqgh_/,"").replace(g,"");b in h&&o.push(h[b])});a(f).jqGrid("remapColumns",o,!0,!0);a.isFunction(f.p.sortable.update)&&f.p.sortable.update(o);setTimeout(function(){f.p.disableClick=!1},50)}};if(f.p.sortable.options)a.extend(g,f.p.sortable.options);else if(a.isFunction(f.p.sortable))f.p.sortable={update:f.p.sortable};if(g.start){var h=g.start;g.start=function(a,b){c();h.call(this,a,b)}}else g.start=c;f.p.sortable.exclude&&(g.items+=
440
+ ":not("+f.p.sortable.exclude+")");b.sortable(g).data("sortable").floating=!0})},columnChooser:function(b){function c(b,c){b&&(typeof b=="string"?a.fn[b]&&a.fn[b].apply(c,a.makeArray(arguments).slice(2)):a.isFunction(b)&&b.apply(c,a.makeArray(arguments).slice(2)))}var f=this;if(!a("#colchooser_"+f[0].p.id).length){var g=a('<div id="colchooser_'+f[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>'),h=a("select",g),b=a.extend({width:420,height:240,
441
+ classname:null,done:function(a){a&&f.jqGrid("remapColumns",a,!0)},msel:"multiselect",dlog:"dialog",dlog_opts:function(a){var b={};b[a.bSubmit]=function(){a.apply_perm();a.cleanup(!1)};b[a.bCancel]=function(){a.cleanup(!0)};return{buttons:b,close:function(){a.cleanup(!0)},modal:a.modal?a.modal:!1,resizable:a.resizable?a.resizable:!0,width:a.width+20}},apply_perm:function(){a("option",h).each(function(){this.selected?f.jqGrid("showCol",j[this.value].name):f.jqGrid("hideCol",j[this.value].name)});var c=
442
+ [];a("option:selected",h).each(function(){c.push(parseInt(this.value,10))});a.each(c,function(){delete l[j[parseInt(this,10)].name]});a.each(l,function(){var a=parseInt(this,10);var b=c,d=a;if(d>=0){var e=b.slice(),f=e.splice(d,Math.max(b.length-d,d));if(d>b.length)d=b.length;e[d]=a;c=e.concat(f)}else c=void 0});b.done&&b.done.call(f,c)},cleanup:function(a){c(b.dlog,g,"destroy");c(b.msel,h,"destroy");g.remove();a&&b.done&&b.done.call(f)},msel_opts:{}},a.jgrid.col,b||{});if(a.ui&&a.ui.multiselect&&
443
+ b.msel=="multiselect"){if(!a.jgrid._multiselect){alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");return}b.msel_opts=a.extend(a.ui.multiselect.defaults,b.msel_opts)}b.caption&&g.attr("title",b.caption);b.classname&&(g.addClass(b.classname),h.addClass(b.classname));b.width&&(a(">div",g).css({width:b.width,margin:"0 auto"}),h.css("width",b.width));b.height&&(a(">div",g).css("height",b.height),h.css("height",b.height-10));var j=f.jqGrid("getGridParam","colModel"),
444
+ e=f.jqGrid("getGridParam","colNames"),l={},k=[];h.empty();a.each(j,function(a){l[this.name]=a;this.hidedlg?this.hidden||k.push(a):h.append("<option value='"+a+"' "+(this.hidden?"":"selected='selected'")+">"+e[a]+"</option>")});var n=a.isFunction(b.dlog_opts)?b.dlog_opts.call(f,b):b.dlog_opts;c(b.dlog,g,n);n=a.isFunction(b.msel_opts)?b.msel_opts.call(f,b):b.msel_opts;c(b.msel,h,n)}},sortableRows:function(b){return this.each(function(){var c=this;if(c.grid&&!c.p.treeGrid&&a.fn.sortable)b=a.extend({cursor:"move",
445
+ axis:"y",items:".jqgrow"},b||{}),b.start&&a.isFunction(b.start)?(b._start_=b.start,delete b.start):b._start_=!1,b.update&&a.isFunction(b.update)?(b._update_=b.update,delete b.update):b._update_=!1,b.start=function(f,g){a(g.item).css("border-width","0px");a("td",g.item).each(function(a){this.style.width=c.grid.cols[a].style.width});if(c.p.subGrid){var h=a(g.item).attr("id");try{a(c).jqGrid("collapseSubGridRow",h)}catch(j){}}b._start_&&b._start_.apply(this,[f,g])},b.update=function(f,g){a(g.item).css("border-width",
446
+ "");c.p.rownumbers===!0&&a("td.jqgrid-rownum",c.rows).each(function(b){a(this).html(b+1+(parseInt(c.p.page,10)-1)*parseInt(c.p.rowNum,10))});b._update_&&b._update_.apply(this,[f,g])},a("tbody:first",c).sortable(b),a("tbody:first",c).disableSelection()})},gridDnD:function(b){return this.each(function(){function c(){var b=a.data(f,"dnd");a("tr.jqgrow:not(.ui-draggable)",f).draggable(a.isFunction(b.drag)?b.drag.call(a(f),b):b.drag)}var f=this;if(f.grid&&!f.p.treeGrid&&a.fn.draggable&&a.fn.droppable)if(a("#jqgrid_dnd").html()===
447
+ null&&a("body").append("<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>"),typeof b=="string"&&b=="updateDnD"&&f.p.jqgdnd===!0)c();else if(b=a.extend({drag:function(b){return a.extend({start:function(c,d){if(f.p.subGrid){var g=a(d.helper).attr("id");try{a(f).jqGrid("collapseSubGridRow",g)}catch(k){}}for(g=0;g<a.data(f,"dnd").connectWith.length;g++)a(a.data(f,"dnd").connectWith[g]).jqGrid("getGridParam","reccount")=="0"&&a(a.data(f,"dnd").connectWith[g]).jqGrid("addRowData","jqg_empty_row",{});
448
+ d.helper.addClass("ui-state-highlight");a("td",d.helper).each(function(a){this.style.width=f.grid.headers[a].width+"px"});b.onstart&&a.isFunction(b.onstart)&&b.onstart.call(a(f),c,d)},stop:function(c,d){if(d.helper.dropped&&!b.dragcopy){var g=a(d.helper).attr("id");a(f).jqGrid("delRowData",g)}for(g=0;g<a.data(f,"dnd").connectWith.length;g++)a(a.data(f,"dnd").connectWith[g]).jqGrid("delRowData","jqg_empty_row");b.onstop&&a.isFunction(b.onstop)&&b.onstop.call(a(f),c,d)}},b.drag_opts||{})},drop:function(b){return a.extend({accept:function(b){if(!a(b).hasClass("jqgrow"))return b;
449
+ var c=a(b).closest("table.ui-jqgrid-btable");return c.length>0&&a.data(c[0],"dnd")!==void 0?(b=a.data(c[0],"dnd").connectWith,a.inArray("#"+this.id,b)!=-1?!0:!1):b},drop:function(c,d){if(a(d.draggable).hasClass("jqgrow")){var g=a(d.draggable).attr("id"),g=d.draggable.parent().parent().jqGrid("getRowData",g);if(!b.dropbyname){var k=0,n={},o,p=a("#"+this.id).jqGrid("getGridParam","colModel");try{for(var m in g){if(g.hasOwnProperty(m)&&p[k])o=p[k].name,n[o]=g[m];k++}g=n}catch(r){}}d.helper.dropped=!0;
450
+ b.beforedrop&&a.isFunction(b.beforedrop)&&(o=b.beforedrop.call(this,c,d,g,a("#"+f.id),a(this)),typeof o!="undefined"&&o!==null&&typeof o=="object"&&(g=o));if(d.helper.dropped){var q;b.autoid&&(a.isFunction(b.autoid)?q=b.autoid.call(this,g):(q=Math.ceil(Math.random()*1E3),q=b.autoidprefix+q));a("#"+this.id).jqGrid("addRowData",q,g,b.droppos)}b.ondrop&&a.isFunction(b.ondrop)&&b.ondrop.call(this,c,d,g)}}},b.drop_opts||{})},onstart:null,onstop:null,beforedrop:null,ondrop:null,drop_opts:{activeClass:"ui-state-active",
451
+ hoverClass:"ui-state-hover"},drag_opts:{revert:"invalid",helper:"clone",cursor:"move",appendTo:"#jqgrid_dnd",zIndex:5E3},dragcopy:!1,dropbyname:!1,droppos:"first",autoid:!0,autoidprefix:"dnd_"},b||{}),b.connectWith){b.connectWith=b.connectWith.split(",");b.connectWith=a.map(b.connectWith,function(b){return a.trim(b)});a.data(f,"dnd",b);f.p.reccount!="0"&&!f.p.jqgdnd&&c();f.p.jqgdnd=!0;for(var g=0;g<b.connectWith.length;g++)a(b.connectWith[g]).droppable(a.isFunction(b.drop)?b.drop.call(a(f),b):b.drop)}})},
452
+ gridResize:function(b){return this.each(function(){var c=this;if(c.grid&&a.fn.resizable)b=a.extend({},b||{}),b.alsoResize?(b._alsoResize_=b.alsoResize,delete b.alsoResize):b._alsoResize_=!1,b.stop&&a.isFunction(b.stop)?(b._stop_=b.stop,delete b.stop):b._stop_=!1,b.stop=function(f,g){a(c).jqGrid("setGridParam",{height:a("#gview_"+c.p.id+" .ui-jqgrid-bdiv").height()});a(c).jqGrid("setGridWidth",g.size.width,b.shrinkToFit);b._stop_&&b._stop_.call(c,f,g)},b.alsoResize=b._alsoResize_?eval("("+("{'#gview_"+
453
+ c.p.id+" .ui-jqgrid-bdiv':true,'"+b._alsoResize_+"':true}")+")"):a(".ui-jqgrid-bdiv","#gview_"+c.p.id),delete b._alsoResize_,a("#gbox_"+c.p.id).resizable(b)})}})})(jQuery);
454
+ function tableToGrid(a,b){jQuery(a).each(function(){if(!this.grid){jQuery(this).width("99%");var a=jQuery(this).width(),c=jQuery("tr td:first-child input[type=checkbox]:first",jQuery(this)),f=jQuery("tr td:first-child input[type=radio]:first",jQuery(this)),c=c.length>0,f=!c&&f.length>0,g=c||f,h=[],j=[];jQuery("th",jQuery(this)).each(function(){h.length===0&&g?(h.push({name:"__selection__",index:"__selection__",width:0,hidden:!0}),j.push("__selection__")):(h.push({name:jQuery(this).attr("id")||jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),
455
+ index:jQuery(this).attr("id")||jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),width:jQuery(this).width()||150}),j.push(jQuery(this).html()))});var e=[],l=[],k=[];jQuery("tbody > tr",jQuery(this)).each(function(){var a={},b=0;jQuery("td",jQuery(this)).each(function(){if(b===0&&g){var c=jQuery("input",jQuery(this)),d=c.attr("value");l.push(d||e.length);c.attr("checked")&&k.push(d);a[h[b].name]=c.attr("value")}else a[h[b].name]=jQuery(this).html();b++});b>0&&e.push(a)});
456
+ jQuery(this).empty();jQuery(this).addClass("scroll");jQuery(this).jqGrid(jQuery.extend({datatype:"local",width:a,colNames:j,colModel:h,multiselect:c},b||{}));for(a=0;a<e.length;a++)f=null,l.length>0&&(f=l[a])&&f.replace&&(f=encodeURIComponent(f).replace(/[.\-%]/g,"_")),f===null&&(f=a+1),jQuery(this).jqGrid("addRowData",f,e[a]);for(a=0;a<k.length;a++)jQuery(this).jqGrid("setSelection",k[a])}})}(function(a){a.jgrid.extend({contextMenu:function(){alert("ContextMenu extension");return!1}})})(jQuery);
457
+ (function(a){a.jgrid.extend({getPostData:function(){var a=this[0];return!a.grid?void 0:a.p.postData},setPostData:function(a){var d=this[0];if(d.grid)typeof a==="object"?d.p.postData=a:alert("Error: cannot add a non-object postData value. postData unchanged.")},appendPostData:function(b){var d=this[0];d.grid&&(typeof b==="object"?a.extend(d.p.postData,b):alert("Error: cannot append a non-object postData value. postData unchanged."))},setPostDataItem:function(a,d){var c=this[0];c.grid&&(c.p.postData[a]=
458
+ d)},getPostDataItem:function(a){var d=this[0];return!d.grid?void 0:d.p.postData[a]},removePostDataItem:function(a){var d=this[0];d.grid&&delete d.p.postData[a]},getUserData:function(){var a=this[0];return!a.grid?void 0:a.p.userData},getUserDataItem:function(a){var d=this[0];return!d.grid?void 0:d.p.userData[a]}})})(jQuery);
456
459
  (function(a){a.jgrid.extend({setColumns:function(b){b=a.extend({top:0,left:0,width:200,height:"auto",dataheight:"auto",modal:!1,drag:!0,beforeShowForm:null,afterShowForm:null,afterSubmitForm:null,closeOnEscape:!0,ShrinkToFit:!1,jqModal:!1,saveicon:[!0,"left","ui-icon-disk"],closeicon:[!0,"left","ui-icon-close"],onClose:null,colnameview:!0,closeAfterSubmit:!0,updateAfterCheck:!1,recreateForm:!1},a.jgrid.col,b||{});return this.each(function(){var d=this;if(d.grid){var c=typeof b.beforeShowForm==="function"?
457
- !0:!1,f=typeof b.afterShowForm==="function"?!0:!1,h=typeof b.afterSubmitForm==="function"?!0:!1,g=d.p.id,j="ColTbl_"+g,e={themodal:"colmod"+g,modalhead:"colhd"+g,modalcontent:"colcnt"+g,scrollelm:j};b.recreateForm===!0&&a("#"+e.themodal).html()!=null&&a("#"+e.themodal).remove();if(a("#"+e.themodal).html()!=null)c&&b.beforeShowForm(a("#"+j)),a.jgrid.viewModal("#"+e.themodal,{gbox:"#gbox_"+g,jqm:b.jqModal,jqM:!1,modal:b.modal});else{var l=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px",l="<div id='"+
460
+ !0:!1,f=typeof b.afterShowForm==="function"?!0:!1,g=typeof b.afterSubmitForm==="function"?!0:!1,h=d.p.id,j="ColTbl_"+h,e={themodal:"colmod"+h,modalhead:"colhd"+h,modalcontent:"colcnt"+h,scrollelm:j};b.recreateForm===!0&&a("#"+e.themodal).html()!=null&&a("#"+e.themodal).remove();if(a("#"+e.themodal).html()!=null)c&&b.beforeShowForm(a("#"+j)),a.jgrid.viewModal("#"+e.themodal,{gbox:"#gbox_"+h,jqm:b.jqModal,jqM:!1,modal:b.modal});else{var l=isNaN(b.dataheight)?b.dataheight:b.dataheight+"px",l="<div id='"+
458
461
  j+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+l+";'>";l+="<table class='ColTable' cellspacing='1' cellpading='2' border='0'><tbody>";for(i=0;i<this.p.colNames.length;i++)d.p.colModel[i].hidedlg||(l+="<tr><td style='white-space: pre;'><input type='checkbox' style='margin-right:5px;' id='col_"+this.p.colModel[i].name+"' class='cbox' value='T' "+(this.p.colModel[i].hidden===!1?"checked":"")+"/><label for='col_"+this.p.colModel[i].name+"'>"+this.p.colNames[i]+(b.colnameview?
459
462
  " ("+this.p.colModel[i].name+")":"")+"</label></td></tr>");l+="</tbody></table></div>";l+="<table border='0' class='EditTable' id='"+j+"_2'><tbody><tr style='display:block;height:3px;'><td></td></tr><tr><td class='DataTD ui-widget-content'></td></tr><tr><td class='ColButton EditButton'>"+(!b.updateAfterCheck?"<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+b.bSubmit+"</a>":"")+"&#160;"+("<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+
460
- b.bCancel+"</a>")+"</td></tr></tbody></table>";b.gbox="#gbox_"+g;a.jgrid.createModal(e,l,b,"#gview_"+d.p.id,a("#gview_"+d.p.id)[0]);b.saveicon[0]==!0&&a("#dData","#"+j+"_2").addClass(b.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.saveicon[2]+"'></span>");b.closeicon[0]==!0&&a("#eData","#"+j+"_2").addClass(b.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.closeicon[2]+"'></span>");b.updateAfterCheck?
463
+ b.bCancel+"</a>")+"</td></tr></tbody></table>";b.gbox="#gbox_"+h;a.jgrid.createModal(e,l,b,"#gview_"+d.p.id,a("#gview_"+d.p.id)[0]);b.saveicon[0]==!0&&a("#dData","#"+j+"_2").addClass(b.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.saveicon[2]+"'></span>");b.closeicon[0]==!0&&a("#eData","#"+j+"_2").addClass(b.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+b.closeicon[2]+"'></span>");b.updateAfterCheck?
461
464
  a(":input","#"+j).click(function(){var c=this.id.substr(4);c&&(this.checked?a(d).jqGrid("showCol",c):a(d).jqGrid("hideCol",c),b.ShrinkToFit===!0&&a(d).jqGrid("setGridWidth",d.grid.width-0.0010,!0));return this}):a("#dData","#"+j+"_2").click(function(){for(i=0;i<d.p.colModel.length;i++)if(!d.p.colModel[i].hidedlg){var c=d.p.colModel[i].name.replace(/\./g,"\\.");a("#col_"+c,"#"+j).attr("checked")?(a(d).jqGrid("showCol",d.p.colModel[i].name),a("#col_"+c,"#"+j).attr("defaultChecked",!0)):(a(d).jqGrid("hideCol",
462
- d.p.colModel[i].name),a("#col_"+c,"#"+j).attr("defaultChecked",""))}b.ShrinkToFit===!0&&a(d).jqGrid("setGridWidth",d.grid.width-0.0010,!0);b.closeAfterSubmit&&a.jgrid.hideModal("#"+e.themodal,{gb:"#gbox_"+g,jqm:b.jqModal,onClose:b.onClose});h&&b.afterSubmitForm(a("#"+j));return!1});a("#eData","#"+j+"_2").click(function(){a.jgrid.hideModal("#"+e.themodal,{gb:"#gbox_"+g,jqm:b.jqModal,onClose:b.onClose});return!1});a("#dData, #eData","#"+j+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});
463
- c&&b.beforeShowForm(a("#"+j));a.jgrid.viewModal("#"+e.themodal,{gbox:"#gbox_"+g,jqm:b.jqModal,jqM:!0,modal:b.modal})}f&&b.afterShowForm(a("#"+j))}})}})})(jQuery);
465
+ d.p.colModel[i].name),a("#col_"+c,"#"+j).attr("defaultChecked",""))}b.ShrinkToFit===!0&&a(d).jqGrid("setGridWidth",d.grid.width-0.0010,!0);b.closeAfterSubmit&&a.jgrid.hideModal("#"+e.themodal,{gb:"#gbox_"+h,jqm:b.jqModal,onClose:b.onClose});g&&b.afterSubmitForm(a("#"+j));return!1});a("#eData","#"+j+"_2").click(function(){a.jgrid.hideModal("#"+e.themodal,{gb:"#gbox_"+h,jqm:b.jqModal,onClose:b.onClose});return!1});a("#dData, #eData","#"+j+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});
466
+ c&&b.beforeShowForm(a("#"+j));a.jgrid.viewModal("#"+e.themodal,{gbox:"#gbox_"+h,jqm:b.jqModal,jqM:!0,modal:b.modal})}f&&b.afterShowForm(a("#"+j))}})}})})(jQuery);
464
467
  jQuery.tableDnD={currentTable:null,dragObject:null,mouseOffset:null,oldY:0,build:function(a){this.each(function(){this.tableDnDConfig=jQuery.extend({onDragStyle:null,onDropStyle:null,onDragClass:"tDnD_whileDrag",onDrop:null,onDragStart:null,scrollAmount:5,serializeRegexp:/[^\-]*$/,serializeParamName:null,dragHandle:null},a||{});jQuery.tableDnD.makeDraggable(this)});jQuery(document).bind("mousemove",jQuery.tableDnD.mousemove).bind("mouseup",jQuery.tableDnD.mouseup);return this},makeDraggable:function(a){var b=
465
468
  a.tableDnDConfig;a.tableDnDConfig.dragHandle?jQuery("td."+a.tableDnDConfig.dragHandle,a).each(function(){jQuery(this).mousedown(function(d){jQuery.tableDnD.dragObject=this.parentNode;jQuery.tableDnD.currentTable=a;jQuery.tableDnD.mouseOffset=jQuery.tableDnD.getMouseOffset(this,d);if(b.onDragStart)b.onDragStart(a,this);return!1})}):jQuery("tr",a).each(function(){var d=jQuery(this);d.hasClass("nodrag")||d.mousedown(function(c){if(c.target.tagName=="TD"){jQuery.tableDnD.dragObject=this;jQuery.tableDnD.currentTable=
466
- a;jQuery.tableDnD.mouseOffset=jQuery.tableDnD.getMouseOffset(this,c);if(b.onDragStart)b.onDragStart(a,this);return!1}}).css("cursor","move")})},updateTables:function(){this.each(function(){this.tableDnDConfig&&jQuery.tableDnD.makeDraggable(this)})},mouseCoords:function(a){if(a.pageX||a.pageY)return{x:a.pageX,y:a.pageY};return{x:a.clientX+document.body.scrollLeft-document.body.clientLeft,y:a.clientY+document.body.scrollTop-document.body.clientTop}},getMouseOffset:function(a,b){var b=b||window.event,
467
- d=this.getPosition(a),c=this.mouseCoords(b);return{x:c.x-d.x,y:c.y-d.y}},getPosition:function(a){var b=0,d=0;if(a.offsetHeight==0)a=a.firstChild;if(a&&a.offsetParent){for(;a.offsetParent;)b+=a.offsetLeft,d+=a.offsetTop,a=a.offsetParent;b+=a.offsetLeft;d+=a.offsetTop}return{x:b,y:d}},mousemove:function(a){if(jQuery.tableDnD.dragObject!=null){var b=jQuery(jQuery.tableDnD.dragObject),d=jQuery.tableDnD.currentTable.tableDnDConfig,c=jQuery.tableDnD.mouseCoords(a),a=c.y-jQuery.tableDnD.mouseOffset.y,f=
468
- window.pageYOffset;if(document.all)if(typeof document.compatMode!="undefined"&&document.compatMode!="BackCompat")f=document.documentElement.scrollTop;else if(typeof document.body!="undefined")f=document.body.scrollTop;c.y-f<d.scrollAmount?window.scrollBy(0,-d.scrollAmount):(window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight)-(c.y-f)<d.scrollAmount&&window.scrollBy(0,d.scrollAmount);if(a!=jQuery.tableDnD.oldY)c=
469
- a>jQuery.tableDnD.oldY,jQuery.tableDnD.oldY=a,d.onDragClass?b.addClass(d.onDragClass):b.css(d.onDragStyle),(b=jQuery.tableDnD.findDropTargetRow(b,a))&&(c&&jQuery.tableDnD.dragObject!=b?jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject,b.nextSibling):!c&&jQuery.tableDnD.dragObject!=b&&jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject,b));return!1}},findDropTargetRow:function(a,b){for(var d=jQuery.tableDnD.currentTable.rows,c=0;c<d.length;c++){var f=
470
- d[c],h=this.getPosition(f).y,g=parseInt(f.offsetHeight)/2;if(f.offsetHeight==0)h=this.getPosition(f.firstChild).y,g=parseInt(f.firstChild.offsetHeight)/2;if(b>h-g&&b<h+g){if(f==a)break;d=jQuery.tableDnD.currentTable.tableDnDConfig;if(d.onAllowDrop){if(!d.onAllowDrop(a,f))break}else if(jQuery(f).hasClass("nodrop"))break;return f}}return null},mouseup:function(){if(jQuery.tableDnD.currentTable&&jQuery.tableDnD.dragObject){var a=jQuery.tableDnD.dragObject,b=jQuery.tableDnD.currentTable.tableDnDConfig;
471
- b.onDragClass?jQuery(a).removeClass(b.onDragClass):jQuery(a).css(b.onDropStyle);jQuery.tableDnD.dragObject=null;if(b.onDrop)b.onDrop(jQuery.tableDnD.currentTable,a);jQuery.tableDnD.currentTable=null}},serialize:function(){return jQuery.tableDnD.currentTable?jQuery.tableDnD.serializeTable(jQuery.tableDnD.currentTable):"Error: No Table id set, you need to set an id on your table and every row"},serializeTable:function(a){for(var b="",d=a.id,c=a.rows,f=0;f<c.length;f++){b.length>0&&(b+="&");var h=c[f].id;
472
- h&&h&&a.tableDnDConfig&&a.tableDnDConfig.serializeRegexp&&(h=h.match(a.tableDnDConfig.serializeRegexp)[0]);b+=d+"[]="+h}return b},serializeTables:function(){var a="";this.each(function(){a+=jQuery.tableDnD.serializeTable(this)});return a}};jQuery.fn.extend({tableDnD:jQuery.tableDnD.build,tableDnDUpdate:jQuery.tableDnD.updateTables,tableDnDSerialize:jQuery.tableDnD.serializeTables});
469
+ a;jQuery.tableDnD.mouseOffset=jQuery.tableDnD.getMouseOffset(this,c);if(b.onDragStart)b.onDragStart(a,this);return!1}}).css("cursor","move")})},updateTables:function(){this.each(function(){this.tableDnDConfig&&jQuery.tableDnD.makeDraggable(this)})},mouseCoords:function(a){return a.pageX||a.pageY?{x:a.pageX,y:a.pageY}:{x:a.clientX+document.body.scrollLeft-document.body.clientLeft,y:a.clientY+document.body.scrollTop-document.body.clientTop}},getMouseOffset:function(a,b){var b=b||window.event,d=this.getPosition(a),
470
+ c=this.mouseCoords(b);return{x:c.x-d.x,y:c.y-d.y}},getPosition:function(a){var b=0,d=0;if(a.offsetHeight==0)a=a.firstChild;if(a&&a.offsetParent){for(;a.offsetParent;)b+=a.offsetLeft,d+=a.offsetTop,a=a.offsetParent;b+=a.offsetLeft;d+=a.offsetTop}return{x:b,y:d}},mousemove:function(a){if(jQuery.tableDnD.dragObject!=null){var b=jQuery(jQuery.tableDnD.dragObject),d=jQuery.tableDnD.currentTable.tableDnDConfig,c=jQuery.tableDnD.mouseCoords(a),a=c.y-jQuery.tableDnD.mouseOffset.y,f=window.pageYOffset;if(document.all)if(typeof document.compatMode!=
471
+ "undefined"&&document.compatMode!="BackCompat")f=document.documentElement.scrollTop;else if(typeof document.body!="undefined")f=document.body.scrollTop;c.y-f<d.scrollAmount?window.scrollBy(0,-d.scrollAmount):(window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight)-(c.y-f)<d.scrollAmount&&window.scrollBy(0,d.scrollAmount);if(a!=jQuery.tableDnD.oldY)c=a>jQuery.tableDnD.oldY,jQuery.tableDnD.oldY=a,d.onDragClass?b.addClass(d.onDragClass):
472
+ b.css(d.onDragStyle),(b=jQuery.tableDnD.findDropTargetRow(b,a))&&(c&&jQuery.tableDnD.dragObject!=b?jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject,b.nextSibling):!c&&jQuery.tableDnD.dragObject!=b&&jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject,b));return!1}},findDropTargetRow:function(a,b){for(var d=jQuery.tableDnD.currentTable.rows,c=0;c<d.length;c++){var f=d[c],g=this.getPosition(f).y,h=parseInt(f.offsetHeight)/2;if(f.offsetHeight==0)g=
473
+ this.getPosition(f.firstChild).y,h=parseInt(f.firstChild.offsetHeight)/2;if(b>g-h&&b<g+h){if(f==a)break;d=jQuery.tableDnD.currentTable.tableDnDConfig;if(d.onAllowDrop){if(!d.onAllowDrop(a,f))break}else if(jQuery(f).hasClass("nodrop"))break;return f}}return null},mouseup:function(){if(jQuery.tableDnD.currentTable&&jQuery.tableDnD.dragObject){var a=jQuery.tableDnD.dragObject,b=jQuery.tableDnD.currentTable.tableDnDConfig;b.onDragClass?jQuery(a).removeClass(b.onDragClass):jQuery(a).css(b.onDropStyle);
474
+ jQuery.tableDnD.dragObject=null;if(b.onDrop)b.onDrop(jQuery.tableDnD.currentTable,a);jQuery.tableDnD.currentTable=null}},serialize:function(){return jQuery.tableDnD.currentTable?jQuery.tableDnD.serializeTable(jQuery.tableDnD.currentTable):"Error: No Table id set, you need to set an id on your table and every row"},serializeTable:function(a){for(var b="",d=a.id,c=a.rows,f=0;f<c.length;f++){b.length>0&&(b+="&");var g=c[f].id;g&&g&&a.tableDnDConfig&&a.tableDnDConfig.serializeRegexp&&(g=g.match(a.tableDnDConfig.serializeRegexp)[0]);
475
+ b+=d+"[]="+g}return b},serializeTables:function(){var a="";this.each(function(){a+=jQuery.tableDnD.serializeTable(this)});return a}};jQuery.fn.extend({tableDnD:jQuery.tableDnD.build,tableDnDUpdate:jQuery.tableDnD.updateTables,tableDnDSerialize:jQuery.tableDnD.serializeTables});
473
476
  (function(a){a.widget("ui.multiselect",{_init:function(){this.element.hide();this.id=this.element.attr("id");this.container=a('<div class="ui-multiselect ui-helper-clearfix ui-widget"></div>').insertAfter(this.element);this.count=0;this.selectedContainer=a('<div class="selected"></div>').appendTo(this.container);this.availableContainer=a('<div class="available"></div>').appendTo(this.container);this.selectedActions=a('<div class="actions ui-widget-header ui-helper-clearfix"><span class="count">0 '+
474
477
  a.ui.multiselect.locale.itemsCount+'</span><a href="#" class="remove-all">'+a.ui.multiselect.locale.removeAll+"</a></div>").appendTo(this.selectedContainer);this.availableActions=a('<div class="actions ui-widget-header ui-helper-clearfix"><input type="text" class="search empty ui-widget-content ui-corner-all"/><a href="#" class="add-all">'+a.ui.multiselect.locale.addAll+"</a></div>").appendTo(this.availableContainer);this.selectedList=a('<ul class="selected connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind("selectstart",
475
478
  function(){return!1}).appendTo(this.selectedContainer);this.availableList=a('<ul class="available connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind("selectstart",function(){return!1}).appendTo(this.availableContainer);var b=this;this.container.width(this.element.width()+1);this.selectedContainer.width(Math.floor(this.element.width()*this.options.dividerLocation));this.availableContainer.width(Math.floor(this.element.width()*(1-this.options.dividerLocation)));this.selectedList.height(Math.max(this.element.height()-
@@ -477,9 +480,9 @@ this.selectedActions.height(),1));this.availableList.height(Math.max(this.elemen
477
480
  c){c.item.data("optionLink").attr("selected",!0);b.count+=1;b._updateCount();b.selectedList.children(".ui-draggable").each(function(){a(this).removeClass("ui-draggable");a(this).data("optionLink",c.item.data("optionLink"));a(this).data("idx",c.item.data("idx"));b._applyItemState(a(this),!0)});setTimeout(function(){c.item.remove()},1)}});this.options.searchable?this._registerSearchEvents(this.availableContainer.find("input.search")):a(".search").hide();a(".remove-all").click(function(){b._populateLists(b.element.find("option").removeAttr("selected"));
478
481
  return!1});a(".add-all").click(function(){b._populateLists(b.element.find("option").attr("selected","selected"));return!1})},destroy:function(){this.element.show();this.container.remove();a.widget.prototype.destroy.apply(this,arguments)},_populateLists:function(b){this.selectedList.children(".ui-element").remove();this.availableList.children(".ui-element").remove();this.count=0;var d=this;a(b.map(function(a){var b=d._getOptionNode(this).appendTo(this.selected?d.selectedList:d.availableList).show();
479
482
  this.selected&&(d.count+=1);d._applyItemState(b,this.selected);b.data("idx",a);return b[0]}));this._updateCount()},_updateCount:function(){this.selectedContainer.find("span.count").text(this.count+" "+a.ui.multiselect.locale.itemsCount)},_getOptionNode:function(b){var b=a(b),d=a('<li class="ui-state-default ui-element" title="'+b.text()+'"><span class="ui-icon"/>'+b.text()+'<a href="#" class="action"><span class="ui-corner-all ui-icon"/></a></li>').hide();d.data("optionLink",b);return d},_cloneWithData:function(a){var d=
480
- a.clone();d.data("optionLink",a.data("optionLink"));d.data("idx",a.data("idx"));return d},_setSelected:function(b,d){b.data("optionLink").attr("selected",d);if(d){var c=this._cloneWithData(b);b[this.options.hide](this.options.animated,function(){a(this).remove()});c.appendTo(this.selectedList).hide()[this.options.show](this.options.animated);this._applyItemState(c,!0);return c}else{var f=this.availableList.find("li"),h=this.options.nodeComparator,c=null,g=b.data("idx"),j=h(b,a(f[g]));if(j)for(;g>=
481
- 0&&g<f.length;){if(j>0?g++:g--,j!=h(b,a(f[g]))){c=f[j>0?g:g+1];break}}else c=f[g];f=this._cloneWithData(b);c?f.insertBefore(a(c)):f.appendTo(this.availableList);b[this.options.hide](this.options.animated,function(){a(this).remove()});f.hide()[this.options.show](this.options.animated);this._applyItemState(f,!1);return f}},_applyItemState:function(a,d){d?(this.options.sortable?a.children("span").addClass("ui-icon-arrowthick-2-n-s").removeClass("ui-helper-hidden").addClass("ui-icon"):a.children("span").removeClass("ui-icon-arrowthick-2-n-s").addClass("ui-helper-hidden").removeClass("ui-icon"),
483
+ a.clone();d.data("optionLink",a.data("optionLink"));d.data("idx",a.data("idx"));return d},_setSelected:function(b,d){b.data("optionLink").attr("selected",d);if(d){var c=this._cloneWithData(b);b[this.options.hide](this.options.animated,function(){a(this).remove()});c.appendTo(this.selectedList).hide()[this.options.show](this.options.animated);this._applyItemState(c,!0);return c}else{var f=this.availableList.find("li"),g=this.options.nodeComparator,c=null,h=b.data("idx"),j=g(b,a(f[h]));if(j)for(;h>=
484
+ 0&&h<f.length;){if(j>0?h++:h--,j!=g(b,a(f[h]))){c=f[j>0?h:h+1];break}}else c=f[h];f=this._cloneWithData(b);c?f.insertBefore(a(c)):f.appendTo(this.availableList);b[this.options.hide](this.options.animated,function(){a(this).remove()});f.hide()[this.options.show](this.options.animated);this._applyItemState(f,!1);return f}},_applyItemState:function(a,d){d?(this.options.sortable?a.children("span").addClass("ui-icon-arrowthick-2-n-s").removeClass("ui-helper-hidden").addClass("ui-icon"):a.children("span").removeClass("ui-icon-arrowthick-2-n-s").addClass("ui-helper-hidden").removeClass("ui-icon"),
482
485
  a.find("a.action span").addClass("ui-icon-minus").removeClass("ui-icon-plus"),this._registerRemoveEvents(a.find("a.action"))):(a.children("span").removeClass("ui-icon-arrowthick-2-n-s").addClass("ui-helper-hidden").removeClass("ui-icon"),a.find("a.action span").addClass("ui-icon-plus").removeClass("ui-icon-minus"),this._registerAddEvents(a.find("a.action")));this._registerHoverEvents(a)},_filter:function(b){var d=a(this),c=b.children("li"),b=c.map(function(){return a(this).text().toLowerCase()}),
483
- f=a.trim(d.val().toLowerCase()),h=[];f?(c.hide(),b.each(function(a){this.indexOf(f)>-1&&h.push(a)}),a.each(h,function(){a(c[this]).show()})):c.show()},_registerHoverEvents:function(b){b.removeClass("ui-state-hover");b.mouseover(function(){a(this).addClass("ui-state-hover")});b.mouseout(function(){a(this).removeClass("ui-state-hover")})},_registerAddEvents:function(b){var d=this;b.click(function(){d._setSelected(a(this).parent(),!0);d.count+=1;d._updateCount();return!1}).each(function(){a(this).parent().draggable({connectToSortable:"ul.selected",
486
+ f=a.trim(d.val().toLowerCase()),g=[];f?(c.hide(),b.each(function(a){this.indexOf(f)>-1&&g.push(a)}),a.each(g,function(){a(c[this]).show()})):c.show()},_registerHoverEvents:function(b){b.removeClass("ui-state-hover");b.mouseover(function(){a(this).addClass("ui-state-hover")});b.mouseout(function(){a(this).removeClass("ui-state-hover")})},_registerAddEvents:function(b){var d=this;b.click(function(){d._setSelected(a(this).parent(),!0);d.count+=1;d._updateCount();return!1}).each(function(){a(this).parent().draggable({connectToSortable:"ul.selected",
484
487
  helper:function(){var b=d._cloneWithData(a(this)).width(a(this).width()-50);b.width(a(this).width());return b},appendTo:".ui-multiselect",containment:".ui-multiselect",revert:"invalid"})})},_registerRemoveEvents:function(b){var d=this;b.click(function(){d._setSelected(a(this).parent(),!1);d.count-=1;d._updateCount();return!1})},_registerSearchEvents:function(b){var d=this;b.focus(function(){a(this).addClass("ui-state-active")}).blur(function(){a(this).removeClass("ui-state-active")}).keypress(function(a){if(a.keyCode==
485
488
  13)return!1}).keyup(function(){d._filter.apply(this,[d.availableList])})}});a.extend(a.ui.multiselect,{defaults:{sortable:!0,searchable:!0,animated:"fast",show:"slideDown",hide:"slideUp",dividerLocation:0.6,nodeComparator:function(a,d){var c=a.text(),f=d.text();return c==f?0:c<f?-1:1}},locale:{addAll:"Add all",removeAll:"Remove all",itemsCount:"items selected"}})})(jQuery);