jquery.jqGrid.min.js 275 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. /*
  2. jqGrid 4.7.0 - jQuery Grid
  3. Copyright (c) 2008, Tony Tomov, tony@trirand.com
  4. Dual licensed under the MIT and GPL licenses
  5. http://www.opensource.org/licenses/mit-license.php
  6. http://www.gnu.org/licenses/gpl-2.0.html
  7. Date: 2014-12-08
  8. */
  9. (function(a){a.jgrid=a.jgrid||{};a.extend(a.jgrid,{version:"4.7.0",htmlDecode:function(a){return a&&("&nbsp;"===a||"&#160;"===a||1===a.length&&160===a.charCodeAt(0))?"":a?String(a).replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&amp;/g,"&"):a},htmlEncode:function(a){return a?String(a).replace(/&/g,"&amp;").replace(/\"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):a},format:function(b){var e=a.makeArray(arguments).slice(1);null==b&&(b="");return b.replace(/\{(\d+)\}/g,
  10. function(a,b){return e[b]})},msie:"Microsoft Internet Explorer"===navigator.appName,msiever:function(){var a=-1;null!=/MSIE ([0-9]{1,}[.0-9]{0,})/.exec(navigator.userAgent)&&(a=parseFloat(RegExp.$1));return a},getCellIndex:function(b){b=a(b);if(b.is("tr"))return-1;b=(b.is("td")||b.is("th")?b:b.closest("td,th"))[0];return a.jgrid.msie?a.inArray(b,b.parentNode.cells):b.cellIndex},stripHtml:function(a){a=String(a);var e=/<("[^"]*"|'[^']*'|[^'">])*>/gi;return a?(a=a.replace(e,""))&&"&nbsp;"!==a&&"&#160;"!==
  11. a?a.replace(/\"/g,"'"):"":a},stripPref:function(b,e){var c=a.type(b);if("string"===c||"number"===c)b=String(b),e=""!==b?String(e).replace(String(b),""):e;return e},parse:function(b){"while(1);"===b.substr(0,9)&&(b=b.substr(9));"/*"===b.substr(0,2)&&(b=b.substr(2,b.length-4));b||(b="{}");return!0===a.jgrid.useJSON&&"object"===typeof JSON&&"function"===typeof JSON.parse?JSON.parse(b):eval("("+b+")")},parseDate:function(b,e,c,f){var g=/^\/Date\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\)\/$/,d="string"===
  12. typeof e?e.match(g):null,g=function(a,d){a=String(a);for(d=parseInt(d,10)||2;a.length<d;)a="0"+a;return a},h={m:1,d:1,y:1970,h:0,i:0,s:0,u:0},k=0,l,p,k=function(a,d){0===a?12===d&&(d=0):12!==d&&(d+=12);return d},m=0;void 0===f&&(f=a.jgrid.formatter.date);void 0===f.parseRe&&(f.parseRe=/[#%\\\/:_;.,\t\s-]/);f.masks.hasOwnProperty(b)&&(b=f.masks[b]);if(e&&null!=e)if(isNaN(e-0)||"u"!==String(b).toLowerCase())if(e.constructor===Date)k=e;else if(null!==d)k=new Date(parseInt(d[1],10)),d[3]&&(m=60*Number(d[5])+
  13. Number(d[6]),m*="-"===d[4]?1:-1,m-=k.getTimezoneOffset(),k.setTime(Number(Number(k)+6E4*m)));else{"ISO8601Long"===f.srcformat&&"Z"===e.charAt(e.length-1)&&(m-=(new Date).getTimezoneOffset());e=String(e).replace(/\T/g,"#").replace(/\t/,"%").split(f.parseRe);b=b.replace(/\T/g,"#").replace(/\t/,"%").split(f.parseRe);l=0;for(p=b.length;l<p;l++)"M"===b[l]&&(d=a.inArray(e[l],f.monthNames),-1!==d&&12>d&&(e[l]=d+1,h.m=e[l])),"F"===b[l]&&(d=a.inArray(e[l],f.monthNames,12),-1!==d&&11<d&&(e[l]=d+1-12,h.m=e[l])),
  14. "a"===b[l]&&(d=a.inArray(e[l],f.AmPm),-1!==d&&2>d&&e[l]===f.AmPm[d]&&(e[l]=d,h.h=k(e[l],h.h))),"A"===b[l]&&(d=a.inArray(e[l],f.AmPm),-1!==d&&1<d&&e[l]===f.AmPm[d]&&(e[l]=d-2,h.h=k(e[l],h.h))),"g"===b[l]&&(h.h=parseInt(e[l],10)),void 0!==e[l]&&(h[b[l].toLowerCase()]=parseInt(e[l],10));h.f&&(h.m=h.f);if(0===h.m&&0===h.y&&0===h.d)return"&#160;";h.m=parseInt(h.m,10)-1;k=h.y;70<=k&&99>=k?h.y=1900+h.y:0<=k&&69>=k&&(h.y=2E3+h.y);k=new Date(h.y,h.m,h.d,h.h,h.i,h.s,h.u);0<m&&k.setTime(Number(Number(k)+6E4*
  15. m))}else k=new Date(1E3*parseFloat(e));else k=new Date(h.y,h.m,h.d,h.h,h.i,h.s,h.u);f.userLocalTime&&0===m&&(m-=(new Date).getTimezoneOffset(),0<m&&k.setTime(Number(Number(k)+6E4*m)));if(void 0===c)return k;f.masks.hasOwnProperty(c)?c=f.masks[c]:c||(c="Y-m-d");b=k.getHours();e=k.getMinutes();h=k.getDate();m=k.getMonth()+1;d=k.getTimezoneOffset();l=k.getSeconds();p=k.getMilliseconds();var r=k.getDay(),q=k.getFullYear(),n=(r+6)%7+1,t=(new Date(q,m-1,h)-new Date(q,0,1))/864E5,u={d:g(h),D:f.dayNames[r],
  16. j:h,l:f.dayNames[r+7],N:n,S:f.S(h),w:r,z:t,W:5>n?Math.floor((t+n-1)/7)+1:Math.floor((t+n-1)/7)||(4>((new Date(q-1,0,1)).getDay()+6)%7?53:52),F:f.monthNames[m-1+12],m:g(m),M:f.monthNames[m-1],n:m,t:"?",L:"?",o:"?",Y:q,y:String(q).substring(2),a:12>b?f.AmPm[0]:f.AmPm[1],A:12>b?f.AmPm[2]:f.AmPm[3],B:"?",g:b%12||12,G:b,h:g(b%12||12),H:g(b),i:g(e),s:g(l),u:p,e:"?",I:"?",O:(0<d?"-":"+")+g(100*Math.floor(Math.abs(d)/60)+Math.abs(d)%60,4),P:"?",T:(String(k).match(/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g)||
  17. [""]).pop().replace(/[^-+\dA-Z]/g,""),Z:"?",c:"?",r:"?",U:Math.floor(k/1E3)};return c.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g,function(a){return u.hasOwnProperty(a)?u[a]:a.substring(1)})},jqID:function(a){return String(a).replace(/[!"#$%&'()*+,.\/:; <=>?@\[\\\]\^`{|}~]/g,"\\$&")},guid:1,uidPref:"jqg",randId:function(b){return(b||a.jgrid.uidPref)+a.jgrid.guid++},getAccessor:function(a,e){var c,f,g=[],d;if("function"===typeof e)return e(a);c=a[e];if(void 0===c)try{if("string"===typeof e&&
  18. (g=e.split(".")),d=g.length)for(c=a;c&&d--;)f=g.shift(),c=c[f]}catch(h){}return c},getXmlData:function(b,e,c){var f="string"===typeof e?e.match(/^(.*)\[(\w+)\]$/):null;if("function"===typeof e)return e(b);if(f&&f[2])return f[1]?a(f[1],b).attr(f[2]):a(b).attr(f[2]);b=a(e,b);return c?b:0<b.length?a(b).text():void 0},cellWidth:function(){var b=a("<div class='ui-jqgrid' style='left:10000px'><table class='ui-jqgrid-btable' style='width:5px;'><tr class='jqgrow'><td style='width:5px;display:block;'></td></tr></table></div>"),
  19. e=b.appendTo("body").find("td").width();b.remove();return.1<Math.abs(e-5)},cell_width:!0,ajaxOptions:{},from:function(b){return new function(b,c){"string"===typeof b&&(b=a.data(b));var f=this,g=b,d=!0,h=!1,k=c,l=/[\$,%]/g,p=null,m=null,r=0,q=!1,n="",t=[],u=!0;if("object"===typeof b&&b.push)0<b.length&&(u="object"!==typeof b[0]?!1:!0);else throw"data provides is not an array";this._hasData=function(){return null===g?!1:0===g.length?!1:!0};this._getStr=function(a){var b=[];h&&b.push("jQuery.trim(");
  20. b.push("String("+a+")");h&&b.push(")");d||b.push(".toLowerCase()");return b.join("")};this._strComp=function(a){return"string"===typeof a?".toString()":""};this._group=function(a,d){return{field:a.toString(),unique:d,items:[]}};this._toStr=function(b){h&&(b=a.trim(b));b=b.toString().replace(/\\/g,"\\\\").replace(/\"/g,'\\"');return d?b:b.toLowerCase()};this._funcLoop=function(d){var b=[];a.each(g,function(a,c){b.push(d(c))});return b};this._append=function(a){var d;k=null===k?"":k+(""===n?" && ":
  21. n);for(d=0;d<r;d++)k+="(";q&&(k+="!");k+="("+a+")";q=!1;n="";r=0};this._setCommand=function(a,d){p=a;m=d};this._resetNegate=function(){q=!1};this._repeatCommand=function(a,d){return null===p?f:null!==a&&null!==d?p(a,d):null!==m&&u?p(m,a):p(a)};this._equals=function(a,d){return 0===f._compare(a,d,1)};this._compare=function(a,b,c){var e=Object.prototype.toString;void 0===c&&(c=1);void 0===a&&(a=null);void 0===b&&(b=null);if(null===a&&null===b)return 0;if(null===a&&null!==b)return 1;if(null!==a&&null===
  22. b)return-1;if("[object Date]"===e.call(a)&&"[object Date]"===e.call(b))return a<b?-c:a>b?c:0;d||"number"===typeof a||"number"===typeof b||(a=String(a),b=String(b));return a<b?-c:a>b?c:0};this._performSort=function(){0!==t.length&&(g=f._doSort(g,0))};this._doSort=function(a,d){var b=t[d].by,c=t[d].dir,e=t[d].type,h=t[d].datefmt,g=t[d].sfunc;if(d===t.length-1)return f._getOrder(a,b,c,e,h,g);d++;b=f._getGroup(a,b,c,e,h);c=[];for(e=0;e<b.length;e++)for(g=f._doSort(b[e].items,d),h=0;h<g.length;h++)c.push(g[h]);
  23. return c};this._getOrder=function(b,c,e,h,g,k){var p=[],n=[],m="a"===e?1:-1,r,q;void 0===h&&(h="text");q="float"===h||"number"===h||"currency"===h||"numeric"===h?function(a){a=parseFloat(String(a).replace(l,""));return isNaN(a)?Number.NEGATIVE_INFINITY:a}:"int"===h||"integer"===h?function(a){return a?parseFloat(String(a).replace(l,"")):Number.NEGATIVE_INFINITY}:"date"===h||"datetime"===h?function(d){return a.jgrid.parseDate(g,d).getTime()}:a.isFunction(h)?h:function(b){b=b?a.trim(String(b)):"";return d?
  24. b:b.toLowerCase()};a.each(b,function(d,b){r=""!==c?a.jgrid.getAccessor(b,c):b;void 0===r&&(r="");r=q(r,b);n.push({vSort:r,index:d})});a.isFunction(k)?n.sort(function(a,d){a=a.vSort;d=d.vSort;return k.call(this,a,d,m)}):n.sort(function(a,d){a=a.vSort;d=d.vSort;return f._compare(a,d,m)});h=0;for(var u=b.length;h<u;)e=n[h].index,p.push(b[e]),h++;return p};this._getGroup=function(d,b,c,e,h){var g=[],k=null,l=null,n;a.each(f._getOrder(d,b,c,e,h),function(d,c){n=a.jgrid.getAccessor(c,b);null==n&&(n="");
  25. f._equals(l,n)||(l=n,null!==k&&g.push(k),k=f._group(b,n));k.items.push(c)});null!==k&&g.push(k);return g};this.ignoreCase=function(){d=!1;return f};this.useCase=function(){d=!0;return f};this.trim=function(){h=!0;return f};this.noTrim=function(){h=!1;return f};this.execute=function(){var d=k,b=[];if(null===d)return f;a.each(g,function(){eval(d)&&b.push(this)});g=b;return f};this.data=function(){return g};this.select=function(d){f._performSort();if(!f._hasData())return[];f.execute();if(a.isFunction(d)){var b=
  26. [];a.each(g,function(a,c){b.push(d(c))});return b}return g};this.hasMatch=function(){if(!f._hasData())return!1;f.execute();return 0<g.length};this.andNot=function(a,d,b){q=!q;return f.and(a,d,b)};this.orNot=function(a,d,b){q=!q;return f.or(a,d,b)};this.not=function(a,d,b){return f.andNot(a,d,b)};this.and=function(a,d,b){n=" && ";return void 0===a?f:f._repeatCommand(a,d,b)};this.or=function(a,d,b){n=" || ";return void 0===a?f:f._repeatCommand(a,d,b)};this.orBegin=function(){r++;return f};this.orEnd=
  27. function(){null!==k&&(k+=")");return f};this.isNot=function(a){q=!q;return f.is(a)};this.is=function(a){f._append("this."+a);f._resetNegate();return f};this._compareValues=function(d,b,c,e,h){var g;g=u?"jQuery.jgrid.getAccessor(this,'"+b+"')":"this";void 0===c&&(c=null);var k=c,n=void 0===h.stype?"text":h.stype;if(null!==c)switch(n){case "int":case "integer":k=isNaN(Number(k))||""===k?"0":k;g="parseInt("+g+",10)";k="parseInt("+k+",10)";break;case "float":case "number":case "numeric":k=String(k).replace(l,
  28. "");k=isNaN(Number(k))||""===k?"0":k;g="parseFloat("+g+")";k="parseFloat("+k+")";break;case "date":case "datetime":k=String(a.jgrid.parseDate(h.newfmt||"Y-m-d",k).getTime());g='jQuery.jgrid.parseDate("'+h.srcfmt+'",'+g+").getTime()";break;default:g=f._getStr(g),k=f._getStr('"'+f._toStr(k)+'"')}f._append(g+" "+e+" "+k);f._setCommand(d,b);f._resetNegate();return f};this.equals=function(a,d,b){return f._compareValues(f.equals,a,d,"==",b)};this.notEquals=function(a,d,b){return f._compareValues(f.equals,
  29. a,d,"!==",b)};this.isNull=function(a,d,b){return f._compareValues(f.equals,a,null,"===",b)};this.greater=function(a,d,b){return f._compareValues(f.greater,a,d,">",b)};this.less=function(a,d,b){return f._compareValues(f.less,a,d,"<",b)};this.greaterOrEquals=function(a,d,b){return f._compareValues(f.greaterOrEquals,a,d,">=",b)};this.lessOrEquals=function(a,d,b){return f._compareValues(f.lessOrEquals,a,d,"<=",b)};this.startsWith=function(d,b){var c=null==b?d:b,c=h?a.trim(c.toString()).length:c.toString().length;
  30. u?f._append(f._getStr("jQuery.jgrid.getAccessor(this,'"+d+"')")+".substr(0,"+c+") == "+f._getStr('"'+f._toStr(b)+'"')):(null!=b&&(c=h?a.trim(b.toString()).length:b.toString().length),f._append(f._getStr("this")+".substr(0,"+c+") == "+f._getStr('"'+f._toStr(d)+'"')));f._setCommand(f.startsWith,d);f._resetNegate();return f};this.endsWith=function(d,b){var c=null==b?d:b,c=h?a.trim(c.toString()).length:c.toString().length;u?f._append(f._getStr("jQuery.jgrid.getAccessor(this,'"+d+"')")+".substr("+f._getStr("jQuery.jgrid.getAccessor(this,'"+
  31. d+"')")+".length-"+c+","+c+') == "'+f._toStr(b)+'"'):f._append(f._getStr("this")+".substr("+f._getStr("this")+'.length-"'+f._toStr(d)+'".length,"'+f._toStr(d)+'".length) == "'+f._toStr(d)+'"');f._setCommand(f.endsWith,d);f._resetNegate();return f};this.contains=function(a,d){u?f._append(f._getStr("jQuery.jgrid.getAccessor(this,'"+a+"')")+'.indexOf("'+f._toStr(d)+'",0) > -1'):f._append(f._getStr("this")+'.indexOf("'+f._toStr(a)+'",0) > -1');f._setCommand(f.contains,a);f._resetNegate();return f};this.groupBy=
  32. function(a,d,b,c){return f._hasData()?f._getGroup(g,a,d,b,c):null};this.orderBy=function(d,b,c,e,h){b=null==b?"a":a.trim(b.toString().toLowerCase());null==c&&(c="text");null==e&&(e="Y-m-d");null==h&&(h=!1);if("desc"===b||"descending"===b)b="d";if("asc"===b||"ascending"===b)b="a";t.push({by:d,dir:b,type:c,datefmt:e,sfunc:h});return f};return f}(b,null)},getMethod:function(b){return this.getAccessor(a.fn.jqGrid,b)},extend:function(b){a.extend(a.fn.jqGrid,b);this.no_legacy_api||a.fn.extend(b)}});a.fn.jqGrid=
  33. function(b){if("string"===typeof b){var e=a.jgrid.getMethod(b);if(!e)throw"jqGrid - No such method: "+b;var c=a.makeArray(arguments).slice(1);return e.apply(this,c)}return this.each(function(){if(!this.grid){var c;null!=b&&void 0!==b.data&&(c=b.data,b.data=[]);var e=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,
  34. 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,onInitGrid:null,loadComplete:null,gridComplete:null,loadError:null,loadBeforeSend:null,afterInsertRow:null,beforeRequest:null,beforeProcessing:null,onHeaderClick:null,viewrecords:!1,loadonce:!1,multiselect:!1,multikey:!1,editurl:null,search:!1,caption:"",hidegrid:!0,hiddengrid:!1,
  35. 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,deselectAfterSort:!0,scrollrows:!1,autowidth:!1,scrollOffset:18,
  36. 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:[],groupColumnShow:[],groupSummary:[],showSummaryOnHide:!1,
  37. sortitems:[],sortnames:[],summary:[],summaryval:[],plusicon:"ui-icon-circlesmall-plus",minusicon:"ui-icon-circlesmall-minus",displayField:[],groupSummaryPos:[],formatDisplayField:[],_locgr:!1},ignoreCase:!1,cmTemplate:{},idPrefix:"",multiSort:!1,minColWidth:33},a.jgrid.defaults,b||{});void 0!==c&&(e.data=c,b.data=c);var d=this,h={headers:[],cols:[],footers:[],dragStart:function(b,c,f){var h=a(this.bDiv).offset().left;this.resizing={idx:b,startX:c.pageX,sOL:c.pageX-h};this.hDiv.style.cursor="col-resize";
  38. this.curGbox=a("#rs_m"+a.jgrid.jqID(e.id),"#gbox_"+a.jgrid.jqID(e.id));this.curGbox.css({display:"block",left:c.pageX-h,top:f[1],height:f[2]});a(d).triggerHandler("jqGridResizeStart",[c,b]);a.isFunction(e.resizeStart)&&e.resizeStart.call(d,c,b);document.onselectstart=function(){return!1}},dragMove:function(a){if(this.resizing){var d=a.pageX-this.resizing.startX;a=this.headers[this.resizing.idx];var b="ltr"===e.direction?a.width+d:a.width-d,c;33<b&&(this.curGbox.css({left:this.resizing.sOL+d}),!0===
  39. e.forceFit?(c=this.headers[this.resizing.idx+e.nv],d="ltr"===e.direction?c.width-d:c.width+d,d>e.minColWidth&&(a.newWidth=b,c.newWidth=d)):(this.newWidth="ltr"===e.direction?e.tblwidth+d:e.tblwidth-d,a.newWidth=b))}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var b=this.resizing.idx,c=this.headers[b].newWidth||this.headers[b].width,c=parseInt(c,10);this.resizing=!1;a("#rs_m"+a.jgrid.jqID(e.id)).css("display","none");e.colModel[b].width=c;this.headers[b].width=c;this.headers[b].el.style.width=
  40. c+"px";this.cols[b].style.width=c+"px";0<this.footers.length&&(this.footers[b].style.width=c+"px");!0===e.forceFit?(c=this.headers[b+e.nv].newWidth||this.headers[b+e.nv].width,this.headers[b+e.nv].width=c,this.headers[b+e.nv].el.style.width=c+"px",this.cols[b+e.nv].style.width=c+"px",0<this.footers.length&&(this.footers[b+e.nv].style.width=c+"px"),e.colModel[b+e.nv].width=c):(e.tblwidth=this.newWidth||e.tblwidth,a("table:first",this.bDiv).css("width",e.tblwidth+"px"),a("table:first",this.hDiv).css("width",
  41. e.tblwidth+"px"),this.hDiv.scrollLeft=this.bDiv.scrollLeft,e.footerrow&&(a("table:first",this.sDiv).css("width",e.tblwidth+"px"),this.sDiv.scrollLeft=this.bDiv.scrollLeft));a(d).triggerHandler("jqGridResizeStop",[c,b]);a.isFunction(e.resizeStop)&&e.resizeStop.call(d,c,b)}this.curGbox=null;document.onselectstart=function(){return!0}},populateVisible:function(){h.timer&&clearTimeout(h.timer);h.timer=null;var d=a(h.bDiv).height();if(d){var b=a("table:first",h.bDiv),c,f;if(b[0].rows.length)try{f=(c=b[0].rows[1])?
  42. a(c).outerHeight()||h.prevRowHeight:h.prevRowHeight}catch(k){f=h.prevRowHeight}if(f){h.prevRowHeight=f;var l=e.rowNum;c=h.scrollTop=h.bDiv.scrollTop;var n=Math.round(b.position().top)-c,p=n+b.height();f*=l;var m,r,q;p<d&&0>=n&&(void 0===e.lastpage||(parseInt((p+c+f-1)/f,10)||0)<=e.lastpage)&&(r=parseInt((d-p+f-1)/f,10)||1,0<=p||2>r||!0===e.scroll?(m=(Math.round((p+c)/f)||0)+1,n=-1):n=1);0<n&&(m=(parseInt(c/f,10)||0)+1,r=(parseInt((c+d)/f,10)||0)+2-m,q=!0);!r||e.lastpage&&(m>e.lastpage||1===e.lastpage||
  43. m===e.page&&m===e.lastpage)||(h.hDiv.loading?h.timer=setTimeout(h.populateVisible,e.scrollTimeout):(e.page=m,q&&(h.selectionPreserver(b[0]),h.emptyRows.call(b[0],!1,!1)),h.populate(r)))}}},scrollGrid:function(a){if(e.scroll){var d=h.bDiv.scrollTop;void 0===h.scrollTop&&(h.scrollTop=0);d!==h.scrollTop&&(h.scrollTop=d,h.timer&&clearTimeout(h.timer),h.timer=setTimeout(h.populateVisible,e.scrollTimeout))}h.hDiv.scrollLeft=h.bDiv.scrollLeft;e.footerrow&&(h.sDiv.scrollLeft=h.bDiv.scrollLeft);a&&a.stopPropagation()},
  44. selectionPreserver:function(d){var b=d.p,c=b.selrow,e=b.selarrrow?a.makeArray(b.selarrrow):null,f=d.grid.bDiv.scrollLeft,h=function(){var g;b.selrow=null;b.selarrrow=[];if(b.multiselect&&e&&0<e.length)for(g=0;g<e.length;g++)e[g]!==c&&a(d).jqGrid("setSelection",e[g],!1,null);c&&a(d).jqGrid("setSelection",c,!1,null);d.grid.bDiv.scrollLeft=f;a(d).unbind(".selectionPreserver",h)};a(d).bind("jqGridGridComplete.selectionPreserver",h)}};if("TABLE"!==this.tagName.toUpperCase()||null==this.id)alert("Element is not a table or has no id!");
  45. else if(void 0!==document.documentMode&&5>=document.documentMode)alert("Grid can not be used in this ('quirks') mode!");else{a(this).empty().attr("tabindex","0");this.p=e;this.p.useProp=!!a.fn.prop;var k,l;if(0===this.p.colNames.length)for(k=0;k<this.p.colModel.length;k++)this.p.colNames[k]=this.p.colModel[k].label||this.p.colModel[k].name;if(this.p.colNames.length!==this.p.colModel.length)alert(a.jgrid.errors.model);else{var p=a("<div class='ui-jqgrid-view' role='grid'></div>");c=a.jgrid.msie;d.p.direction=
  46. a.trim(d.p.direction.toLowerCase());-1===a.inArray(d.p.direction,["ltr","rtl"])&&(d.p.direction="ltr");l=d.p.direction;a(p).insertBefore(this);a(this).removeClass("scroll").appendTo(p);var m=a("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");a(m).attr({id:"gbox_"+this.id,dir:l}).insertBefore(p);a(p).attr("id","gview_"+this.id).appendTo(m);a("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").insertBefore(p);a("<div class='loading ui-state-default ui-state-active' id='load_"+
  47. this.id+"'>"+this.p.loadtext+"</div>").insertBefore(p);a(this).attr({cellspacing:"0",cellpadding:"0",border:"0",role:"presentation","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});var r=function(a,d){a=parseInt(a,10);return isNaN(a)?d||0:a},q=function(b,c,e,f,g,k){var l=d.p.colModel[b],n=l.align,p='style="',m=l.classes,r=l.name,q=[];n&&(p+="text-align:"+n+";");!0===l.hidden&&(p+="display:none;");if(0===c)p+="width: "+h.headers[b].width+"px;";else if(a.isFunction(l.cellattr)||
  48. "string"===typeof l.cellattr&&null!=a.jgrid.cellattr&&a.isFunction(a.jgrid.cellattr[l.cellattr]))if(b=a.isFunction(l.cellattr)?l.cellattr:a.jgrid.cellattr[l.cellattr],(f=b.call(d,g,e,f,l,k))&&"string"===typeof f)if(f=f.replace(/style/i,"style").replace(/title/i,"title"),-1<f.indexOf("title")&&(l.title=!1),-1<f.indexOf("class")&&(m=void 0),q=f.replace(/\-style/g,"-sti").split(/style/),2===q.length){q[1]=a.trim(q[1].replace(/\-sti/g,"-style").replace("=",""));if(0===q[1].indexOf("'")||0===q[1].indexOf('"'))q[1]=
  49. q[1].substring(1);p+=q[1].replace(/'/gi,'"')}else p+='"';q.length||(q[0]="",p+='"');p+=(void 0!==m?' class="'+m+'"':"")+(l.title&&e?' title="'+a.jgrid.stripHtml(e)+'"':"");p+=' aria-describedby="'+d.p.id+"_"+r+'"';return p+q[0]},n=function(b){return null==b||""===b?"&#160;":d.p.autoencode?a.jgrid.htmlEncode(b):String(b)},t=function(b,c,e,f,h){var g=d.p.colModel[e];void 0!==g.formatter?(b=""!==String(d.p.idPrefix)?a.jgrid.stripPref(d.p.idPrefix,b):b,b={rowId:b,colModel:g,gid:d.p.id,pos:e},c=a.isFunction(g.formatter)?
  50. g.formatter.call(d,c,b,f,h):a.fmatter?a.fn.fmatter.call(d,g.formatter,c,b,f,h):n(c)):c=n(c);return c},u=function(a,d,b,c,e,f){d=t(a,d,b,e,"add");return'<td role="gridcell" '+q(b,c,d,e,a,f)+">"+d+"</td>"},w=function(a,b,c,e){e='<input role="checkbox" type="checkbox" id="jqg_'+d.p.id+"_"+a+'" class="cbox" name="jqg_'+d.p.id+"_"+a+'"'+(e?'checked="checked"':"")+"/>";return'<td role="gridcell" '+q(b,c,"",null,a,!0)+">"+e+"</td>"},s=function(a,d,b,c){b=(parseInt(b,10)-1)*parseInt(c,10)+1+d;return'<td role="gridcell" class="ui-state-default jqgrid-rownum" '+
  51. q(a,d,b,null,d,!0)+">"+b+"</td>"},x=function(a){var b,c=[],e=0,f;for(f=0;f<d.p.colModel.length;f++)b=d.p.colModel[f],"cb"!==b.name&&"subgrid"!==b.name&&"rn"!==b.name&&(c[e]="local"===a?b.name:"xml"===a||"xmlstring"===a?b.xmlmap||b.name:b.jsonmap||b.name,!1!==d.p.keyName&&!0===b.key&&(d.p.keyName=c[e]),e++);return c},A=function(b){var c=d.p.remapColumns;c&&c.length||(c=a.map(d.p.colModel,function(a,d){return d}));b&&(c=a.map(c,function(a){return a<b?null:a-b}));return c},v=function(d,b){var c;this.p.deepempty?
  52. a(this.rows).slice(1).remove():(c=0<this.rows.length?this.rows[0]:null,a(this.firstChild).empty().append(c));d&&this.p.scroll&&(a(this.grid.bDiv.firstChild).css({height:"auto"}),a(this.grid.bDiv.firstChild.firstChild).css({height:0,display:"none"}),0!==this.grid.bDiv.scrollTop&&(this.grid.bDiv.scrollTop=0));!0===b&&this.p.treeGrid&&(this.p.data=[],this.p._index={})},H=function(){var b=d.p,c=b.data,e=c.length,f,h,g,k,l,p=b.localReader,n=b.colModel,m=p.cell,r=(!0===b.multiselect?1:0)+(!0===b.subGrid?
  53. 1:0)+(!0===b.rownumbers?1:0),q=b.scroll?a.jgrid.randId():1,u,s,t;if("local"===b.datatype&&!0===p.repeatitems)for(u=A(r),s=x("local"),g=!1===b.keyIndex?a.isFunction(p.id)?p.id.call(d,c):p.id:b.keyIndex,b=0;b<e;b++){h=c[b];f=a.jgrid.getAccessor(h,g);void 0===f&&("number"===typeof g&&null!=n[g+r]&&(f=a.jgrid.getAccessor(h,n[g+r].name)),void 0===f&&(f=q+b,m&&(k=a.jgrid.getAccessor(h,m)||h,f=null!=k&&void 0!==k[g]?k[g]:f)));k={};k[p.id]=f;m&&(h=a.jgrid.getAccessor(h,m)||h);t=a.isArray(h)?u:s;for(f=0;f<
  54. t.length;f++)l=a.jgrid.getAccessor(h,t[f]),k[n[f+r].name]=l;a.extend(!0,c[b],k)}},B=function(){var b=d.p.data.length,c,e,f;c=!1===d.p.keyName||!0===d.p.loadonce?d.p.localReader.id:d.p.keyName;d.p._index=[];for(e=0;e<b;e++)f=a.jgrid.getAccessor(d.p.data[e],c),void 0===f&&(f=String(e+1)),d.p._index[f]=e},D=function(b,c,e,f,h,g){var k="-1",l="",p;c=c?"display:none;":"";e="ui-widget-content jqgrow ui-row-"+d.p.direction+(e?" "+e:"")+(g?" ui-state-highlight":"");g=a(d).triggerHandler("jqGridRowAttr",[f,
  55. h,b]);"object"!==typeof g&&(g=a.isFunction(d.p.rowattr)?d.p.rowattr.call(d,f,h,b):"string"===typeof d.p.rowattr&&null!=a.jgrid.rowattr&&a.isFunction(a.jgrid.rowattr[d.p.rowattr])?a.jgrid.rowattr[d.p.rowattr].call(d,f,h,b):{});if(!a.isEmptyObject(g)){g.hasOwnProperty("id")&&(b=g.id,delete g.id);g.hasOwnProperty("tabindex")&&(k=g.tabindex,delete g.tabindex);g.hasOwnProperty("style")&&(c+=g.style,delete g.style);g.hasOwnProperty("class")&&(e+=" "+g["class"],delete g["class"]);try{delete g.role}catch(n){}for(p in g)g.hasOwnProperty(p)&&
  56. (l+=" "+p+"="+g[p])}return'<tr role="row" id="'+b+'" tabindex="'+k+'" class="'+e+'"'+(""===c?"":' style="'+c+'"')+l+">"},C=function(b,c,e,f,h){var g=new Date,k="local"!==d.p.datatype&&d.p.loadonce||"xmlstring"===d.p.datatype,l=d.p.xmlReader,p="local"===d.p.datatype?"local":"xml";k&&(d.p.data=[],d.p._index={},d.p.localReader.id="_id_");d.p.reccount=0;if(a.isXMLDoc(b)){-1!==d.p.treeANode||d.p.scroll?e=1<e?e:1:(v.call(d,!1,!0),e=1);var n=a(d),m,q,t=0,B,K=!0===d.p.multiselect?1:0,N=0,y,C=!0===d.p.rownumbers?
  57. 1:0,H,I=[],P,z={},F,J,E=[],O=!0===d.p.altRows?d.p.altclass:"",ha;!0===d.p.subGrid&&(N=1,y=a.jgrid.getMethod("addSubGridCell"));l.repeatitems||(I=x(p));H=!1===d.p.keyName?a.isFunction(l.id)?l.id.call(d,b):l.id:d.p.keyName;p=-1===String(H).indexOf("[")?I.length?function(b,d){return a(H,b).text()||d}:function(b,d){return a(l.cell,b).eq(H).text()||d}:function(a,b){return a.getAttribute(H.replace(/[\[\]]/g,""))||b};d.p.userData={};d.p.page=r(a.jgrid.getXmlData(b,l.page),d.p.page);d.p.lastpage=r(a.jgrid.getXmlData(b,
  58. l.total),1);d.p.records=r(a.jgrid.getXmlData(b,l.records));a.isFunction(l.userdata)?d.p.userData=l.userdata.call(d,b)||{}:a.jgrid.getXmlData(b,l.userdata,!0).each(function(){d.p.userData[this.getAttribute("name")]=a(this).text()});b=a.jgrid.getXmlData(b,l.root,!0);(b=a.jgrid.getXmlData(b,l.row,!0))||(b=[]);var S=b.length,G=0,U=[],L=parseInt(d.p.rowNum,10),M=d.p.scroll?a.jgrid.randId():1;0<S&&0>=d.p.page&&(d.p.page=1);if(b&&S){h&&(L*=h+1);h=a.isFunction(d.p.afterInsertRow);var T=!1,Y;d.p.grouping&&
  59. (T=!0===d.p.groupingView.groupCollapse,Y=a.jgrid.getMethod("groupingPrepare"));for(;G<S;){F=b[G];J=p(F,M+G);J=d.p.idPrefix+J;m=0===e?0:e+1;ha=1===(m+G)%2?O:"";var ca=E.length;E.push("");C&&E.push(s(0,G,d.p.page,d.p.rowNum));K&&E.push(w(J,C,G,!1));N&&E.push(y.call(n,K+C,G+e));if(l.repeatitems){P||(P=A(K+N+C));var ba=a.jgrid.getXmlData(F,l.cell,!0);a.each(P,function(a){var b=ba[this];if(!b)return!1;B=b.textContent||b.text;z[d.p.colModel[a+K+N+C].name]=B;E.push(u(J,B,a+K+N+C,G+e,F,z))})}else for(m=0;m<
  60. I.length;m++)B=a.jgrid.getXmlData(F,I[m]),z[d.p.colModel[m+K+N+C].name]=B,E.push(u(J,B,m+K+N+C,G+e,F,z));E[ca]=D(J,T,ha,z,F,!1);E.push("</tr>");d.p.grouping&&(U.push(E),d.p.groupingView._locgr||Y.call(n,z,G),E=[]);if(k||!0===d.p.treeGrid)z._id_=a.jgrid.stripPref(d.p.idPrefix,J),d.p.data.push(z),d.p._index[z._id_]=d.p.data.length-1;!1===d.p.gridview&&(a("tbody:first",c).append(E.join("")),n.triggerHandler("jqGridAfterInsertRow",[J,z,F]),h&&d.p.afterInsertRow.call(d,J,z,F),E=[]);z={};t++;G++;if(t===
  61. L)break}}!0===d.p.gridview&&(q=-1<d.p.treeANode?d.p.treeANode:0,d.p.grouping?k||(n.jqGrid("groupingRender",U,d.p.colModel.length,d.p.page,L),U=null):!0===d.p.treeGrid&&0<q?a(d.rows[q]).after(E.join("")):(d.firstElementChild.innerHTML+=E.join(""),d.grid.cols=d.rows[0].cells));if(!0===d.p.subGrid)try{n.jqGrid("addSubGrid",K+C)}catch($){}d.p.totaltime=new Date-g;0<t&&0===d.p.records&&(d.p.records=S);E=null;if(!0===d.p.treeGrid)try{n.jqGrid("setTreeNode",q+1,t+q+1)}catch(Q){}d.p.reccount=t;d.p.treeANode=
  62. -1;d.p.userDataOnFooter&&n.jqGrid("footerData","set",d.p.userData,!0);k&&(d.p.records=S,d.p.lastpage=Math.ceil(S/L));f||d.updatepager(!1,!0);if(k){for(;t<S;){F=b[t];J=p(F,t+M);J=d.p.idPrefix+J;if(l.repeatitems){P||(P=A(K+N+C));var aa=a.jgrid.getXmlData(F,l.cell,!0);a.each(P,function(a){var b=aa[this];if(!b)return!1;B=b.textContent||b.text;z[d.p.colModel[a+K+N+C].name]=B})}else for(m=0;m<I.length;m++)B=a.jgrid.getXmlData(F,I[m]),z[d.p.colModel[m+K+N+C].name]=B;z._id_=a.jgrid.stripPref(d.p.idPrefix,
  63. J);d.p.grouping&&Y.call(n,z,t);d.p.data.push(z);d.p._index[z._id_]=d.p.data.length-1;z={};t++}d.p.grouping&&(d.p.groupingView._locgr=!0,n.jqGrid("groupingRender",U,d.p.colModel.length,d.p.page,L),U=null)}}},F=function(b,c,e,f,h){var g=new Date;if(b){-1!==d.p.treeANode||d.p.scroll?e=1<e?e:1:(v.call(d,!1,!0),e=1);var k,l="local"!==d.p.datatype&&d.p.loadonce||"jsonstring"===d.p.datatype;l&&(d.p.data=[],d.p._index={},d.p.localReader.id="_id_");d.p.reccount=0;"local"===d.p.datatype?(c=d.p.localReader,
  64. k="local"):(c=d.p.jsonReader,k="json");var p=a(d),n=0,m,q,t,B=[],K=d.p.multiselect?1:0,N=!0===d.p.subGrid?1:0,y,C=!0===d.p.rownumbers?1:0,H=A(K+N+C);k=x(k);var I,z,F,J={},P,E,G=[],ha=!0===d.p.altRows?d.p.altclass:"",S;d.p.page=r(a.jgrid.getAccessor(b,c.page),d.p.page);d.p.lastpage=r(a.jgrid.getAccessor(b,c.total),1);d.p.records=r(a.jgrid.getAccessor(b,c.records));d.p.userData=a.jgrid.getAccessor(b,c.userdata)||{};N&&(y=a.jgrid.getMethod("addSubGridCell"));F=!1===d.p.keyName?a.isFunction(c.id)?c.id.call(d,
  65. b):c.id:d.p.keyName;z=a.jgrid.getAccessor(b,c.root);null==z&&a.isArray(b)&&(z=b);z||(z=[]);b=z.length;q=0;0<b&&0>=d.p.page&&(d.p.page=1);var O=parseInt(d.p.rowNum,10),U=d.p.scroll?a.jgrid.randId():1,L=!1,M;h&&(O*=h+1);"local"!==d.p.datatype||d.p.deselectAfterSort||(L=!0);var Y=a.isFunction(d.p.afterInsertRow),T=[],ca=!1,ba;d.p.grouping&&(ca=!0===d.p.groupingView.groupCollapse,ba=a.jgrid.getMethod("groupingPrepare"));for(;q<b;){h=z[q];E=a.jgrid.getAccessor(h,F);void 0===E&&("number"===typeof F&&null!=
  66. d.p.colModel[F+K+N+C]&&(E=a.jgrid.getAccessor(h,d.p.colModel[F+K+N+C].name)),void 0===E&&(E=U+q,0===B.length&&c.cell&&(m=a.jgrid.getAccessor(h,c.cell)||h,E=null!=m&&void 0!==m[F]?m[F]:E)));E=d.p.idPrefix+E;m=1===e?0:e;S=1===(m+q)%2?ha:"";L&&(M=d.p.multiselect?-1!==a.inArray(E,d.p.selarrrow):E===d.p.selrow);var $=G.length;G.push("");C&&G.push(s(0,q,d.p.page,d.p.rowNum));K&&G.push(w(E,C,q,M));N&&G.push(y.call(p,K+C,q+e));I=k;c.repeatitems&&(c.cell&&(h=a.jgrid.getAccessor(h,c.cell)||h),a.isArray(h)&&
  67. (I=H));for(t=0;t<I.length;t++)m=a.jgrid.getAccessor(h,I[t]),J[d.p.colModel[t+K+N+C].name]=m,G.push(u(E,m,t+K+N+C,q+e,h,J));G[$]=D(E,ca,S,J,h,M);G.push("</tr>");d.p.grouping&&(T.push(G),d.p.groupingView._locgr||ba.call(p,J,q),G=[]);if(l||!0===d.p.treeGrid)J._id_=a.jgrid.stripPref(d.p.idPrefix,E),d.p.data.push(J),d.p._index[J._id_]=d.p.data.length-1;!1===d.p.gridview&&(a("#"+a.jgrid.jqID(d.p.id)+" tbody:first").append(G.join("")),p.triggerHandler("jqGridAfterInsertRow",[E,J,h]),Y&&d.p.afterInsertRow.call(d,
  68. E,J,h),G=[]);J={};n++;q++;if(n===O)break}!0===d.p.gridview&&(P=-1<d.p.treeANode?d.p.treeANode:0,d.p.grouping?l||(p.jqGrid("groupingRender",T,d.p.colModel.length,d.p.page,O),T=null):!0===d.p.treeGrid&&0<P?a(d.rows[P]).after(G.join("")):(d.firstElementChild.innerHTML+=G.join(""),d.grid.cols=d.rows[0].cells));if(!0===d.p.subGrid)try{p.jqGrid("addSubGrid",K+C)}catch(Q){}d.p.totaltime=new Date-g;0<n&&0===d.p.records&&(d.p.records=b);if(!0===d.p.treeGrid)try{p.jqGrid("setTreeNode",P+1,n+P+1)}catch(aa){}d.p.reccount=
  69. n;d.p.treeANode=-1;d.p.userDataOnFooter&&p.jqGrid("footerData","set",d.p.userData,!0);l&&(d.p.records=b,d.p.lastpage=Math.ceil(b/O));f||d.updatepager(!1,!0);if(l){for(;n<b&&z[n];){h=z[n];E=a.jgrid.getAccessor(h,F);void 0===E&&("number"===typeof F&&null!=d.p.colModel[F+K+N+C]&&(E=a.jgrid.getAccessor(h,d.p.colModel[F+K+N+C].name)),void 0===E&&(E=U+n,0===B.length&&c.cell&&(e=a.jgrid.getAccessor(h,c.cell)||h,E=null!=e&&void 0!==e[F]?e[F]:E)));if(h){E=d.p.idPrefix+E;I=k;c.repeatitems&&(c.cell&&(h=a.jgrid.getAccessor(h,
  70. c.cell)||h),a.isArray(h)&&(I=H));for(t=0;t<I.length;t++)J[d.p.colModel[t+K+N+C].name]=a.jgrid.getAccessor(h,I[t]);J._id_=a.jgrid.stripPref(d.p.idPrefix,E);d.p.grouping&&ba.call(p,J,n);d.p.data.push(J);d.p._index[J._id_]=d.p.data.length-1;J={}}n++}d.p.grouping&&(d.p.groupingView._locgr=!0,p.jqGrid("groupingRender",T,d.p.colModel.length,d.p.page,O))}}},y=function(){function b(a){var d=0,c,e,f,g,k;if(null!=a.groups){(e=a.groups.length&&"OR"===a.groupOp.toString().toUpperCase())&&u.orBegin();for(c=0;c<
  71. a.groups.length;c++){0<d&&e&&u.or();try{b(a.groups[c])}catch(l){alert(l)}d++}e&&u.orEnd()}if(null!=a.rules)try{(f=a.rules.length&&"OR"===a.groupOp.toString().toUpperCase())&&u.orBegin();for(c=0;c<a.rules.length;c++)k=a.rules[c],g=a.groupOp.toString().toUpperCase(),t[k.op]&&k.field&&(0<d&&g&&"OR"===g&&(u=u.or()),u=t[k.op](u,g)(k.field,k.data,h[k.field])),d++;f&&u.orEnd()}catch(p){alert(p)}}var c=d.p.multiSort?[]:"",e=[],f=!1,h={},g=[],k=[],l,p,n;if(a.isArray(d.p.data)){var m=d.p.grouping?d.p.groupingView:
  72. !1,r,q;a.each(d.p.colModel,function(){p=this.sorttype||"text";"date"===p||"datetime"===p?(this.formatter&&"string"===typeof this.formatter&&"date"===this.formatter?(l=this.formatoptions&&this.formatoptions.srcformat?this.formatoptions.srcformat:a.jgrid.formatter.date.srcformat,n=this.formatoptions&&this.formatoptions.newformat?this.formatoptions.newformat:a.jgrid.formatter.date.newformat):l=n=this.datefmt||"Y-m-d",h[this.name]={stype:p,srcfmt:l,newfmt:n,sfunc:this.sortfunc||null}):h[this.name]={stype:p,
  73. srcfmt:"",newfmt:"",sfunc:this.sortfunc||null};if(d.p.grouping)for(q=0,r=m.groupField.length;q<r;q++)if(this.name===m.groupField[q]){var b=this.name;this.index&&(b=this.index);g[q]=h[b];k[q]=b}d.p.multiSort?this.lso&&(c.push(this.name),b=this.lso.split("-"),e.push(b[b.length-1])):f||this.index!==d.p.sortname&&this.name!==d.p.sortname||(c=this.name,f=!0)});if(d.p.treeGrid)a(d).jqGrid("SortTree",c,d.p.sortorder,h[c].stype||"text",h[c].srcfmt||"");else{var t={eq:function(a){return a.equals},ne:function(a){return a.notEquals},
  74. 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},nc:function(a,b){return"OR"===b?a.orNot().contains:a.andNot().contains},bw:function(a){return a.startsWith},bn:function(a,b){return"OR"===b?a.orNot().startsWith:a.andNot().startsWith},en:function(a,b){return"OR"===b?a.orNot().endsWith:a.andNot().endsWith},ew:function(a){return a.endsWith},ni:function(a,b){return"OR"===b?a.orNot().equals:
  75. a.andNot().equals},"in":function(a){return a.equals},nu:function(a){return a.isNull},nn:function(a,b){return"OR"===b?a.orNot().isNull:a.andNot().isNull}},u=a.jgrid.from(d.p.data);d.p.ignoreCase&&(u=u.ignoreCase());if(!0===d.p.search){var s=d.p.postData.filters;if(s)"string"===typeof s&&(s=a.jgrid.parse(s)),b(s);else try{u=t[d.p.postData.searchOper](u)(d.p.postData.searchField,d.p.postData.searchString,h[d.p.postData.searchField])}catch(x){}}if(d.p.grouping)for(q=0;q<r;q++)u.orderBy(k[q],m.groupOrder[q],
  76. g[q].stype,g[q].srcfmt);d.p.multiSort?a.each(c,function(a){u.orderBy(this,e[a],h[this].stype,h[this].srcfmt,h[this].sfunc)}):c&&d.p.sortorder&&f&&("DESC"===d.p.sortorder.toUpperCase()?u.orderBy(d.p.sortname,"d",h[c].stype,h[c].srcfmt,h[c].sfunc):u.orderBy(d.p.sortname,"a",h[c].stype,h[c].srcfmt,h[c].sfunc));var s=u.select(),v=parseInt(d.p.rowNum,10),w=s.length,D=parseInt(d.p.page,10),A=Math.ceil(w/v),K={};if((d.p.search||d.p.resetsearch)&&d.p.grouping&&d.p.groupingView._locgr){d.p.groupingView.groups=
  77. [];var N,B=a.jgrid.getMethod("groupingPrepare"),C,y;if(d.p.footerrow&&d.p.userDataOnFooter){for(C in d.p.userData)d.p.userData.hasOwnProperty(C)&&(d.p.userData[C]=0);y=!0}for(N=0;N<w;N++){if(y)for(C in d.p.userData)d.p.userData[C]+=parseFloat(s[N][C]||0);B.call(a(d),s[N],N,v)}}s=s.slice((D-1)*v,D*v);h=u=null;K[d.p.localReader.total]=A;K[d.p.localReader.page]=D;K[d.p.localReader.records]=w;K[d.p.localReader.root]=s;K[d.p.localReader.userdata]=d.p.userData;s=null;return K}}},O=function(){d.grid.hDiv.loading=
  78. !0;d.p.hiddengrid||a(d).jqGrid("progressBar",{method:"show",loadtype:d.p.loadui,htmlcontent:d.p.loadtext})},z=function(){d.grid.hDiv.loading=!1;a(d).jqGrid("progressBar",{method:"hide",loadtype:d.p.loadui})},L=function(b){if(!d.grid.hDiv.loading){var c=d.p.scroll&&!1===b,e={},f,h=d.p.prmNames;0>=d.p.page&&(d.p.page=Math.min(1,d.p.lastpage));null!==h.search&&(e[h.search]=d.p.search);null!==h.nd&&(e[h.nd]=(new Date).getTime());null!==h.rows&&(e[h.rows]=d.p.rowNum);null!==h.page&&(e[h.page]=d.p.page);
  79. null!==h.sort&&(e[h.sort]=d.p.sortname);null!==h.order&&(e[h.order]=d.p.sortorder);null!==d.p.rowTotal&&null!==h.totalrows&&(e[h.totalrows]=d.p.rowTotal);var g=a.isFunction(d.p.loadComplete),k=g?d.p.loadComplete:null,l=0;b=b||1;1<b?null!==h.npage?(e[h.npage]=b,l=b-1,b=1):k=function(a){d.p.page++;d.grid.hDiv.loading=!1;g&&d.p.loadComplete.call(d,a);L(b-1)}:null!==h.npage&&delete d.p.postData[h.npage];if(d.p.grouping){a(d).jqGrid("groupingSetup");var p=d.p.groupingView,n,m="";for(n=0;n<p.groupField.length;n++){var r=
  80. p.groupField[n];a.each(d.p.colModel,function(a,b){b.name===r&&b.index&&(r=b.index)});m+=r+" "+p.groupOrder[n]+", "}e[h.sort]=m+e[h.sort]}a.extend(d.p.postData,e);var q=d.p.scroll?d.rows.length-1:1,e=a(d).triggerHandler("jqGridBeforeRequest");if(!1!==e&&"stop"!==e)if(a.isFunction(d.p.datatype))d.p.datatype.call(d,d.p.postData,"load_"+d.p.id,q,b,l);else{if(a.isFunction(d.p.beforeRequest)&&(e=d.p.beforeRequest.call(d),void 0===e&&(e=!0),!1===e))return;f=d.p.datatype.toLowerCase();switch(f){case "json":case "jsonp":case "xml":case "script":a.ajax(a.extend({url:d.p.url,
  81. type:d.p.mtype,dataType:f,data:a.isFunction(d.p.serializeGridData)?d.p.serializeGridData.call(d,d.p.postData):d.p.postData,success:function(e,h,g){if(a.isFunction(d.p.beforeProcessing)&&!1===d.p.beforeProcessing.call(d,e,h,g))z();else{"xml"===f?C(e,d.grid.bDiv,q,1<b,l):F(e,d.grid.bDiv,q,1<b,l);a(d).triggerHandler("jqGridLoadComplete",[e]);k&&k.call(d,e);a(d).triggerHandler("jqGridAfterLoadComplete",[e]);c&&d.grid.populateVisible();if(d.p.loadonce||d.p.treeGrid)d.p.datatype="local";1===b&&z()}},error:function(c,
  82. e,f){a.isFunction(d.p.loadError)&&d.p.loadError.call(d,c,e,f);1===b&&z()},beforeSend:function(b,c){var e=!0;a.isFunction(d.p.loadBeforeSend)&&(e=d.p.loadBeforeSend.call(d,b,c));void 0===e&&(e=!0);if(!1===e)return!1;O()}},a.jgrid.ajaxOptions,d.p.ajaxGridOptions));break;case "xmlstring":O();e="string"!==typeof d.p.datastr?d.p.datastr:a.parseXML(d.p.datastr);C(e,d.grid.bDiv);a(d).triggerHandler("jqGridLoadComplete",[e]);g&&d.p.loadComplete.call(d,e);a(d).triggerHandler("jqGridAfterLoadComplete",[e]);
  83. d.p.datatype="local";d.p.datastr=null;z();break;case "jsonstring":O();e="string"===typeof d.p.datastr?a.jgrid.parse(d.p.datastr):d.p.datastr;F(e,d.grid.bDiv);a(d).triggerHandler("jqGridLoadComplete",[e]);g&&d.p.loadComplete.call(d,e);a(d).triggerHandler("jqGridAfterLoadComplete",[e]);d.p.datatype="local";d.p.datastr=null;z();break;case "local":case "clientside":O(),d.p.datatype="local",e=y(),F(e,d.grid.bDiv,q,1<b,l),a(d).triggerHandler("jqGridLoadComplete",[e]),k&&k.call(d,e),a(d).triggerHandler("jqGridAfterLoadComplete",
  84. [e]),c&&d.grid.populateVisible(),z()}}}},Q=function(b){a("#cb_"+a.jgrid.jqID(d.p.id),d.grid.hDiv)[d.p.useProp?"prop":"attr"]("checked",b);if(d.p.frozenColumns&&d.p.id+"_frozen")a("#cb_"+a.jgrid.jqID(d.p.id),d.grid.fhDiv)[d.p.useProp?"prop":"attr"]("checked",b)},V=function(b,c){var e="",f="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",h="",g,k,p,n,m=function(b){var c;a.isFunction(d.p.onPaging)&&(c=d.p.onPaging.call(d,b));if("stop"===c)return!1;
  85. d.p.selrow=null;d.p.multiselect&&(d.p.selarrrow=[],Q(!1));d.p.savedRow=[];return!0};b=b.substr(1);c+="_"+b;g="pg_"+b;k=b+"_left";p=b+"_center";n=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='"+k+"' align='left'></td><td id='"+p+"' align='center' style='white-space:pre;'></td><td id='"+n+"' align='right'></td></tr></tbody></table></div>").attr("dir",
  86. "ltr");if(0<d.p.rowList.length){h="<td dir='"+l+"'>";h+="<select class='ui-pg-selbox' role='listbox' "+(d.p.pgrecs?"title='"+d.p.pgrecs+"'":"")+">";for(k=0;k<d.p.rowList.length;k++)p=d.p.rowList[k].toString().split(":"),1===p.length&&(p[1]=p[0]),h+='<option role="option" value="'+p[0]+'"'+(r(d.p.rowNum,0)===r(p[0],0)?' selected="selected"':"")+">"+p[1]+"</option>";h+="</select></td>"}"rtl"===l&&(f+=h);!0===d.p.pginput&&(e="<td dir='"+l+"'>"+a.jgrid.format(d.p.pgtext||"","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>",
  87. "<span id='sp_1_"+a.jgrid.jqID(b)+"'></span>")+"</td>");!0===d.p.pgbuttons?(k=["first"+c,"prev"+c,"next"+c,"last"+c],"rtl"===l&&k.reverse(),f+="<td id='"+k[0]+"' class='ui-pg-button ui-corner-all' "+(d.p.pgfirst?"title='"+d.p.pgfirst+"'":"")+"><span class='ui-icon ui-icon-seek-first'></span></td>",f+="<td id='"+k[1]+"' class='ui-pg-button ui-corner-all' "+(d.p.pgprev?"title='"+d.p.pgprev+"'":"")+"><span class='ui-icon ui-icon-seek-prev'></span></td>",f=f+(""!==e?"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>"+
  88. e+"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>":"")+("<td id='"+k[2]+"' class='ui-pg-button ui-corner-all' "+(d.p.pgnext?"title='"+d.p.pgnext+"'":"")+"><span class='ui-icon ui-icon-seek-next'></span></td>"),f+="<td id='"+k[3]+"' class='ui-pg-button ui-corner-all' "+(d.p.pglast?"title='"+d.p.pglast+"'":"")+"><span class='ui-icon ui-icon-seek-end'></span></td>"):""!==e&&(f+=e);"ltr"===l&&(f+=h);f+="</tr></tbody></table>";!0===d.p.viewrecords&&
  89. a("td#"+b+"_"+d.p.recordpos,"#"+g).append("<div dir='"+l+"' style='text-align:"+d.p.recordpos+"' class='ui-paging-info'></div>");a("td#"+b+"_"+d.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();0<f&&(""!==e&&(f+=50),a("td#"+b+"_"+d.p.pagerpos,"#"+g).width(f));d.p._nvtd=[];
  90. d.p._nvtd[0]=f?Math.floor((d.p.width-f)/2):Math.floor(d.p.width/3);d.p._nvtd[1]=0;f=null;a(".ui-pg-selbox","#"+g).bind("change",function(){if(!m("records"))return!1;d.p.page=Math.round(d.p.rowNum*(d.p.page-1)/this.value-.5)+1;d.p.rowNum=this.value;d.p.pager&&a(".ui-pg-selbox",d.p.pager).val(this.value);d.p.toppager&&a(".ui-pg-selbox",d.p.toppager).val(this.value);L();return!1});!0===d.p.pgbuttons&&(a(".ui-pg-button","#"+g).hover(function(){a(this).hasClass("ui-state-disabled")?this.style.cursor="default":
  91. (a(this).addClass("ui-state-hover"),this.style.cursor="pointer")},function(){a(this).hasClass("ui-state-disabled")||(a(this).removeClass("ui-state-hover"),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(){if(a(this).hasClass("ui-state-disabled"))return!1;var b=r(d.p.page,1),e=r(d.p.lastpage,1),f=!1,h=!0,g=!0,k=!0,l=!0;0===e||1===e?l=k=g=h=!1:1<e&&1<=b?1===b?g=h=!1:b===e&&(l=k=!1):1<e&&0===b&&(l=
  92. k=!1,b=e-1);if(!m(this.id))return!1;this.id==="first"+c&&h&&(d.p.page=1,f=!0);this.id==="prev"+c&&g&&(d.p.page=b-1,f=!0);this.id==="next"+c&&k&&(d.p.page=b+1,f=!0);this.id==="last"+c&&l&&(d.p.page=e,f=!0);f&&L();return!1}));!0===d.p.pginput&&a("input.ui-pg-input","#"+g).keypress(function(b){if(13===(b.charCode||b.keyCode||0)){if(!m("user"))return!1;a(this).val(r(a(this).val(),1));d.p.page=0<a(this).val()?a(this).val():d.p.page;L();return!1}return this})},X=function(b,c){var e,f="",h=d.p.colModel,
  93. g=!1,k;k=d.p.frozenColumns?c:d.grid.headers[b].el;var l="";a("span.ui-grid-ico-sort",k).addClass("ui-state-disabled");a(k).attr("aria-selected","false");if(h[b].lso)if("asc"===h[b].lso)h[b].lso+="-desc",l="desc";else if("desc"===h[b].lso)h[b].lso+="-asc",l="asc";else{if("asc-desc"===h[b].lso||"desc-asc"===h[b].lso)h[b].lso=""}else h[b].lso=l=h[b].firstsortorder||"asc";l?(a("span.s-ico",k).show(),a("span.ui-icon-"+l,k).removeClass("ui-state-disabled"),a(k).attr("aria-selected","true")):d.p.viewsortcols[0]||
  94. a("span.s-ico",k).hide();d.p.sortorder="";a.each(h,function(a){this.lso&&(0<a&&g&&(f+=", "),e=this.lso.split("-"),f+=h[a].index||h[a].name,f+=" "+e[e.length-1],g=!0,d.p.sortorder=e[e.length-1])});k=f.lastIndexOf(d.p.sortorder);f=f.substring(0,k);d.p.sortname=f},E=function(b,c,e,f,h){if(d.p.colModel[c].sortable&&!(0<d.p.savedRow.length)){e||(d.p.lastsort===c&&""!==d.p.sortname?"asc"===d.p.sortorder?d.p.sortorder="desc":"desc"===d.p.sortorder&&(d.p.sortorder="asc"):d.p.sortorder=d.p.colModel[c].firstsortorder||
  95. "asc",d.p.page=1);if(d.p.multiSort)X(c,h);else{if(f){if(d.p.lastsort===c&&d.p.sortorder===f&&!e)return;d.p.sortorder=f}e=d.grid.headers[d.p.lastsort].el;h=d.p.frozenColumns?h:d.grid.headers[c].el;a("span.ui-grid-ico-sort",e).addClass("ui-state-disabled");a(e).attr("aria-selected","false");d.p.frozenColumns&&(d.grid.fhDiv.find("span.ui-grid-ico-sort").addClass("ui-state-disabled"),d.grid.fhDiv.find("th").attr("aria-selected","false"));a("span.ui-icon-"+d.p.sortorder,h).removeClass("ui-state-disabled");
  96. a(h).attr("aria-selected","true");d.p.viewsortcols[0]||(d.p.lastsort!==c?(d.p.frozenColumns&&d.grid.fhDiv.find("span.s-ico").hide(),a("span.s-ico",e).hide(),a("span.s-ico",h).show()):""===d.p.sortname&&a("span.s-ico",h).show());b=b.substring(5+d.p.id.length+1);d.p.sortname=d.p.colModel[c].index||b}"stop"===a(d).triggerHandler("jqGridSortCol",[d.p.sortname,c,d.p.sortorder])?d.p.lastsort=c:a.isFunction(d.p.onSortCol)&&"stop"===d.p.onSortCol.call(d,d.p.sortname,c,d.p.sortorder)?d.p.lastsort=c:("local"===
  97. d.p.datatype?d.p.deselectAfterSort&&a(d).jqGrid("resetSelection"):(d.p.selrow=null,d.p.multiselect&&Q(!1),d.p.selarrrow=[],d.p.savedRow=[]),d.p.scroll&&(h=d.grid.bDiv.scrollLeft,v.call(d,!0,!1),d.grid.hDiv.scrollLeft=h),d.p.subGrid&&"local"===d.p.datatype&&a("td.sgexpanded","#"+a.jgrid.jqID(d.p.id)).each(function(){a(this).trigger("click")}),L(),d.p.lastsort=c,d.p.sortname!==b&&c&&(d.p.lastsort=c))}},aa=function(b){b=a(d.grid.headers[b].el);b=[b.position().left+b.outerWidth()];"rtl"===d.p.direction&&
  98. (b[0]=d.p.width-b[0]);b[0]-=d.grid.bDiv.scrollLeft;b.push(a(d.grid.hDiv).position().top);b.push(a(d.grid.bDiv).offset().top-a(d.grid.hDiv).offset().top+a(d.grid.bDiv).height());return b},T=function(b){var c,e=d.grid.headers,f=a.jgrid.getCellIndex(b);for(c=0;c<e.length;c++)if(b===e[c].el){f=c;break}return f},M;this.p.id=this.id;-1===a.inArray(d.p.multikey,["shiftKey","altKey","ctrlKey"])&&(d.p.multikey=!1);d.p.keyName=!1;for(k=0;k<d.p.colModel.length;k++)M="string"===typeof d.p.colModel[k].template?
  99. null!=a.jgrid.cmTemplate&&"object"===typeof a.jgrid.cmTemplate[d.p.colModel[k].template]?a.jgrid.cmTemplate[d.p.colModel[k].template]:{}:d.p.colModel[k].template,d.p.colModel[k]=a.extend(!0,{},d.p.cmTemplate,M||{},d.p.colModel[k]),!1===d.p.keyName&&!0===d.p.colModel[k].key&&(d.p.keyName=d.p.colModel[k].name);d.p.sortorder=d.p.sortorder.toLowerCase();a.jgrid.cell_width=a.jgrid.cellWidth();!0===d.p.grouping&&(d.p.scroll=!1,d.p.rownumbers=!1,d.p.treeGrid=!1,d.p.gridview=!0);if(!0===this.p.treeGrid){try{a(this).jqGrid("setTreeGrid")}catch(K){}"local"!==
  100. d.p.datatype&&(d.p.localReader={id:"_id_"})}if(this.p.subGrid)try{a(d).jqGrid("setSubGrid")}catch(N){}this.p.multiselect&&(this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>"),this.p.colModel.unshift({name:"cb",width:a.jgrid.cell_width?d.p.multiselectWidth+d.p.cellLayout:d.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:d.p.rownumWidth,
  101. sortable:!1,resizable:!1,hidedlg:!0,search:!1,align:"center",fixed:!0}));d.p.xmlReader=a.extend(!0,{root:"rows",row:"row",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"}},d.p.xmlReader);d.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"}},
  102. d.p.jsonReader);d.p.localReader=a.extend(!0,{root:"rows",page:"page",total:"total",records:"records",repeatitems:!1,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:!0,cell:"cell"}},d.p.localReader);d.p.scroll&&(d.p.pgbuttons=!1,d.p.pginput=!1,d.p.rowList=[]);d.p.data.length&&(H(),B());M="<thead><tr class='ui-jqgrid-labels' role='row'>";var J,P,Y,U,S,G,I,ea,ca=ea="",ga=[],ba=[];P=[];if(!0===d.p.shrinkToFit&&!0===d.p.forceFit)for(k=d.p.colModel.length-1;0<=k;k--)if(!d.p.colModel[k].hidden){d.p.colModel[k].resizable=
  103. !1;break}"horizontal"===d.p.viewsortcols[1]&&(ea=" ui-i-asc",ca=" ui-i-desc");J=c?"class='ui-th-div-ie'":"";ea="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+ea+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+l+"'></span>"+("<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+ca+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+l+"'></span></span>");if(d.p.multiSort)for(ga=d.p.sortname.split(","),k=0;k<ga.length;k++)P=a.trim(ga[k]).split(" "),
  104. ga[k]=a.trim(P[0]),ba[k]=P[1]?a.trim(P[1]):d.p.sortorder||"asc";for(k=0;k<this.p.colNames.length;k++)P=d.p.headertitles?' title="'+a.jgrid.stripHtml(d.p.colNames[k])+'"':"",M+="<th id='"+d.p.id+"_"+d.p.colModel[k].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+l+"'"+P+">",P=d.p.colModel[k].index||d.p.colModel[k].name,M+="<div id='jqgh_"+d.p.id+"_"+d.p.colModel[k].name+"' "+J+">"+d.p.colNames[k],d.p.colModel[k].width=d.p.colModel[k].width?parseInt(d.p.colModel[k].width,10):
  105. 150,"boolean"!==typeof d.p.colModel[k].title&&(d.p.colModel[k].title=!0),d.p.colModel[k].lso="",P===d.p.sortname&&(d.p.lastsort=k),d.p.multiSort&&(P=a.inArray(P,ga),-1!==P&&(d.p.colModel[k].lso=ba[P])),M+=ea+"</div></th>";M+="</tr></thead>";ea=null;a(this).append(M);a("thead tr:first th",this).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});if(this.p.multiselect){var ia=[],$;a("#cb_"+a.jgrid.jqID(d.p.id),this).bind("click",function(){d.p.selarrrow=
  106. [];var b=!0===d.p.frozenColumns?d.p.id+"_frozen":"";this.checked?(a(d.rows).each(function(c){0<c&&!(a(this).hasClass("ui-subgrid")||a(this).hasClass("jqgroup")||a(this).hasClass("ui-state-disabled")||a(this).hasClass("jqfoot"))&&(a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(this.id))[d.p.useProp?"prop":"attr"]("checked",!0),a(this).addClass("ui-state-highlight").attr("aria-selected","true"),d.p.selarrrow.push(this.id),d.p.selrow=this.id,b&&(a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(this.id),
  107. d.grid.fbDiv)[d.p.useProp?"prop":"attr"]("checked",!0),a("#"+a.jgrid.jqID(this.id),d.grid.fbDiv).addClass("ui-state-highlight")))}),$=!0,ia=[]):(a(d.rows).each(function(c){0<c&&!(a(this).hasClass("ui-subgrid")||a(this).hasClass("jqgroup")||a(this).hasClass("ui-state-disabled")||a(this).hasClass("jqfoot"))&&(a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(this.id))[d.p.useProp?"prop":"attr"]("checked",!1),a(this).removeClass("ui-state-highlight").attr("aria-selected","false"),ia.push(this.id),b&&(a("#jqg_"+
  108. a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(this.id),d.grid.fbDiv)[d.p.useProp?"prop":"attr"]("checked",!1),a("#"+a.jgrid.jqID(this.id),d.grid.fbDiv).removeClass("ui-state-highlight")))}),d.p.selrow=null,$=!1);a(d).triggerHandler("jqGridSelectAll",[$?d.p.selarrrow:ia,$]);a.isFunction(d.p.onSelectAll)&&d.p.onSelectAll.call(d,$?d.p.selarrrow:ia,$)})}!0===d.p.autowidth&&(M=a(m).innerWidth(),d.p.width=0<M?M:"nw");(function(){var b=0,c=a.jgrid.cell_width?0:r(d.p.cellLayout,0),e=0,f,g=r(d.p.scrollOffset,0),k,
  109. l=!1,p,n=0,m;a.each(d.p.colModel,function(){void 0===this.hidden&&(this.hidden=!1);if(d.p.grouping&&d.p.autowidth){var f=a.inArray(this.name,d.p.groupingView.groupField);0<=f&&d.p.groupingView.groupColumnShow.length>f&&(this.hidden=!d.p.groupingView.groupColumnShow[f])}this.widthOrg=k=r(this.width,0);!1===this.hidden&&(b+=k+c,this.fixed?n+=k+c:e++)});isNaN(d.p.width)&&(d.p.width=b+(!1!==d.p.shrinkToFit||isNaN(d.p.height)?0:g));h.width=d.p.width;d.p.tblwidth=b;!1===d.p.shrinkToFit&&!0===d.p.forceFit&&
  110. (d.p.forceFit=!1);!0===d.p.shrinkToFit&&0<e&&(p=h.width-c*e-n,isNaN(d.p.height)||(p-=g,l=!0),b=0,a.each(d.p.colModel,function(a){!1!==this.hidden||this.fixed||(this.width=k=Math.round(p*this.width/(d.p.tblwidth-c*e-n)),b+=k,f=a)}),m=0,l?h.width-n-(b+c*e)!==g&&(m=h.width-n-(b+c*e)-g):l||1===Math.abs(h.width-n-(b+c*e))||(m=h.width-n-(b+c*e)),d.p.colModel[f].width+=m,d.p.tblwidth=b+m+c*e+n,d.p.tblwidth>d.p.width&&(d.p.colModel[f].width-=d.p.tblwidth-parseInt(d.p.width,10),d.p.tblwidth=d.p.width))})();
  111. a(m).css("width",h.width+"px").append("<div class='ui-jqgrid-resize-mark' id='rs_m"+d.p.id+"'>&#160;</div>");a(p).css("width",h.width+"px");M=a("thead:first",d).get(0);var da="";d.p.footerrow&&(da+="<table role='presentation' style='width:"+d.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+l+"'>");var p=a("tr:first",M),fa="<tr class='jqgfirstrow' role='row' style='height:auto'>";d.p.disableClick=!1;
  112. a("th",p).each(function(b){Y=d.p.colModel[b].width;void 0===d.p.colModel[b].resizable&&(d.p.colModel[b].resizable=!0);d.p.colModel[b].resizable?(U=document.createElement("span"),a(U).html("&#160;").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+l).css("cursor","col-resize"),a(this).addClass(d.p.resizeclass)):U="";a(this).css("width",Y+"px").prepend(U);U=null;var c="";d.p.colModel[b].hidden&&(a(this).css("display","none"),c="display:none;");fa+="<td role='gridcell' style='height:0px;width:"+Y+"px;"+
  113. c+"'></td>";h.headers[b]={width:Y,el:this};S=d.p.colModel[b].sortable;"boolean"!==typeof S&&(S=d.p.colModel[b].sortable=!0);c=d.p.colModel[b].name;"cb"!==c&&"subgrid"!==c&&"rn"!==c&&d.p.viewsortcols[2]&&a(">div",this).addClass("ui-jqgrid-sortable");S&&(d.p.multiSort?d.p.viewsortcols[0]?(a("div span.s-ico",this).show(),d.p.colModel[b].lso&&a("div span.ui-icon-"+d.p.colModel[b].lso,this).removeClass("ui-state-disabled")):d.p.colModel[b].lso&&(a("div span.s-ico",this).show(),a("div span.ui-icon-"+d.p.colModel[b].lso,
  114. this).removeClass("ui-state-disabled")):d.p.viewsortcols[0]?(a("div span.s-ico",this).show(),b===d.p.lastsort&&a("div span.ui-icon-"+d.p.sortorder,this).removeClass("ui-state-disabled")):b===d.p.lastsort&&""!==d.p.sortname&&(a("div span.s-ico",this).show(),a("div span.ui-icon-"+d.p.sortorder,this).removeClass("ui-state-disabled")));d.p.footerrow&&(da+="<td role='gridcell' "+q(b,0,"",null,"",!1)+">&#160;</td>")}).mousedown(function(b){if(1===a(b.target).closest("th>span.ui-jqgrid-resize").length){var c=
  115. T(this);if(!0===d.p.forceFit){var e=d.p,f=c,g;for(g=c+1;g<d.p.colModel.length;g++)if(!0!==d.p.colModel[g].hidden){f=g;break}e.nv=f-c}h.dragStart(c,b,aa(c));return!1}}).click(function(b){if(d.p.disableClick)return d.p.disableClick=!1;var c="th>div.ui-jqgrid-sortable",e,f;d.p.viewsortcols[2]||(c="th>div>span>span.ui-grid-ico-sort");b=a(b.target).closest(c);if(1===b.length){var h;if(d.p.frozenColumns){var g=a(this)[0].id.substring(d.p.id.length+1);a(d.p.colModel).each(function(a){if(this.name===g)return h=
  116. a,!1})}else h=T(this);d.p.viewsortcols[2]||(e=!0,f=b.attr("sort"));null!=h&&E(a("div",this)[0].id,h,e,f,this);return!1}});if(d.p.sortable&&a.fn.sortable)try{a(d).jqGrid("sortableColumns",p)}catch(ma){}d.p.footerrow&&(da+="</tr></tbody></table>");fa+="</tr>";p=document.createElement("tbody");this.appendChild(p);a(this).addClass("ui-jqgrid-btable").append(fa);var fa=null,p=a("<table class='ui-jqgrid-htable' style='width:"+d.p.tblwidth+"px' role='presentation' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(M),
  117. W=d.p.caption&&!0===d.p.hiddengrid?!0:!1;k=a("<div class='ui-jqgrid-hbox"+("rtl"===l?"-rtl":"")+"'></div>");M=null;h.hDiv=document.createElement("div");a(h.hDiv).css({width:h.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(k);a(k).append(p);p=null;W&&a(h.hDiv).hide();d.p.pager&&("string"===typeof d.p.pager?"#"!==d.p.pager.substr(0,1)&&(d.p.pager="#"+d.p.pager):d.p.pager="#"+a(d.p.pager).attr("id"),a(d.p.pager).css({width:h.width+"px"}).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom").appendTo(m),
  118. W&&a(d.p.pager).hide(),V(d.p.pager,""));!1===d.p.cellEdit&&!0===d.p.hoverrows&&a(d).bind("mouseover",function(b){I=a(b.target).closest("tr.jqgrow");"ui-subgrid"!==a(I).attr("class")&&a(I).addClass("ui-state-hover")}).bind("mouseout",function(b){I=a(b.target).closest("tr.jqgrow");a(I).removeClass("ui-state-hover")});var R,Z,ja;a(d).before(h.hDiv).click(function(b){G=b.target;I=a(G,d.rows).closest("tr.jqgrow");if(0===a(I).length||-1<I[0].className.indexOf("ui-state-disabled")||(a(G,d).closest("table.ui-jqgrid-btable").attr("id")||
  119. "").replace("_frozen","")!==d.id)return this;var c=a(G).hasClass("cbox"),e=a(d).triggerHandler("jqGridBeforeSelectRow",[I[0].id,b]),e=!1===e||"stop"===e?!1:!0;if(a.isFunction(d.p.beforeSelectRow)){var f=d.p.beforeSelectRow.call(d,I[0].id,b);if(!1===f||"stop"===f)e=!1}if("A"!==G.tagName&&("INPUT"!==G.tagName&&"TEXTAREA"!==G.tagName&&"OPTION"!==G.tagName&&"SELECT"!==G.tagName||c)){R=I[0].id;G=a(G).closest("tr.jqgrow>td");0<G.length&&(Z=a.jgrid.getCellIndex(G),ja=a(G).closest("td,th").html(),a(d).triggerHandler("jqGridCellSelect",
  120. [R,Z,ja,b]),a.isFunction(d.p.onCellSelect)&&d.p.onCellSelect.call(d,R,Z,ja,b));if(!0===d.p.cellEdit)if(d.p.multiselect&&c&&e)a(d).jqGrid("setSelection",R,!0,b);else if(0<G.length){R=I[0].rowIndex;try{a(d).jqGrid("editCell",R,Z,!0)}catch(h){}}if(e)if(d.p.multikey)b[d.p.multikey]?a(d).jqGrid("setSelection",R,!0,b):d.p.multiselect&&c&&(c=a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+R).is(":checked"),a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+R)[d.p.useProp?"prop":"attr"]("checked",c));else{if(d.p.multiselect&&d.p.multiboxonly&&
  121. !c){var g=d.p.frozenColumns?d.p.id+"_frozen":"";a(d.p.selarrrow).each(function(b,c){var e=a(d).jqGrid("getGridRowById",c);e&&a(e).removeClass("ui-state-highlight");a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(c))[d.p.useProp?"prop":"attr"]("checked",!1);g&&(a("#"+a.jgrid.jqID(c),"#"+a.jgrid.jqID(g)).removeClass("ui-state-highlight"),a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(c),"#"+a.jgrid.jqID(g))[d.p.useProp?"prop":"attr"]("checked",!1))});d.p.selarrrow=[]}a(d).jqGrid("setSelection",R,!0,
  122. b)}}}).bind("reloadGrid",function(b,c){!0===d.p.treeGrid&&(d.p.datatype=d.p.treedatatype);c&&c.current&&d.grid.selectionPreserver(d);"local"===d.p.datatype?(a(d).jqGrid("resetSelection"),d.p.data.length&&(H(),B())):d.p.treeGrid||(d.p.selrow=null,d.p.multiselect&&(d.p.selarrrow=[],Q(!1)),d.p.savedRow=[]);d.p.scroll&&v.call(d,!0,!1);if(c&&c.page){var e=c.page;e>d.p.lastpage&&(e=d.p.lastpage);1>e&&(e=1);d.p.page=e;d.grid.bDiv.scrollTop=d.grid.prevRowHeight?(e-1)*d.grid.prevRowHeight*d.p.rowNum:0}d.grid.prevRowHeight&&
  123. d.p.scroll?(delete d.p.lastpage,d.grid.populateVisible()):d.grid.populate();!0===d.p._inlinenav&&a(d).jqGrid("showAddEditButtons");return!1}).dblclick(function(b){G=b.target;I=a(G,d.rows).closest("tr.jqgrow");if(0!==a(I).length){R=I[0].rowIndex;Z=a.jgrid.getCellIndex(G);var c=a(d).triggerHandler("jqGridDblClickRow",[a(I).attr("id"),R,Z,b]);if(null!=c||a.isFunction(d.p.ondblClickRow)&&(c=d.p.ondblClickRow.call(d,a(I).attr("id"),R,Z,b),null!=c))return c}}).bind("contextmenu",function(b){G=b.target;
  124. I=a(G,d.rows).closest("tr.jqgrow");if(0!==a(I).length){d.p.multiselect||a(d).jqGrid("setSelection",I[0].id,!0,b);R=I[0].rowIndex;Z=a.jgrid.getCellIndex(G);var c=a(d).triggerHandler("jqGridRightClickRow",[a(I).attr("id"),R,Z,b]);if(null!=c||a.isFunction(d.p.onRightClickRow)&&(c=d.p.onRightClickRow.call(d,a(I).attr("id"),R,Z,b),null!=c))return c}});h.bDiv=document.createElement("div");c&&"auto"===String(d.p.height).toLowerCase()&&(d.p.height="100%");a(h.bDiv).append(a('<div style="position:relative;'+
  125. (c&&8>a.jgrid.msiever()?"height:0.01%;":"")+'"></div>').append("<div></div>").append(this)).addClass("ui-jqgrid-bdiv").css({height:d.p.height+(isNaN(d.p.height)?"":"px"),width:h.width+"px"}).scroll(h.scrollGrid);a("table:first",h.bDiv).css({width:d.p.tblwidth+"px"});a.support.tbody||2===a("tbody",this).length&&a("tbody:gt(0)",this).remove();d.p.multikey&&(a.jgrid.msie?a(h.bDiv).bind("selectstart",function(){return!1}):a(h.bDiv).bind("mousedown",function(){return!1}));W&&a(h.bDiv).hide();h.cDiv=document.createElement("div");
  126. var ka=!0===d.p.hidegrid?a("<a role='link' class='ui-jqgrid-titlebar-close ui-corner-all HeaderButton' "+(d.p.showhide?"title='"+d.p.showhide+"'":"")+" />").hover(function(){ka.addClass("ui-state-hover")},function(){ka.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css("rtl"===l?"left":"right","0px"):"";a(h.cDiv).append(ka).append("<span class='ui-jqgrid-title'>"+d.p.caption+"</span>").addClass("ui-jqgrid-titlebar ui-jqgrid-caption"+("rtl"===l?"-rtl":
  127. "")+" ui-widget-header ui-corner-top ui-helper-clearfix");a(h.cDiv).insertBefore(h.hDiv);d.p.toolbar[0]&&(h.uDiv=document.createElement("div"),"top"===d.p.toolbar[1]?a(h.uDiv).insertBefore(h.hDiv):"bottom"===d.p.toolbar[1]&&a(h.uDiv).insertAfter(h.hDiv),"both"===d.p.toolbar[1]?(h.ubDiv=document.createElement("div"),a(h.uDiv).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id).insertBefore(h.hDiv),a(h.ubDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id).insertAfter(h.hDiv),
  128. W&&a(h.ubDiv).hide()):a(h.uDiv).width(h.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id),W&&a(h.uDiv).hide());d.p.toppager&&(d.p.toppager=a.jgrid.jqID(d.p.id)+"_toppager",h.topDiv=a("<div id='"+d.p.toppager+"'></div>")[0],d.p.toppager="#"+d.p.toppager,a(h.topDiv).addClass("ui-state-default ui-jqgrid-toppager").width(h.width).insertBefore(h.hDiv),V(d.p.toppager,"_t"));d.p.footerrow&&(h.sDiv=a("<div class='ui-jqgrid-sdiv'></div>")[0],k=a("<div class='ui-jqgrid-hbox"+("rtl"===
  129. l?"-rtl":"")+"'></div>"),a(h.sDiv).append(k).width(h.width).insertAfter(h.hDiv),a(k).append(da),h.footers=a(".ui-jqgrid-ftable",h.sDiv)[0].rows[0].cells,d.p.rownumbers&&(h.footers[0].className="ui-state-default jqgrid-rownum"),W&&a(h.sDiv).hide());k=null;if(d.p.caption){var la=d.p.datatype;!0===d.p.hidegrid&&(a(".ui-jqgrid-titlebar-close",h.cDiv).click(function(b){var c=a.isFunction(d.p.onHeaderClick),e=".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",f,g=this;!0===d.p.toolbar[0]&&
  130. ("both"===d.p.toolbar[1]&&(e+=", #"+a(h.ubDiv).attr("id")),e+=", #"+a(h.uDiv).attr("id"));f=a(e,"#gview_"+a.jgrid.jqID(d.p.id)).length;"visible"===d.p.gridstate?a(e,"#gbox_"+a.jgrid.jqID(d.p.id)).slideUp("fast",function(){f--;0===f&&(a("span",g).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s"),d.p.gridstate="hidden",a("#gbox_"+a.jgrid.jqID(d.p.id)).hasClass("ui-resizable")&&a(".ui-resizable-handle","#gbox_"+a.jgrid.jqID(d.p.id)).hide(),a(d).triggerHandler("jqGridHeaderClick",
  131. [d.p.gridstate,b]),c&&(W||d.p.onHeaderClick.call(d,d.p.gridstate,b)))}):"hidden"===d.p.gridstate&&a(e,"#gbox_"+a.jgrid.jqID(d.p.id)).slideDown("fast",function(){f--;0===f&&(a("span",g).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n"),W&&(d.p.datatype=la,L(),W=!1),d.p.gridstate="visible",a("#gbox_"+a.jgrid.jqID(d.p.id)).hasClass("ui-resizable")&&a(".ui-resizable-handle","#gbox_"+a.jgrid.jqID(d.p.id)).show(),a(d).triggerHandler("jqGridHeaderClick",[d.p.gridstate,b]),c&&
  132. (W||d.p.onHeaderClick.call(d,d.p.gridstate,b)))});return!1}),W&&(d.p.datatype="local",a(".ui-jqgrid-titlebar-close",h.cDiv).trigger("click")))}else a(h.cDiv).hide(),a(h.hDiv).addClass("ui-corner-top");a(h.hDiv).after(h.bDiv).mousemove(function(a){if(h.resizing)return h.dragMove(a),!1});a(".ui-jqgrid-labels",h.hDiv).bind("selectstart",function(){return!1});a(document).bind("mouseup.jqGrid"+d.p.id,function(){return h.resizing?(h.dragEnd(),!1):!0});d.formatCol=q;d.sortData=E;d.updatepager=function(b,
  133. c){var e,f,h,g,k,l,p,n="",m=d.p.pager?"_"+a.jgrid.jqID(d.p.pager.substr(1)):"",q=d.p.toppager?"_"+d.p.toppager.substr(1):"";h=parseInt(d.p.page,10)-1;0>h&&(h=0);h*=parseInt(d.p.rowNum,10);k=h+d.p.reccount;if(d.p.scroll){e=a("tbody:first > tr:gt(0)",d.grid.bDiv);h=k-e.length;d.p.reccount=e.length;if(e=e.outerHeight()||d.grid.prevRowHeight)f=h*e,p=parseInt(d.p.records,10)*e,a(">div:first",d.grid.bDiv).css({height:p}).children("div:first").css({height:f,display:f?"":"none"}),0==d.grid.bDiv.scrollTop&&
  134. 1<d.p.page&&(d.grid.bDiv.scrollTop=d.p.rowNum*(d.p.page-1)*e);d.grid.bDiv.scrollLeft=d.grid.hDiv.scrollLeft}n=d.p.pager||"";if(n+=d.p.toppager?n?","+d.p.toppager:d.p.toppager:"")p=a.jgrid.formatter.integer||{},e=r(d.p.page),f=r(d.p.lastpage),a(".selbox",n)[this.p.useProp?"prop":"attr"]("disabled",!1),!0===d.p.pginput&&(a(".ui-pg-input",n).val(d.p.page),g=d.p.toppager?"#sp_1"+m+",#sp_1"+q:"#sp_1"+m,a(g).html(a.fmatter?a.fmatter.util.NumberFormat(d.p.lastpage,p):d.p.lastpage)),d.p.viewrecords&&(0===
  135. d.p.reccount?a(".ui-paging-info",n).html(d.p.emptyrecords):(g=h+1,l=d.p.records,a.fmatter&&(g=a.fmatter.util.NumberFormat(g,p),k=a.fmatter.util.NumberFormat(k,p),l=a.fmatter.util.NumberFormat(l,p)),a(".ui-paging-info",n).html(a.jgrid.format(d.p.recordtext,g,k,l)))),!0===d.p.pgbuttons&&(0>=e&&(e=f=0),1===e||0===e?(a("#first"+m+", #prev"+m).addClass("ui-state-disabled").removeClass("ui-state-hover"),d.p.toppager&&a("#first_t"+q+", #prev_t"+q).addClass("ui-state-disabled").removeClass("ui-state-hover")):
  136. (a("#first"+m+", #prev"+m).removeClass("ui-state-disabled"),d.p.toppager&&a("#first_t"+q+", #prev_t"+q).removeClass("ui-state-disabled")),e===f||0===e?(a("#next"+m+", #last"+m).addClass("ui-state-disabled").removeClass("ui-state-hover"),d.p.toppager&&a("#next_t"+q+", #last_t"+q).addClass("ui-state-disabled").removeClass("ui-state-hover")):(a("#next"+m+", #last"+m).removeClass("ui-state-disabled"),d.p.toppager&&a("#next_t"+q+", #last_t"+q).removeClass("ui-state-disabled")));!0===b&&!0===d.p.rownumbers&&
  137. a(">td.jqgrid-rownum",d.rows).each(function(b){a(this).html(h+1+b)});c&&d.p.jqgdnd&&a(d).jqGrid("gridDnD","updateDnD");a(d).triggerHandler("jqGridGridComplete");a.isFunction(d.p.gridComplete)&&d.p.gridComplete.call(d);a(d).triggerHandler("jqGridAfterGridComplete")};d.refreshIndex=B;d.setHeadCheckBox=Q;d.constructTr=D;d.formatter=function(a,b,c,d,e){return t(a,b,c,d,e)};a.extend(h,{populate:L,emptyRows:v,beginReq:O,endReq:z});this.grid=h;d.addXmlData=function(a){C(a,d.grid.bDiv)};d.addJSONData=function(a){F(a,
  138. d.grid.bDiv)};this.grid.cols=this.rows[0].cells;a(d).triggerHandler("jqGridInitGrid");a.isFunction(d.p.onInitGrid)&&d.p.onInitGrid.call(d);L();d.p.hiddengrid=!1}}}})};a.jgrid.extend({getGridParam:function(a){var e=this[0];if(e&&e.grid)return a?void 0!==e.p[a]?e.p[a]:null:e.p},setGridParam:function(b,e){return this.each(function(){null==e&&(e=!1);this.grid&&"object"===typeof b&&(!0===e?this.p=a.extend({},this.p,b):a.extend(!0,this.p,b))})},getGridRowById:function(b){var e;this.each(function(){try{for(var c=
  139. this.rows.length;c--;)if(b.toString()===this.rows[c].id){e=this.rows[c];break}}catch(f){e=a(this.grid.bDiv).find("#"+a.jgrid.jqID(b))}});return e},getDataIDs:function(){var b=[],e=0,c,f=0;this.each(function(){if((c=this.rows.length)&&0<c)for(;e<c;)a(this.rows[e]).hasClass("jqgrow")&&(b[f]=this.rows[e].id,f++),e++});return b},setSelection:function(b,e,c){return this.each(function(){var f,g,d,h,k,l;void 0!==b&&(e=!1===e?!1:!0,!(g=a(this).jqGrid("getGridRowById",b))||!g.className||-1<g.className.indexOf("ui-state-disabled")||
  140. (!0===this.p.scrollrows&&(d=a(this).jqGrid("getGridRowById",b).rowIndex,0<=d&&(f=a(this.grid.bDiv)[0].clientHeight,h=a(this.grid.bDiv)[0].scrollTop,k=a(this.rows[d]).position().top,d=this.rows[d].clientHeight,k+d>=f+h?a(this.grid.bDiv)[0].scrollTop=k-(f+h)+d+h:k<f+h&&k<h&&(a(this.grid.bDiv)[0].scrollTop=k))),!0===this.p.frozenColumns&&(l=this.p.id+"_frozen"),this.p.multiselect?(this.setHeadCheckBox(!1),this.p.selrow=g.id,h=a.inArray(this.p.selrow,this.p.selarrrow),-1===h?("ui-subgrid"!==g.className&&
  141. a(g).addClass("ui-state-highlight").attr("aria-selected","true"),f=!0,this.p.selarrrow.push(this.p.selrow)):("ui-subgrid"!==g.className&&a(g).removeClass("ui-state-highlight").attr("aria-selected","false"),f=!1,this.p.selarrrow.splice(h,1),k=this.p.selarrrow[0],this.p.selrow=void 0===k?null:k),a("#jqg_"+a.jgrid.jqID(this.p.id)+"_"+a.jgrid.jqID(g.id))[this.p.useProp?"prop":"attr"]("checked",f),l&&(-1===h?a("#"+a.jgrid.jqID(b),"#"+a.jgrid.jqID(l)).addClass("ui-state-highlight"):a("#"+a.jgrid.jqID(b),
  142. "#"+a.jgrid.jqID(l)).removeClass("ui-state-highlight"),a("#jqg_"+a.jgrid.jqID(this.p.id)+"_"+a.jgrid.jqID(b),"#"+a.jgrid.jqID(l))[this.p.useProp?"prop":"attr"]("checked",f)),e&&(a(this).triggerHandler("jqGridSelectRow",[g.id,f,c]),this.p.onSelectRow&&this.p.onSelectRow.call(this,g.id,f,c))):"ui-subgrid"!==g.className&&(this.p.selrow!==g.id?((f=a(this).jqGrid("getGridRowById",this.p.selrow))&&a(f).removeClass("ui-state-highlight").attr({"aria-selected":"false",tabindex:"-1"}),a(g).addClass("ui-state-highlight").attr({"aria-selected":"true",
  143. tabindex:"0"}),l&&(a("#"+a.jgrid.jqID(this.p.selrow),"#"+a.jgrid.jqID(l)).removeClass("ui-state-highlight"),a("#"+a.jgrid.jqID(b),"#"+a.jgrid.jqID(l)).addClass("ui-state-highlight")),f=!0):f=!1,this.p.selrow=g.id,e&&(a(this).triggerHandler("jqGridSelectRow",[g.id,f,c]),this.p.onSelectRow&&this.p.onSelectRow.call(this,g.id,f,c)))))})},resetSelection:function(b){return this.each(function(){var e=this,c,f;!0===e.p.frozenColumns&&(f=e.p.id+"_frozen");if(void 0!==b){c=b===e.p.selrow?e.p.selrow:b;a("#"+
  144. a.jgrid.jqID(e.p.id)+" tbody:first tr#"+a.jgrid.jqID(c)).removeClass("ui-state-highlight").attr("aria-selected","false");f&&a("#"+a.jgrid.jqID(c),"#"+a.jgrid.jqID(f)).removeClass("ui-state-highlight");if(e.p.multiselect){a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+a.jgrid.jqID(c),"#"+a.jgrid.jqID(e.p.id))[e.p.useProp?"prop":"attr"]("checked",!1);if(f)a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+a.jgrid.jqID(c),"#"+a.jgrid.jqID(f))[e.p.useProp?"prop":"attr"]("checked",!1);e.setHeadCheckBox(!1);c=a.inArray(a.jgrid.jqID(c),
  145. e.p.selarrrow);-1!==c&&e.p.selarrrow.splice(c,1)}c=null}else e.p.multiselect?(a(e.p.selarrrow).each(function(b,c){a(a(e).jqGrid("getGridRowById",c)).removeClass("ui-state-highlight").attr("aria-selected","false");a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+a.jgrid.jqID(c))[e.p.useProp?"prop":"attr"]("checked",!1);f&&(a("#"+a.jgrid.jqID(c),"#"+a.jgrid.jqID(f)).removeClass("ui-state-highlight"),a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+a.jgrid.jqID(c),"#"+a.jgrid.jqID(f))[e.p.useProp?"prop":"attr"]("checked",!1))}),
  146. e.setHeadCheckBox(!1),e.p.selarrrow=[],e.p.selrow=null):e.p.selrow&&(a("#"+a.jgrid.jqID(e.p.id)+" tbody:first tr#"+a.jgrid.jqID(e.p.selrow)).removeClass("ui-state-highlight").attr("aria-selected","false"),f&&a("#"+a.jgrid.jqID(e.p.selrow),"#"+a.jgrid.jqID(f)).removeClass("ui-state-highlight"),e.p.selrow=null);!0===e.p.cellEdit&&0<=parseInt(e.p.iCol,10)&&0<=parseInt(e.p.iRow,10)&&(a("td:eq("+e.p.iCol+")",e.rows[e.p.iRow]).removeClass("edit-cell ui-state-highlight"),a(e.rows[e.p.iRow]).removeClass("selected-row ui-state-hover"));
  147. e.p.savedRow=[]})},getRowData:function(b){var e={},c,f=!1,g,d=0;this.each(function(){var h=this,k,l;if(void 0===b)f=!0,c=[],g=h.rows.length;else{l=a(h).jqGrid("getGridRowById",b);if(!l)return e;g=2}for(;d<g;)f&&(l=h.rows[d]),a(l).hasClass("jqgrow")&&(a('td[role="gridcell"]',l).each(function(b){k=h.p.colModel[b].name;if("cb"!==k&&"subgrid"!==k&&"rn"!==k)if(!0===h.p.treeGrid&&k===h.p.ExpandColumn)e[k]=a.jgrid.htmlDecode(a("span:first",this).html());else try{e[k]=a.unformat.call(h,this,{rowId:l.id,colModel:h.p.colModel[b]},
  148. b)}catch(c){e[k]=a.jgrid.htmlDecode(a(this).html())}}),f&&(c.push(e),e={})),d++});return c||e},delRowData:function(b){var e=!1,c,f,g;this.each(function(){c=a(this).jqGrid("getGridRowById",b);if(!c)return!1;this.p.subGrid&&(g=a(c).next(),g.hasClass("ui-subgrid")&&g.remove());a(c).remove();this.p.records--;this.p.reccount--;this.updatepager(!0,!1);e=!0;this.p.multiselect&&(f=a.inArray(b,this.p.selarrrow),-1!==f&&this.p.selarrrow.splice(f,1));this.p.selrow=this.p.multiselect&&0<this.p.selarrrow.length?
  149. this.p.selarrrow[this.p.selarrrow.length-1]:null;if("local"===this.p.datatype){var d=a.jgrid.stripPref(this.p.idPrefix,b),d=this.p._index[d];void 0!==d&&(this.p.data.splice(d,1),this.refreshIndex())}if(!0===this.p.altRows&&e){var h=this.p.altclass;a(this.rows).each(function(b){1===b%2?a(this).addClass(h):a(this).removeClass(h)})}});return e},setRowData:function(b,e,c){var f,g=!0,d;this.each(function(){if(!this.grid)return!1;var h=this,k,l,p=typeof c,m={};l=a(this).jqGrid("getGridRowById",b);if(!l)return!1;
  150. if(e)try{if(a(this.p.colModel).each(function(c){f=this.name;var g=a.jgrid.getAccessor(e,f);void 0!==g&&(m[f]=this.formatter&&"string"===typeof this.formatter&&"date"===this.formatter?a.unformat.date.call(h,g,this):g,k=h.formatter(b,m[f],c,e,"edit"),d=this.title?{title:a.jgrid.stripHtml(k)}:{},!0===h.p.treeGrid&&f===h.p.ExpandColumn?a("td[role='gridcell']:eq("+c+") > span:first",l).html(k).attr(d):a("td[role='gridcell']:eq("+c+")",l).html(k).attr(d))}),"local"===h.p.datatype){var r=a.jgrid.stripPref(h.p.idPrefix,
  151. b),q=h.p._index[r],n;if(h.p.treeGrid)for(n in h.p.treeReader)h.p.treeReader.hasOwnProperty(n)&&delete m[h.p.treeReader[n]];void 0!==q&&(h.p.data[q]=a.extend(!0,h.p.data[q],m));m=null}}catch(t){g=!1}g&&("string"===p?a(l).addClass(c):null!==c&&"object"===p&&a(l).css(c),a(h).triggerHandler("jqGridAfterGridComplete"))});return g},addRowData:function(b,e,c,f){-1==["first","last","before","after"].indexOf(c)&&(c="last");var g=!1,d,h,k,l,p,m,r,q,n="",t,u,w,s,x,A;e&&(a.isArray(e)?(t=!0,u=b):(e=[e],t=!1),
  152. this.each(function(){var v=e.length;p=!0===this.p.rownumbers?1:0;k=!0===this.p.multiselect?1:0;l=!0===this.p.subGrid?1:0;t||(void 0!==b?b=String(b):(b=a.jgrid.randId(),!1!==this.p.keyName&&(u=this.p.keyName,void 0!==e[0][u]&&(b=e[0][u]))));w=this.p.altclass;for(var H=0,B="",D={},C=a.isFunction(this.p.afterInsertRow)?!0:!1;H<v;){s=e[H];h=[];if(t){try{b=s[u],void 0===b&&(b=a.jgrid.randId())}catch(F){b=a.jgrid.randId()}B=!0===this.p.altRows?0===(this.rows.length-1)%2?w:"":""}A=b;b=this.p.idPrefix+b;
  153. p&&(n=this.formatCol(0,1,"",null,b,!0),h[h.length]='<td role="gridcell" class="ui-state-default jqgrid-rownum" '+n+">0</td>");k&&(q='<input role="checkbox" type="checkbox" id="jqg_'+this.p.id+"_"+b+'" class="cbox"/>',n=this.formatCol(p,1,"",null,b,!0),h[h.length]='<td role="gridcell" '+n+">"+q+"</td>");l&&(h[h.length]=a(this).jqGrid("addSubGridCell",k+p,1));for(r=k+l+p;r<this.p.colModel.length;r++)x=this.p.colModel[r],d=x.name,D[d]=s[d],q=this.formatter(b,a.jgrid.getAccessor(s,d),r,s),n=this.formatCol(r,
  154. 1,q,s,b,D),h[h.length]='<td role="gridcell" '+n+">"+q+"</td>";h.unshift(this.constructTr(b,!1,B,D,s,!1));h[h.length]="</tr>";if(0===this.rows.length)a("table:first",this.grid.bDiv).append(h.join(""));else switch(c){case "last":a(this.rows[this.rows.length-1]).after(h.join(""));m=this.rows.length-1;break;case "first":a(this.rows[0]).after(h.join(""));m=1;break;case "after":if(m=a(this).jqGrid("getGridRowById",f))a(this.rows[m.rowIndex+1]).hasClass("ui-subgrid")?a(this.rows[m.rowIndex+1]).after(h):
  155. a(m).after(h.join("")),m=m.rowIndex+1;break;case "before":if(m=a(this).jqGrid("getGridRowById",f))a(m).before(h.join("")),m=m.rowIndex-1}!0===this.p.subGrid&&a(this).jqGrid("addSubGrid",k+p,m);this.p.records++;this.p.reccount++;a(this).triggerHandler("jqGridAfterInsertRow",[b,s,s]);C&&this.p.afterInsertRow.call(this,b,s,s);H++;"local"===this.p.datatype&&(D[this.p.localReader.id]=A,this.p._index[A]=this.p.data.length,this.p.data.push(D),D={})}!0!==this.p.altRows||t||("last"===c?1===(this.rows.length-
  156. 1)%2&&a(this.rows[this.rows.length-1]).addClass(w):a(this.rows).each(function(b){1===b%2?a(this).addClass(w):a(this).removeClass(w)}));this.updatepager(!0,!0);g=!0}));return g},footerData:function(b,e,c){function f(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}var g,d=!1,h={},k;void 0==b&&(b="get");"boolean"!==typeof c&&(c=!0);b=b.toLowerCase();this.each(function(){var l=this,p;if(!l.grid||!l.p.footerrow||"set"===b&&f(e))return!1;d=!0;a(this.p.colModel).each(function(f){g=this.name;"set"===
  157. b?void 0!==e[g]&&(p=c?l.formatter("",e[g],f,e,"edit"):e[g],k=this.title?{title:a.jgrid.stripHtml(p)}:{},a("tr.footrow td:eq("+f+")",l.grid.sDiv).html(p).attr(k),d=!0):"get"===b&&(h[g]=a("tr.footrow td:eq("+f+")",l.grid.sDiv).html())})});return"get"===b?h:d},showHideCol:function(b,e){return this.each(function(){var c=this,f=!1,g=a.jgrid.cell_width?0:c.p.cellLayout,d;if(c.grid){"string"===typeof b&&(b=[b]);e="none"!==e?"":"none";var h=""===e?!0:!1,k=c.p.groupHeader&&("object"===typeof c.p.groupHeader||
  158. a.isFunction(c.p.groupHeader));k&&a(c).jqGrid("destroyGroupHeader",!1);a(this.p.colModel).each(function(k){if(-1!==a.inArray(this.name,b)&&this.hidden===h){if(!0===c.p.frozenColumns&&!0===this.frozen)return!0;a("tr[role=row]",c.grid.hDiv).each(function(){a(this.cells[k]).css("display",e)});a(c.rows).each(function(){a(this).hasClass("jqgroup")||a(this.cells[k]).css("display",e)});c.p.footerrow&&a("tr.footrow td:eq("+k+")",c.grid.sDiv).css("display",e);d=parseInt(this.width,10);c.p.tblwidth="none"===
  159. e?c.p.tblwidth-(d+g):c.p.tblwidth+(d+g);this.hidden=!h;f=!0;a(c).triggerHandler("jqGridShowHideCol",[h,this.name,k])}});!0===f&&(!0!==c.p.shrinkToFit||isNaN(c.p.height)||(c.p.tblwidth+=parseInt(c.p.scrollOffset,10)),a(c).jqGrid("setGridWidth",!0===c.p.shrinkToFit?c.p.tblwidth:c.p.width));k&&a(c).jqGrid("setGroupHeaders",c.p.groupHeader)}})},hideCol:function(b){return this.each(function(){a(this).jqGrid("showHideCol",b,"none")})},showCol:function(b){return this.each(function(){a(this).jqGrid("showHideCol",
  160. b,"")})},remapColumns:function(b,e,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 d=this.get(0);f(d.p.colModel);f(d.p.colNames);f(d.grid.headers);g(a("thead:first",d.grid.hDiv),c&&":not(.ui-jqgrid-labels)");e&&g(a("#"+a.jgrid.jqID(d.p.id)+" tbody:first"),".jqgfirstrow, tr.jqgrow, tr.jqfoot");d.p.footerrow&&
  161. g(a("tbody:first",d.grid.sDiv));d.p.remapColumns&&(d.p.remapColumns.length?f(d.p.remapColumns):d.p.remapColumns=a.makeArray(b));d.p.lastsort=a.inArray(d.p.lastsort,b);d.p.treeGrid&&(d.p.expColInd=a.inArray(d.p.expColInd,b));a(d).triggerHandler("jqGridRemapColumns",[b,e,c])},setGridWidth:function(b,e){return this.each(function(){if(this.grid){var c=this,f,g=0,d=a.jgrid.cell_width?0:c.p.cellLayout,h,k=0,l=!1,p=c.p.scrollOffset,m,r=0,q;"boolean"!==typeof e&&(e=c.p.shrinkToFit);if(!isNaN(b)){b=parseInt(b,
  162. 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");c.p.toppager&&a(c.p.toppager).css("width",b+"px");!0===c.p.toolbar[0]&&(a(c.grid.uDiv).css("width",b+"px"),"both"===c.p.toolbar[1]&&a(c.grid.ubDiv).css("width",b+"px"));c.p.footerrow&&a(c.grid.sDiv).css("width",b+"px");!1===e&&!0===c.p.forceFit&&(c.p.forceFit=
  163. !1);if(!0===e){a.each(c.p.colModel,function(){!1===this.hidden&&(f=this.widthOrg,g+=f+d,this.fixed?r+=f+d:k++)});if(0===k)return;c.p.tblwidth=g;m=b-d*k-r;!isNaN(c.p.height)&&(a(c.grid.bDiv)[0].clientHeight<a(c.grid.bDiv)[0].scrollHeight||1===c.rows.length)&&(l=!0,m-=p);var g=0,n=0<c.grid.cols.length;a.each(c.p.colModel,function(a){!1!==this.hidden||this.fixed||(f=this.widthOrg,f=Math.round(m*f/(c.p.tblwidth-d*k-r)),0>f||(this.width=f,g+=f,c.grid.headers[a].width=f,c.grid.headers[a].el.style.width=
  164. f+"px",c.p.footerrow&&(c.grid.footers[a].style.width=f+"px"),n&&(c.grid.cols[a].style.width=f+"px"),h=a))});if(!h)return;q=0;l?b-r-(g+d*k)!==p&&(q=b-r-(g+d*k)-p):1!==Math.abs(b-r-(g+d*k))&&(q=b-r-(g+d*k));c.p.colModel[h].width+=q;c.p.tblwidth=g+q+d*k+r;c.p.tblwidth>b?(l=c.p.tblwidth-parseInt(b,10),c.p.tblwidth=b,f=c.p.colModel[h].width-=l):f=c.p.colModel[h].width;c.grid.headers[h].width=f;c.grid.headers[h].el.style.width=f+"px";n&&(c.grid.cols[h].style.width=f+"px");c.p.footerrow&&(c.grid.footers[h].style.width=
  165. f+"px")}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){var e=a(this.grid.bDiv);e.css({height:b+(isNaN(b)?"":"px")});!0===this.p.frozenColumns&&a("#"+a.jgrid.jqID(this.p.id)+"_frozen").parent().height(e.height()-16);this.p.height=
  166. b;this.p.scroll&&this.grid.populateVisible()}})},setCaption:function(b){return this.each(function(){this.p.caption=b;a("span.ui-jqgrid-title, span.ui-jqgrid-title-rtl",this.grid.cDiv).html(b);a(this.grid.cDiv).show();a(this.grid.hDiv).removeClass("ui-corner-top")})},setLabel:function(b,e,c,f){return this.each(function(){var g=-1;if(this.grid&&void 0!==b&&(a(this.p.colModel).each(function(a){if(this.name===b)return g=a,!1}),0<=g)){var d=a("tr.ui-jqgrid-labels th:eq("+g+")",this.grid.hDiv);if(e){var h=
  167. a(".s-ico",d);a("[id^=jqgh_]",d).empty().html(e).append(h);this.p.colNames[g]=e}c&&("string"===typeof c?a(d).addClass(c):a(d).css(c));"object"===typeof f&&a(d).attr(f)}})},setCell:function(b,e,c,f,g,d){return this.each(function(){var h=-1,k,l;if(this.grid&&(isNaN(e)?a(this.p.colModel).each(function(a){if(this.name===e)return h=a,!1}):h=parseInt(e,10),0<=h&&(k=a(this).jqGrid("getGridRowById",b)))){var p=a("td:eq("+h+")",k);l=0;var m=[];if(""!==c||!0===d){for(;l<k.cells.length;)m.push(k.cells[l].innerHTML),
  168. l++;k=this.formatter(b,c,h,m,"edit");l=this.p.colModel[h].title?{title:a.jgrid.stripHtml(k)}:{};this.p.treeGrid&&0<a(".tree-wrap",a(p)).length?a("span",a(p)).html(k).attr(l):a(p).html(k).attr(l);"local"===this.p.datatype&&(k=this.p.colModel[h],c=k.formatter&&"string"===typeof k.formatter&&"date"===k.formatter?a.unformat.date.call(this,c,k):c,l=this.p._index[a.jgrid.stripPref(this.p.idPrefix,b)],void 0!==l&&(this.p.data[l][k.name]=c))}"string"===typeof f?a(p).addClass(f):f&&a(p).css(f);"object"===
  169. typeof g&&a(p).attr(g)}})},getCell:function(b,e){var c=!1;this.each(function(){var f=-1;if(this.grid&&(isNaN(e)?a(this.p.colModel).each(function(a){if(this.name===e)return f=a,!1}):f=parseInt(e,10),0<=f)){var g=a(this).jqGrid("getGridRowById",b);if(g)try{c=a.unformat.call(this,a("td:eq("+f+")",g),{rowId:g.id,colModel:this.p.colModel[f]},f)}catch(d){c=a.jgrid.htmlDecode(a("td:eq("+f+")",g).html())}}});return c},getCol:function(b,e,c){var f=[],g,d=0,h,k,l;e="boolean"!==typeof e?!1:e;void 0===c&&(c=
  170. !1);this.each(function(){var p=-1;if(this.grid&&(isNaN(b)?a(this.p.colModel).each(function(a){if(this.name===b)return p=a,!1}):p=parseInt(b,10),0<=p)){var m=this.rows.length,r=0,q=0;if(m&&0<m){for(;r<m;){if(a(this.rows[r]).hasClass("jqgrow")){try{g=a.unformat.call(this,a(this.rows[r].cells[p]),{rowId:this.rows[r].id,colModel:this.p.colModel[p]},p)}catch(n){g=a.jgrid.htmlDecode(this.rows[r].cells[p].innerHTML)}c?(l=parseFloat(g),isNaN(l)||(d+=l,void 0===k&&(k=h=l),h=Math.min(h,l),k=Math.max(k,l),q++)):
  171. e?f.push({id:this.rows[r].id,value:g}):f.push(g)}r++}if(c)switch(c.toLowerCase()){case "sum":f=d;break;case "avg":f=d/q;break;case "count":f=m-1;break;case "min":f=h;break;case "max":f=k}}}});return f},clearGridData:function(b){return this.each(function(){if(this.grid){"boolean"!==typeof b&&(b=!1);if(this.p.deepempty)a("#"+a.jgrid.jqID(this.p.id)+" tbody:first tr:gt(0)").remove();else{var e=a("#"+a.jgrid.jqID(this.p.id)+" tbody:first tr:first")[0];a("#"+a.jgrid.jqID(this.p.id)+" tbody:first").empty().append(e)}this.p.footerrow&&
  172. 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(b,e){var c=!1,f;this.each(function(){(f=a(this).jqGrid("getGridRowById",b))&&(c=!0===e?f:f.rowIndex)});return c},bindKeys:function(b){var e=a.extend({onEnter:null,onSpace:null,onLeftKey:null,onRightKey:null,scrollingRows:!0},b||{});return this.each(function(){var b=
  173. this;a("body").is("[role]")||a("body").attr("role","application");b.p.scrollrows=e.scrollingRows;a(b).keydown(function(f){var g=a(b).find("tr[tabindex=0]")[0],d,h,k,l=b.p.treeReader.expanded_field;if(g)if(k=b.p._index[a.jgrid.stripPref(b.p.idPrefix,g.id)],37===f.keyCode||38===f.keyCode||39===f.keyCode||40===f.keyCode){if(38===f.keyCode){h=g.previousSibling;d="";if(h)if(a(h).is(":hidden"))for(;h;){if(h=h.previousSibling,!a(h).is(":hidden")&&a(h).hasClass("jqgrow")){d=h.id;break}}else d=h.id;a(b).jqGrid("setSelection",
  174. d,!0,f);f.preventDefault()}if(40===f.keyCode){h=g.nextSibling;d="";if(h)if(a(h).is(":hidden"))for(;h;){if(h=h.nextSibling,!a(h).is(":hidden")&&a(h).hasClass("jqgrow")){d=h.id;break}}else d=h.id;a(b).jqGrid("setSelection",d,!0,f);f.preventDefault()}37===f.keyCode&&(b.p.treeGrid&&b.p.data[k][l]&&a(g).find("div.treeclick").trigger("click"),a(b).triggerHandler("jqGridKeyLeft",[b.p.selrow]),a.isFunction(e.onLeftKey)&&e.onLeftKey.call(b,b.p.selrow));39===f.keyCode&&(b.p.treeGrid&&!b.p.data[k][l]&&a(g).find("div.treeclick").trigger("click"),
  175. a(b).triggerHandler("jqGridKeyRight",[b.p.selrow]),a.isFunction(e.onRightKey)&&e.onRightKey.call(b,b.p.selrow))}else 13===f.keyCode?(a(b).triggerHandler("jqGridKeyEnter",[b.p.selrow]),a.isFunction(e.onEnter)&&e.onEnter.call(b,b.p.selrow)):32===f.keyCode&&(a(b).triggerHandler("jqGridKeySpace",[b.p.selrow]),a.isFunction(e.onSpace)&&e.onSpace.call(b,b.p.selrow))})})},unbindKeys:function(){return this.each(function(){a(this).unbind("keydown")})},getLocalRow:function(b){var e=!1,c;this.each(function(){void 0!==
  176. b&&(c=this.p._index[a.jgrid.stripPref(this.p.idPrefix,b)],0<=c&&(e=this.p.data[c]))});return e},progressBar:function(b){b=a.extend({htmlcontent:"",method:"hide",loadtype:"disable"},b||{});return this.each(function(){var e="show"===b.method?!0:!1;""!==b.htmlcontent&&a("#load_"+a.jgrid.jqID(this.p.id)).html(b.htmlcontent);switch(b.loadtype){case "enable":a("#load_"+a.jgrid.jqID(this.p.id)).toggle(e);break;case "block":a("#lui_"+a.jgrid.jqID(this.p.id)).toggle(e),a("#load_"+a.jgrid.jqID(this.p.id)).toggle(e)}})}})})(jQuery);
  177. (function(a){a.jgrid.extend({editCell:function(b,e,c){return this.each(function(){var f=this,g,d,h,k;if(f.grid&&!0===f.p.cellEdit){e=parseInt(e,10);f.p.selrow=f.rows[b].id;f.p.knv||a(f).jqGrid("GridNav");if(0<f.p.savedRow.length){if(!0===c&&b==f.p.iRow&&e==f.p.iCol)return;a(f).jqGrid("saveCell",f.p.savedRow[0].id,f.p.savedRow[0].ic)}else window.setTimeout(function(){a("#"+a.jgrid.jqID(f.p.knv)).attr("tabindex","-1").focus()},1);k=f.p.colModel[e];g=k.name;if("subgrid"!==g&&"cb"!==g&&"rn"!==g){h=a("td:eq("+
  178. e+")",f.rows[b]);if(!0!==k.editable||!0!==c||h.hasClass("not-editable-cell"))0<=parseInt(f.p.iCol,10)&&0<=parseInt(f.p.iRow,10)&&(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")),h.addClass("edit-cell ui-state-highlight"),a(f.rows[b]).addClass("selected-row ui-state-hover"),d=h.html().replace(/\&#160\;/ig,""),a(f).triggerHandler("jqGridSelectCell",[f.rows[b].id,g,d,b,e]),a.isFunction(f.p.onSelectCell)&&
  179. f.p.onSelectCell.call(f,f.rows[b].id,g,d,b,e);else{0<=parseInt(f.p.iCol,10)&&0<=parseInt(f.p.iRow,10)&&(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(h).addClass("edit-cell ui-state-highlight");a(f.rows[b]).addClass("selected-row ui-state-hover");try{d=a.unformat.call(f,h,{rowId:f.rows[b].id,colModel:k},e)}catch(l){d=k.edittype&&"textarea"===k.edittype?a(h).text():a(h).html()}f.p.autoencode&&
  180. (d=a.jgrid.htmlDecode(d));k.edittype||(k.edittype="text");f.p.savedRow.push({id:b,ic:e,name:g,v:d});if("&nbsp;"===d||"&#160;"===d||1===d.length&&160===d.charCodeAt(0))d="";if(a.isFunction(f.p.formatCell)){var p=f.p.formatCell.call(f,f.rows[b].id,g,d,b,e);void 0!==p&&(d=p)}a(f).triggerHandler("jqGridBeforeEditCell",[f.rows[b].id,g,d,b,e]);a.isFunction(f.p.beforeEditCell)&&f.p.beforeEditCell.call(f,f.rows[b].id,g,d,b,e);var p=a.extend({},k.editoptions||{},{id:b+"_"+g,name:g,rowId:f.rows[b].id}),m=a.jgrid.createEl.call(f,
  181. k.edittype,p,d,!0,a.extend({},a.jgrid.ajaxOptions,f.p.ajaxSelectOptions||{}));a(h).html("").append(m).attr("tabindex","0");a.jgrid.bindEv.call(f,m,p);window.setTimeout(function(){a(m).focus()},1);a("input, select, textarea",h).bind("keydown",function(c){27===c.keyCode&&(0<a("input.hasDatepicker",h).length?a(".ui-datepicker").is(":hidden")?a(f).jqGrid("restoreCell",b,e):a("input.hasDatepicker",h).datepicker("hide"):a(f).jqGrid("restoreCell",b,e));if(13===c.keyCode&&!c.shiftKey)return a(f).jqGrid("saveCell",
  182. b,e),!1;if(9===c.keyCode){if(f.grid.hDiv.loading)return!1;c.shiftKey?a(f).jqGrid("prevCell",b,e):a(f).jqGrid("nextCell",b,e)}c.stopPropagation()});a(f).triggerHandler("jqGridAfterEditCell",[f.rows[b].id,g,d,b,e]);a.isFunction(f.p.afterEditCell)&&f.p.afterEditCell.call(f,f.rows[b].id,g,d,b,e)}f.p.iCol=e;f.p.iRow=b}}})},saveCell:function(b,e){return this.each(function(){var c=this,f;if(c.grid&&!0===c.p.cellEdit){f=1<=c.p.savedRow.length?0:null;if(null!==f){var g=a("td:eq("+e+")",c.rows[b]),d,h,k=c.p.colModel[e],
  183. l=k.name,p=a.jgrid.jqID(l);switch(k.edittype){case "select":if(k.editoptions.multiple){var p=a("#"+b+"_"+p,c.rows[b]),m=[];(d=a(p).val())?d.join(","):d="";a("option:selected",p).each(function(b,c){m[b]=a(c).text()});h=m.join(",")}else d=a("#"+b+"_"+p+" option:selected",c.rows[b]).val(),h=a("#"+b+"_"+p+" option:selected",c.rows[b]).text();k.formatter&&(h=d);break;case "checkbox":var r=["Yes","No"];k.editoptions&&(r=k.editoptions.value.split(":"));h=d=a("#"+b+"_"+p,c.rows[b]).is(":checked")?r[0]:r[1];
  184. break;case "password":case "text":case "textarea":case "button":h=d=a("#"+b+"_"+p,c.rows[b]).val();break;case "custom":try{if(k.editoptions&&a.isFunction(k.editoptions.custom_value)){d=k.editoptions.custom_value.call(c,a(".customelement",g),"get");if(void 0===d)throw"e2";h=d}else throw"e1";}catch(q){"e1"===q&&a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose),"e2"===q?a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_value' "+
  185. a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):a.jgrid.info_dialog(a.jgrid.errors.errcap,q.message,a.jgrid.edit.bClose)}}if(h!==c.p.savedRow[f].v){if(f=a(c).triggerHandler("jqGridBeforeSaveCell",[c.rows[b].id,l,d,b,e]))h=d=f;a.isFunction(c.p.beforeSaveCell)&&(f=c.p.beforeSaveCell.call(c,c.rows[b].id,l,d,b,e))&&(h=d=f);var n=a.jgrid.checkValues.call(c,d,e);if(!0===n[0]){f=a(c).triggerHandler("jqGridBeforeSubmitCell",[c.rows[b].id,l,d,b,e])||{};a.isFunction(c.p.beforeSubmitCell)&&((f=c.p.beforeSubmitCell.call(c,
  186. c.rows[b].id,l,d,b,e))||(f={}));0<a("input.hasDatepicker",g).length&&a("input.hasDatepicker",g).datepicker("hide");if("remote"===c.p.cellsubmit)if(c.p.cellurl){var t={};c.p.autoencode&&(d=a.jgrid.htmlEncode(d));t[l]=d;r=c.p.prmNames;k=r.id;p=r.oper;t[k]=a.jgrid.stripPref(c.p.idPrefix,c.rows[b].id);t[p]=r.editoper;t=a.extend(f,t);a(c).jqGrid("progressBar",{method:"show",loadtype:c.p.loadui,htmlcontent:a.jgrid.defaults.savetext||"Saving..."});c.grid.hDiv.loading=!0;a.ajax(a.extend({url:c.p.cellurl,
  187. data:a.isFunction(c.p.serializeCellData)?c.p.serializeCellData.call(c,t):t,type:"POST",complete:function(f,k){a(c).jqGrid("progressBar",{method:"hide",loadtype:c.p.loadui});c.grid.hDiv.loading=!1;if("success"===k){var n=a(c).triggerHandler("jqGridAfterSubmitCell",[c,f,t.id,l,d,b,e])||[!0,""];!0===n[0]&&a.isFunction(c.p.afterSubmitCell)&&(n=c.p.afterSubmitCell.call(c,f,t.id,l,d,b,e));!0===n[0]?(a(g).empty(),a(c).jqGrid("setCell",c.rows[b].id,e,h,!1,!1,!0),a(g).addClass("dirty-cell"),a(c.rows[b]).addClass("edited"),
  188. a(c).triggerHandler("jqGridAfterSaveCell",[c.rows[b].id,l,d,b,e]),a.isFunction(c.p.afterSaveCell)&&c.p.afterSaveCell.call(c,c.rows[b].id,l,d,b,e),c.p.savedRow.splice(0,1)):(a.jgrid.info_dialog(a.jgrid.errors.errcap,n[1],a.jgrid.edit.bClose),a(c).jqGrid("restoreCell",b,e))}},error:function(d,f,h){a("#lui_"+a.jgrid.jqID(c.p.id)).hide();c.grid.hDiv.loading=!1;a(c).triggerHandler("jqGridErrorCell",[d,f,h]);a.isFunction(c.p.errorCell)?c.p.errorCell.call(c,d,f,h):a.jgrid.info_dialog(a.jgrid.errors.errcap,
  189. d.status+" : "+d.statusText+"<br/>"+f,a.jgrid.edit.bClose);a(c).jqGrid("restoreCell",b,e)}},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,e)}catch(u){}"clientArray"===c.p.cellsubmit&&(a(g).empty(),a(c).jqGrid("setCell",c.rows[b].id,e,h,!1,!1,!0),a(g).addClass("dirty-cell"),a(c.rows[b]).addClass("edited"),a(c).triggerHandler("jqGridAfterSaveCell",[c.rows[b].id,l,d,b,e]),a.isFunction(c.p.afterSaveCell)&&
  190. c.p.afterSaveCell.call(c,c.rows[b].id,l,d,b,e),c.p.savedRow.splice(0,1))}else try{window.setTimeout(function(){a.jgrid.info_dialog(a.jgrid.errors.errcap,d+" "+n[1],a.jgrid.edit.bClose)},100),a(c).jqGrid("restoreCell",b,e)}catch(w){}}else a(c).jqGrid("restoreCell",b,e)}window.setTimeout(function(){a("#"+a.jgrid.jqID(c.p.knv)).attr("tabindex","-1").focus()},0)}})},restoreCell:function(b,e){return this.each(function(){var c=this,f;if(c.grid&&!0===c.p.cellEdit){f=1<=c.p.savedRow.length?0:null;if(null!==
  191. f){var g=a("td:eq("+e+")",c.rows[b]);if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker",g).datepicker("hide")}catch(d){}a(g).empty().attr("tabindex","-1");a(c).jqGrid("setCell",c.rows[b].id,e,c.p.savedRow[f].v,!1,!1,!0);a(c).triggerHandler("jqGridAfterRestoreCell",[c.rows[b].id,c.p.savedRow[f].v,b,e]);a.isFunction(c.p.afterRestoreCell)&&c.p.afterRestoreCell.call(c,c.rows[b].id,c.p.savedRow[f].v,b,e);c.p.savedRow.splice(0,1)}window.setTimeout(function(){a("#"+c.p.knv).attr("tabindex","-1").focus()},
  192. 0)}})},nextCell:function(b,e){return this.each(function(){var c=!1,f;if(this.grid&&!0===this.p.cellEdit){for(f=e+1;f<this.p.colModel.length;f++)if(!0===this.p.colModel[f].editable){c=f;break}!1!==c?a(this).jqGrid("editCell",b,c,!0):0<this.p.savedRow.length&&a(this).jqGrid("saveCell",b,e)}})},prevCell:function(b,e){return this.each(function(){var c=!1,f;if(this.grid&&!0===this.p.cellEdit){for(f=e-1;0<=f;f--)if(!0===this.p.colModel[f].editable){c=f;break}!1!==c?a(this).jqGrid("editCell",b,c,!0):0<this.p.savedRow.length&&
  193. a(this).jqGrid("saveCell",b,e)}})},GridNav:function(){return this.each(function(){function b(b,d,e){if("v"===e.substr(0,1)){var f=a(c.grid.bDiv)[0].clientHeight,g=a(c.grid.bDiv)[0].scrollTop,r=c.rows[b].offsetTop+c.rows[b].clientHeight,q=c.rows[b].offsetTop;"vd"===e&&r>=f&&(a(c.grid.bDiv)[0].scrollTop=a(c.grid.bDiv)[0].scrollTop+c.rows[b].clientHeight);"vu"===e&&q<g&&(a(c.grid.bDiv)[0].scrollTop=a(c.grid.bDiv)[0].scrollTop-c.rows[b].clientHeight)}"h"===e&&(e=a(c.grid.bDiv)[0].clientWidth,f=a(c.grid.bDiv)[0].scrollLeft,
  194. g=c.rows[b].cells[d].offsetLeft,c.rows[b].cells[d].offsetLeft+c.rows[b].cells[d].clientWidth>=e+parseInt(f,10)?a(c.grid.bDiv)[0].scrollLeft=a(c.grid.bDiv)[0].scrollLeft+c.rows[b].cells[d].clientWidth:g<f&&(a(c.grid.bDiv)[0].scrollLeft=a(c.grid.bDiv)[0].scrollLeft-c.rows[b].cells[d].clientWidth))}function e(a,b){var d,e;if("lft"===b)for(d=a+1,e=a;0<=e;e--)if(!0!==c.p.colModel[e].hidden){d=e;break}if("rgt"===b)for(d=a-1,e=a;e<c.p.colModel.length;e++)if(!0!==c.p.colModel[e].hidden){d=e;break}return d}
  195. var c=this;if(c.grid&&!0===c.p.cellEdit){c.p.knv=c.p.id+"_kn";var f=a("<div style='position:fixed;top:0px;width:1px;height:1px;' tabindex='0'><div tabindex='-1' style='width:1px;height:1px;' id='"+c.p.knv+"'></div></div>"),g,d;a(f).insertBefore(c.grid.cDiv);a("#"+c.p.knv).focus().keydown(function(f){d=f.keyCode;"rtl"===c.p.direction&&(37===d?d=39:39===d&&(d=37));switch(d){case 38:0<c.p.iRow-1&&(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-
  196. 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:0<=c.p.iCol-1&&(g=e(c.p.iCol-1,"lft"),b(c.p.iRow,g,"h"),a(c).jqGrid("editCell",c.p.iRow,g,!1));break;case 39:c.p.iCol+1<=c.p.colModel.length-1&&(g=e(c.p.iCol+1,"rgt"),b(c.p.iRow,g,"h"),a(c).jqGrid("editCell",c.p.iRow,g,!1));break;case 13:0<=parseInt(c.p.iCol,10)&&0<=parseInt(c.p.iRow,10)&&a(c).jqGrid("editCell",c.p.iRow,c.p.iCol,!0);break;default:return!0}return!1})}})},getChangedCells:function(b){var e=
  197. [];b||(b="all");this.each(function(){var c=this,f;c.grid&&!0===c.p.cellEdit&&a(c.rows).each(function(g){var d={};a(this).hasClass("edited")&&(a("td",this).each(function(e){f=c.p.colModel[e].name;if("cb"!==f&&"subgrid"!==f)if("dirty"===b){if(a(this).hasClass("dirty-cell"))try{d[f]=a.unformat.call(c,this,{rowId:c.rows[g].id,colModel:c.p.colModel[e]},e)}catch(k){d[f]=a.jgrid.htmlDecode(a(this).html())}}else try{d[f]=a.unformat.call(c,this,{rowId:c.rows[g].id,colModel:c.p.colModel[e]},e)}catch(l){d[f]=
  198. a.jgrid.htmlDecode(a(this).html())}}),d.id=this.id,e.push(d))})});return e}})})(jQuery);
  199. (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,e){e=a.extend({jqm:!0,gb:"",removemodal:!1,formprop:!1,form:""},e||{});var c=e.gb&&"string"===typeof e.gb&&"#gbox_"===e.gb.substr(0,6)?a("#"+e.gb.substr(6))[0]:!1;if(e.onClose){var f=c?e.onClose.call(c,b):e.onClose(b);if("boolean"===typeof f&&!f)return}if(e.formprop&&c&&e.form){f=a(b)[0].style.height;-1<f.indexOf("px")&&(f=parseFloat(f));
  200. var g,d;"edit"===e.form?(g="#"+a.jgrid.jqID("FrmGrid_"+e.gb.substr(6)),d="formProp"):"view"===e.form&&(g="#"+a.jgrid.jqID("ViewGrid_"+e.gb.substr(6)),d="viewProp");a(c).data(d,{top:parseFloat(a(b).css("top")),left:parseFloat(a(b).css("left")),width:a(b).width(),height:f,dataheight:a(g).height(),datawidth:a(g).width()})}if(a.fn.jqm&&!0===e.jqm)a(b).attr("aria-hidden","true").jqmHide();else{if(""!==e.gb)try{a(".jqgrid-overlay:first",e.gb).hide()}catch(h){}a(b).hide().attr("aria-hidden","true")}e.removemodal&&
  201. a(b).remove()},findPos:function(a){var e=0,c=0;if(a.offsetParent){do e+=a.offsetLeft,c+=a.offsetTop;while(a=a.offsetParent)}return[e,c]},createModal:function(b,e,c,f,g,d,h){c=a.extend(!0,{},a.jgrid.jqModal||{},c);var k=document.createElement("div"),l,p=this;h=a.extend({},h||{});l="rtl"===a(c.gbox).attr("dir")?!0:!1;k.className="ui-widget ui-widget-content ui-corner-all ui-jqdialog";k.id=b.themodal;var m=document.createElement("div");m.className="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";
  202. m.id=b.modalhead;a(m).append("<span class='ui-jqdialog-title'>"+c.caption+"</span>");var r=a("<a class='ui-jqdialog-titlebar-close ui-corner-all'></a>").hover(function(){r.addClass("ui-state-hover")},function(){r.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-closethick'></span>");a(m).append(r);l?(k.dir="rtl",a(".ui-jqdialog-title",m).css("float","right"),a(".ui-jqdialog-titlebar-close",m).css("left","0.3em")):(k.dir="ltr",a(".ui-jqdialog-title",m).css("float","left"),a(".ui-jqdialog-titlebar-close",
  203. m).css("right","0.3em"));var q=document.createElement("div");a(q).addClass("ui-jqdialog-content ui-widget-content").attr("id",b.modalcontent);a(q).append(e);k.appendChild(q);a(k).prepend(m);!0===d?a("body").append(k):"string"===typeof d?a(d).append(k):a(k).insertBefore(f);a(k).css(h);void 0===c.jqModal&&(c.jqModal=!0);e={};if(a.fn.jqm&&!0===c.jqModal)0===c.left&&0===c.top&&c.overlay&&(h=[],h=a.jgrid.findPos(g),c.left=h[0]+4,c.top=h[1]+4),e.top=c.top+"px",e.left=c.left;else if(0!==c.left||0!==c.top)e.left=
  204. c.left,e.top=c.top+"px";a("a.ui-jqdialog-titlebar-close",m).click(function(){var d=a("#"+a.jgrid.jqID(b.themodal)).data("onClose")||c.onClose,e=a("#"+a.jgrid.jqID(b.themodal)).data("gbox")||c.gbox;p.hideModal("#"+a.jgrid.jqID(b.themodal),{gb:e,jqm:c.jqModal,onClose:d,removemodal:c.removemodal||!1,formprop:!c.recreateForm||!1,form:c.form||""});return!1});0!==c.width&&c.width||(c.width=300);0!==c.height&&c.height||(c.height=200);c.zIndex||(f=a(f).parents("*[role=dialog]").filter(":first").css("z-index"),
  205. c.zIndex=f?parseInt(f,10)+2:950);f=0;l&&e.left&&!d&&(f=a(c.gbox).width()-(isNaN(c.width)?0:parseInt(c.width,10))-8,e.left=parseInt(e.left,10)+parseInt(f,10));e.left&&(e.left+="px");a(k).css(a.extend({width:isNaN(c.width)?"auto":c.width+"px",height:isNaN(c.height)?"auto":c.height+"px",zIndex:c.zIndex,overflow:"hidden"},e)).attr({tabIndex:"-1",role:"dialog","aria-labelledby":b.modalhead,"aria-hidden":"true"});void 0===c.drag&&(c.drag=!0);void 0===c.resize&&(c.resize=!0);if(c.drag)if(a(m).css("cursor",
  206. "move"),a.fn.jqDrag)a(k).jqDrag(m);else try{a(k).draggable({handle:a("#"+a.jgrid.jqID(m.id))})}catch(n){}if(c.resize)if(a.fn.jqResize)a(k).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se'></div>"),a("#"+a.jgrid.jqID(b.themodal)).jqResize(".jqResize",b.scrollelm?"#"+a.jgrid.jqID(b.scrollelm):!1);else try{a(k).resizable({handles:"se, sw",alsoResize:b.scrollelm?"#"+a.jgrid.jqID(b.scrollelm):!1})}catch(t){}!0===c.closeOnEscape&&a(k).keydown(function(d){27===
  207. d.which&&(d=a("#"+a.jgrid.jqID(b.themodal)).data("onClose")||c.onClose,p.hideModal("#"+a.jgrid.jqID(b.themodal),{gb:c.gbox,jqm:c.jqModal,onClose:d,removemodal:c.removemodal||!1,formprop:!c.recreateForm||!1,form:c.form||""}))})},viewModal:function(b,e){e=a.extend({toTop:!0,overlay:10,modal:!1,overlayClass:"ui-widget-overlay",onShow:a.jgrid.showModal,onHide:a.jgrid.closeModal,gbox:"",jqm:!0,jqM:!0},e||{});if(a.fn.jqm&&!0===e.jqm)e.jqM?a(b).attr("aria-hidden","false").jqm(e).jqmShow():a(b).attr("aria-hidden",
  208. "false").jqmShow();else{""!==e.gbox&&(a(".jqgrid-overlay:first",e.gbox).show(),a(b).data("gbox",e.gbox));a(b).show().attr("aria-hidden","false");try{a(":input:visible",b)[0].focus()}catch(c){}}},info_dialog:function(b,e,c,f){var g={width:290,height:"auto",dataheight:"auto",drag:!0,resize:!1,left:250,top:170,zIndex:1E3,jqModal:!0,modal:!1,closeOnEscape:!0,align:"center",buttonalign:"center",buttons:[]};a.extend(!0,g,a.jgrid.jqModal||{},{caption:"<b>"+b+"</b>"},f||{});var d=g.jqModal,h=this;a.fn.jqm&&
  209. !d&&(d=!1);b="";if(0<g.buttons.length)for(f=0;f<g.buttons.length;f++)void 0===g.buttons[f].id&&(g.buttons[f].id="info_button_"+f),b+="<a id='"+g.buttons[f].id+"' class='fm-button ui-state-default ui-corner-all'>"+g.buttons[f].text+"</a>";f=isNaN(g.dataheight)?g.dataheight:g.dataheight+"px";e="<div id='info_id'>"+("<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+f+";"+("text-align:"+g.align+";")+"'>"+e+"</div>");e+=c?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+
  210. g.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a 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;'>"+b+"</div>":"";e+="</div>";try{"false"===a("#info_dialog").attr("aria-hidden")&&a.jgrid.hideModal("#info_dialog",{jqm:d}),a("#info_dialog").remove()}catch(k){}a.jgrid.createModal({themodal:"info_dialog",
  211. modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},e,g,"","",!0);b&&a.each(g.buttons,function(b){a("#"+a.jgrid.jqID(this.id),"#info_id").bind("click",function(){g.buttons[b].onClick.call(a("#info_dialog"));return!1})});a("#closedialog","#info_id").click(function(){h.hideModal("#info_dialog",{jqm:d,onClose:a("#info_dialog").data("onClose")||g.onClose,gb:a("#info_dialog").data("gbox")||g.gbox});return!1});a(".fm-button","#info_dialog").hover(function(){a(this).addClass("ui-state-hover")},
  212. function(){a(this).removeClass("ui-state-hover")});a.isFunction(g.beforeOpen)&&g.beforeOpen();a.jgrid.viewModal("#info_dialog",{onHide:function(a){a.w.hide().remove();a.o&&a.o.remove()},modal:g.modal,jqm:d});a.isFunction(g.afterOpen)&&g.afterOpen();try{a("#info_dialog").focus()}catch(l){}},bindEv:function(b,e){a.isFunction(e.dataInit)&&e.dataInit.call(this,b,e);e.dataEvents&&a.each(e.dataEvents,function(){void 0!==this.data?a(b).bind(this.type,this.data,this.fn):a(b).bind(this.type,this.fn)})},createEl:function(b,
  213. e,c,f,g){function d(b,c,d){var e="dataInit dataEvents dataUrl buildSelect sopt searchhidden defaultValue attr custom_element custom_value".split(" ");void 0!==d&&a.isArray(d)&&a.merge(e,d);a.each(c,function(c,d){-1===a.inArray(c,e)&&a(b).attr(c,d)});c.hasOwnProperty("id")||a(b).attr("id",a.jgrid.randId())}var h="",k=this;switch(b){case "textarea":h=document.createElement("textarea");f?e.cols||a(h).css({width:"98%"}):e.cols||(e.cols=20);e.rows||(e.rows=2);if("&nbsp;"===c||"&#160;"===c||1===c.length&&
  214. 160===c.charCodeAt(0))c="";h.value=c;d(h,e);a(h).attr({role:"textbox",multiline:"true"});break;case "checkbox":h=document.createElement("input");h.type="checkbox";e.value?(b=e.value.split(":"),c===b[0]&&(h.checked=!0,h.defaultChecked=!0),h.value=b[0],a(h).attr("offval",b[1])):(b=(c+"").toLowerCase(),0>b.search(/(false|f|0|no|n|off|undefined)/i)&&""!==b?(h.checked=!0,h.defaultChecked=!0,h.value=c):h.value="on",a(h).attr("offval","off"));d(h,e,["value"]);a(h).attr("role","checkbox");break;case "select":h=
  215. document.createElement("select");h.setAttribute("role","select");f=[];!0===e.multiple?(b=!0,h.multiple="multiple",a(h).attr("aria-multiselectable","true")):b=!1;if(void 0!==e.dataUrl){b=null;var l=e.postData||g.postData;try{b=e.rowId}catch(p){}k.p&&k.p.idPrefix&&(b=a.jgrid.stripPref(k.p.idPrefix,b));a.ajax(a.extend({url:a.isFunction(e.dataUrl)?e.dataUrl.call(k,b,c,String(e.name)):e.dataUrl,type:"GET",dataType:"html",data:a.isFunction(l)?l.call(k,b,c,String(e.name)):l,context:{elem:h,options:e,vl:c},
  216. success:function(b){var c=[],e=this.elem,f=this.vl,h=a.extend({},this.options),g=!0===h.multiple;b=a.isFunction(h.buildSelect)?h.buildSelect.call(k,b):b;"string"===typeof b&&(b=a(a.trim(b)).html());b&&(a(e).append(b),d(e,h,l?["postData"]:void 0),void 0===h.size&&(h.size=g?3:1),g?(c=f.split(","),c=a.map(c,function(b){return a.trim(b)})):c[0]=a.trim(f),setTimeout(function(){a("option",e).each(function(b){0===b&&e.multiple&&(this.selected=!1);a(this).attr("role","option");if(-1<a.inArray(a.trim(a(this).text()),
  217. c)||-1<a.inArray(a.trim(a(this).val()),c))this.selected="selected"})},0))}},g||{}))}else if(e.value){var m;void 0===e.size&&(e.size=b?3:1);b&&(f=c.split(","),f=a.map(f,function(b){return a.trim(b)}));"function"===typeof e.value&&(e.value=e.value());var r,q,n=void 0===e.separator?":":e.separator;g=void 0===e.delimiter?";":e.delimiter;if("string"===typeof e.value)for(r=e.value.split(g),m=0;m<r.length;m++)q=r[m].split(n),2<q.length&&(q[1]=a.map(q,function(a,b){if(0<b)return a}).join(n)),g=document.createElement("option"),
  218. g.setAttribute("role","option"),g.value=q[0],g.innerHTML=q[1],h.appendChild(g),b||a.trim(q[0])!==a.trim(c)&&a.trim(q[1])!==a.trim(c)||(g.selected="selected"),b&&(-1<a.inArray(a.trim(q[1]),f)||-1<a.inArray(a.trim(q[0]),f))&&(g.selected="selected");else if("object"===typeof e.value)for(m in n=e.value,n)n.hasOwnProperty(m)&&(g=document.createElement("option"),g.setAttribute("role","option"),g.value=m,g.innerHTML=n[m],h.appendChild(g),b||a.trim(m)!==a.trim(c)&&a.trim(n[m])!==a.trim(c)||(g.selected="selected"),
  219. b&&(-1<a.inArray(a.trim(n[m]),f)||-1<a.inArray(a.trim(m),f))&&(g.selected="selected"));d(h,e,["value"])}break;case "text":case "password":case "button":m="button"===b?"button":"textbox";h=document.createElement("input");h.type=b;h.value=c;d(h,e);"button"!==b&&(f?e.size||a(h).css({width:"98%"}):e.size||(e.size=20));a(h).attr("role",m);break;case "image":case "file":h=document.createElement("input");h.type=b;d(h,e);break;case "custom":h=document.createElement("span");try{if(a.isFunction(e.custom_element))if(n=
  220. e.custom_element.call(k,c,e))n=a(n).addClass("customelement").attr({id:e.id,name:e.name}),a(h).empty().append(n);else throw"e2";else throw"e1";}catch(t){"e1"===t&&a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose),"e2"===t?a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):a.jgrid.info_dialog(a.jgrid.errors.errcap,"string"===typeof t?t:t.message,a.jgrid.edit.bClose)}}return h},
  221. checkDate:function(a,e){var c={},f;a=a.toLowerCase();f=-1!==a.indexOf("/")?"/":-1!==a.indexOf("-")?"-":-1!==a.indexOf(".")?".":"/";a=a.split(f);e=e.split(f);if(3!==e.length)return!1;var g=-1,d,h=f=-1,k;for(k=0;k<a.length;k++)d=isNaN(e[k])?0:parseInt(e[k],10),c[a[k]]=d,d=a[k],-1!==d.indexOf("y")&&(g=k),-1!==d.indexOf("m")&&(h=k),-1!==d.indexOf("d")&&(f=k);d="y"===a[g]||"yyyy"===a[g]?4:"yy"===a[g]?2:-1;k=[0,31,29,31,30,31,30,31,31,30,31,30,31];var l;if(-1===g)return!1;l=c[a[g]].toString();2===d&&1===
  222. l.length&&(d=1);if(l.length!==d||0===c[a[g]]&&"00"!==e[g]||-1===h)return!1;l=c[a[h]].toString();if(1>l.length||1>c[a[h]]||12<c[a[h]]||-1===f)return!1;l=c[a[f]].toString();!(d=1>l.length||1>c[a[f]]||31<c[a[f]])&&(d=2===c[a[h]])&&(g=c[a[g]],d=c[a[f]]>(0!==g%4||0===g%100&&0!==g%400?28:29));return d||c[a[f]]>k[c[a[h]]]?!1:!0},isEmpty:function(a){return a.match(/^\s+$/)||""===a?!0:!1},checkTime:function(b){var e=/^(\d{1,2}):(\d{2})([apAP][Mm])?$/;if(!a.jgrid.isEmpty(b))if(b=b.match(e)){if(b[3]){if(1>b[1]||
  223. 12<b[1])return!1}else if(23<b[1])return!1;if(59<b[2])return!1}else return!1;return!0},checkValues:function(b,e,c,f){var g,d,h;h=this.p.colModel;if(void 0===c)if("string"===typeof e)for(c=0,f=h.length;c<f;c++){if(h[c].name===e){g=h[c].editrules;e=c;null!=h[c].formoptions&&(d=h[c].formoptions.label);break}}else 0<=e&&(g=h[e].editrules);else g=c,d=void 0===f?"_":f;if(g){d||(d=null!=this.p.colNames?this.p.colNames[e]:h[e].label);if(!0===g.required&&a.jgrid.isEmpty(b))return[!1,d+": "+a.jgrid.edit.msg.required,
  224. ""];c=!1===g.required?!1:!0;if(!0===g.number&&(!1!==c||!a.jgrid.isEmpty(b))&&isNaN(b))return[!1,d+": "+a.jgrid.edit.msg.number,""];if(void 0!==g.minValue&&!isNaN(g.minValue)&&parseFloat(b)<parseFloat(g.minValue))return[!1,d+": "+a.jgrid.edit.msg.minValue+" "+g.minValue,""];if(void 0!==g.maxValue&&!isNaN(g.maxValue)&&parseFloat(b)>parseFloat(g.maxValue))return[!1,d+": "+a.jgrid.edit.msg.maxValue+" "+g.maxValue,""];if(!(!0!==g.email||!1===c&&a.jgrid.isEmpty(b)||(f=/^((([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,
  225. f.test(b))))return[!1,d+": "+a.jgrid.edit.msg.email,""];if(!(!0!==g.integer||!1===c&&a.jgrid.isEmpty(b)||!isNaN(b)&&0===b%1&&-1===b.indexOf(".")))return[!1,d+": "+a.jgrid.edit.msg.integer,""];if(!(!0!==g.date||!1===c&&a.jgrid.isEmpty(b)||(h[e].formatoptions&&h[e].formatoptions.newformat?(h=h[e].formatoptions.newformat,a.jgrid.formatter.date.masks.hasOwnProperty(h)&&(h=a.jgrid.formatter.date.masks[h])):h=h[e].datefmt||"Y-m-d",a.jgrid.checkDate(h,b))))return[!1,d+": "+a.jgrid.edit.msg.date+" - "+h,
  226. ""];if(!0===g.time&&!(!1===c&&a.jgrid.isEmpty(b)||a.jgrid.checkTime(b)))return[!1,d+": "+a.jgrid.edit.msg.date+" - hh:mm (am/pm)",""];if(!(!0!==g.url||!1===c&&a.jgrid.isEmpty(b)||(f=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i,f.test(b))))return[!1,d+": "+a.jgrid.edit.msg.url,""];if(!0===g.custom&&(!1!==c||!a.jgrid.isEmpty(b)))return a.isFunction(g.custom_func)?(b=g.custom_func.call(this,b,d,e),a.isArray(b)?b:[!1,a.jgrid.edit.msg.customarray,
  227. ""]):[!1,a.jgrid.edit.msg.customfcheck,""]}return[!0,"",""]}})})(jQuery);
  228. (function(a){a.jgrid.extend({getColProp:function(a){var e={},c=this[0];if(!c.grid)return!1;var c=c.p.colModel,f;for(f=0;f<c.length;f++)if(c[f].name===a){e=c[f];break}return e},setColProp:function(b,e){return this.each(function(){if(this.grid&&e){var c=this.p.colModel,f;for(f=0;f<c.length;f++)if(c[f].name===b){a.extend(!0,this.p.colModel[f],e);break}}})},sortGrid:function(a,e,c){return this.each(function(){var f=-1,g,d=!1;if(this.grid){a||(a=this.p.sortname);for(g=0;g<this.p.colModel.length;g++)if(this.p.colModel[g].index===
  229. a||this.p.colModel[g].name===a){f=g;!0===this.p.frozenColumns&&!0===this.p.colModel[g].frozen&&(d=this.grid.fhDiv.find("#"+this.p.id+"_"+a));break}-1!==f&&(g=this.p.colModel[f].sortable,d||(d=this.grid.headers[f].el),"boolean"!==typeof g&&(g=!0),"boolean"!==typeof e&&(e=!1),g&&this.sortData("jqgh_"+this.p.id+"_"+a,f,e,c,d))}})},clearBeforeUnload:function(){return this.each(function(){var b=this.grid;a.isFunction(b.emptyRows)&&b.emptyRows.call(this,!0,!0);a(document).unbind("mouseup.jqGrid"+this.p.id);
  230. a(b.hDiv).unbind("mousemove");a(this).unbind();b.dragEnd=null;b.dragMove=null;b.dragStart=null;b.emptyRows=null;b.populate=null;b.populateVisible=null;b.scrollGrid=null;b.selectionPreserver=null;b.bDiv=null;b.cDiv=null;b.hDiv=null;b.cols=null;var e,c=b.headers.length;for(e=0;e<c;e++)b.headers[e].el=null;this.grid=this.addJSONData=this.addXmlData=this.formatter=this.constructTr=this.setHeadCheckBox=this.refreshIndex=this.updatepager=this.sortData=this.formatCol=null})},GridDestroy:function(){return this.each(function(){if(this.grid){this.p.pager&&
  231. a(this.p.pager).remove();try{a(this).jqGrid("clearBeforeUnload"),a("#gbox_"+a.jgrid.jqID(this.id)).remove(),a("#alertmod_"+a.jgrid.jqID(this.id)).remove()}catch(b){}}})},GridUnload:function(){return this.each(function(){if(this.grid){var b=a(this).attr("id"),e=a(this).attr("class");this.p.pager&&a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager ui-corner-bottom");var c=document.createElement("table");a(c).attr({id:b});c.className=e;b=a.jgrid.jqID(this.id);a(c).removeClass("ui-jqgrid-btable");
  232. 1===a(this.p.pager).parents("#gbox_"+b).length?(a(c).insertBefore("#gbox_"+b).show(),a(this.p.pager).insertBefore("#gbox_"+b)):a(c).insertBefore("#gbox_"+b).show();a(this).jqGrid("clearBeforeUnload");a("#gbox_"+b).remove()}})},setGridState:function(b){return this.each(function(){this.grid&&("hidden"===b?(a(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+a.jgrid.jqID(this.p.id)).slideUp("fast"),this.p.pager&&a(this.p.pager).slideUp("fast"),this.p.toppager&&a(this.p.toppager).slideUp("fast"),!0===this.p.toolbar[0]&&
  233. ("both"===this.p.toolbar[1]&&a(this.grid.ubDiv).slideUp("fast"),a(this.grid.uDiv).slideUp("fast")),this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+a.jgrid.jqID(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"):"visible"===b&&(a(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+a.jgrid.jqID(this.p.id)).slideDown("fast"),this.p.pager&&a(this.p.pager).slideDown("fast"),this.p.toppager&&
  234. a(this.p.toppager).slideDown("fast"),!0===this.p.toolbar[0]&&("both"===this.p.toolbar[1]&&a(this.grid.ubDiv).slideDown("fast"),a(this.grid.uDiv).slideDown("fast")),this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+a.jgrid.jqID(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,autosearchDelay:500,searchOnEnter:!0,
  235. beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,searchurl:"",stringResult:!1,groupOp:"AND",defaultSearch:"bw",searchOperators:!1,resetIcon:"x",operands:{eq:"==",ne:"!",lt:"<",le:"<=",gt:">",ge:">=",bw:"^",bn:"!^","in":"=",ni:"!=",ew:"|",en:"!@",cn:"~",nc:"!~",nu:"#",nn:"!#"}},a.jgrid.search,b||{});return this.each(function(){var e=this;if(!this.ftoolbar){var c=function(){var c={},d=0,f,g,m={},r;a.each(e.p.colModel,function(){var n=a("#gs_"+a.jgrid.jqID(this.name),!0===this.frozen&&
  236. !0===e.p.frozenColumns?e.grid.fhDiv:e.grid.hDiv);g=this.index||this.name;r=b.searchOperators?n.parent().prev().children("a").attr("soper")||b.defaultSearch:this.searchoptions&&this.searchoptions.sopt?this.searchoptions.sopt[0]:"select"===this.stype?"eq":b.defaultSearch;if((f="custom"===this.stype&&a.isFunction(this.searchoptions.custom_value)&&0<n.length&&"SPAN"===n[0].nodeName.toUpperCase()?this.searchoptions.custom_value.call(e,n.children(".customelement:first"),"get"):n.val())||"nu"===r||"nn"===
  237. r)c[g]=f,m[g]=r,d++;else try{delete e.p.postData[g]}catch(q){}});var q=0<d?!0:!1;if(!0===b.stringResult||"local"===e.p.datatype||!0===b.searchOperators){var n='{"groupOp":"'+b.groupOp+'","rules":[',t=0;a.each(c,function(a,b){0<t&&(n+=",");n+='{"field":"'+a+'",';n+='"op":"'+m[a]+'",';n+='"data":"'+(b+"").replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';t++});n+="]}";a.extend(e.p.postData,{filters:n});a.each(["searchField","searchString","searchOper"],function(a,b){e.p.postData.hasOwnProperty(b)&&delete e.p.postData[b]})}else a.extend(e.p.postData,
  238. c);var u;e.p.searchurl&&(u=e.p.url,a(e).jqGrid("setGridParam",{url:e.p.searchurl}));var w="stop"===a(e).triggerHandler("jqGridToolbarBeforeSearch")?!0:!1;!w&&a.isFunction(b.beforeSearch)&&(w=b.beforeSearch.call(e));w||a(e).jqGrid("setGridParam",{search:q}).trigger("reloadGrid",[{page:1}]);u&&a(e).jqGrid("setGridParam",{url:u});a(e).triggerHandler("jqGridToolbarAfterSearch");a.isFunction(b.afterSearch)&&b.afterSearch.call(e)},f=function(d,f,g){a("#sopt_menu").remove();f=parseInt(f,10);g=parseInt(g,
  239. 10)+18;f='<ul id="sopt_menu" class="ui-search-menu" role="menu" tabindex="0" style="font-size:'+(a(".ui-jqgrid-view").css("font-size")||"11px")+";left:"+f+"px;top:"+g+'px;">';g=a(d).attr("soper");var p,m=[],r,q=0,n=a(d).attr("colname");for(p=e.p.colModel.length;q<p&&e.p.colModel[q].name!==n;)q++;q=e.p.colModel[q];n=a.extend({},q.searchoptions);n.sopt||(n.sopt=[],n.sopt[0]="select"===q.stype?"eq":b.defaultSearch);a.each(b.odata,function(){m.push(this.oper)});for(q=0;q<n.sopt.length;q++)r=a.inArray(n.sopt[q],
  240. m),-1!==r&&(p=g===b.odata[r].oper?"ui-state-highlight":"",f+='<li class="ui-menu-item '+p+'" role="presentation"><a class="ui-corner-all g-menu-item" tabindex="0" role="menuitem" value="'+b.odata[r].oper+'" oper="'+b.operands[b.odata[r].oper]+'"><table cellspacing="0" cellpadding="0" border="0"><tr><td width="25px">'+b.operands[b.odata[r].oper]+"</td><td>"+b.odata[r].text+"</td></tr></table></a></li>");f+="</ul>";a("body").append(f);a("#sopt_menu").addClass("ui-menu ui-widget ui-widget-content ui-corner-all");
  241. a("#sopt_menu > li > a").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).click(function(f){f=a(this).attr("value");var g=a(this).attr("oper");a(e).triggerHandler("jqGridToolbarSelectOper",[f,g,d]);a("#sopt_menu").hide();a(d).text(g).attr("soper",f);!0===b.autosearch&&(g=a(d).parent().next().children()[0],(a(g).val()||"nu"===f||"nn"===f)&&c())})},g=a("<tr class='ui-search-toolbar' role='row'></tr>"),d;a.each(e.p.colModel,function(f){var k=this,
  242. l,p;p="";var m="=",r,q=a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+e.p.direction+"'></th>"),n=a("<div style='position:relative;height:auto;padding-right:0.3em;padding-left:0.3em;'></div>"),t=a("<table class='ui-search-table' cellspacing='0'><tr><td class='ui-search-oper'></td><td class='ui-search-input'></td><td class='ui-search-clear'></td></tr></table>");!0===this.hidden&&a(q).css("display","none");this.search=!1===this.search?!1:!0;void 0===this.stype&&(this.stype="text");
  243. l=a.extend({},this.searchoptions||{});if(this.search){if(b.searchOperators){p=l.sopt?l.sopt[0]:"select"===k.stype?"eq":b.defaultSearch;for(r=0;r<b.odata.length;r++)if(b.odata[r].oper===p){m=b.operands[p]||"";break}p="<a title='"+(null!=l.searchtitle?l.searchtitle:b.operandTitle)+"' style='padding-right: 0.5em;' soper='"+p+"' class='soptclass' colname='"+this.name+"'>"+m+"</a>"}a("td:eq(0)",t).attr("colindex",f).append(p);void 0===l.clearSearch&&(l.clearSearch=!0);l.clearSearch?(p=b.resetTitle||"Clear Search Value",
  244. a("td:eq(2)",t).append("<a title='"+p+"' style='padding-right: 0.3em;padding-left: 0.3em;' class='clearsearchclass'>"+b.resetIcon+"</a>")):a("td:eq(2)",t).hide();switch(this.stype){case "select":if(p=this.surl||l.dataUrl)a(n).append(t),a.ajax(a.extend({url:p,dataType:"html",success:function(d){void 0!==l.buildSelect?(d=l.buildSelect(d))&&a("td:eq(1)",t).append(d):a("td:eq(1)",t).append(d);void 0!==l.defaultValue&&a("select",n).val(l.defaultValue);a("select",n).attr({name:k.index||k.name,id:"gs_"+
  245. k.name});l.attr&&a("select",n).attr(l.attr);a("select",n).css({width:"100%"});a.jgrid.bindEv.call(e,a("select",n)[0],l);!0===b.autosearch&&a("select",n).change(function(){c();return!1});d=null}},a.jgrid.ajaxOptions,e.p.ajaxSelectOptions||{}));else{var u,w,s;k.searchoptions?(u=void 0===k.searchoptions.value?"":k.searchoptions.value,w=void 0===k.searchoptions.separator?":":k.searchoptions.separator,s=void 0===k.searchoptions.delimiter?";":k.searchoptions.delimiter):k.editoptions&&(u=void 0===k.editoptions.value?
  246. "":k.editoptions.value,w=void 0===k.editoptions.separator?":":k.editoptions.separator,s=void 0===k.editoptions.delimiter?";":k.editoptions.delimiter);if(u){var x=document.createElement("select");x.style.width="100%";a(x).attr({name:k.index||k.name,id:"gs_"+k.name});var A;if("string"===typeof u)for(p=u.split(s),A=0;A<p.length;A++)u=p[A].split(w),s=document.createElement("option"),s.value=u[0],s.innerHTML=u[1],x.appendChild(s);else if("object"===typeof u)for(A in u)u.hasOwnProperty(A)&&(s=document.createElement("option"),
  247. s.value=A,s.innerHTML=u[A],x.appendChild(s));void 0!==l.defaultValue&&a(x).val(l.defaultValue);l.attr&&a(x).attr(l.attr);a(n).append(t);a.jgrid.bindEv.call(e,x,l);a("td:eq(1)",t).append(x);!0===b.autosearch&&a(x).change(function(){c();return!1})}}break;case "text":w=void 0!==l.defaultValue?l.defaultValue:"";a("td:eq(1)",t).append("<input type='text' style='width:100%;padding:0px;' name='"+(k.index||k.name)+"' id='gs_"+k.name+"' value='"+w+"'/>");a(n).append(t);l.attr&&a("input",n).attr(l.attr);a.jgrid.bindEv.call(e,
  248. a("input",n)[0],l);!0===b.autosearch&&(b.searchOnEnter?a("input",n).keypress(function(a){return 13===(a.charCode||a.keyCode||0)?(c(),!1):this}):a("input",n).keydown(function(a){switch(a.which){case 13:return!1;case 9:case 16:case 37:case 38:case 39:case 40:case 27:break;default:d&&clearTimeout(d),d=setTimeout(function(){c()},b.autosearchDelay)}}));break;case "custom":a("td:eq(1)",t).append("<span style='width:95%;padding:0px;' name='"+(k.index||k.name)+"' id='gs_"+k.name+"'/>");a(n).append(t);try{if(a.isFunction(l.custom_element))if(x=
  249. l.custom_element.call(e,void 0!==l.defaultValue?l.defaultValue:"",l))x=a(x).addClass("customelement"),a(n).find("span[name='"+(k.index||k.name)+"']").append(x);else throw"e2";else throw"e1";}catch(v){"e1"===v&&a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose),"e2"===v?a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):a.jgrid.info_dialog(a.jgrid.errors.errcap,"string"===
  250. typeof v?v:v.message,a.jgrid.edit.bClose)}}}a(q).append(n);a(g).append(q);b.searchOperators||a("td:eq(0)",t).hide()});a("table thead",e.grid.hDiv).append(g);b.searchOperators&&(a(".soptclass",g).click(function(b){var c=a(this).offset();f(this,c.left,c.top);b.stopPropagation()}),a("body").on("click",function(b){"soptclass"!==b.target.className&&a("#sopt_menu").hide()}));a(".clearsearchclass",g).click(function(d){d=a(this).parents("tr:first");var f=parseInt(a("td.ui-search-oper",d).attr("colindex"),
  251. 10),g=a.extend({},e.p.colModel[f].searchoptions||{}),g=g.defaultValue?g.defaultValue:"";"select"===e.p.colModel[f].stype?g?a("td.ui-search-input select",d).val(g):a("td.ui-search-input select",d)[0].selectedIndex=0:a("td.ui-search-input input",d).val(g);!0===b.autosearch&&c()});this.ftoolbar=!0;this.triggerToolbar=c;this.clearToolbar=function(c){var d={},f=0,g;c="boolean"!==typeof c?!0:c;a.each(e.p.colModel,function(){var b,c=a("#gs_"+a.jgrid.jqID(this.name),!0===this.frozen&&!0===e.p.frozenColumns?
  252. e.grid.fhDiv:e.grid.hDiv);this.searchoptions&&void 0!==this.searchoptions.defaultValue&&(b=this.searchoptions.defaultValue);g=this.index||this.name;switch(this.stype){case "select":c.find("option").each(function(c){0===c&&(this.selected=!0);if(a(this).val()===b)return this.selected=!0,!1});if(void 0!==b)d[g]=b,f++;else try{delete e.p.postData[g]}catch(h){}break;case "text":c.val(b||"");if(void 0!==b)d[g]=b,f++;else try{delete e.p.postData[g]}catch(n){}break;case "custom":a.isFunction(this.searchoptions.custom_value)&&
  253. 0<c.length&&"SPAN"===c[0].nodeName.toUpperCase()&&this.searchoptions.custom_value.call(e,c.children(".customelement:first"),"set",b||"")}});var m=0<f?!0:!1;e.p.resetsearch=!0;if(!0===b.stringResult||"local"===e.p.datatype){var r='{"groupOp":"'+b.groupOp+'","rules":[',q=0;a.each(d,function(a,b){0<q&&(r+=",");r+='{"field":"'+a+'",';r+='"op":"eq",';r+='"data":"'+(b+"").replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';q++});r+="]}";a.extend(e.p.postData,{filters:r});a.each(["searchField","searchString",
  254. "searchOper"],function(a,b){e.p.postData.hasOwnProperty(b)&&delete e.p.postData[b]})}else a.extend(e.p.postData,d);var n;e.p.searchurl&&(n=e.p.url,a(e).jqGrid("setGridParam",{url:e.p.searchurl}));var t="stop"===a(e).triggerHandler("jqGridToolbarBeforeClear")?!0:!1;!t&&a.isFunction(b.beforeClear)&&(t=b.beforeClear.call(e));t||c&&a(e).jqGrid("setGridParam",{search:m}).trigger("reloadGrid",[{page:1}]);n&&a(e).jqGrid("setGridParam",{url:n});a(e).triggerHandler("jqGridToolbarAfterClear");a.isFunction(b.afterClear)&&
  255. b.afterClear()};this.toggleToolbar=function(){var b=a("tr.ui-search-toolbar",e.grid.hDiv),c=!0===e.p.frozenColumns?a("tr.ui-search-toolbar",e.grid.fhDiv):!1;"none"===b.css("display")?(b.show(),c&&c.show()):(b.hide(),c&&c.hide())}}})},destroyFilterToolbar:function(){return this.each(function(){this.ftoolbar&&(this.toggleToolbar=this.clearToolbar=this.triggerToolbar=null,this.ftoolbar=!1,a(this.grid.hDiv).find("table thead tr.ui-search-toolbar").remove())})},destroyGroupHeader:function(b){void 0===
  256. b&&(b=!0);return this.each(function(){var e,c,f,g,d,h;c=this.grid;var k=a("table.ui-jqgrid-htable thead",c.hDiv),l=this.p.colModel;if(c){a(this).unbind(".setGroupHeaders");e=a("<tr>",{role:"row"}).addClass("ui-jqgrid-labels");g=c.headers;c=0;for(f=g.length;c<f;c++){d=l[c].hidden?"none":"";d=a(g[c].el).width(g[c].width).css("display",d);try{d.removeAttr("rowSpan")}catch(p){d.attr("rowSpan",1)}e.append(d);h=d.children("span.ui-jqgrid-resize");0<h.length&&(h[0].style.height="");d.children("div")[0].style.top=
  257. ""}a(k).children("tr.ui-jqgrid-labels").remove();a(k).prepend(e);!0===b&&a(this).jqGrid("setGridParam",{groupHeader:null})}})},setGroupHeaders:function(b){b=a.extend({useColSpanStyle:!1,groupHeaders:[]},b||{});return this.each(function(){this.p.groupHeader=b;var e,c,f=0,g,d,h,k,l,p=this.p.colModel,m=p.length,r=this.grid.headers,q=a("table.ui-jqgrid-htable",this.grid.hDiv),n=q.children("thead").children("tr.ui-jqgrid-labels:last").addClass("jqg-second-row-header");g=q.children("thead");var t=q.find(".jqg-first-row-header");
  258. void 0===t[0]?t=a("<tr>",{role:"row","aria-hidden":"true"}).addClass("jqg-first-row-header").css("height","auto"):t.empty();var u,w=function(a,b){var c=b.length,d;for(d=0;d<c;d++)if(b[d].startColumnName===a)return d;return-1};a(this).prepend(g);g=a("<tr>",{role:"row"}).addClass("ui-jqgrid-labels jqg-third-row-header");for(e=0;e<m;e++)if(h=r[e].el,k=a(h),c=p[e],d={height:"0px",width:r[e].width+"px",display:c.hidden?"none":""},a("<th>",{role:"gridcell"}).css(d).addClass("ui-first-th-"+this.p.direction).appendTo(t),
  259. h.style.width="",d=w(c.name,b.groupHeaders),0<=d){d=b.groupHeaders[d];f=d.numberOfColumns;l=d.titleText;for(d=c=0;d<f&&e+d<m;d++)p[e+d].hidden||c++;d=a("<th>").attr({role:"columnheader"}).addClass("ui-state-default ui-th-column-header ui-th-"+this.p.direction).css({height:"22px","border-top":"0 none"}).html(l);0<c&&d.attr("colspan",String(c));this.p.headertitles&&d.attr("title",d.text());0===c&&d.hide();k.before(d);g.append(h);--f}else 0===f?b.useColSpanStyle?k.attr("rowspan","2"):(a("<th>",{role:"columnheader"}).addClass("ui-state-default ui-th-column-header ui-th-"+
  260. this.p.direction).css({display:c.hidden?"none":"","border-top":"0 none"}).insertBefore(k),g.append(h)):(g.append(h),f--);p=a(this).children("thead");p.prepend(t);g.insertAfter(n);q.append(p);b.useColSpanStyle&&(q.find("span.ui-jqgrid-resize").each(function(){var b=a(this).parent();b.is(":visible")&&(this.style.cssText="height: "+b.height()+"px !important; cursor: col-resize;")}),q.find("div.ui-jqgrid-sortable").each(function(){var b=a(this),c=b.parent();c.is(":visible")&&c.is(":has(span.ui-jqgrid-resize)")&&
  261. b.css("top",(c.height()-b.outerHeight())/2+"px")}));u=p.find("tr.jqg-first-row-header");a(this).bind("jqGridResizeStop.setGroupHeaders",function(a,b,c){u.find("th").eq(c).width(b)})})},setFrozenColumns:function(){return this.each(function(){if(this.grid){var b=this,e=b.p.colModel,c=0,f=e.length,g=-1,d=!1;if(!0!==b.p.subGrid&&!0!==b.p.treeGrid&&!0!==b.p.cellEdit&&!b.p.sortable&&!b.p.scroll){b.p.rownumbers&&c++;for(b.p.multiselect&&c++;c<f;){if(!0===e[c].frozen)d=!0,g=c;else break;c++}if(0<=g&&d){e=
  262. b.p.caption?a(b.grid.cDiv).outerHeight():0;c=a(".ui-jqgrid-htable","#gview_"+a.jgrid.jqID(b.p.id)).height();b.p.toppager&&(e+=a(b.grid.topDiv).outerHeight());!0===b.p.toolbar[0]&&"bottom"!==b.p.toolbar[1]&&(e+=a(b.grid.uDiv).outerHeight());b.grid.fhDiv=a('<div style="position:absolute;left:0px;top:'+e+"px;height:"+c+'px;" class="frozen-div ui-state-default ui-jqgrid-hdiv"></div>');b.grid.fbDiv=a('<div style="position:absolute;left:0px;top:'+(parseInt(e,10)+parseInt(c,10)+1)+'px;overflow-y:hidden" class="frozen-bdiv ui-jqgrid-bdiv"></div>');
  263. a("#gview_"+a.jgrid.jqID(b.p.id)).append(b.grid.fhDiv);f=a(".ui-jqgrid-htable","#gview_"+a.jgrid.jqID(b.p.id)).clone(!0);if(b.p.groupHeader){a("tr.jqg-first-row-header, tr.jqg-third-row-header",f).each(function(){a("th:gt("+g+")",this).remove()});var h=-1,k=-1,l,p;a("tr.jqg-second-row-header th",f).each(function(){l=parseInt(a(this).attr("colspan"),10);if(p=parseInt(a(this).attr("rowspan"),10))h++,k++;l&&(h+=l,k++);if(h===g)return!1});h!==g&&(k=g);a("tr.jqg-second-row-header",f).each(function(){a("th:gt("+
  264. k+")",this).remove()})}else a("tr",f).each(function(){a("th:gt("+g+")",this).remove()});a(f).width(1);a(b.grid.fhDiv).append(f).mousemove(function(a){if(b.grid.resizing)return b.grid.dragMove(a),!1});b.p.footerrow&&(f=a(".ui-jqgrid-bdiv","#gview_"+a.jgrid.jqID(b.p.id)).height(),b.grid.fsDiv=a('<div style="position:absolute;left:0px;top:'+(parseInt(e,10)+parseInt(c,10)+parseInt(f,10)+1)+'px;" class="frozen-sdiv ui-jqgrid-sdiv"></div>'),a("#gview_"+a.jgrid.jqID(b.p.id)).append(b.grid.fsDiv),e=a(".ui-jqgrid-ftable",
  265. "#gview_"+a.jgrid.jqID(b.p.id)).clone(!0),a("tr",e).each(function(){a("td:gt("+g+")",this).remove()}),a(e).width(1),a(b.grid.fsDiv).append(e));a(b).bind("jqGridResizeStop.setFrozenColumns",function(c,d,e){c=a(".ui-jqgrid-htable",b.grid.fhDiv);a("th:eq("+e+")",c).width(d);c=a(".ui-jqgrid-btable",b.grid.fbDiv);a("tr:first td:eq("+e+")",c).width(d);b.p.footerrow&&(c=a(".ui-jqgrid-ftable",b.grid.fsDiv),a("tr:first td:eq("+e+")",c).width(d))});a(b).bind("jqGridSortCol.setFrozenColumns",function(c,d,e){c=
  266. a("tr.ui-jqgrid-labels:last th:eq("+b.p.lastsort+")",b.grid.fhDiv);d=a("tr.ui-jqgrid-labels:last th:eq("+e+")",b.grid.fhDiv);a("span.ui-grid-ico-sort",c).addClass("ui-state-disabled");a(c).attr("aria-selected","false");a("span.ui-icon-"+b.p.sortorder,d).removeClass("ui-state-disabled");a(d).attr("aria-selected","true");b.p.viewsortcols[0]||b.p.lastsort===e||(a("span.s-ico",c).hide(),a("span.s-ico",d).show())});a("#gview_"+a.jgrid.jqID(b.p.id)).append(b.grid.fbDiv);a(b.grid.bDiv).scroll(function(){a(b.grid.fbDiv).scrollTop(a(this).scrollTop())});
  267. !0===b.p.hoverrows&&a("#"+a.jgrid.jqID(b.p.id)).unbind("mouseover").unbind("mouseout");a(b).bind("jqGridAfterGridComplete.setFrozenColumns",function(){a("#"+a.jgrid.jqID(b.p.id)+"_frozen").remove();a(b.grid.fbDiv).height(a(b.grid.bDiv).height()-16);var c=a("#"+a.jgrid.jqID(b.p.id)).clone(!0);a("tr[role=row]",c).each(function(){a("td[role=gridcell]:gt("+g+")",this).remove()});a(c).width(1).attr("id",b.p.id+"_frozen");a(b.grid.fbDiv).append(c);!0===b.p.hoverrows&&(a("tr.jqgrow",c).hover(function(){a(this).addClass("ui-state-hover");
  268. a("#"+a.jgrid.jqID(this.id),"#"+a.jgrid.jqID(b.p.id)).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover");a("#"+a.jgrid.jqID(this.id),"#"+a.jgrid.jqID(b.p.id)).removeClass("ui-state-hover")}),a("tr.jqgrow","#"+a.jgrid.jqID(b.p.id)).hover(function(){a(this).addClass("ui-state-hover");a("#"+a.jgrid.jqID(this.id),"#"+a.jgrid.jqID(b.p.id)+"_frozen").addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover");a("#"+a.jgrid.jqID(this.id),"#"+a.jgrid.jqID(b.p.id)+
  269. "_frozen").removeClass("ui-state-hover")}));c=null});b.grid.hDiv.loading||a(b).triggerHandler("jqGridAfterGridComplete");b.p.frozenColumns=!0}}}})},destroyFrozenColumns:function(){return this.each(function(){if(this.grid&&!0===this.p.frozenColumns){a(this.grid.fhDiv).remove();a(this.grid.fbDiv).remove();this.grid.fhDiv=null;this.grid.fbDiv=null;this.p.footerrow&&(a(this.grid.fsDiv).remove(),this.grid.fsDiv=null);a(this).unbind(".setFrozenColumns");if(!0===this.p.hoverrows){var b;a("#"+a.jgrid.jqID(this.p.id)).bind("mouseover",
  270. function(e){b=a(e.target).closest("tr.jqgrow");"ui-subgrid"!==a(b).attr("class")&&a(b).addClass("ui-state-hover")}).bind("mouseout",function(e){b=a(e.target).closest("tr.jqgrow");a(b).removeClass("ui-state-hover")})}this.p.frozenColumns=!1}})}})})(jQuery);
  271. (function(a){a.fn.jqFilter=function(b){if("string"===typeof b){var e=a.fn.jqFilter[b];if(!e)throw"jqFilter - No such method: "+b;var c=a.makeArray(arguments).slice(1);return e.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:[],operands:null,numopts:"eq ne lt le gt ge nu nn in ni".split(" "),stropts:"eq ne bw bn ew en cn nc nu nn in ni".split(" "),strarr:["text","string","blob"],groupOps:[{op:"AND",
  272. text:"AND"},{op:"OR",text:"OR"}],groupButton:!0,ruleButtons:!0,direction:"ltr"},a.jgrid.filter,b||{});return this.each(function(){if(!this.filter){this.p=f;if(null===this.p.filter||void 0===this.p.filter)this.p.filter={groupOp:this.p.groupOps[0].op,rules:[],groups:[]};var b,c=this.p.columns.length,e,k=/msie/i.test(navigator.userAgent)&&!window.opera;this.p.initFilter=a.extend(!0,{},this.p.filter);if(c){for(b=0;b<c;b++)e=this.p.columns[b],e.stype?e.inputtype=e.stype:e.inputtype||(e.inputtype="text"),
  273. e.sorttype?e.searchtype=e.sorttype:e.searchtype||(e.searchtype="string"),void 0===e.hidden&&(e.hidden=!1),e.label||(e.label=e.name),e.index&&(e.name=e.index),e.hasOwnProperty("searchoptions")||(e.searchoptions={}),e.hasOwnProperty("searchrules")||(e.searchrules={});this.p.showQuery&&a(this).append("<table class='queryresult ui-widget ui-widget-content' style='display:block;max-width:440px;border:0px none;' dir='"+this.p.direction+"'><tbody><tr><td class='query'></td></tr></tbody></table>");var l=
  274. function(b,c){var d=[!0,""],e=a("#"+a.jgrid.jqID(f.id))[0]||null;if(a.isFunction(c.searchrules))d=c.searchrules.call(e,b,c);else if(a.jgrid&&a.jgrid.checkValues)try{d=a.jgrid.checkValues.call(e,b,-1,c.searchrules,c.label)}catch(h){}d&&d.length&&!1===d[0]&&(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,
  275. 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>"),g="left";"rtl"===this.p.direction&&(g="right",h.attr("dir","rtl"));null===c&&h.append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='"+g+"'></th></tr>");var k=a("<tr></tr>");h.append(k);g=a("<th colspan='5' align='"+
  276. g+"'></th>");k.append(g);if(!0===this.p.ruleButtons){var l=a("<select class='opsel'></select>");g.append(l);var k="",s;for(e=0;e<f.groupOps.length;e++)s=b.groupOp===d.p.groupOps[e].op?" selected='selected'":"",k+="<option value='"+d.p.groupOps[e].op+"'"+s+">"+d.p.groupOps[e].text+"</option>";l.append(k).bind("change",function(){b.groupOp=a(l).val();d.onchange()})}k="<span></span>";this.p.groupButton&&(k=a("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>"),k.bind("click",
  277. function(){void 0===b.groups&&(b.groups=[]);b.groups.push({groupOp:f.groupOps[0].op,rules:[],groups:[]});d.reDraw();d.onchange();return!1}));g.append(k);if(!0===this.p.ruleButtons){var k=a("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>"),x;k.bind("click",function(){void 0===b.rules&&(b.rules=[]);for(e=0;e<d.p.columns.length;e++){var c=void 0===d.p.columns[e].search?!0:d.p.columns[e].search,f=!0===d.p.columns[e].hidden;if(!0===d.p.columns[e].searchoptions.searchhidden&&
  278. c||c&&!f){x=d.p.columns[e];break}}c=x.searchoptions.sopt?x.searchoptions.sopt:d.p.sopt?d.p.sopt:-1!==a.inArray(x.searchtype,d.p.strarr)?d.p.stropts:d.p.numopts;b.rules.push({field:x.name,op:c[0],data:""});d.reDraw();return!1});g.append(k)}null!==c&&(k=a("<input type='button' value='-' title='Delete group' class='delete-group'/>"),g.append(k),k.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(void 0!==b.groups)for(e=
  279. 0;e<b.groups.length;e++)g=a("<tr></tr>"),h.append(g),k=a("<td class='first'></td>"),g.append(k),k=a("<td colspan='4'></td>"),k.append(this.createTableForGroup(b.groups[e],b)),g.append(k);void 0===b.groupOp&&(b.groupOp=d.p.groupOps[0].op);if(void 0!==b.rules)for(e=0;e<b.rules.length;e++)h.append(this.createTableRowForRule(b.rules[e],b));return h};this.createTableRowForRule=function(b,c){var d=this,e=a("#"+a.jgrid.jqID(f.id))[0]||null,h=a("<tr></tr>"),g,l,w,s,x="",A;h.append("<td class='first'></td>");
  280. var v=a("<td class='columns'></td>");h.append(v);var H=a("<select></select>"),B,D=[];v.append(H);H.bind("change",function(){b.field=a(H).val();w=a(this).parents("tr:first");for(g=0;g<d.p.columns.length;g++)if(d.p.columns[g].name===b.field){s=d.p.columns[g];break}if(s){s.searchoptions.id=a.jgrid.randId();k&&"text"===s.inputtype&&!s.searchoptions.size&&(s.searchoptions.size=10);var c=a.jgrid.createEl.call(e,s.inputtype,s.searchoptions,"",!0,d.p.ajaxSelectOptions||{},!0);a(c).addClass("input-elm");l=
  281. s.searchoptions.sopt?s.searchoptions.sopt:d.p.sopt?d.p.sopt:-1!==a.inArray(s.searchtype,d.p.strarr)?d.p.stropts:d.p.numopts;var f="",h=0;D=[];a.each(d.p.ops,function(){D.push(this.oper)});for(g=0;g<l.length;g++)B=a.inArray(l[g],D),-1!==B&&(0===h&&(b.op=d.p.ops[B].oper),f+="<option value='"+d.p.ops[B].oper+"'>"+d.p.ops[B].text+"</option>",h++);a(".selectopts",w).empty().append(f);a(".selectopts",w)[0].selectedIndex=0;a.jgrid.msie&&9>a.jgrid.msiever()&&(f=parseInt(a("select.selectopts",w)[0].offsetWidth,
  282. 10)+1,a(".selectopts",w).width(f),a(".selectopts",w).css("width","auto"));a(".data",w).empty().append(c);a.jgrid.bindEv.call(e,c,s.searchoptions);a(".input-elm",w).bind("change",function(c){c=c.target;b.data="SPAN"===c.nodeName.toUpperCase()&&s.searchoptions&&a.isFunction(s.searchoptions.custom_value)?s.searchoptions.custom_value.call(e,a(c).children(".customelement:first"),"get"):c.value;d.onchange()});setTimeout(function(){b.data=a(c).val();d.onchange()},0)}});for(g=v=0;g<d.p.columns.length;g++){A=
  283. void 0===d.p.columns[g].search?!0:d.p.columns[g].search;var C=!0===d.p.columns[g].hidden;if(!0===d.p.columns[g].searchoptions.searchhidden&&A||A&&!C)A="",b.field===d.p.columns[g].name&&(A=" selected='selected'",v=g),x+="<option value='"+d.p.columns[g].name+"'"+A+">"+d.p.columns[g].label+"</option>"}H.append(x);x=a("<td class='operators'></td>");h.append(x);s=f.columns[v];s.searchoptions.id=a.jgrid.randId();k&&"text"===s.inputtype&&!s.searchoptions.size&&(s.searchoptions.size=10);v=a.jgrid.createEl.call(e,
  284. s.inputtype,s.searchoptions,b.data,!0,d.p.ajaxSelectOptions||{},!0);if("nu"===b.op||"nn"===b.op)a(v).attr("readonly","true"),a(v).attr("disabled","true");var F=a("<select class='selectopts'></select>");x.append(F);F.bind("change",function(){b.op=a(F).val();w=a(this).parents("tr:first");var c=a(".input-elm",w)[0];"nu"===b.op||"nn"===b.op?(b.data="","SELECT"!==c.tagName.toUpperCase()&&(c.value=""),c.setAttribute("readonly","true"),c.setAttribute("disabled","true")):("SELECT"===c.tagName.toUpperCase()&&
  285. (b.data=c.value),c.removeAttribute("readonly"),c.removeAttribute("disabled"));d.onchange()});l=s.searchoptions.sopt?s.searchoptions.sopt:d.p.sopt?d.p.sopt:-1!==a.inArray(s.searchtype,d.p.strarr)?d.p.stropts:d.p.numopts;x="";a.each(d.p.ops,function(){D.push(this.oper)});for(g=0;g<l.length;g++)B=a.inArray(l[g],D),-1!==B&&(A=b.op===d.p.ops[B].oper?" selected='selected'":"",x+="<option value='"+d.p.ops[B].oper+"'"+A+">"+d.p.ops[B].text+"</option>");F.append(x);x=a("<td class='data'></td>");h.append(x);
  286. x.append(v);a.jgrid.bindEv.call(e,v,s.searchoptions);a(v).addClass("input-elm").bind("change",function(){b.data="custom"===s.inputtype?s.searchoptions.custom_value.call(e,a(this).children(".customelement:first"),"get"):a(this).val();d.onchange()});x=a("<td></td>");h.append(x);!0===this.p.ruleButtons&&(v=a("<input type='button' value='-' title='Delete rule' class='delete-rule ui-del'/>"),x.append(v),v.bind("click",function(){for(g=0;g<c.rules.length;g++)if(c.rules[g]===b){c.rules.splice(g,1);break}d.reDraw();
  287. d.onchange();return!1}));return h};this.getStringForGroup=function(a){var b="(",c;if(void 0!==a.groups)for(c=0;c<a.groups.length;c++){1<b.length&&(b+=" "+a.groupOp+" ");try{b+=this.getStringForGroup(a.groups[c])}catch(d){alert(d)}}if(void 0!==a.rules)try{for(c=0;c<a.rules.length;c++)1<b.length&&(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].oper===
  288. b.op){c=this.p.operands.hasOwnProperty(b.op)?this.p.operands[b.op]:"";d=this.p.ops[e].oper;break}for(e=0;e<this.p.columns.length;e++)if(this.p.columns[e].name===b.field){g=this.p.columns[e];break}if(void 0==g)return"";e=b.data;if("bw"===d||"bn"===d)e+="%";if("ew"===d||"en"===d)e="%"+e;if("cn"===d||"nc"===d)e="%"+e+"%";if("in"===d||"ni"===d)e=" ("+e+")";f.errorcheck&&l(b.data,g);return-1!==a.inArray(g.searchtype,["int","integer","float","number","currency"])||"nn"===d||"nu"===d?b.field+" "+c+" "+e:
  289. 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);a("tr.error",this).show()};this.toUserFriendlyString=function(){return this.getStringForGroup(f.filter)};this.toString=function(){function a(c){var d="(",e;if(void 0!==c.groups)for(e=0;e<c.groups.length;e++)1<
  290. d.length&&(d="OR"===c.groupOp?d+" || ":d+" && "),d+=a(c.groups[e]);if(void 0!==c.rules)for(e=0;e<c.rules.length;e++){1<d.length&&(d="OR"===c.groupOp?d+" || ":d+" && ");var f=c.rules[e];if(b.p.errorcheck){for(var g=void 0,h=void 0,g=0;g<b.p.columns.length;g++)if(b.p.columns[g].name===f.field){h=b.p.columns[g];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}}})};
  291. 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){return void 0!==a&&this.p.hasOwnProperty(a)?this.p[a]:this.p},resetFilter:function(){return this.each(function(){this.resetFilter()})},addFilter:function(b){"string"===typeof b&&(b=a.jgrid.parse(b));this.each(function(){this.p.filter=b;this.reDraw();this.onchange()})}})})(jQuery);
  292. (function(a){var b={};a.jgrid.extend({searchGrid:function(b){b=a.extend(!0,{recreateFilter:!1,drag:!0,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",loadDefaults:!0,beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,afterRedraw:null,afterChange:null,closeAfterSearch:!1,closeAfterReset:!1,closeOnEscape:!1,searchOnEnter:!1,multipleSearch:!1,multipleGroup:!1,top:0,left:0,jqModal:!0,modal:!1,resize:!0,width:450,height:"auto",dataheight:"auto",showQuery:!1,
  293. errorcheck:!0,sopt:null,stringResult:void 0,onClose:null,onSearch:null,onReset:null,toTop:!0,overlay:30,columns:[],tmplNames:null,tmplFilters:null,tmplLabel:" Template: ",showOnLoad:!1,layer:null,operands:{eq:"=",ne:"<>",lt:"<",le:"<=",gt:">",ge:">=",bw:"LIKE",bn:"NOT LIKE","in":"IN",ni:"NOT IN",ew:"LIKE",en:"NOT LIKE",cn:"LIKE",nc:"NOT LIKE",nu:"IS NULL",nn:"ISNOT NULL"}},a.jgrid.search,b||{});return this.each(function(){function c(c){d=a(f).triggerHandler("jqGridFilterBeforeShow",[c]);void 0===
  294. d&&(d=!0);d&&a.isFunction(b.beforeShowSearch)&&(d=b.beforeShowSearch.call(f,c));d&&(a.jgrid.viewModal("#"+a.jgrid.jqID(k.themodal),{gbox:"#gbox_"+a.jgrid.jqID(g),jqm:b.jqModal,modal:b.modal,overlay:b.overlay,toTop:b.toTop}),a(f).triggerHandler("jqGridFilterAfterShow",[c]),a.isFunction(b.afterShowSearch)&&b.afterShowSearch.call(f,c))}var f=this;if(f.grid){var g="fbox_"+f.p.id,d=!0,h=!0,k={themodal:"searchmod"+g,modalhead:"searchhd"+g,modalcontent:"searchcnt"+g,scrollelm:g},l=f.p.postData[b.sFilter],
  295. p;"string"===typeof l&&(l=a.jgrid.parse(l));!0===b.recreateFilter&&a("#"+a.jgrid.jqID(k.themodal)).remove();if(void 0!==a("#"+a.jgrid.jqID(k.themodal))[0])c(a("#fbox_"+a.jgrid.jqID(+f.p.id)));else{var m=a("<div><div id='"+g+"' class='searchFilter' style='overflow:auto'></div></div>").insertBefore("#gview_"+a.jgrid.jqID(f.p.id)),r="left",q="";"rtl"===f.p.direction&&(r="right",q=" style='text-align:left'",m.attr("dir","rtl"));var n=a.extend([],f.p.colModel),t="<a 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>"+
  296. b.Find+"</a>",u="<a 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>",w="",s="",x,A=!1,v=-1;b.showQuery&&(w="<a 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>");b.columns.length?(n=b.columns,v=0,x=n[0].index||n[0].name):a.each(n,function(a,b){b.label||(b.label=f.p.colNames[a]);if(!A){var c=
  297. void 0===b.search?!0:b.search,d=!0===b.hidden;if(b.searchoptions&&!0===b.searchoptions.searchhidden&&c||c&&!d)A=!0,x=b.index||b.name,v=a}});if(!l&&x||!1===b.multipleSearch){var H="eq";0<=v&&n[v].searchoptions&&n[v].searchoptions.sopt?H=n[v].searchoptions.sopt[0]:b.sopt&&b.sopt.length&&(H=b.sopt[0]);l={groupOp:"AND",rules:[{field:x,op:H,data:""}]}}A=!1;b.tmplNames&&b.tmplNames.length&&(A=!0,s=b.tmplLabel,s+="<select class='ui-template'>",s+="<option value='default'>Default</option>",a.each(b.tmplNames,
  298. function(a,b){s+="<option value='"+a+"'>"+b+"</option>"}),s+="</select>");r="<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:"+r+"'>"+u+s+"</td><td class='EditButton' "+q+">"+w+t+"</td></tr></tbody></table>";g=a.jgrid.jqID(g);a("#"+g).jqFilter({columns:n,filter:b.loadDefaults?l:null,showQuery:b.showQuery,errorcheck:b.errorcheck,sopt:b.sopt,
  299. groupButton:b.multipleGroup,ruleButtons:b.multipleSearch,afterRedraw:b.afterRedraw,ops:b.odata,operands:b.operands,ajaxSelectOptions:f.p.ajaxSelectOptions,groupOps:b.groupOps,onChange:function(){this.p.showQuery&&a(".query",this).html(this.toUserFriendlyString());a.isFunction(b.afterChange)&&b.afterChange.call(f,a("#"+g),b)},direction:f.p.direction,id:f.p.id});m.append(r);A&&b.tmplFilters&&b.tmplFilters.length&&a(".ui-template",m).bind("change",function(){var c=a(this).val();"default"===c?a("#"+g).jqFilter("addFilter",
  300. l):a("#"+g).jqFilter("addFilter",b.tmplFilters[parseInt(c,10)]);return!1});!0===b.multipleGroup&&(b.multipleSearch=!0);a(f).triggerHandler("jqGridFilterInitialize",[a("#"+g)]);a.isFunction(b.onInitializeSearch)&&b.onInitializeSearch.call(f,a("#"+g));b.gbox="#gbox_"+g;b.layer?a.jgrid.createModal(k,m,b,"#gview_"+a.jgrid.jqID(f.p.id),a("#gbox_"+a.jgrid.jqID(f.p.id))[0],"#"+a.jgrid.jqID(b.layer),{position:"relative"}):a.jgrid.createModal(k,m,b,"#gview_"+a.jgrid.jqID(f.p.id),a("#gbox_"+a.jgrid.jqID(f.p.id))[0]);
  301. (b.searchOnEnter||b.closeOnEscape)&&a("#"+a.jgrid.jqID(k.themodal)).keydown(function(c){var d=a(c.target);if(!(!b.searchOnEnter||13!==c.which||d.hasClass("add-group")||d.hasClass("add-rule")||d.hasClass("delete-group")||d.hasClass("delete-rule")||d.hasClass("fm-button")&&d.is("[id$=_query]")))return a("#"+g+"_search").click(),!1;if(b.closeOnEscape&&27===c.which)return a("#"+a.jgrid.jqID(k.modalhead)).find(".ui-jqdialog-titlebar-close").click(),!1});w&&a("#"+g+"_query").bind("click",function(){a(".queryresult",
  302. m).toggle();return!1});void 0===b.stringResult&&(b.stringResult=b.multipleSearch);a("#"+g+"_search").bind("click",function(){var c={},d,l;p=a("#"+g);p.find(".input-elm:focus").change();l=p.jqFilter("filterData");if(b.errorcheck&&(p[0].hideError(),b.showQuery||p.jqFilter("toSQLString"),p[0].p.error))return p[0].showError(),!1;if(b.stringResult){try{d=xmlJsonClass.toJson(l,"","",!1)}catch(n){try{d=JSON.stringify(l)}catch(m){}}"string"===typeof d&&(c[b.sFilter]=d,a.each([b.sField,b.sValue,b.sOper],function(){c[this]=
  303. ""}))}else b.multipleSearch?(c[b.sFilter]=l,a.each([b.sField,b.sValue,b.sOper],function(){c[this]=""})):(c[b.sField]=l.rules[0].field,c[b.sValue]=l.rules[0].data,c[b.sOper]=l.rules[0].op,c[b.sFilter]="");f.p.search=!0;a.extend(f.p.postData,c);h=a(f).triggerHandler("jqGridFilterSearch");void 0===h&&(h=!0);h&&a.isFunction(b.onSearch)&&(h=b.onSearch.call(f,f.p.filters));!1!==h&&a(f).trigger("reloadGrid",[{page:1}]);b.closeAfterSearch&&a.jgrid.hideModal("#"+a.jgrid.jqID(k.themodal),{gb:"#gbox_"+a.jgrid.jqID(f.p.id),
  304. jqm:b.jqModal,onClose:b.onClose});return!1});a("#"+g+"_reset").bind("click",function(){var c={},d=a("#"+g);f.p.search=!1;f.p.resetsearch=!0;!1===b.multipleSearch?c[b.sField]=c[b.sValue]=c[b.sOper]="":c[b.sFilter]="";d[0].resetFilter();A&&a(".ui-template",m).val("default");a.extend(f.p.postData,c);h=a(f).triggerHandler("jqGridFilterReset");void 0===h&&(h=!0);h&&a.isFunction(b.onReset)&&(h=b.onReset.call(f));!1!==h&&a(f).trigger("reloadGrid",[{page:1}]);b.closeAfterReset&&a.jgrid.hideModal("#"+a.jgrid.jqID(k.themodal),
  305. {gb:"#gbox_"+a.jgrid.jqID(f.p.id),jqm:b.jqModal,onClose:b.onClose});return!1});c(a("#"+g));a(".fm-button:not(.ui-state-disabled)",m).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},editGridRow:function(e,c){c=a.extend(!0,{top:0,left:0,width:300,datawidth:"auto",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,
  306. 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,overlayClass:"ui-widget-overlay",removemodal:!0,
  307. form:"edit"},a.jgrid.edit,c||{});b[a(this)[0].p.id]=c;return this.each(function(){function f(){a(s+" > tbody > tr > td .FormElement").each(function(){var b=a(".customelement",this);if(b.length){var c=a(b[0]).attr("name");a.each(n.p.colModel,function(){if(this.name===c&&this.editoptions&&a.isFunction(this.editoptions.custom_value)){try{if(y[c]=this.editoptions.custom_value.call(n,a("#"+a.jgrid.jqID(c),s),"get"),void 0===y[c])throw"e1";}catch(b){"e1"===b?a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_value' "+
  308. a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):a.jgrid.info_dialog(a.jgrid.errors.errcap,b.message,a.jgrid.edit.bClose)}return!0}})}else{switch(a(this).get(0).type){case "checkbox":a(this).is(":checked")?y[this.name]=a(this).val():(b=a(this).attr("offval"),y[this.name]=b);break;case "select-one":y[this.name]=a("option:selected",this).val();break;case "select-multiple":y[this.name]=a(this).val();y[this.name]=y[this.name]?y[this.name].join(","):"";a("option:selected",this).each(function(b,c){a(c).text()});
  309. break;case "password":case "text":case "textarea":case "button":y[this.name]=a(this).val()}n.p.autoencode&&(y[this.name]=a.jgrid.htmlEncode(y[this.name]))}});return!0}function g(c,d,e,f){var g,h,k,l=0,m,p,q,r=[],s=!1,t="",v;for(v=1;v<=f;v++)t+="<td class='CaptionTD'>&#160;</td><td class='DataTD'>&#160;</td>";"_empty"!==c&&(s=a(d).jqGrid("getInd",c));a(d.p.colModel).each(function(v){g=this.name;p=(h=this.editrules&&!0===this.editrules.edithidden?!1:!0===this.hidden?!0:!1)?"style='display:none'":"";
  310. if("cb"!==g&&"subgrid"!==g&&!0===this.editable&&"rn"!==g){if(!1===s)m="";else if(g===d.p.ExpandColumn&&!0===d.p.treeGrid)m=a("td[role='gridcell']:eq("+v+")",d.rows[s]).text();else{try{m=a.unformat.call(d,a("td[role='gridcell']:eq("+v+")",d.rows[s]),{rowId:c,colModel:this},v)}catch(x){m=this.edittype&&"textarea"===this.edittype?a("td[role='gridcell']:eq("+v+")",d.rows[s]).text():a("td[role='gridcell']:eq("+v+")",d.rows[s]).html()}if(!m||"&nbsp;"===m||"&#160;"===m||1===m.length&&160===m.charCodeAt(0))m=
  311. ""}var D=a.extend({},this.editoptions||{},{id:g,name:g,rowId:c}),w=a.extend({},{elmprefix:"",elmsuffix:"",rowabove:!1,rowcontent:""},this.formoptions||{}),A=parseInt(w.rowpos,10)||l+1,C=parseInt(2*(parseInt(w.colpos,10)||1),10);"_empty"===c&&D.defaultValue&&(m=a.isFunction(D.defaultValue)?D.defaultValue.call(n):D.defaultValue);this.edittype||(this.edittype="text");n.p.autoencode&&(m=a.jgrid.htmlDecode(m));q=a.jgrid.createEl.call(n,this.edittype,D,m,!1,a.extend({},a.jgrid.ajaxOptions,d.p.ajaxSelectOptions||
  312. {}));if(b[n.p.id].checkOnSubmit||b[n.p.id].checkOnUpdate)b[n.p.id]._savedData[g]=m;a(q).addClass("FormElement");-1<a.inArray(this.edittype,["text","textarea","password","select"])&&a(q).addClass("ui-widget-content ui-corner-all");k=a(e).find("tr[rowpos="+A+"]");if(w.rowabove){var y=a("<tr><td class='contentinfo' colspan='"+2*f+"'>"+w.rowcontent+"</td></tr>");a(e).append(y);y[0].rp=A}0===k.length&&(k=a("<tr "+p+" rowpos='"+A+"'></tr>").addClass("FormData").attr("id","tr_"+g),a(k).append(t),a(e).append(k),
  313. k[0].rp=A);a("td:eq("+(C-2)+")",k[0]).html(void 0===w.label?d.p.colNames[v]:w.label);a("td:eq("+(C-1)+")",k[0]).append(w.elmprefix).append(q).append(w.elmsuffix);"custom"===this.edittype&&a.isFunction(D.custom_value)&&D.custom_value.call(n,a("#"+g,"#"+u),"set",m);a.jgrid.bindEv.call(n,q,D);r[l]=v;l++}});0<l&&(v=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(2*f-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+d.p.id+"_id' value='"+
  314. c+"'/></td></tr>"),v[0].rp=l+999,a(e).append(v),b[n.p.id].checkOnSubmit||b[n.p.id].checkOnUpdate)&&(b[n.p.id]._savedData[d.p.id+"_id"]=c);return r}function d(c,d,e){var f,g=0,h,k,l,m,p;if(b[n.p.id].checkOnSubmit||b[n.p.id].checkOnUpdate)b[n.p.id]._savedData={},b[n.p.id]._savedData[d.p.id+"_id"]=c;var q=d.p.colModel;if("_empty"===c)a(q).each(function(){f=this.name;l=a.extend({},this.editoptions||{});(k=a("#"+a.jgrid.jqID(f),"#"+e))&&k.length&&null!==k[0]&&(m="","custom"===this.edittype&&a.isFunction(l.custom_value)?
  315. l.custom_value.call(n,a("#"+f,"#"+e),"set",m):l.defaultValue?(m=a.isFunction(l.defaultValue)?l.defaultValue.call(n):l.defaultValue,"checkbox"===k[0].type?(p=m.toLowerCase(),0>p.search(/(false|f|0|no|n|off|undefined)/i)&&""!==p?(k[0].checked=!0,k[0].defaultChecked=!0,k[0].value=m):(k[0].checked=!1,k[0].defaultChecked=!1)):k.val(m)):"checkbox"===k[0].type?(k[0].checked=!1,k[0].defaultChecked=!1,m=a(k).attr("offval")):k[0].type&&"select"===k[0].type.substr(0,6)?k[0].selectedIndex=0:k.val(m),!0===b[n.p.id].checkOnSubmit||
  316. b[n.p.id].checkOnUpdate)&&(b[n.p.id]._savedData[f]=m)}),a("#id_g","#"+e).val(c);else{var r=a(d).jqGrid("getInd",c,!0);r&&(a('td[role="gridcell"]',r).each(function(k){f=q[k].name;if("cb"!==f&&"subgrid"!==f&&"rn"!==f&&!0===q[k].editable){if(f===d.p.ExpandColumn&&!0===d.p.treeGrid)h=a(this).text();else try{h=a.unformat.call(d,a(this),{rowId:c,colModel:q[k]},k)}catch(l){h="textarea"===q[k].edittype?a(this).text():a(this).html()}n.p.autoencode&&(h=a.jgrid.htmlDecode(h));if(!0===b[n.p.id].checkOnSubmit||
  317. b[n.p.id].checkOnUpdate)b[n.p.id]._savedData[f]=h;f=a.jgrid.jqID(f);switch(q[k].edittype){case "password":case "text":case "button":case "image":case "textarea":if("&nbsp;"===h||"&#160;"===h||1===h.length&&160===h.charCodeAt(0))h="";a("#"+f,"#"+e).val(h);break;case "select":var m=h.split(","),m=a.map(m,function(b){return a.trim(b)});a("#"+f+" option","#"+e).each(function(){q[k].editoptions.multiple||a.trim(h)!==a.trim(a(this).text())&&m[0]!==a.trim(a(this).text())&&m[0]!==a.trim(a(this).val())?q[k].editoptions.multiple?
  318. -1<a.inArray(a.trim(a(this).text()),m)||-1<a.inArray(a.trim(a(this).val()),m)?this.selected=!0:this.selected=!1:this.selected=!1:this.selected=!0});break;case "checkbox":h=String(h);if(q[k].editoptions&&q[k].editoptions.value)if(q[k].editoptions.value.split(":")[0]===h)a("#"+f,"#"+e)[n.p.useProp?"prop":"attr"]({checked:!0,defaultChecked:!0});else a("#"+f,"#"+e)[n.p.useProp?"prop":"attr"]({checked:!1,defaultChecked:!1});else h=h.toLowerCase(),0>h.search(/(false|f|0|no|n|off|undefined)/i)&&""!==h?(a("#"+
  319. f,"#"+e)[n.p.useProp?"prop":"attr"]("checked",!0),a("#"+f,"#"+e)[n.p.useProp?"prop":"attr"]("defaultChecked",!0)):(a("#"+f,"#"+e)[n.p.useProp?"prop":"attr"]("checked",!1),a("#"+f,"#"+e)[n.p.useProp?"prop":"attr"]("defaultChecked",!1));break;case "custom":try{if(q[k].editoptions&&a.isFunction(q[k].editoptions.custom_value))q[k].editoptions.custom_value.call(n,a("#"+f,"#"+e),"set",h);else throw"e1";}catch(p){"e1"===p?a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,
  320. a.jgrid.edit.bClose):a.jgrid.info_dialog(a.jgrid.errors.errcap,p.message,a.jgrid.edit.bClose)}}g++}}),0<g&&a("#id_g",s).val(c))}}function h(){a.each(n.p.colModel,function(a,b){b.editoptions&&!0===b.editoptions.NullIfEmpty&&y.hasOwnProperty(b.name)&&""===y[b.name]&&(y[b.name]="null")})}function k(){var e,f=[!0,"",""],g={},k=n.p.prmNames,l,m,p,q,r,v=a(n).triggerHandler("jqGridAddEditBeforeCheckValues",[a("#"+u),z]);v&&"object"===typeof v&&(y=v);a.isFunction(b[n.p.id].beforeCheckValues)&&(v=b[n.p.id].beforeCheckValues.call(n,
  321. y,a("#"+u),z))&&"object"===typeof v&&(y=v);for(p in y)if(y.hasOwnProperty(p)&&(f=a.jgrid.checkValues.call(n,y[p],p),!1===f[0]))break;h();f[0]&&(g=a(n).triggerHandler("jqGridAddEditClickSubmit",[b[n.p.id],y,z]),void 0===g&&a.isFunction(b[n.p.id].onclickSubmit)&&(g=b[n.p.id].onclickSubmit.call(n,b[n.p.id],y,z)||{}),f=a(n).triggerHandler("jqGridAddEditBeforeSubmit",[y,a("#"+u),z]),void 0===f&&(f=[!0,"",""]),f[0]&&a.isFunction(b[n.p.id].beforeSubmit)&&(f=b[n.p.id].beforeSubmit.call(n,y,a("#"+u),z)));
  322. if(f[0]&&!b[n.p.id].processing){b[n.p.id].processing=!0;a("#sData",s+"_2").addClass("ui-state-active");p=b[n.p.id].url||a(n).jqGrid("getGridParam","editurl");m=k.oper;l="clientArray"===p?n.p.keyName:k.id;y[m]="_empty"===a.trim(y[n.p.id+"_id"])?k.addoper:k.editoper;y[m]!==k.addoper?y[l]=y[n.p.id+"_id"]:void 0===y[l]&&(y[l]=y[n.p.id+"_id"]);delete y[n.p.id+"_id"];y=a.extend(y,b[n.p.id].editData,g);if(!0===n.p.treeGrid)for(r in y[m]===k.addoper&&(q=a(n).jqGrid("getGridParam","selrow"),y["adjacency"===
  323. n.p.treeGridModel?n.p.treeReader.parent_id_field:"parent_id"]=q),n.p.treeReader)n.p.treeReader.hasOwnProperty(r)&&(g=n.p.treeReader[r],!y.hasOwnProperty(g)||y[m]===k.addoper&&"parent_id_field"===r||delete y[g]);y[l]=a.jgrid.stripPref(n.p.idPrefix,y[l]);r=a.extend({url:p,type:b[n.p.id].mtype,data:a.isFunction(b[n.p.id].serializeEditData)?b[n.p.id].serializeEditData.call(n,y):y,complete:function(g,h){var p;a("#sData",s+"_2").removeClass("ui-state-active");y[l]=n.p.idPrefix+y[l];300<=g.status&&304!==
  324. g.status?(f[0]=!1,f[1]=a(n).triggerHandler("jqGridAddEditErrorTextFormat",[g,z]),a.isFunction(b[n.p.id].errorTextFormat)?f[1]=b[n.p.id].errorTextFormat.call(n,g,z):f[1]=h+" Status: '"+g.statusText+"'. Error code: "+g.status):(f=a(n).triggerHandler("jqGridAddEditAfterSubmit",[g,y,z]),void 0===f&&(f=[!0,"",""]),f[0]&&a.isFunction(b[n.p.id].afterSubmit)&&(f=b[n.p.id].afterSubmit.call(n,g,y,z)));if(!1===f[0])a("#FormError>td",s).html(f[1]),a("#FormError",s).show();else if(n.p.autoencode&&a.each(y,function(b,
  325. c){y[b]=a.jgrid.htmlDecode(c)}),y[m]===k.addoper?(f[2]||(f[2]=a.jgrid.randId()),null==y[l]?y[l]=f[2]:f[2]=y[l],b[n.p.id].reloadAfterSubmit?a(n).trigger("reloadGrid"):!0===n.p.treeGrid?a(n).jqGrid("addChildNode",f[2],q,y):a(n).jqGrid("addRowData",f[2],y,c.addedrow),b[n.p.id].closeAfterAdd?(!0!==n.p.treeGrid&&a(n).jqGrid("setSelection",f[2]),a.jgrid.hideModal("#"+a.jgrid.jqID(x.themodal),{gb:"#gbox_"+a.jgrid.jqID(t),jqm:c.jqModal,onClose:b[n.p.id].onClose,removemodal:b[n.p.id].removemodal,formprop:!b[n.p.id].recreateForm,
  326. form:b[n.p.id].form})):b[n.p.id].clearAfterAdd&&d("_empty",n,u)):(b[n.p.id].reloadAfterSubmit?(a(n).trigger("reloadGrid"),b[n.p.id].closeAfterEdit||setTimeout(function(){a(n).jqGrid("setSelection",y[l])},1E3)):!0===n.p.treeGrid?a(n).jqGrid("setTreeRow",y[l],y):a(n).jqGrid("setRowData",y[l],y),b[n.p.id].closeAfterEdit&&a.jgrid.hideModal("#"+a.jgrid.jqID(x.themodal),{gb:"#gbox_"+a.jgrid.jqID(t),jqm:c.jqModal,onClose:b[n.p.id].onClose,removemodal:b[n.p.id].removemodal,formprop:!b[n.p.id].recreateForm,
  327. form:b[n.p.id].form})),a.isFunction(b[n.p.id].afterComplete)&&(e=g,setTimeout(function(){a(n).triggerHandler("jqGridAddEditAfterComplete",[e,y,a("#"+u),z]);b[n.p.id].afterComplete.call(n,e,y,a("#"+u),z);e=null},500)),b[n.p.id].checkOnSubmit||b[n.p.id].checkOnUpdate)if(a("#"+u).data("disabled",!1),"_empty"!==b[n.p.id]._savedData[n.p.id+"_id"])for(p in b[n.p.id]._savedData)b[n.p.id]._savedData.hasOwnProperty(p)&&y[p]&&(b[n.p.id]._savedData[p]=y[p]);b[n.p.id].processing=!1;try{a(":input:visible","#"+
  328. u)[0].focus()}catch(r){}}},a.jgrid.ajaxOptions,b[n.p.id].ajaxEditOptions);r.url||b[n.p.id].useDataProxy||(a.isFunction(n.p.dataProxy)?b[n.p.id].useDataProxy=!0:(f[0]=!1,f[1]+=" "+a.jgrid.errors.nourl));f[0]&&(b[n.p.id].useDataProxy?(g=n.p.dataProxy.call(n,r,"set_"+n.p.id),void 0===g&&(g=[!0,""]),!1===g[0]?(f[0]=!1,f[1]=g[1]||"Error deleting the selected row!"):(r.data.oper===k.addoper&&b[n.p.id].closeAfterAdd&&a.jgrid.hideModal("#"+a.jgrid.jqID(x.themodal),{gb:"#gbox_"+a.jgrid.jqID(t),jqm:c.jqModal,
  329. onClose:b[n.p.id].onClose,removemodal:b[n.p.id].removemodal,formprop:!b[n.p.id].recreateForm,form:b[n.p.id].form}),r.data.oper===k.editoper&&b[n.p.id].closeAfterEdit&&a.jgrid.hideModal("#"+a.jgrid.jqID(x.themodal),{gb:"#gbox_"+a.jgrid.jqID(t),jqm:c.jqModal,onClose:b[n.p.id].onClose,removemodal:b[n.p.id].removemodal,formprop:!b[n.p.id].recreateForm,form:b[n.p.id].form}))):"clientArray"===r.url?(b[n.p.id].reloadAfterSubmit=!1,y=r.data,r.complete({status:200,statusText:""},"")):a.ajax(r))}!1===f[0]&&
  330. (a("#FormError>td",s).html(f[1]),a("#FormError",s).show())}function l(a,b){var c=!1,d;for(d in a)if(a.hasOwnProperty(d)&&a[d]!=b[d]){c=!0;break}return c}function p(){var c=!0;a("#FormError",s).hide();b[n.p.id].checkOnUpdate&&(y={},f(),O=l(y,b[n.p.id]._savedData))&&(a("#"+u).data("disabled",!0),a(".confirm","#"+x.themodal).show(),c=!1);return c}function m(){var b;if("_empty"!==e&&void 0!==n.p.savedRow&&0<n.p.savedRow.length&&a.isFunction(a.fn.jqGrid.restoreRow))for(b=0;b<n.p.savedRow.length;b++)if(n.p.savedRow[b].id==
  331. e){a(n).jqGrid("restoreRow",e);break}}function r(b,c){var d=c[1].length-1;0===b?a("#pData",s+"_2").addClass("ui-state-disabled"):void 0!==c[1][b-1]&&a("#"+a.jgrid.jqID(c[1][b-1])).hasClass("ui-state-disabled")?a("#pData",s+"_2").addClass("ui-state-disabled"):a("#pData",s+"_2").removeClass("ui-state-disabled");b===d?a("#nData",s+"_2").addClass("ui-state-disabled"):void 0!==c[1][b+1]&&a("#"+a.jgrid.jqID(c[1][b+1])).hasClass("ui-state-disabled")?a("#nData",s+"_2").addClass("ui-state-disabled"):a("#nData",
  332. s+"_2").removeClass("ui-state-disabled")}function q(){var b=a(n).jqGrid("getDataIDs"),c=a("#id_g",s).val();return[a.inArray(c,b),b]}var n=this;if(n.grid&&e){var t=n.p.id,u="FrmGrid_"+t,w="TblGrid_"+t,s="#"+a.jgrid.jqID(w),x={themodal:"editmod"+t,modalhead:"edithd"+t,modalcontent:"editcnt"+t,scrollelm:u},A=a.isFunction(b[n.p.id].beforeShowForm)?b[n.p.id].beforeShowForm:!1,v=a.isFunction(b[n.p.id].afterShowForm)?b[n.p.id].afterShowForm:!1,H=a.isFunction(b[n.p.id].beforeInitData)?b[n.p.id].beforeInitData:
  333. !1,B=a.isFunction(b[n.p.id].onInitializeForm)?b[n.p.id].onInitializeForm:!1,D=!0,C=1,F=0,y,O,z,u=a.jgrid.jqID(u);"new"===e?(e="_empty",z="add",c.caption=b[n.p.id].addCaption):(c.caption=b[n.p.id].editCaption,z="edit");c.recreateForm||a(n).data("formProp")&&a.extend(b[a(this)[0].p.id],a(n).data("formProp"));var L=!0;c.checkOnUpdate&&c.jqModal&&!c.modal&&(L=!1);var Q=isNaN(b[a(this)[0].p.id].dataheight)?b[a(this)[0].p.id].dataheight:b[a(this)[0].p.id].dataheight+"px",D=isNaN(b[a(this)[0].p.id].datawidth)?
  334. b[a(this)[0].p.id].datawidth:b[a(this)[0].p.id].datawidth+"px",Q=a("<form name='FormPost' id='"+u+"' class='FormGrid' onSubmit='return false;' style='width:"+D+";overflow:auto;position:relative;height:"+Q+";'></form>").data("disabled",!1),V=a("<table id='"+w+"' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>");a(n.p.colModel).each(function(){var a=this.formoptions;C=Math.max(C,a?a.colpos||0:0);F=Math.max(F,a?a.rowpos||0:0)});a(Q).append(V);D=a("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+
  335. 2*C+"'></td></tr>");D[0].rp=0;a(V).append(D);D=a("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+2*C+"'>"+b[n.p.id].topinfo+"</td></tr>");D[0].rp=0;a(V).append(D);D=a(n).triggerHandler("jqGridAddEditBeforeInitData",[Q,z]);void 0===D&&(D=!0);D&&H&&(D=H.call(n,Q,z));if(!1!==D){m();var D=(H="rtl"===n.p.direction?!0:!1)?"nData":"pData",X=H?"pData":"nData";g(e,n,V,C);var D="<a id='"+D+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>",
  336. X="<a id='"+X+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",E="<a id='sData' class='fm-button ui-state-default ui-corner-all'>"+c.bSubmit+"</a>",aa="<a id='cData' class='fm-button ui-state-default ui-corner-all'>"+c.bCancel+"</a>",w="<table border='0' cellspacing='0' cellpadding='0' class='EditTable' id='"+w+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr id='Act_Buttons'><td class='navButton'>"+
  337. (H?X+D:D+X)+"</td><td class='EditButton'>"+E+aa+"</td></tr>"+("<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+b[n.p.id].bottominfo+"</td></tr>"),w=w+"</tbody></table>";if(0<F){var T=[];a.each(a(V)[0].rows,function(a,b){T[a]=b});T.sort(function(a,b){return a.rp>b.rp?1:a.rp<b.rp?-1:0});a.each(T,function(b,c){a("tbody",V).append(c)})}c.gbox="#gbox_"+a.jgrid.jqID(t);var M=!1;!0===c.closeOnEscape&&(c.closeOnEscape=!1,M=!0);w=a("<div></div>").append(Q).append(w);a.jgrid.createModal(x,
  338. w,b[a(this)[0].p.id],"#gview_"+a.jgrid.jqID(n.p.id),a("#gbox_"+a.jgrid.jqID(n.p.id))[0]);H&&(a("#pData, #nData",s+"_2").css("float","right"),a(".EditButton",s+"_2").css("text-align","left"));b[n.p.id].topinfo&&a(".tinfo",s).show();b[n.p.id].bottominfo&&a(".binfo",s+"_2").show();w=w=null;a("#"+a.jgrid.jqID(x.themodal)).keydown(function(d){var e=d.target;if(!0===a("#"+u).data("disabled"))return!1;if(!0===b[n.p.id].savekey[0]&&d.which===b[n.p.id].savekey[1]&&"TEXTAREA"!==e.tagName)return a("#sData",
  339. s+"_2").trigger("click"),!1;if(27===d.which){if(!p())return!1;M&&a.jgrid.hideModal("#"+a.jgrid.jqID(x.themodal),{gb:c.gbox,jqm:c.jqModal,onClose:b[n.p.id].onClose,removemodal:b[n.p.id].removemodal,formprop:!b[n.p.id].recreateForm,form:b[n.p.id].form});return!1}if(!0===b[n.p.id].navkeys[0]){if("_empty"===a("#id_g",s).val())return!0;if(d.which===b[n.p.id].navkeys[1])return a("#pData",s+"_2").trigger("click"),!1;if(d.which===b[n.p.id].navkeys[2])return a("#nData",s+"_2").trigger("click"),!1}});c.checkOnUpdate&&
  340. (a("a.ui-jqdialog-titlebar-close span","#"+a.jgrid.jqID(x.themodal)).removeClass("jqmClose"),a("a.ui-jqdialog-titlebar-close","#"+a.jgrid.jqID(x.themodal)).unbind("click").click(function(){if(!p())return!1;a.jgrid.hideModal("#"+a.jgrid.jqID(x.themodal),{gb:"#gbox_"+a.jgrid.jqID(t),jqm:c.jqModal,onClose:b[n.p.id].onClose,removemodal:b[n.p.id].removemodal,formprop:!b[n.p.id].recreateForm,form:b[n.p.id].form});return!1}));c.saveicon=a.extend([!0,"left","ui-icon-disk"],c.saveicon);c.closeicon=a.extend([!0,
  341. "left","ui-icon-close"],c.closeicon);!0===c.saveicon[0]&&a("#sData",s+"_2").addClass("right"===c.saveicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.saveicon[2]+"'></span>");!0===c.closeicon[0]&&a("#cData",s+"_2").addClass("right"===c.closeicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.closeicon[2]+"'></span>");if(b[n.p.id].checkOnSubmit||b[n.p.id].checkOnUpdate)E="<a id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+
  342. c.bYes+"</a>",X="<a id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+c.bNo+"</a>",aa="<a id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+c.bExit+"</a>",w=c.zIndex||999,w++,a("<div class='"+c.overlayClass+" jqgrid-overlay confirm' style='z-index:"+w+";display:none;'>&#160;</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+(w+1)+"'>"+c.saveData+"<br/><br/>"+E+X+aa+"</div>").insertAfter("#"+u),a("#sNew","#"+a.jgrid.jqID(x.themodal)).click(function(){k();
  343. a("#"+u).data("disabled",!1);a(".confirm","#"+a.jgrid.jqID(x.themodal)).hide();return!1}),a("#nNew","#"+a.jgrid.jqID(x.themodal)).click(function(){a(".confirm","#"+a.jgrid.jqID(x.themodal)).hide();a("#"+u).data("disabled",!1);setTimeout(function(){a(":input:visible","#"+u)[0].focus()},0);return!1}),a("#cNew","#"+a.jgrid.jqID(x.themodal)).click(function(){a(".confirm","#"+a.jgrid.jqID(x.themodal)).hide();a("#"+u).data("disabled",!1);a.jgrid.hideModal("#"+a.jgrid.jqID(x.themodal),{gb:"#gbox_"+a.jgrid.jqID(t),
  344. jqm:c.jqModal,onClose:b[n.p.id].onClose,removemodal:b[n.p.id].removemodal,formprop:!b[n.p.id].recreateForm,form:b[n.p.id].form});return!1});a(n).triggerHandler("jqGridAddEditInitializeForm",[a("#"+u),z]);B&&B.call(n,a("#"+u),z);"_empty"!==e&&b[n.p.id].viewPagerButtons?a("#pData,#nData",s+"_2").show():a("#pData,#nData",s+"_2").hide();a(n).triggerHandler("jqGridAddEditBeforeShowForm",[a("#"+u),z]);A&&A.call(n,a("#"+u),z);a("#"+a.jgrid.jqID(x.themodal)).data("onClose",b[n.p.id].onClose);a.jgrid.viewModal("#"+
  345. a.jgrid.jqID(x.themodal),{gbox:"#gbox_"+a.jgrid.jqID(t),jqm:c.jqModal,overlay:c.overlay,modal:c.modal,overlayClass:c.overlayClass,onHide:function(b){var c=a("#editmod"+t)[0].style.height;-1<c.indexOf("px")&&(c=parseFloat(c));a(n).data("formProp",{top:parseFloat(a(b.w).css("top")),left:parseFloat(a(b.w).css("left")),width:a(b.w).width(),height:c,dataheight:a("#"+u).height(),datawidth:a("#"+u).width()});b.w.remove();b.o&&b.o.remove()}});L||a("."+a.jgrid.jqID(c.overlayClass)).click(function(){if(!p())return!1;
  346. a.jgrid.hideModal("#"+a.jgrid.jqID(x.themodal),{gb:"#gbox_"+a.jgrid.jqID(t),jqm:c.jqModal,onClose:b[n.p.id].onClose,removemodal:b[n.p.id].removemodal,formprop:!b[n.p.id].recreateForm,form:b[n.p.id].form});return!1});a(".fm-button","#"+a.jgrid.jqID(x.themodal)).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a("#sData",s+"_2").click(function(){y={};a("#FormError",s).hide();f();"_empty"===y[n.p.id+"_id"]?k():!0===c.checkOnSubmit?(O=l(y,b[n.p.id]._savedData))?
  347. (a("#"+u).data("disabled",!0),a(".confirm","#"+a.jgrid.jqID(x.themodal)).show()):k():k();return!1});a("#cData",s+"_2").click(function(){if(!p())return!1;a.jgrid.hideModal("#"+a.jgrid.jqID(x.themodal),{gb:"#gbox_"+a.jgrid.jqID(t),jqm:c.jqModal,onClose:b[n.p.id].onClose,removemodal:b[n.p.id].removemodal,formprop:!b[n.p.id].recreateForm,form:b[n.p.id].form});return!1});a("#nData",s+"_2").click(function(){if(!p())return!1;a("#FormError",s).hide();var b=q();b[0]=parseInt(b[0],10);if(-1!==b[0]&&b[1][b[0]+
  348. 1]){a(n).triggerHandler("jqGridAddEditClickPgButtons",["next",a("#"+u),b[1][b[0]]]);var e;if(a.isFunction(c.onclickPgButtons)&&(e=c.onclickPgButtons.call(n,"next",a("#"+u),b[1][b[0]]),void 0!==e&&!1===e)||a("#"+a.jgrid.jqID(b[1][b[0]+1])).hasClass("ui-state-disabled"))return!1;d(b[1][b[0]+1],n,u);a(n).jqGrid("setSelection",b[1][b[0]+1]);a(n).triggerHandler("jqGridAddEditAfterClickPgButtons",["next",a("#"+u),b[1][b[0]]]);a.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons.call(n,"next",a("#"+
  349. u),b[1][b[0]+1]);r(b[0]+1,b)}return!1});a("#pData",s+"_2").click(function(){if(!p())return!1;a("#FormError",s).hide();var b=q();if(-1!==b[0]&&b[1][b[0]-1]){a(n).triggerHandler("jqGridAddEditClickPgButtons",["prev",a("#"+u),b[1][b[0]]]);var e;if(a.isFunction(c.onclickPgButtons)&&(e=c.onclickPgButtons.call(n,"prev",a("#"+u),b[1][b[0]]),void 0!==e&&!1===e)||a("#"+a.jgrid.jqID(b[1][b[0]-1])).hasClass("ui-state-disabled"))return!1;d(b[1][b[0]-1],n,u);a(n).jqGrid("setSelection",b[1][b[0]-1]);a(n).triggerHandler("jqGridAddEditAfterClickPgButtons",
  350. ["prev",a("#"+u),b[1][b[0]]]);a.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons.call(n,"prev",a("#"+u),b[1][b[0]-1]);r(b[0]-1,b)}return!1});a(n).triggerHandler("jqGridAddEditAfterShowForm",[a("#"+u),z]);v&&v.call(n,a("#"+u),z);A=q();r(A[0],A)}}})},viewGridRow:function(e,c){c=a.extend(!0,{top:0,left:0,width:0,datawidth:"auto",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,
  351. beforeInitData:null,viewPagerButtons:!0,recreateForm:!1,removemodal:!0,form:"view"},a.jgrid.view,c||{});b[a(this)[0].p.id]=c;return this.each(function(){function f(){!0!==b[l.p.id].closeOnEscape&&!0!==b[l.p.id].navkeys[0]||setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+a.jgrid.jqID(t.modalhead)).attr("tabindex","-1").focus()},0)}function g(b,d,e,f){var g,h,k,l=0,n,m,p=[],q=!1,r,s="<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>",
  352. t="",u=["integer","number","currency"],v=0,x=0,w,A,B;for(r=1;r<=f;r++)t+=1===r?s:"<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&&!0===this.editrules.edithidden?!1:!0===this.hidden?!0:!1)||"right"!==this.align||(this.formatter&&-1!==a.inArray(this.formatter,u)?v=Math.max(v,parseInt(this.width,10)):x=Math.max(x,parseInt(this.width,10)))});w=0!==v?v:0!==x?x:0;q=a(d).jqGrid("getInd",
  353. b);a(d.p.colModel).each(function(b){g=this.name;A=!1;m=(h=this.editrules&&!0===this.editrules.edithidden?!1:!0===this.hidden?!0:!1)?"style='display:none'":"";B="boolean"!==typeof this.viewable?!0:this.viewable;if("cb"!==g&&"subgrid"!==g&&"rn"!==g&&B){n=!1===q?"":g===d.p.ExpandColumn&&!0===d.p.treeGrid?a("td:eq("+b+")",d.rows[q]).text():a("td:eq("+b+")",d.rows[q]).html();A="right"===this.align&&0!==w?!0:!1;var c=a.extend({},{rowabove:!1,rowcontent:""},this.formoptions||{}),r=parseInt(c.rowpos,10)||
  354. l+1,s=parseInt(2*(parseInt(c.colpos,10)||1),10);if(c.rowabove){var v=a("<tr><td class='contentinfo' colspan='"+2*f+"'>"+c.rowcontent+"</td></tr>");a(e).append(v);v[0].rp=r}k=a(e).find("tr[rowpos="+r+"]");0===k.length&&(k=a("<tr "+m+" rowpos='"+r+"'></tr>").addClass("FormData").attr("id","trv_"+g),a(k).append(t),a(e).append(k),k[0].rp=r);a("td:eq("+(s-2)+")",k[0]).html("<b>"+(void 0===c.label?d.p.colNames[b]:c.label)+"</b>");a("td:eq("+(s-1)+")",k[0]).append("<span>"+n+"</span>").attr("id","v_"+g);
  355. A&&a("td:eq("+(s-1)+") span",k[0]).css({"text-align":"right",width:w+"px"});p[l]=b;l++}});0<l&&(b=a("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(2*f-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 d(b,c){var d,e,f=0,g,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&&!0===c.p.colModel[b].editrules.edithidden?
  356. !1:!0===c.p.colModel[b].hidden?!0:!1;"cb"!==d&&"subgrid"!==d&&"rn"!==d&&(g=d===c.p.ExpandColumn&&!0===c.p.treeGrid?a(this).text():a(this).html(),d=a.jgrid.jqID("v_"+d),a("#"+d+" span","#"+r).html(g),e&&a("#"+d,"#"+r).parents("tr:first").hide(),f++)}),0<f&&a("#id_g","#"+r).val(b)}function h(b,c){var d=c[1].length-1;0===b?a("#pData","#"+r+"_2").addClass("ui-state-disabled"):void 0!==c[1][b-1]&&a("#"+a.jgrid.jqID(c[1][b-1])).hasClass("ui-state-disabled")?a("#pData",r+"_2").addClass("ui-state-disabled"):
  357. a("#pData","#"+r+"_2").removeClass("ui-state-disabled");b===d?a("#nData","#"+r+"_2").addClass("ui-state-disabled"):void 0!==c[1][b+1]&&a("#"+a.jgrid.jqID(c[1][b+1])).hasClass("ui-state-disabled")?a("#nData",r+"_2").addClass("ui-state-disabled"):a("#nData","#"+r+"_2").removeClass("ui-state-disabled")}function k(){var b=a(l).jqGrid("getDataIDs"),c=a("#id_g","#"+r).val();return[a.inArray(c,b),b]}var l=this;if(l.grid&&e){var p=l.p.id,m="ViewGrid_"+a.jgrid.jqID(p),r="ViewTbl_"+a.jgrid.jqID(p),q="ViewGrid_"+
  358. p,n="ViewTbl_"+p,t={themodal:"viewmod"+p,modalhead:"viewhd"+p,modalcontent:"viewcnt"+p,scrollelm:m},u=a.isFunction(b[l.p.id].beforeInitData)?b[l.p.id].beforeInitData:!1,w=!0,s=1,x=0;c.recreateForm||a(l).data("viewProp")&&a.extend(b[a(this)[0].p.id],a(l).data("viewProp"));var A=isNaN(b[a(this)[0].p.id].dataheight)?b[a(this)[0].p.id].dataheight:b[a(this)[0].p.id].dataheight+"px",v=isNaN(b[a(this)[0].p.id].datawidth)?b[a(this)[0].p.id].datawidth:b[a(this)[0].p.id].datawidth+"px",q=a("<form name='FormPost' id='"+
  359. q+"' class='FormGrid' style='width:"+v+";overflow:auto;position:relative;height:"+A+";'></form>"),H=a("<table id='"+n+"' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");a(l.p.colModel).each(function(){var a=this.formoptions;s=Math.max(s,a?a.colpos||0:0);x=Math.max(x,a?a.rowpos||0:0)});a(q).append(H);u&&(w=u.call(l,q),void 0===w&&(w=!0));if(!1!==w){g(e,l,H,s);n="rtl"===l.p.direction?!0:!1;u="<a id='"+(n?"nData":"pData")+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>";
  360. w="<a id='"+(n?"pData":"nData")+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>";A="<a id='cData' class='fm-button ui-state-default ui-corner-all'>"+c.bClose+"</a>";if(0<x){var B=[];a.each(a(H)[0].rows,function(a,b){B[a]=b});B.sort(function(a,b){return a.rp>b.rp?1:a.rp<b.rp?-1:0});a.each(B,function(b,c){a("tbody",H).append(c)})}c.gbox="#gbox_"+a.jgrid.jqID(p);q=a("<div></div>").append(q).append("<table border='0' class='EditTable' id='"+
  361. r+"_2'><tbody><tr id='Act_Buttons'><td class='navButton' width='"+c.labelswidth+"'>"+(n?w+u:u+w)+"</td><td class='EditButton'>"+A+"</td></tr></tbody></table>");a.jgrid.createModal(t,q,c,"#gview_"+a.jgrid.jqID(l.p.id),a("#gview_"+a.jgrid.jqID(l.p.id))[0]);n&&(a("#pData, #nData","#"+r+"_2").css("float","right"),a(".EditButton","#"+r+"_2").css("text-align","left"));c.viewPagerButtons||a("#pData, #nData","#"+r+"_2").hide();q=null;a("#"+t.themodal).keydown(function(d){if(27===d.which)return b[l.p.id].closeOnEscape&&
  362. a.jgrid.hideModal("#"+a.jgrid.jqID(t.themodal),{gb:c.gbox,jqm:c.jqModal,onClose:c.onClose,removemodal:b[l.p.id].removemodal,formprop:!b[l.p.id].recreateForm,form:b[l.p.id].form}),!1;if(!0===c.navkeys[0]){if(d.which===c.navkeys[1])return a("#pData","#"+r+"_2").trigger("click"),!1;if(d.which===c.navkeys[2])return a("#nData","#"+r+"_2").trigger("click"),!1}});c.closeicon=a.extend([!0,"left","ui-icon-close"],c.closeicon);!0===c.closeicon[0]&&a("#cData","#"+r+"_2").addClass("right"===c.closeicon[1]?"fm-button-icon-right":
  363. "fm-button-icon-left").append("<span class='ui-icon "+c.closeicon[2]+"'></span>");a.isFunction(c.beforeShowForm)&&c.beforeShowForm.call(l,a("#"+m));a.jgrid.viewModal("#"+a.jgrid.jqID(t.themodal),{gbox:"#gbox_"+a.jgrid.jqID(p),jqm:c.jqModal,overlay:c.overlay,modal:c.modal,onHide:function(b){a(l).data("viewProp",{top:parseFloat(a(b.w).css("top")),left:parseFloat(a(b.w).css("left")),width:a(b.w).width(),height:a(b.w).height(),dataheight:a("#"+m).height(),datawidth:a("#"+m).width()});b.w.remove();b.o&&
  364. b.o.remove()}});a(".fm-button:not(.ui-state-disabled)","#"+r+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});f();a("#cData","#"+r+"_2").click(function(){a.jgrid.hideModal("#"+a.jgrid.jqID(t.themodal),{gb:"#gbox_"+a.jgrid.jqID(p),jqm:c.jqModal,onClose:c.onClose,removemodal:b[l.p.id].removemodal,formprop:!b[l.p.id].recreateForm,form:b[l.p.id].form});return!1});a("#nData","#"+r+"_2").click(function(){a("#FormError","#"+r).hide();var b=k();
  365. b[0]=parseInt(b[0],10);-1!==b[0]&&b[1][b[0]+1]&&(a.isFunction(c.onclickPgButtons)&&c.onclickPgButtons.call(l,"next",a("#"+m),b[1][b[0]]),d(b[1][b[0]+1],l),a(l).jqGrid("setSelection",b[1][b[0]+1]),a.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons.call(l,"next",a("#"+m),b[1][b[0]+1]),h(b[0]+1,b));f();return!1});a("#pData","#"+r+"_2").click(function(){a("#FormError","#"+r).hide();var b=k();-1!==b[0]&&b[1][b[0]-1]&&(a.isFunction(c.onclickPgButtons)&&c.onclickPgButtons.call(l,"prev",a("#"+m),
  366. b[1][b[0]]),d(b[1][b[0]-1],l),a(l).jqGrid("setSelection",b[1][b[0]-1]),a.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons.call(l,"prev",a("#"+m),b[1][b[0]-1]),h(b[0]-1,b));f();return!1});q=k();h(q[0],q)}}})},delGridRow:function(e,c){c=a.extend(!0,{top:0,left:0,width:240,height:"auto",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,
  367. 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&&e){var g=a.isFunction(b[f.p.id].beforeShowForm),d=a.isFunction(b[f.p.id].afterShowForm),h=a.isFunction(b[f.p.id].beforeInitData)?b[f.p.id].beforeInitData:!1,k=f.p.id,l={},p=!0,m="DelTbl_"+a.jgrid.jqID(k),r,q,n,t,u="DelTbl_"+k,w={themodal:"delmod"+k,modalhead:"delhd"+
  368. k,modalcontent:"delcnt"+k,scrollelm:m};a.isArray(e)&&(e=e.join());if(void 0!==a("#"+a.jgrid.jqID(w.themodal))[0]){h&&(p=h.call(f,a("#"+m)),void 0===p&&(p=!0));if(!1===p)return;a("#DelData>td","#"+m).text(e);a("#DelError","#"+m).hide();!0===b[f.p.id].processing&&(b[f.p.id].processing=!1,a("#dData","#"+m).removeClass("ui-state-active"));g&&b[f.p.id].beforeShowForm.call(f,a("#"+m));a.jgrid.viewModal("#"+a.jgrid.jqID(w.themodal),{gbox:"#gbox_"+a.jgrid.jqID(k),jqm:b[f.p.id].jqModal,jqM:!1,overlay:b[f.p.id].overlay,
  369. 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",x=isNaN(c.datawidth)?c.datawidth:c.datawidth+"px",u="<div id='"+u+"' class='formdata' style='width:"+x+";overflow:auto;position:relative;height:"+s+";'><table class='DelTable'><tbody>",u=u+"<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>",u=u+("<tr id='DelData' style='display:none'><td >"+e+"</td></tr>"),u=u+('<tr><td class="delmsg" style="white-space:pre;">'+
  370. b[f.p.id].msg+"</td></tr><tr><td >&#160;</td></tr>"),u=u+"</tbody></table></div>",u=u+("<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+m+"_2'><tbody><tr><td><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='DelButton EditButton'>"+("<a id='dData' class='fm-button ui-state-default ui-corner-all'>"+c.bSubmit+"</a>")+"&#160;"+("<a id='eData' class='fm-button ui-state-default ui-corner-all'>"+c.bCancel+"</a>")+"</td></tr></tbody></table>");c.gbox="#gbox_"+
  371. a.jgrid.jqID(k);a.jgrid.createModal(w,u,c,"#gview_"+a.jgrid.jqID(f.p.id),a("#gview_"+a.jgrid.jqID(f.p.id))[0]);h&&(p=h.call(f,a(u)),void 0===p&&(p=!0));if(!1===p)return;a(".fm-button","#"+m+"_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);!0===c.delicon[0]&&a("#dData","#"+m+"_2").addClass("right"===
  372. c.delicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.delicon[2]+"'></span>");!0===c.cancelicon[0]&&a("#eData","#"+m+"_2").addClass("right"===c.cancelicon[1]?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.cancelicon[2]+"'></span>");a("#dData","#"+m+"_2").click(function(){var d=[!0,""],e,g=a("#DelData>td","#"+m).text();l={};a.isFunction(b[f.p.id].onclickSubmit)&&(l=b[f.p.id].onclickSubmit.call(f,b[f.p.id],g)||{});a.isFunction(b[f.p.id].beforeSubmit)&&
  373. (d=b[f.p.id].beforeSubmit.call(f,g));if(d[0]&&!b[f.p.id].processing){b[f.p.id].processing=!0;n=f.p.prmNames;r=a.extend({},b[f.p.id].delData,l);t=n.oper;r[t]=n.deloper;q=n.id;g=String(g).split(",");if(!g.length)return!1;for(e in g)g.hasOwnProperty(e)&&(g[e]=a.jgrid.stripPref(f.p.idPrefix,g[e]));r[q]=g.join();a(this).addClass("ui-state-active");e=a.extend({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.call(f,
  374. r):r,complete:function(e,h){var l;a("#dData","#"+m+"_2").removeClass("ui-state-active");300<=e.status&&304!==e.status?(d[0]=!1,a.isFunction(b[f.p.id].errorTextFormat)?d[1]=b[f.p.id].errorTextFormat.call(f,e):d[1]=h+" Status: '"+e.statusText+"'. Error code: "+e.status):a.isFunction(b[f.p.id].afterSubmit)&&(d=b[f.p.id].afterSubmit.call(f,e,r));if(!1===d[0])a("#DelError>td","#"+m).html(d[1]),a("#DelError","#"+m).show();else{if(b[f.p.id].reloadAfterSubmit&&"local"!==f.p.datatype)a(f).trigger("reloadGrid");
  375. else{if(!0===f.p.treeGrid)try{a(f).jqGrid("delTreeNode",f.p.idPrefix+g[0])}catch(n){}else for(l=0;l<g.length;l++)a(f).jqGrid("delRowData",f.p.idPrefix+g[l]);f.p.selrow=null;f.p.selarrrow=[]}a.isFunction(b[f.p.id].afterComplete)&&setTimeout(function(){b[f.p.id].afterComplete.call(f,e,g)},500)}b[f.p.id].processing=!1;d[0]&&a.jgrid.hideModal("#"+a.jgrid.jqID(w.themodal),{gb:"#gbox_"+a.jgrid.jqID(k),jqm:c.jqModal,onClose:b[f.p.id].onClose})}},a.jgrid.ajaxOptions,b[f.p.id].ajaxDelOptions);e.url||b[f.p.id].useDataProxy||
  376. (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?(e=f.p.dataProxy.call(f,e,"del_"+f.p.id),void 0===e&&(e=[!0,""]),!1===e[0]?(d[0]=!1,d[1]=e[1]||"Error deleting the selected row!"):a.jgrid.hideModal("#"+a.jgrid.jqID(w.themodal),{gb:"#gbox_"+a.jgrid.jqID(k),jqm:c.jqModal,onClose:b[f.p.id].onClose})):"clientArray"===e.url?(r=e.data,e.complete({status:200,statusText:""},"")):a.ajax(e))}!1===d[0]&&(a("#DelError>td","#"+m).html(d[1]),
  377. a("#DelError","#"+m).show());return!1});a("#eData","#"+m+"_2").click(function(){a.jgrid.hideModal("#"+a.jgrid.jqID(w.themodal),{gb:"#gbox_"+a.jgrid.jqID(k),jqm:b[f.p.id].jqModal,onClose:b[f.p.id].onClose});return!1});g&&b[f.p.id].beforeShowForm.call(f,a("#"+m));a.jgrid.viewModal("#"+a.jgrid.jqID(w.themodal),{gbox:"#gbox_"+a.jgrid.jqID(k),jqm:b[f.p.id].jqModal,overlay:b[f.p.id].overlay,modal:b[f.p.id].modal})}d&&b[f.p.id].afterShowForm.call(f,a("#"+m));!0===b[f.p.id].closeOnEscape&&setTimeout(function(){a(".ui-jqdialog-titlebar-close",
  378. "#"+a.jgrid.jqID(w.modalhead)).attr("tabindex","-1").focus()},0)}})},navGrid:function(b,c,f,g,d,h,k){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,alertleft:null,alertzIndex:null},
  379. a.jgrid.nav,c||{});return this.each(function(){if(!this.nav){var l={themodal:"alertmod_"+this.p.id,modalhead:"alerthd_"+this.p.id,modalcontent:"alertcnt_"+this.p.id},p=this,m;if(p.grid&&"string"===typeof b){void 0===a("#"+l.themodal)[0]&&(c.alerttop||c.alertleft||(void 0!==window.innerWidth?(c.alertleft=window.innerWidth,c.alerttop=window.innerHeight):void 0!==document.documentElement&&void 0!==document.documentElement.clientWidth&&0!==document.documentElement.clientWidth?(c.alertleft=document.documentElement.clientWidth,
  380. 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_"+a.jgrid.jqID(p.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,zIndex:c.alertzIndex},"#gview_"+
  381. a.jgrid.jqID(p.p.id),a("#gbox_"+a.jgrid.jqID(p.p.id))[0],!0));var r=1,q,n=function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},t=function(){a(this).removeClass("ui-state-hover")};c.cloneToTop&&p.p.toppager&&(r=2);for(q=0;q<r;q++){var u=a("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),w,s;0===q?(w=b,s=p.p.id,w===p.p.toppager&&(s+="_top",r=1)):(w=p.p.toppager,s=
  382. p.p.id+"_top");"rtl"===p.p.direction&&a(u).attr("dir","rtl").css("float","right");c.add&&(g=g||{},m=a("<td class='ui-pg-button ui-corner-all'></td>"),a(m).append("<div class='ui-pg-div'><span class='ui-icon "+c.addicon+"'></span>"+c.addtext+"</div>"),a("tr",u).append(m),a(m,u).attr({title:c.addtitle||"",id:g.id||"add_"+s}).click(function(){a(this).hasClass("ui-state-disabled")||(a.isFunction(c.addfunc)?c.addfunc.call(p):a(p).jqGrid("editGridRow","new",g));return!1}).hover(n,t),m=null);c.edit&&(m=
  383. a("<td class='ui-pg-button ui-corner-all'></td>"),f=f||{},a(m).append("<div class='ui-pg-div'><span class='ui-icon "+c.editicon+"'></span>"+c.edittext+"</div>"),a("tr",u).append(m),a(m,u).attr({title:c.edittitle||"",id:f.id||"edit_"+s}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var b=p.p.selrow;b?a.isFunction(c.editfunc)?c.editfunc.call(p,b):a(p).jqGrid("editGridRow",b,f):(a.jgrid.viewModal("#"+l.themodal,{gbox:"#gbox_"+a.jgrid.jqID(p.p.id),jqm:!0}),a("#jqg_alrt").focus())}return!1}).hover(n,
  384. t),m=null);c.view&&(m=a("<td class='ui-pg-button ui-corner-all'></td>"),k=k||{},a(m).append("<div class='ui-pg-div'><span class='ui-icon "+c.viewicon+"'></span>"+c.viewtext+"</div>"),a("tr",u).append(m),a(m,u).attr({title:c.viewtitle||"",id:k.id||"view_"+s}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var b=p.p.selrow;b?a.isFunction(c.viewfunc)?c.viewfunc.call(p,b):a(p).jqGrid("viewGridRow",b,k):(a.jgrid.viewModal("#"+l.themodal,{gbox:"#gbox_"+a.jgrid.jqID(p.p.id),jqm:!0}),a("#jqg_alrt").focus())}return!1}).hover(n,
  385. t),m=null);c.del&&(m=a("<td class='ui-pg-button ui-corner-all'></td>"),d=d||{},a(m).append("<div class='ui-pg-div'><span class='ui-icon "+c.delicon+"'></span>"+c.deltext+"</div>"),a("tr",u).append(m),a(m,u).attr({title:c.deltitle||"",id:d.id||"del_"+s}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var b;p.p.multiselect?(b=p.p.selarrrow,0===b.length&&(b=null)):b=p.p.selrow;b?a.isFunction(c.delfunc)?c.delfunc.call(p,b):a(p).jqGrid("delGridRow",b,d):(a.jgrid.viewModal("#"+l.themodal,{gbox:"#gbox_"+
  386. a.jgrid.jqID(p.p.id),jqm:!0}),a("#jqg_alrt").focus())}return!1}).hover(n,t),m=null);(c.add||c.edit||c.del||c.view)&&a("tr",u).append("<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>");c.search&&(m=a("<td class='ui-pg-button ui-corner-all'></td>"),h=h||{},a(m).append("<div class='ui-pg-div'><span class='ui-icon "+c.searchicon+"'></span>"+c.searchtext+"</div>"),a("tr",u).append(m),a(m,u).attr({title:c.searchtitle||"",id:h.id||"search_"+s}).click(function(){a(this).hasClass("ui-state-disabled")||
  387. (a.isFunction(c.searchfunc)?c.searchfunc.call(p,h):a(p).jqGrid("searchGrid",h));return!1}).hover(n,t),h.showOnLoad&&!0===h.showOnLoad&&a(m,u).click(),m=null);c.refresh&&(m=a("<td class='ui-pg-button ui-corner-all'></td>"),a(m).append("<div class='ui-pg-div'><span class='ui-icon "+c.refreshicon+"'></span>"+c.refreshtext+"</div>"),a("tr",u).append(m),a(m,u).attr({title:c.refreshtitle||"",id:"refresh_"+s}).click(function(){if(!a(this).hasClass("ui-state-disabled")){a.isFunction(c.beforeRefresh)&&c.beforeRefresh.call(p);
  388. p.p.search=!1;p.p.resetsearch=!0;try{if("currentfilter"!==c.refreshstate){var b=p.p.id;p.p.postData.filters="";try{a("#fbox_"+a.jgrid.jqID(b)).jqFilter("resetFilter")}catch(d){}a.isFunction(p.clearToolbar)&&p.clearToolbar.call(p,!1)}}catch(e){}switch(c.refreshstate){case "firstpage":a(p).trigger("reloadGrid",[{page:1}]);break;case "current":case "currentfilter":a(p).trigger("reloadGrid",[{current:!0}])}a.isFunction(c.afterRefresh)&&c.afterRefresh.call(p)}return!1}).hover(n,t),m=null);m=a(".ui-jqgrid").css("font-size")||
  389. "11px";a("body").append("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+m+";visibility:hidden;' ></div>");m=a(u).clone().appendTo("#testpg2").width();a("#testpg2").remove();a(w+"_"+c.position,w).append(u);p.p._nvtd&&(m>p.p._nvtd[0]&&(a(w+"_"+c.position,w).width(m),p.p._nvtd[0]=m),p.p._nvtd[1]=m);u=m=m=null;this.nav=!0}}}})},navButtonAdd:function(b,c){c=a.extend({caption:"newButton",title:"",buttonicon:"ui-icon-newwin",onClickButton:null,position:"last",cursor:"pointer"},
  390. c||{});return this.each(function(){if(this.grid){"string"===typeof b&&0!==b.indexOf("#")&&(b="#"+a.jgrid.jqID(b));var f=a(".navtable",b)[0],g=this;if(f&&(!c.id||void 0===a("#"+a.jgrid.jqID(c.id),f)[0])){var d=a("<td></td>");"NONE"===c.buttonicon.toString().toUpperCase()?a(d).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'>"+c.caption+"</div>"):a(d).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'><span class='ui-icon "+c.buttonicon+"'></span>"+c.caption+
  391. "</div>");c.id&&a(d).attr("id",c.id);"first"===c.position?0===f.rows[0].cells.length?a("tr",f).append(d):a("tr td:eq(0)",f).before(d):a("tr",f).append(d);a(d,f).attr("title",c.title||"").click(function(b){a(this).hasClass("ui-state-disabled")||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",
  392. sepcontent:"",position:"last"},c||{});return this.each(function(){if(this.grid){"string"===typeof b&&0!==b.indexOf("#")&&(b="#"+a.jgrid.jqID(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+"'></span>"+c.sepcontent+"</td>";"first"===c.position?0===f.rows[0].cells.length?a("tr",f).append(g):a("tr td:eq(0)",f).before(g):a("tr",f).append(g)}}})},GridToForm:function(b,c){return this.each(function(){var f=this,g;if(f.grid){var d=
  393. a(f).jqGrid("getRowData",b);if(d)for(g in d)d.hasOwnProperty(g)&&(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(){if(a(this).val()==d[g])a(this)[f.p.useProp?"prop":"attr"]("checked",!0);else a(this)[f.p.useProp?"prop":"attr"]("checked",!1)}):a("[name="+a.jgrid.jqID(g)+"]",c).val(d[g]))}})},FormToGrid:function(b,c,f,g){return this.each(function(){if(this.grid){f||(f="set");g||(g="first");var d=
  394. a(c).serializeArray(),h={};a.each(d,function(a,b){h[b.name]=b.value});"add"===f?a(this).jqGrid("addRowData",b,h,g):"set"===f&&a(this).jqGrid("setRowData",b,h)}})}})})(jQuery);
  395. (function(a){a.extend(a.jgrid,{template:function(b){var e=a.makeArray(arguments).slice(1),c,f=e.length;null==b&&(b="");return b.replace(/\{([\w\-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,function(b,d){if(!isNaN(parseInt(d,10)))return e[parseInt(d,10)];for(c=0;c<f;c++)if(a.isArray(e[c]))for(var h=e[c],k=h.length;k--;)if(d===h[k].nm)return h[k].v})}});a.jgrid.extend({groupingSetup:function(){return this.each(function(){var b,e,c=this.p.colModel,f=this.p.groupingView;if(null===f||"object"!==typeof f&&!a.isFunction(f))this.p.grouping=
  396. !1;else if(f.groupField.length){void 0===f.visibiltyOnNextGrouping&&(f.visibiltyOnNextGrouping=[]);f.lastvalues=[];f._locgr||(f.groups=[]);f.counters=[];for(b=0;b<f.groupField.length;b++)f.groupOrder[b]||(f.groupOrder[b]="asc"),f.groupText[b]||(f.groupText[b]="{0}"),"boolean"!==typeof f.groupColumnShow[b]&&(f.groupColumnShow[b]=!0),"boolean"!==typeof f.groupSummary[b]&&(f.groupSummary[b]=!1),f.groupSummaryPos[b]||(f.groupSummaryPos[b]="footer"),!0===f.groupColumnShow[b]?(f.visibiltyOnNextGrouping[b]=
  397. !0,a(this).jqGrid("showCol",f.groupField[b])):(f.visibiltyOnNextGrouping[b]=a("#"+a.jgrid.jqID(this.p.id+"_"+f.groupField[b])).is(":visible"),a(this).jqGrid("hideCol",f.groupField[b]));f.summary=[];f.hideFirstGroupCol&&(f.formatDisplayField[0]=function(a){return a});b=0;for(e=c.length;b<e;b++)f.hideFirstGroupCol&&!c[b].hidden&&f.groupField[0]===c[b].name&&(c[b].formatter=function(){return""}),c[b].summaryType&&(c[b].summaryDivider?f.summary.push({nm:c[b].name,st:c[b].summaryType,v:"",sd:c[b].summaryDivider,
  398. vd:"",sr:c[b].summaryRound,srt:c[b].summaryRoundType||"round"}):f.summary.push({nm:c[b].name,st:c[b].summaryType,v:"",sr:c[b].summaryRound,srt:c[b].summaryRoundType||"round"}))}else this.p.grouping=!1})},groupingPrepare:function(b,e){this.each(function(){var c=this.p.groupingView,f=this,g,d=c.groupField.length,h,k,l,p=0;for(g=0;g<d;g++)h=c.groupField[g],l=c.displayField[g],k=b[h],l=null==l?null:b[l],null==l&&(l=k),void 0!==k&&(0===e?(c.groups.push({idx:g,dataIndex:h,value:k,displayValue:l,startRow:e,
  399. cnt:1,summary:[]}),c.lastvalues[g]=k,c.counters[g]={cnt:1,pos:c.groups.length-1,summary:a.extend(!0,[],c.summary)}):"object"===typeof k||(a.isArray(c.isInTheSameGroup)&&a.isFunction(c.isInTheSameGroup[g])?c.isInTheSameGroup[g].call(f,c.lastvalues[g],k,g,c):c.lastvalues[g]===k)?1===p?(c.groups.push({idx:g,dataIndex:h,value:k,displayValue:l,startRow:e,cnt:1,summary:[]}),c.lastvalues[g]=k,c.counters[g]={cnt:1,pos:c.groups.length-1,summary:a.extend(!0,[],c.summary)}):(c.counters[g].cnt+=1,c.groups[c.counters[g].pos].cnt=
  400. c.counters[g].cnt):(c.groups.push({idx:g,dataIndex:h,value:k,displayValue:l,startRow:e,cnt:1,summary:[]}),c.lastvalues[g]=k,p=1,c.counters[g]={cnt:1,pos:c.groups.length-1,summary:a.extend(!0,[],c.summary)}),a.each(c.counters[g].summary,function(){a.isFunction(this.st)?this.v=this.st.call(f,this.v,this.nm,b):(this.v=a(f).jqGrid("groupingCalculations.handler",this.st,this.v,this.nm,this.sr,this.srt,b),"avg"===this.st.toLowerCase()&&this.sd&&(this.vd=a(f).jqGrid("groupingCalculations.handler",this.st,
  401. this.vd,this.sd,this.sr,this.srt,b)))}),c.groups[c.counters[g].pos].summary=c.counters[g].summary)});return this},groupingToggle:function(b){this.each(function(){var e=this.p.groupingView,c=b.split("_"),f=parseInt(c[c.length-2],10);c.splice(c.length-2,2);var g=c.join("_"),c=e.minusicon,e=e.plusicon,d=a("#"+a.jgrid.jqID(b)),d=d.length?d[0].nextSibling:null,h=a("#"+a.jgrid.jqID(b)+" span.tree-wrap-"+this.p.direction),k=function(b){b=a.map(b.split(" "),function(a){if(a.substring(0,g.length+1)===g+"_")return parseInt(a.substring(g.length+
  402. 1),10)});return 0<b.length?b[0]:void 0},l,p,m=!1,r=this.p.frozenColumns?this.p.id+"_frozen":!1,q=(l=r?a("#"+a.jgrid.jqID(b),"#"+a.jgrid.jqID(r)):!1)&&l.length?l[0].nextSibling:null;if(h.hasClass(c)){if(d)for(;d;){l=k(d.className);if(void 0!==l&&l<=f)break;a(d).hide();d=d.nextSibling;r&&(a(q).hide(),q=q.nextSibling)}h.removeClass(c).addClass(e);m=!0}else{if(d)for(p=void 0;d;){l=k(d.className);void 0===p&&(p=void 0===l);if(void 0!==l){if(l<=f)break;l===f+1&&(a(d).show().find(">td>span.tree-wrap-"+this.p.direction).removeClass(c).addClass(e),
  403. r&&a(q).show().find(">td>span.tree-wrap-"+this.p.direction).removeClass(c).addClass(e))}else p&&(a(d).show(),r&&a(q).show());d=d.nextSibling;r&&(q=q.nextSibling)}h.removeClass(e).addClass(c)}a(this).triggerHandler("jqGridGroupingClickGroup",[b,m]);a.isFunction(this.p.onClickGroup)&&this.p.onClickGroup.call(this,b,m)});return!1},groupingRender:function(b,e,c,f){return this.each(function(){function g(a,b,c){var d=!1;if(0===b)d=c[a];else{var e=c[a].idx;if(0===e)d=c[a];else for(;0<=a;a--)if(c[a].idx===
  404. e-b){d=c[a];break}}return d}function d(b,c,d,f){var k=g(b,c,d),l=h.p.colModel,n,m=k.cnt;b="";var p;for(p=f;p<e;p++){var q="<td "+h.formatCol(p,1,"")+">&#160;</td>",r="{0}";a.each(k.summary,function(){if(this.nm===l[p].name){l[p].summaryTpl&&(r=l[p].summaryTpl);"string"===typeof this.st&&"avg"===this.st.toLowerCase()&&(this.sd&&this.vd?this.v/=this.vd:this.v&&0<m&&(this.v/=m));try{this.groupCount=k.cnt,this.groupIndex=k.dataIndex,this.groupValue=k.value,n=h.formatter("",this.v,p,this)}catch(b){n=this.v}q=
  405. "<td "+h.formatCol(p,1,"")+">"+a.jgrid.format(r,n)+"</td>";return!1}});b+=q}return b}var h=this,k=h.p.groupingView,l="",p="",m,r,q=k.groupCollapse?k.plusicon:k.minusicon,n,t=[],u=k.groupField.length,q=q+(" tree-wrap-"+h.p.direction);a.each(h.p.colModel,function(a,b){var c;for(c=0;c<u;c++)if(k.groupField[c]===b.name){t[c]=a;break}});var w=0,s=a.makeArray(k.groupSummary),x;s.reverse();x=h.p.multiselect?' colspan="2"':"";a.each(k.groups,function(g,v){if(k._locgr&&!(v.startRow+v.cnt>(c-1)*f&&v.startRow<
  406. c*f))return!0;w++;r=h.p.id+"ghead_"+v.idx;m=r+"_"+g;p="<span style='cursor:pointer;' class='ui-icon "+q+"' onclick=\"jQuery('#"+a.jgrid.jqID(h.p.id)+"').jqGrid('groupingToggle','"+m+"');return false;\"></span>";try{a.isArray(k.formatDisplayField)&&a.isFunction(k.formatDisplayField[v.idx])?(v.displayValue=k.formatDisplayField[v.idx].call(h,v.displayValue,v.value,h.p.colModel[t[v.idx]],v.idx,k),n=v.displayValue):n=h.formatter(m,v.displayValue,t[v.idx],v.value)}catch(H){n=v.displayValue}"header"===k.groupSummaryPos[v.idx]?
  407. (l+='<tr id="'+m+'"'+(k.groupCollapse&&0<v.idx?' style="display:none;" ':" ")+'role="row" class= "ui-widget-content jqgroup ui-row-'+h.p.direction+" "+r+'"><td style="padding-left:'+12*v.idx+'px;"'+x+">"+p+a.jgrid.template(k.groupText[v.idx],n,v.cnt,v.summary)+"</td>",l+=d(g,0,k.groups,!1===k.groupColumnShow[v.idx]?""===x?2:3:""===x?1:2),l+="</tr>"):l+='<tr id="'+m+'"'+(k.groupCollapse&&0<v.idx?' style="display:none;" ':" ")+'role="row" class= "ui-widget-content jqgroup ui-row-'+h.p.direction+" "+
  408. r+'"><td style="padding-left:'+12*v.idx+'px;" colspan="'+(!1===k.groupColumnShow[v.idx]?e-1:e)+'">'+p+a.jgrid.template(k.groupText[v.idx],n,v.cnt,v.summary)+"</td></tr>";if(u-1===v.idx){var B=k.groups[g+1],D,C=0;D=v.startRow;var F=void 0!==B?B.startRow:k.groups[g].startRow+k.groups[g].cnt;k._locgr&&(C=(c-1)*f,C>v.startRow&&(D=C));for(;D<F&&b[D-C];D++)l+=b[D-C].join("");if("header"!==k.groupSummaryPos[v.idx]){var y;if(void 0!==B){for(y=0;y<k.groupField.length&&B.dataIndex!==k.groupField[y];y++);w=
  409. k.groupField.length-y}for(B=0;B<w;B++)s[B]&&(C="",k.groupCollapse&&!k.showSummaryOnHide&&(C=' style="display:none;"'),l+="<tr"+C+' jqfootlevel="'+(v.idx-B)+'" role="row" class="ui-widget-content jqfoot ui-row-'+h.p.direction+'">',l+=d(g,B,k.groups,0),l+="</tr>");w=y}}});a("#"+a.jgrid.jqID(h.p.id)+" tbody:first").append(l);l=null})},groupingGroupBy:function(b,e){return this.each(function(){"string"===typeof b&&(b=[b]);var c=this.p.groupingView;this.p.grouping=!0;c._locgr=!1;void 0===c.visibiltyOnNextGrouping&&
  410. (c.visibiltyOnNextGrouping=[]);var f;for(f=0;f<c.groupField.length;f++)!c.groupColumnShow[f]&&c.visibiltyOnNextGrouping[f]&&a(this).jqGrid("showCol",c.groupField[f]);for(f=0;f<b.length;f++)c.visibiltyOnNextGrouping[f]=a("#"+a.jgrid.jqID(this.p.id)+"_"+a.jgrid.jqID(b[f])).is(":visible");this.p.groupingView=a.extend(this.p.groupingView,e||{});c.groupField=b;a(this).trigger("reloadGrid")})},groupingRemove:function(b){return this.each(function(){void 0===b&&(b=!0);this.p.grouping=!1;if(!0===b){var e=
  411. this.p.groupingView,c;for(c=0;c<e.groupField.length;c++)!e.groupColumnShow[c]&&e.visibiltyOnNextGrouping[c]&&a(this).jqGrid("showCol",e.groupField);a("tr.jqgroup, tr.jqfoot","#"+a.jgrid.jqID(this.p.id)+" tbody:first").remove();a("tr.jqgrow:hidden","#"+a.jgrid.jqID(this.p.id)+" tbody:first").show()}else a(this).trigger("reloadGrid")})},groupingCalculations:{handler:function(a,e,c,f,g,d){var h={sum:function(){return parseFloat(e||0)+parseFloat(d[c]||0)},min:function(){return""===e?parseFloat(d[c]||
  412. 0):Math.min(parseFloat(e),parseFloat(d[c]||0))},max:function(){return""===e?parseFloat(d[c]||0):Math.max(parseFloat(e),parseFloat(d[c]||0))},count:function(){""===e&&(e=0);return d.hasOwnProperty(c)?e+1:0},avg:function(){return h.sum()}};if(!h[a])throw"jqGrid Grouping No such method: "+a;a=h[a]();null!=f&&("fixed"===g?a=a.toFixed(f):(f=Math.pow(10,f),a=Math.round(a*f)/f));return a}}})})(jQuery);
  413. (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 e=this,c=function(b,c){var f=a(c.xmlGrid.config,b)[0],g=a(c.xmlGrid.data,b)[0],p,m;if(xmlJsonClass.xml2json&&a.jgrid.parse){f=xmlJsonClass.xml2json(f," ");f=a.jgrid.parse(f);for(m in f)f.hasOwnProperty(m)&&(p=f[m]);g?(g=f.grid.datatype,
  414. f.grid.datatype="xmlstring",f.grid.datastr=b,a(e).jqGrid(p).jqGrid("setGridParam",{datatype:g})):a(e).jqGrid(p)}else alert("xml2json or parse are not present")},f=function(b,c){if(b&&"string"===typeof b){var f=!1;a.jgrid.useJSON&&(a.jgrid.useJSON=!1,f=!0);var g=a.jgrid.parse(b);f&&(a.jgrid.useJSON=!0);f=g[c.jsonGrid.config];if(g=g[c.jsonGrid.data]){var p=f.datatype;f.datatype="jsonstring";f.datastr=g;a(e).jqGrid(f).jqGrid("setGridParam",{datatype:p})}else a(e).jqGrid(f)}};switch(b.imptype){case "xml":a.ajax(a.extend({url:b.impurl,
  415. type:b.mtype,data:b.impData,dataType:"xml",complete:function(d,f){"success"===f&&(c(d.responseXML,b),a(e).triggerHandler("jqGridImportComplete",[d,b]),a.isFunction(b.importComplete)&&b.importComplete(d))}},b.ajaxOptions));break;case "xmlstring":if(b.impstring&&"string"===typeof b.impstring){var g=a.parseXML(b.impstring);g&&(c(g,b),a(e).triggerHandler("jqGridImportComplete",[g,b]),a.isFunction(b.importComplete)&&b.importComplete(g),b.impstring=null);g=null}break;case "json":a.ajax(a.extend({url:b.impurl,
  416. type:b.mtype,data:b.impData,dataType:"json",complete:function(c){try{f(c.responseText,b),a(e).triggerHandler("jqGridImportComplete",[c,b]),a.isFunction(b.importComplete)&&b.importComplete(c)}catch(g){}}},b.ajaxOptions));break;case "jsonstring":b.impstring&&"string"===typeof b.impstring&&(f(b.impstring,b),a(e).triggerHandler("jqGridImportComplete",[b.impstring,b]),a.isFunction(b.importComplete)&&b.importComplete(b.impstring),b.impstring=null)}})},jqGridExport:function(b){b=a.extend({exptype:"xmlstring",
  417. root:"grid",ident:"\t"},b||{});var e=null;this.each(function(){if(this.grid){var c,f=a.extend(!0,{},a(this).jqGrid("getGridParam"));f.rownumbers&&(f.colNames.splice(0,1),f.colModel.splice(0,1));f.multiselect&&(f.colNames.splice(0,1),f.colModel.splice(0,1));f.subGrid&&(f.colNames.splice(0,1),f.colModel.splice(0,1));f.knv=null;if(f.treeGrid)for(c in f.treeReader)f.treeReader.hasOwnProperty(c)&&(f.colNames.splice(f.colNames.length-1),f.colModel.splice(f.colModel.length-1));switch(b.exptype){case "xmlstring":e=
  418. "<"+b.root+">"+xmlJsonClass.json2xml(f,b.ident)+"</"+b.root+">";break;case "jsonstring":e="{"+xmlJsonClass.toJson(f,b.root,b.ident,!1)+"}",void 0!==f.postData.filters&&(e=e.replace(/filters":"/,'filters":'),e=e.replace(/}]}"/,"}]}"))}}});return e},excelExport:function(b){b=a.extend({exptype:"remote",url:null,oper:"oper",tag:"excel",exportOptions:{}},b||{});return this.each(function(){if(this.grid){var e;"remote"===b.exptype&&(e=a.extend({},this.p.postData),e[b.oper]=b.tag,e=jQuery.param(e),e=-1!==
  419. b.url.indexOf("?")?b.url+"&"+e:b.url+"?"+e,window.location=e)}})}})})(jQuery);
  420. (function(a){a.jgrid.inlineEdit=a.jgrid.inlineEdit||{};a.jgrid.extend({editRow:function(b,e,c,f,g,d,h,k,l){var p={},m=a.makeArray(arguments).slice(1);"object"===a.type(m[0])?p=m[0]:(void 0!==e&&(p.keys=e),a.isFunction(c)&&(p.oneditfunc=c),a.isFunction(f)&&(p.successfunc=f),void 0!==g&&(p.url=g),void 0!==d&&(p.extraparam=d),a.isFunction(h)&&(p.aftersavefunc=h),a.isFunction(k)&&(p.errorfunc=k),a.isFunction(l)&&(p.afterrestorefunc=l));p=a.extend(!0,{keys:!1,oneditfunc:null,successfunc:null,url:null,
  421. extraparam:{},aftersavefunc:null,errorfunc:null,afterrestorefunc:null,restoreAfterError:!0,mtype:"POST",focusField:!0},a.jgrid.inlineEdit,p);return this.each(function(){var c=this,d,e,f,g=0,h=null,k={},l,m;c.grid&&(l=a(c).jqGrid("getInd",b,!0),!1!==l&&(f=a.isFunction(p.beforeEditRow)?p.beforeEditRow.call(c,p,b):void 0,void 0===f&&(f=!0),f&&(f=a(l).attr("editable")||"0","0"!==f||a(l).hasClass("not-editable-row")||(m=c.p.colModel,a('td[role="gridcell"]',l).each(function(f){d=m[f].name;var l=!0===c.p.treeGrid&&
  422. d===c.p.ExpandColumn;if(l)e=a("span:first",this).html();else try{e=a.unformat.call(c,this,{rowId:b,colModel:m[f]},f)}catch(p){e=m[f].edittype&&"textarea"===m[f].edittype?a(this).text():a(this).html()}if("cb"!==d&&"subgrid"!==d&&"rn"!==d&&(c.p.autoencode&&(e=a.jgrid.htmlDecode(e)),k[d]=e,!0===m[f].editable)){null===h&&(h=f);l?a("span:first",this).html(""):a(this).html("");var t=a.extend({},m[f].editoptions||{},{id:b+"_"+d,name:d,rowId:b});m[f].edittype||(m[f].edittype="text");if("&nbsp;"===e||"&#160;"===
  423. e||1===e.length&&160===e.charCodeAt(0))e="";var x=a.jgrid.createEl.call(c,m[f].edittype,t,e,!0,a.extend({},a.jgrid.ajaxOptions,c.p.ajaxSelectOptions||{}));a(x).addClass("editable");l?a("span:first",this).append(x):a(this).append(x);a.jgrid.bindEv.call(c,x,t);"select"===m[f].edittype&&void 0!==m[f].editoptions&&!0===m[f].editoptions.multiple&&void 0===m[f].editoptions.dataUrl&&a.jgrid.msie&&a(x).width(a(x).width());g++}}),0<g&&(k.id=b,c.p.savedRow.push(k),a(l).attr("editable","1"),p.focusField&&("number"===
  424. typeof p.focusField&&parseInt(p.focusField,10)<=m.length&&(h=p.focusField),setTimeout(function(){var b=a("td:eq("+h+") :input:visible",l).not(":disabled");0<b.length&&b.focus()},0)),!0===p.keys&&a(l).bind("keydown",function(d){if(27===d.keyCode){a(c).jqGrid("restoreRow",b,p.afterrestorefunc);if(c.p._inlinenav)try{a(c).jqGrid("showAddEditButtons")}catch(e){}return!1}if(13===d.keyCode){if("TEXTAREA"===d.target.tagName)return!0;if(a(c).jqGrid("saveRow",b,p)&&c.p._inlinenav)try{a(c).jqGrid("showAddEditButtons")}catch(f){}return!1}}),
  425. a(c).triggerHandler("jqGridInlineEditRow",[b,p]),a.isFunction(p.oneditfunc)&&p.oneditfunc.call(c,b))))))})},saveRow:function(b,e,c,f,g,d,h){var k=a.makeArray(arguments).slice(1),l={};"object"===a.type(k[0])?l=k[0]:(a.isFunction(e)&&(l.successfunc=e),void 0!==c&&(l.url=c),void 0!==f&&(l.extraparam=f),a.isFunction(g)&&(l.aftersavefunc=g),a.isFunction(d)&&(l.errorfunc=d),a.isFunction(h)&&(l.afterrestorefunc=h));var l=a.extend(!0,{successfunc:null,url:null,extraparam:{},aftersavefunc:null,errorfunc:null,
  426. afterrestorefunc:null,restoreAfterError:!0,mtype:"POST",saveui:"enable",savetext:a.jgrid.defaults.savetext||"Saving..."},a.jgrid.inlineEdit,l),p=!1,m=this[0],r,q={},n={},t={},u,w,s;if(!m.grid)return p;s=a(m).jqGrid("getInd",b,!0);if(!1===s)return p;k=a.isFunction(l.beforeSaveRow)?l.beforeSaveRow.call(m,l,b):void 0;void 0===k&&(k=!0);if(k){k=a(s).attr("editable");l.url=l.url||m.p.editurl;if("1"===k){var x;a('td[role="gridcell"]',s).each(function(b){x=m.p.colModel[b];r=x.name;if("cb"!==r&&"subgrid"!==
  427. r&&!0===x.editable&&"rn"!==r&&!a(this).hasClass("not-editable-cell")){switch(x.edittype){case "checkbox":var c=["Yes","No"];x.editoptions&&(c=x.editoptions.value.split(":"));q[r]=a("input",this).is(":checked")?c[0]:c[1];break;case "text":case "password":case "textarea":case "button":q[r]=a("input, textarea",this).val();break;case "select":if(x.editoptions.multiple){var c=a("select",this),d=[];q[r]=a(c).val();q[r]=q[r]?q[r].join(","):"";a("select option:selected",this).each(function(b,c){d[b]=a(c).text()});
  428. n[r]=d.join(",")}else q[r]=a("select option:selected",this).val(),n[r]=a("select option:selected",this).text();x.formatter&&"select"===x.formatter&&(n={});break;case "custom":try{if(x.editoptions&&a.isFunction(x.editoptions.custom_value)){if(q[r]=x.editoptions.custom_value.call(m,a(".customelement",this),"get"),void 0===q[r])throw"e2";}else throw"e1";}catch(e){"e1"===e&&a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose),"e2"===e?a.jgrid.info_dialog(a.jgrid.errors.errcap,
  429. "function 'custom_value' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):a.jgrid.info_dialog(a.jgrid.errors.errcap,e.message,a.jgrid.edit.bClose)}}w=a.jgrid.checkValues.call(m,q[r],b);if(!1===w[0])return!1;m.p.autoencode&&(q[r]=a.jgrid.htmlEncode(q[r]));"clientArray"!==l.url&&x.editoptions&&!0===x.editoptions.NullIfEmpty&&""===q[r]&&(t[r]="null")}});if(!1===w[0]){try{var A=a(m).jqGrid("getGridRowById",b),v=a.jgrid.findPos(A);a.jgrid.info_dialog(a.jgrid.errors.errcap,w[1],a.jgrid.edit.bClose,{left:v[0],
  430. top:v[1]+a(A).outerHeight()})}catch(H){alert(w[1])}return p}k=m.p.prmNames;A=b;v=!1===m.p.keyName?k.id:m.p.keyName;q&&(q[k.oper]=k.editoper,void 0===q[v]||""===q[v]?q[v]=b:s.id!==m.p.idPrefix+q[v]&&(k=a.jgrid.stripPref(m.p.idPrefix,b),void 0!==m.p._index[k]&&(m.p._index[q[v]]=m.p._index[k],delete m.p._index[k]),b=m.p.idPrefix+q[v],a(s).attr("id",b),m.p.selrow===A&&(m.p.selrow=b),a.isArray(m.p.selarrrow)&&(k=a.inArray(A,m.p.selarrrow),0<=k&&(m.p.selarrrow[k]=b)),m.p.multiselect&&(k="jqg_"+m.p.id+"_"+
  431. b,a("input.cbox",s).attr("id",k).attr("name",k))),void 0===m.p.inlineData&&(m.p.inlineData={}),q=a.extend({},q,m.p.inlineData,l.extraparam));if("clientArray"===l.url){q=a.extend({},q,n);m.p.autoencode&&a.each(q,function(b,c){q[b]=a.jgrid.htmlDecode(c)});k=a(m).jqGrid("setRowData",b,q);a(s).attr("editable","0");for(v=0;v<m.p.savedRow.length;v++)if(String(m.p.savedRow[v].id)===String(A)){u=v;break}0<=u&&m.p.savedRow.splice(u,1);a(m).triggerHandler("jqGridInlineAfterSaveRow",[b,k,q,l]);a.isFunction(l.aftersavefunc)&&
  432. l.aftersavefunc.call(m,b,k,q,l);p=!0;a(s).removeClass("jqgrid-new-row").unbind("keydown")}else a(m).jqGrid("progressBar",{method:"show",loadtype:l.saveui,htmlcontent:l.savetext}),t=a.extend({},q,t),t[v]=a.jgrid.stripPref(m.p.idPrefix,t[v]),a.ajax(a.extend({url:l.url,data:a.isFunction(m.p.serializeRowData)?m.p.serializeRowData.call(m,t):t,type:l.mtype,async:!1,complete:function(c,d){a(m).jqGrid("progressBar",{method:"hide",loadtype:l.saveui,htmlcontent:l.savetext});if("success"===d){var e=!0,f;f=a(m).triggerHandler("jqGridInlineSuccessSaveRow",
  433. [c,b,l]);a.isArray(f)||(f=[!0,q]);f[0]&&a.isFunction(l.successfunc)&&(f=l.successfunc.call(m,c));a.isArray(f)?(e=f[0],q=f[1]||q):e=f;if(!0===e){m.p.autoencode&&a.each(q,function(b,c){q[b]=a.jgrid.htmlDecode(c)});q=a.extend({},q,n);a(m).jqGrid("setRowData",b,q);a(s).attr("editable","0");for(e=0;e<m.p.savedRow.length;e++)if(String(m.p.savedRow[e].id)===String(b)){u=e;break}0<=u&&m.p.savedRow.splice(u,1);a(m).triggerHandler("jqGridInlineAfterSaveRow",[b,c,q,l]);a.isFunction(l.aftersavefunc)&&l.aftersavefunc.call(m,
  434. b,c,q,l);p=!0;a(s).removeClass("jqgrid-new-row").unbind("keydown")}else a(m).triggerHandler("jqGridInlineErrorSaveRow",[b,c,d,null,l]),a.isFunction(l.errorfunc)&&l.errorfunc.call(m,b,c,d,null),!0===l.restoreAfterError&&a(m).jqGrid("restoreRow",b,l.afterrestorefunc)}},error:function(c,d,e){a("#lui_"+a.jgrid.jqID(m.p.id)).hide();a(m).triggerHandler("jqGridInlineErrorSaveRow",[b,c,d,e,l]);if(a.isFunction(l.errorfunc))l.errorfunc.call(m,b,c,d,e);else{c=c.responseText||c.statusText;try{a.jgrid.info_dialog(a.jgrid.errors.errcap,
  435. '<div class="ui-state-error">'+c+"</div>",a.jgrid.edit.bClose,{buttonalign:"right"})}catch(f){alert(c)}}!0===l.restoreAfterError&&a(m).jqGrid("restoreRow",b,l.afterrestorefunc)}},a.jgrid.ajaxOptions,m.p.ajaxRowOptions||{}))}return p}},restoreRow:function(b,e){var c=a.makeArray(arguments).slice(1),f={};"object"===a.type(c[0])?f=c[0]:a.isFunction(e)&&(f.afterrestorefunc=e);f=a.extend(!0,{},a.jgrid.inlineEdit,f);return this.each(function(){var c=this,d=-1,e,k={},l;if(c.grid&&(e=a(c).jqGrid("getInd",
  436. b,!0),!1!==e&&(l=a.isFunction(f.beforeCancelRow)?f.beforeCancelRow.call(c,f,b):void 0,void 0===l&&(l=!0),l))){for(l=0;l<c.p.savedRow.length;l++)if(String(c.p.savedRow[l].id)===String(b)){d=l;break}if(0<=d){if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker","#"+a.jgrid.jqID(e.id)).datepicker("hide")}catch(p){}a.each(c.p.colModel,function(){!0===this.editable&&c.p.savedRow[d].hasOwnProperty(this.name)&&(k[this.name]=c.p.savedRow[d][this.name])});a(c).jqGrid("setRowData",b,k);a(e).attr("editable",
  437. "0").unbind("keydown");c.p.savedRow.splice(d,1);a("#"+a.jgrid.jqID(b),"#"+a.jgrid.jqID(c.p.id)).hasClass("jqgrid-new-row")&&setTimeout(function(){a(c).jqGrid("delRowData",b);a(c).jqGrid("showAddEditButtons")},0)}a(c).triggerHandler("jqGridInlineAfterRestoreRow",[b]);a.isFunction(f.afterrestorefunc)&&f.afterrestorefunc.call(c,b)}})},addRow:function(b){b=a.extend(!0,{rowID:null,initdata:{},position:"first",useDefValues:!0,useFormatter:!1,addRowParams:{extraparam:{}}},b||{});return this.each(function(){if(this.grid){var e=
  438. this,c=a.isFunction(b.beforeAddRow)?b.beforeAddRow.call(e,b.addRowParams):void 0;void 0===c&&(c=!0);c&&(b.rowID=a.isFunction(b.rowID)?b.rowID.call(e,b):null!=b.rowID?b.rowID:a.jgrid.randId(),!0===b.useDefValues&&a(e.p.colModel).each(function(){if(this.editoptions&&this.editoptions.defaultValue){var c=this.editoptions.defaultValue,c=a.isFunction(c)?c.call(e):c;b.initdata[this.name]=c}}),a(e).jqGrid("addRowData",b.rowID,b.initdata,b.position),b.rowID=e.p.idPrefix+b.rowID,a("#"+a.jgrid.jqID(b.rowID),
  439. "#"+a.jgrid.jqID(e.p.id)).addClass("jqgrid-new-row"),b.useFormatter?a("#"+a.jgrid.jqID(b.rowID)+" .ui-inline-edit","#"+a.jgrid.jqID(e.p.id)).click():(c=e.p.prmNames,b.addRowParams.extraparam[c.oper]=c.addoper,a(e).jqGrid("editRow",b.rowID,b.addRowParams),a(e).jqGrid("setSelection",b.rowID)))}})},inlineNav:function(b,e){e=a.extend(!0,{edit:!0,editicon:"ui-icon-pencil",add:!0,addicon:"ui-icon-plus",save:!0,saveicon:"ui-icon-disk",cancel:!0,cancelicon:"ui-icon-cancel",addParams:{addRowParams:{extraparam:{}}},
  440. editParams:{},restoreAfterSelect:!0},a.jgrid.nav,e||{});return this.each(function(){if(this.grid){var c=this,f,g=a.jgrid.jqID(c.p.id);c.p._inlinenav=!0;if(!0===e.addParams.useFormatter){var d=c.p.colModel,h;for(h=0;h<d.length;h++)if(d[h].formatter&&"actions"===d[h].formatter){d[h].formatoptions&&(d=a.extend({keys:!1,onEdit:null,onSuccess:null,afterSave:null,onError:null,afterRestore:null,extraparam:{},url:null},d[h].formatoptions),e.addParams.addRowParams={keys:d.keys,oneditfunc:d.onEdit,successfunc:d.onSuccess,
  441. url:d.url,extraparam:d.extraparam,aftersavefunc:d.afterSave,errorfunc:d.onError,afterrestorefunc:d.afterRestore});break}}e.add&&a(c).jqGrid("navButtonAdd",b,{caption:e.addtext,title:e.addtitle,buttonicon:e.addicon,id:c.p.id+"_iladd",onClickButton:function(){a(c).jqGrid("addRow",e.addParams);e.addParams.useFormatter||(a("#"+g+"_ilsave").removeClass("ui-state-disabled"),a("#"+g+"_ilcancel").removeClass("ui-state-disabled"),a("#"+g+"_iladd").addClass("ui-state-disabled"),a("#"+g+"_iledit").addClass("ui-state-disabled"))}});
  442. e.edit&&a(c).jqGrid("navButtonAdd",b,{caption:e.edittext,title:e.edittitle,buttonicon:e.editicon,id:c.p.id+"_iledit",onClickButton:function(){var b=a(c).jqGrid("getGridParam","selrow");b?(a(c).jqGrid("editRow",b,e.editParams),a("#"+g+"_ilsave").removeClass("ui-state-disabled"),a("#"+g+"_ilcancel").removeClass("ui-state-disabled"),a("#"+g+"_iladd").addClass("ui-state-disabled"),a("#"+g+"_iledit").addClass("ui-state-disabled")):(a.jgrid.viewModal("#alertmod",{gbox:"#gbox_"+g,jqm:!0}),a("#jqg_alrt").focus())}});
  443. e.save&&(a(c).jqGrid("navButtonAdd",b,{caption:e.savetext||"",title:e.savetitle||"Save row",buttonicon:e.saveicon,id:c.p.id+"_ilsave",onClickButton:function(){var b=c.p.savedRow[0].id;if(b){var d=c.p.prmNames,f=d.oper,h=e.editParams;a("#"+a.jgrid.jqID(b),"#"+g).hasClass("jqgrid-new-row")?(e.addParams.addRowParams.extraparam[f]=d.addoper,h=e.addParams.addRowParams):(e.editParams.extraparam||(e.editParams.extraparam={}),e.editParams.extraparam[f]=d.editoper);a(c).jqGrid("saveRow",b,h)&&a(c).jqGrid("showAddEditButtons")}else a.jgrid.viewModal("#alertmod",
  444. {gbox:"#gbox_"+g,jqm:!0}),a("#jqg_alrt").focus()}}),a("#"+g+"_ilsave").addClass("ui-state-disabled"));e.cancel&&(a(c).jqGrid("navButtonAdd",b,{caption:e.canceltext||"",title:e.canceltitle||"Cancel row editing",buttonicon:e.cancelicon,id:c.p.id+"_ilcancel",onClickButton:function(){var b=c.p.savedRow[0].id,d=e.editParams;b?(a("#"+a.jgrid.jqID(b),"#"+g).hasClass("jqgrid-new-row")&&(d=e.addParams.addRowParams),a(c).jqGrid("restoreRow",b,d),a(c).jqGrid("showAddEditButtons")):(a.jgrid.viewModal("#alertmod",
  445. {gbox:"#gbox_"+g,jqm:!0}),a("#jqg_alrt").focus())}}),a("#"+g+"_ilcancel").addClass("ui-state-disabled"));!0===e.restoreAfterSelect&&(f=a.isFunction(c.p.beforeSelectRow)?c.p.beforeSelectRow:!1,c.p.beforeSelectRow=function(b,d){var g=!0;0<c.p.savedRow.length&&!0===c.p._inlinenav&&b!==c.p.selrow&&null!==c.p.selrow&&(c.p.selrow===e.addParams.rowID?a(c).jqGrid("delRowData",c.p.selrow):a(c).jqGrid("restoreRow",c.p.selrow,e.editParams),a(c).jqGrid("showAddEditButtons"));f&&(g=f.call(c,b,d));return g})}})},
  446. showAddEditButtons:function(){return this.each(function(){if(this.grid){var b=a.jgrid.jqID(this.p.id);a("#"+b+"_ilsave").addClass("ui-state-disabled");a("#"+b+"_ilcancel").addClass("ui-state-disabled");a("#"+b+"_iladd").removeClass("ui-state-disabled");a("#"+b+"_iledit").removeClass("ui-state-disabled")}})}})})(jQuery);
  447. (function(a){a.jgrid.msie&&8===a.jgrid.msiever()&&(a.expr[":"].hidden=function(a){return 0===a.offsetWidth||0===a.offsetHeight||"none"===a.style.display});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(e,c){var f=b.call(this,e,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}}a.ui.multiselect.prototype.destroy&&
  448. (a.ui.multiselect.prototype.destroy=function(){this.element.show();this.container.remove();void 0===a.Widget?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=a.jgrid.jqID(f.p.id),g={tolerance:"pointer",axis:"x",scrollSensitivity:"1",items:">th:not(:has(#jqgh_"+g+"_cb,#jqgh_"+g+"_rn,#jqgh_"+g+"_subgrid),:hidden)",
  449. placeholder:{element:function(b){return a(document.createElement(b[0].nodeName)).addClass(b[0].className+" 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,
  450. c){var d=a(c.item).parent(),d=a(">th",d),e={},g=f.p.id+"_";a.each(f.p.colModel,function(a){e[this.name]=a});var r=[];d.each(function(){var b=a(">div",this).get(0).id.replace(/^jqgh_/,"").replace(g,"");e.hasOwnProperty(b)&&r.push(e[b])});a(f).jqGrid("remapColumns",r,!0,!0);a.isFunction(f.p.sortable.update)&&f.p.sortable.update(r);setTimeout(function(){f.p.disableClick=!1},50)}};f.p.sortable.options?a.extend(g,f.p.sortable.options):a.isFunction(f.p.sortable)&&(f.p.sortable={update:f.p.sortable});if(g.start){var d=
  451. g.start;g.start=function(a,b){c();d.call(this,a,b)}}else g.start=c;f.p.sortable.exclude&&(g.items+=":not("+f.p.sortable.exclude+")");g=b.sortable(g);g=g.data("sortable")||g.data("uiSortable");null!=g&&(g.data("sortable").floating=!0)})},columnChooser:function(b){function c(b,c){b&&("string"===typeof b?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,g,d,h={},k=[],l,p,m=f.jqGrid("getGridParam","colModel"),r=f.jqGrid("getGridParam",
  452. "colNames"),q=function(b){return a.ui.multiselect.prototype&&b.data(a.ui.multiselect.prototype.widgetFullName||a.ui.multiselect.prototype.widgetName)||b.data("ui-multiselect")||b.data("multiselect")};if(!a("#colchooser_"+a.jgrid.jqID(f[0].p.id)).length){g=a('<div id="colchooser_'+f[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>');d=a("select",g);b=a.extend({width:400,height:240,classname:null,done:function(a){a&&f.jqGrid("remapColumns",
  453. a,!0)},msel:"multiselect",dlog:"dialog",dialog_opts:{minWidth:470,dialogClass:"ui-jqdialog"},dlog_opts:function(b){var c={};c[b.bSubmit]=function(){b.apply_perm();b.cleanup(!1)};c[b.bCancel]=function(){b.cleanup(!0)};return a.extend(!0,{buttons:c,close:function(){b.cleanup(!0)},modal:b.modal||!1,resizable:b.resizable||!0,width:b.width+70,resize:function(){var a=q(d),b=a.container.closest(".ui-dialog-content");0<b.length&&"object"===typeof b[0].style?b[0].style.width="":b.css("width","");a.selectedList.height(Math.max(a.selectedContainer.height()-
  454. a.selectedActions.outerHeight()-1,1));a.availableList.height(Math.max(a.availableContainer.height()-a.availableActions.outerHeight()-1,1))}},b.dialog_opts||{})},apply_perm:function(){var c=[];a("option",d).each(function(){a(this).is("[selected]")?f.jqGrid("showCol",m[this.value].name):f.jqGrid("hideCol",m[this.value].name)});a("option[selected]",d).each(function(){c.push(parseInt(this.value,10))});a.each(c,function(){delete h[m[parseInt(this,10)].name]});a.each(h,function(){var a=parseInt(this,10);
  455. var b=c,d=a,e,f;0<=d?(e=b.slice(),f=e.splice(d,Math.max(b.length-d,d)),d>b.length&&(d=b.length),e[d]=a,c=e.concat(f)):c=b});b.done&&b.done.call(f,c);f.jqGrid("setGridWidth",f[0].p.tblwidth,f[0].p.shrinkToFit)},cleanup:function(a){c(b.dlog,g,"destroy");c(b.msel,d,"destroy");g.remove();a&&b.done&&b.done.call(f)},msel_opts:{}},a.jgrid.col,b||{});if(a.ui&&a.ui.multiselect&&a.ui.multiselect.defaults){if(!a.jgrid._multiselect){alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");
  456. 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),d.addClass(b.classname));b.width&&(a(">div",g).css({width:b.width,margin:"0 auto"}),d.css("width",b.width));b.height&&(a(">div",g).css("height",b.height),d.css("height",b.height-10));d.empty();a.each(m,function(b){h[this.name]=b;this.hidedlg?this.hidden||k.push(b):d.append("<option value='"+b+"' "+(this.hidden?"":"selected='selected'")+">"+a.jgrid.stripHtml(r[b])+
  457. "</option>")});l=a.isFunction(b.dlog_opts)?b.dlog_opts.call(f,b):b.dlog_opts;c(b.dlog,g,l);l=a.isFunction(b.msel_opts)?b.msel_opts.call(f,b):b.msel_opts;c(b.msel,d,l);l=a("#colchooser_"+a.jgrid.jqID(f[0].p.id));l.css({margin:"auto"});l.find(">div").css({width:"100%",height:"100%",margin:"auto"});l=q(d);l.container.css({width:"100%",height:"100%",margin:"auto"});l.selectedContainer.css({width:100*l.options.dividerLocation+"%",height:"100%",margin:"auto",boxSizing:"border-box"});l.availableContainer.css({width:100-
  458. 100*l.options.dividerLocation+"%",height:"100%",margin:"auto",boxSizing:"border-box"});l.selectedList.css("height","auto");l.availableList.css("height","auto");p=Math.max(l.selectedList.height(),l.availableList.height());p=Math.min(p,a(window).height());l.selectedList.css("height",p);l.availableList.css("height",p)}},sortableRows:function(b){return this.each(function(){var c=this;c.grid&&!c.p.treeGrid&&a.fn.sortable&&(b=a.extend({cursor:"move",axis:"y",items:".jqgrow"},b||{}),b.start&&a.isFunction(b.start)?
  459. (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","0");a("td",g.item).each(function(a){this.style.width=c.grid.cols[a].style.width});if(c.p.subGrid){var d=a(g.item).attr("id");try{a(c).jqGrid("collapseSubGridRow",d)}catch(h){}}b._start_&&b._start_.apply(this,[f,g])},b.update=function(f,g){a(g.item).css("border-width","");!0===c.p.rownumbers&&a("td.jqgrid-rownum",c.rows).each(function(b){a(this).html(b+
  460. 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,g,d;if(f.grid&&!f.p.treeGrid&&a.fn.draggable&&a.fn.droppable)if(void 0===a("#jqgrid_dnd")[0]&&a("body").append("<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>"),
  461. "string"===typeof b&&"updateDnD"===b&&!0===f.p.jqgdnd)c();else if(b=a.extend({drag:function(b){return a.extend({start:function(c,d){var e;if(f.p.subGrid){e=a(d.helper).attr("id");try{a(f).jqGrid("collapseSubGridRow",e)}catch(g){}}for(e=0;e<a.data(f,"dnd").connectWith.length;e++)0===a(a.data(f,"dnd").connectWith[e]).jqGrid("getGridParam","reccount")&&a(a.data(f,"dnd").connectWith[e]).jqGrid("addRowData","jqg_empty_row",{});d.helper.addClass("ui-state-highlight");a("td",d.helper).each(function(a){this.style.width=
  462. f.grid.headers[a].width+"px"});b.onstart&&a.isFunction(b.onstart)&&b.onstart.call(a(f),c,d)},stop:function(c,d){var e;d.helper.dropped&&!b.dragcopy&&(e=a(d.helper).attr("id"),void 0===e&&(e=a(this).attr("id")),a(f).jqGrid("delRowData",e));for(e=0;e<a.data(f,"dnd").connectWith.length;e++)a(a.data(f,"dnd").connectWith[e]).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;
  463. b=a(b).closest("table.ui-jqgrid-btable");return 0<b.length&&void 0!==a.data(b[0],"dnd")?(b=a.data(b[0],"dnd").connectWith,-1!==a.inArray("#"+a.jgrid.jqID(this.id),b)?!0:!1):!1},drop:function(c,d){if(a(d.draggable).hasClass("jqgrow")){var e=a(d.draggable).attr("id"),e=d.draggable.parent().parent().jqGrid("getRowData",e);if(!b.dropbyname){var g=0,r={},q,n,t=a("#"+a.jgrid.jqID(this.id)).jqGrid("getGridParam","colModel");try{for(n in e)e.hasOwnProperty(n)&&(q=t[g].name,"cb"!==q&&"rn"!==q&&"subgrid"!==
  464. q&&e.hasOwnProperty(n)&&t[g]&&(r[q]=e[n]),g++);e=r}catch(u){}}d.helper.dropped=!0;b.beforedrop&&a.isFunction(b.beforedrop)&&(q=b.beforedrop.call(this,c,d,e,a("#"+a.jgrid.jqID(f.p.id)),a(this)),void 0!==q&&null!==q&&"object"===typeof q&&(e=q));if(d.helper.dropped){var w;b.autoid&&(a.isFunction(b.autoid)?w=b.autoid.call(this,e):(w=Math.ceil(1E3*Math.random()),w=b.autoidprefix+w));a("#"+a.jgrid.jqID(this.id)).jqGrid("addRowData",w,e,b.droppos)}b.ondrop&&a.isFunction(b.ondrop)&&b.ondrop.call(this,c,d,
  465. e)}}},b.drop_opts||{})},onstart:null,onstop:null,beforedrop:null,ondrop:null,drop_opts:{activeClass:"ui-state-active",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)for(b.connectWith=b.connectWith.split(","),b.connectWith=a.map(b.connectWith,function(b){return a.trim(b)}),a.data(f,"dnd",b),0===f.p.reccount||f.p.jqgdnd||c(),f.p.jqgdnd=
  466. !0,g=0;g<b.connectWith.length;g++)d=b.connectWith[g],a(d).droppable(a.isFunction(b.drop)?b.drop.call(a(f),b):b.drop)})},gridResize:function(b){return this.each(function(){var c=this,f=a.jgrid.jqID(c.p.id);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(g,d){a(c).jqGrid("setGridParam",{height:a("#gview_"+f+" .ui-jqgrid-bdiv").height()});
  467. a(c).jqGrid("setGridWidth",d.size.width,b.shrinkToFit);b._stop_&&b._stop_.call(c,g,d)},b.alsoResize=b._alsoResize_?eval("("+("{'#gview_"+f+" .ui-jqgrid-bdiv':true,'"+b._alsoResize_+"':true}")+")"):a(".ui-jqgrid-bdiv","#gview_"+f),delete b._alsoResize_,a("#gbox_"+f).resizable(b))})}})})(jQuery);
  468. (function(a){function b(a,b){var f,g,d=[],h;if(!this||"function"!==typeof a||a instanceof RegExp)throw new TypeError;h=this.length;for(f=0;f<h;f++)if(this.hasOwnProperty(f)&&(g=this[f],a.call(b,g,f,this))){d.push(g);break}return d}a.assocArraySize=function(a){var b=0,f;for(f in a)a.hasOwnProperty(f)&&b++;return b};a.jgrid.extend({pivotSetup:function(e,c){var f=[],g=[],d=[],h=[],k=[],l={grouping:!0,groupingView:{groupField:[],groupSummary:[],groupSummaryPos:[]}},p=[],m=a.extend({rowTotals:!1,rowTotalsText:"Total",
  469. colTotals:!1,groupSummary:!0,groupSummaryPos:"header",frozenStaticCols:!1},c||{});this.each(function(){function c(a,d,e){a=b.call(a,d,e);return 0<a.length?a[0]:null}function q(a,b){var c=0,d=!0,e;for(e in a){if(a[e]!=this[c]){d=!1;break}c++;if(c>=this.length)break}d&&(w=b);return d}function n(b,c,d,e){var f=c.length,g,l,m,n,p="",q=[];a.isArray(d)?(n=d.length,q=d):(n=1,q[0]=d);h=[];k=[];for(m=h.root=0;m<n;m++){var r=[],s;for(g=0;g<f;g++){if(null==d)s=l=a.trim(c[g].member)+"_"+c[g].aggregator,q[0]=
  470. s;else{s=d[m].replace(/\s+/g,"");try{l=1===f?p+s:p+s+"_"+c[g].aggregator+"_"+String(g)}catch(t){}}var u=l=isNaN(parseInt(l,10))?l:l+" ",v=r,x=l,w=e[l],y=c[g].member,A=b,z=void 0;switch(c[g].aggregator){case "sum":z=parseFloat(w||0)+parseFloat(A[y]||0);break;case "count":if(""===w||null==w)w=0;z=A.hasOwnProperty(y)?w+1:0;break;case "min":z=""===w||null==w?parseFloat(A[y]||0):Math.min(parseFloat(w),parseFloat(A[y]||0));break;case "max":z=""===w||null==w?parseFloat(A[y]||0):Math.max(parseFloat(w),parseFloat(A[y]||
  471. 0))}e[u]=v[x]=z;1>=m&&"_r_Totals"!==s&&""===p&&(p=s)}h[l]=r;k[l]=q[m]}return e}function t(a){var b,c,d,e,g;for(d in a)if(a.hasOwnProperty(d)){if("object"!==typeof a[d]){if("level"===d){void 0===Q[a.level]&&(Q[a.level]="",0<a.level&&"_r_Totals"!==a.text&&(p[a.level-1]={useColSpanStyle:!1,groupHeaders:[]}));if(Q[a.level]!==a.text&&a.children.length&&"_r_Totals"!==a.text&&0<a.level){p[a.level-1].groupHeaders.push({titleText:a.label,numberOfColumns:0});c=p[a.level-1].groupHeaders.length-1;g=0===c?X:V+
  472. H;if(a.level-1===(m.rowTotals?1:0)&&0<c){var h=p[a.level-1].groupHeaders[c-1].numberOfColumns;h&&(g=h+1+m.aggregates.length)}p[a.level-1].groupHeaders[c].startColumnName=f[g].name;p[a.level-1].groupHeaders[c].numberOfColumns=f.length-g;V=f.length}Q[a.level]=a.text}if(a.level===v&&"level"===d&&0<v)if(1<H){c=1;for(b in a.fields)1===c&&p[v-1].groupHeaders.push({startColumnName:b,numberOfColumns:1,titleText:a.text}),c++;p[v-1].groupHeaders[p[v-1].groupHeaders.length-1].numberOfColumns=c-1}else p.splice(v-
  473. 1,1)}null!=a[d]&&"object"===typeof a[d]&&t(a[d]);if("level"===d&&0<a.level)for(b in c=0,a.fields)if(a.fields.hasOwnProperty(b)){g={};for(e in m.aggregates[c])if(m.aggregates[c].hasOwnProperty(e))switch(e){case "member":case "label":case "aggregator":break;default:g[e]=m.aggregates[c][e]}1<H?(g.name=b,g.label=m.aggregates[c].label||a.label):(g.name=a.text,g.label="_r_Totals"===a.text?m.rowTotalsText:a.label);f.push(g);c++}}}var u,w,s,x=e.length,A,v,H,B,D=0;m.rowTotals&&0<m.yDimension.length&&(m.yDimension.splice(0,
  474. 0,{dataName:m.yDimension[0].dataName}),m.yDimension[0].converter=function(){return"_r_Totals"});A=a.isArray(m.xDimension)?m.xDimension.length:0;v=m.yDimension.length;H=a.isArray(m.aggregates)?m.aggregates.length:0;if(0===A||0===H)throw"xDimension or aggregates optiona are not set!";var C;for(s=0;s<A;s++)C={name:m.xDimension[s].dataName,frozen:m.frozenStaticCols},null==m.xDimension[s].isGroupField&&(m.xDimension[s].isGroupField=!0),C=a.extend(!0,C,m.xDimension[s]),f.push(C);C=A-1;for(var F={};D<x;){u=
  475. e[D];var y=[],O=[];B={};s=0;do y[s]=a.trim(u[m.xDimension[s].dataName]),B[m.xDimension[s].dataName]=y[s],s++;while(s<A);var z=0;w=-1;s=c(g,q,y);if(!s){z=0;if(1<=v){for(z=0;z<v;z++)O[z]=a.trim(u[m.yDimension[z].dataName]),m.yDimension[z].converter&&a.isFunction(m.yDimension[z].converter)&&(O[z]=m.yDimension[z].converter.call(this,O[z],y,O));B=n(u,m.aggregates,O,B)}else 0===v&&(B=n(u,m.aggregates,null,B));g.push(B)}else if(0<=w){z=0;if(1<=v){for(z=0;z<v;z++)O[z]=a.trim(u[m.yDimension[z].dataName]),
  476. m.yDimension[z].converter&&a.isFunction(m.yDimension[z].converter)&&(O[z]=m.yDimension[z].converter.call(this,O[z],y,O));s=n(u,m.aggregates,O,s)}else 0===v&&(s=n(u,m.aggregates,null,s));g[w]=s}u=0;var y=B=null,L;for(L in h)if(h.hasOwnProperty(L)){if(0===u)F.children&&void 0!==F.children||(F={text:L,level:0,children:[],label:L}),B=F.children;else{y=null;for(s=0;s<B.length;s++)if(B[s].text===L){y=B[s];break}y?B=y.children:(B.push({children:[],text:L,level:u,fields:h[L],label:k[L]}),B=B[B.length-1].children)}u++}D++}var Q=
  477. [],V=f.length,X=V;0<v&&(p[v-1]={useColSpanStyle:!1,groupHeaders:[]});t(F);if(m.colTotals)for(D=g.length;D--;)for(s=A;s<f.length;s++)x=f[s].name,d[x]=d[x]?d[x]+parseFloat(g[D][x]||0):parseFloat(g[D][x]||0);if(0<C)for(s=0;s<C;s++)f[s].isGroupField&&(l.groupingView.groupField.push(f[s].name),l.groupingView.groupSummary.push(m.groupSummary),l.groupingView.groupSummaryPos.push(m.groupSummaryPos));else l.grouping=!1;l.sortname=f[C].name;l.groupingView.hideFirstGroupCol=!0});return{colModel:f,rows:g,groupOptions:l,
  478. groupHeaders:p,summary:d}},jqPivot:function(b,c,f,g){return this.each(function(){function d(b){var d=jQuery(h).jqGrid("pivotSetup",b,c),e=0<a.assocArraySize(d.summary)?!0:!1,g=a.jgrid.from(d.rows);for(b=0;b<d.groupOptions.groupingView.groupField.length;b++)g.orderBy(d.groupOptions.groupingView.groupField[b],"a","text","");jQuery(h).jqGrid(a.extend(!0,{datastr:a.extend(g.select(),e?{userdata:d.summary}:{}),datatype:"jsonstring",footerrow:e,userDataOnFooter:e,colModel:d.colModel,viewrecords:!0,sortname:c.xDimension[0].dataName},
  479. d.groupOptions,f||{}));d=d.groupHeaders;if(d.length)for(b=0;b<d.length;b++)d[b]&&d[b].groupHeaders.length&&jQuery(h).jqGrid("setGroupHeaders",d[b]);c.frozenStaticCols&&jQuery(h).jqGrid("setFrozenColumns")}var h=this;"string"===typeof b?a.ajax(a.extend({url:b,dataType:"json",success:function(b){d(a.jgrid.getAccessor(b,g&&g.reader?g.reader:"rows"))}},g||{})):d(b)})}})})(jQuery);
  480. (function(a){a.jgrid.extend({setSubGrid:function(){return this.each(function(){var b,e;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,selectOnCollapse:!1,reloadOnExpand:!0},this.p.subGridOptions||{});this.p.colNames.unshift("");this.p.colModel.unshift({name:"subgrid",width:a.jgrid.cell_width?this.p.subGridWidth+this.p.cellLayout:this.p.subGridWidth,sortable:!1,resizable:!1,hidedlg:!0,
  481. search:!1,fixed:!0});b=this.p.subGridModel;if(b[0])for(b[0].align=a.extend([],b[0].align||[]),e=0;e<b[0].name.length;e++)b[0].align[e]=b[0].align[e]||"left"})},addSubGridCell:function(a,e){var c="",f,g;this.each(function(){c=this.formatCol(a,e);g=this.p.id;f=this.p.subGridOptions.plusicon});return'<td role="gridcell" aria-describedby="'+g+'_subgrid" class="ui-sgcollapsed sgcollapsed" '+c+"><a style='cursor:pointer;'><span class='ui-icon "+f+"'></span></a></td>"},addSubGrid:function(b,e){return this.each(function(){var c=
  482. this;if(c.grid){var f=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,g,h,k=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),l=a("<tr></tr>");for(g=0;g<c.p.subGridModel[0].name.length;g++)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[g]),a(e).width(c.p.subGridModel[0].width[g]),a(l).append(e);a(k).append(l);b&&(h=c.p.xmlReader.subgrid,
  483. a(h.root+" "+h.row,b).each(function(){l=a("<tr class='ui-widget-content ui-subtblcell'></tr>");if(!0===h.repeatitems)a(h.cell,this).each(function(b){f(l,a(this).text()||"&#160;",b)});else{var b=c.p.subGridModel[0].mapping||c.p.subGridModel[0].name;if(b)for(g=0;g<b.length;g++)f(l,a(b[g],this).text()||"&#160;",g)}a(k).append(l)}));e=a("table:first",c.grid.bDiv).attr("id")+"_";a("#"+a.jgrid.jqID(e+d)).append(k);c.grid.hDiv.loading=!1;a("#load_"+a.jgrid.jqID(c.p.id)).hide();return!1},d=function(b,d){var e,
  484. g,h,k,l,m=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),n=a("<tr></tr>");for(g=0;g<c.p.subGridModel[0].name.length;g++)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[g]),a(e).width(c.p.subGridModel[0].width[g]),a(n).append(e);a(m).append(n);if(b&&(k=c.p.jsonReader.subgrid,e=a.jgrid.getAccessor(b,k.root),void 0!==e))for(g=0;g<e.length;g++){h=e[g];n=a("<tr class='ui-widget-content ui-subtblcell'></tr>");
  485. if(!0===k.repeatitems)for(k.cell&&(h=h[k.cell]),l=0;l<h.length;l++)f(n,h[l]||"&#160;",l);else{var p=c.p.subGridModel[0].mapping||c.p.subGridModel[0].name;if(p.length)for(l=0;l<p.length;l++)f(n,h[p[l]]||"&#160;",l)}a(m).append(n)}g=a("table:first",c.grid.bDiv).attr("id")+"_";a("#"+a.jgrid.jqID(g+d)).append(m);c.grid.hDiv.loading=!1;a("#load_"+a.jgrid.jqID(c.p.id)).hide();return!1},h=function(b){var e,f,h,k;e=a(b).attr("id");f={nd_:(new Date).getTime()};f[c.p.prmNames.subgridid]=e;if(!c.p.subGridModel[0])return!1;
  486. if(c.p.subGridModel[0].params)for(k=0;k<c.p.subGridModel[0].params.length;k++)for(h=0;h<c.p.colModel.length;h++)c.p.colModel[h].name===c.p.subGridModel[0].params[k]&&(f[c.p.colModel[h].name]=a("td:eq("+h+")",b).text().replace(/\&#160\;/ig,""));if(!c.grid.hDiv.loading)switch(c.grid.hDiv.loading=!0,a("#load_"+a.jgrid.jqID(c.p.id)).show(),c.p.subgridtype||(c.p.subgridtype=c.p.datatype),a.isFunction(c.p.subgridtype)?c.p.subgridtype.call(c,f):c.p.subgridtype=c.p.subgridtype.toLowerCase(),c.p.subgridtype){case "xml":case "json":a.ajax(a.extend({type:c.p.mtype,
  487. url:a.isFunction(c.p.subGridUrl)?c.p.subGridUrl.call(c,f):c.p.subGridUrl,dataType:c.p.subgridtype,data:a.isFunction(c.p.serializeSubGridData)?c.p.serializeSubGridData.call(c,f):f,complete:function(b){"xml"===c.p.subgridtype?g(b.responseXML,e):d(a.jgrid.parse(b.responseText),e)}},a.jgrid.ajaxOptions,c.p.ajaxSubgridOptions||{}))}return!1},k,l,p,m=0,r,q;a.each(c.p.colModel,function(){!0!==this.hidden&&"rn"!==this.name&&"cb"!==this.name||m++});var n=c.rows.length,t=1;void 0!==e&&0<e&&(t=e,n=e+1);for(;t<
  488. n;)a(c.rows[t]).hasClass("jqgrow")&&(c.p.scroll&&a(c.rows[t].cells[b]).unbind("click"),a(c.rows[t].cells[b]).bind("click",function(){var d=a(this).parent("tr")[0];q=d.nextSibling;if(a(this).hasClass("sgcollapsed")){l=c.p.id;k=d.id;if(!0===c.p.subGridOptions.reloadOnExpand||!1===c.p.subGridOptions.reloadOnExpand&&!a(q).hasClass("ui-subgrid")){p=1<=b?"<td colspan='"+b+"'>&#160;</td>":"";r=a(c).triggerHandler("jqGridSubGridBeforeExpand",[l+"_"+k,k]);(r=!1===r||"stop"===r?!1:!0)&&a.isFunction(c.p.subGridBeforeExpand)&&
  489. (r=c.p.subGridBeforeExpand.call(c,l+"_"+k,k));if(!1===r)return!1;a(d).after("<tr role='row' class='ui-subgrid'>"+p+"<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-m,10)+"' class='ui-widget-content subgrid-data'><div id="+l+"_"+k+" class='tablediv'></div></td></tr>");a(c).triggerHandler("jqGridSubGridRowExpanded",[l+"_"+k,k]);a.isFunction(c.p.subGridRowExpanded)?c.p.subGridRowExpanded.call(c,
  490. l+"_"+k,k):h(d)}else a(q).show();a(this).html("<a style='cursor:pointer;'><span class='ui-icon "+c.p.subGridOptions.minusicon+"'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");c.p.subGridOptions.selectOnExpand&&a(c).jqGrid("setSelection",k)}else if(a(this).hasClass("sgexpanded")){r=a(c).triggerHandler("jqGridSubGridRowColapsed",[l+"_"+k,k]);r=!1===r||"stop"===r?!1:!0;k=d.id;r&&a.isFunction(c.p.subGridRowColapsed)&&(r=c.p.subGridRowColapsed.call(c,l+"_"+k,k));if(!1===r)return!1;!0===
  491. c.p.subGridOptions.reloadOnExpand?a(q).remove(".ui-subgrid"):a(q).hasClass("ui-subgrid")&&a(q).hide();a(this).html("<a style='cursor:pointer;'><span class='ui-icon "+c.p.subGridOptions.plusicon+"'></span></a>").removeClass("sgexpanded").addClass("sgcollapsed");c.p.subGridOptions.selectOnCollapse&&a(c).jqGrid("setSelection",k)}return!1})),t++;!0===c.p.subGridOptions.expandOnLoad&&a(c.rows).filter(".jqgrow").each(function(b,c){a(c.cells[0]).click()});c.subGridXml=function(a,b){g(a,b)};c.subGridJson=
  492. function(a,b){d(a,b)}}})},expandSubGridRow:function(b){return this.each(function(){if((this.grid||b)&&!0===this.p.subGrid){var e=a(this).jqGrid("getInd",b,!0);e&&(e=a("td.sgcollapsed",e)[0])&&a(e).trigger("click")}})},collapseSubGridRow:function(b){return this.each(function(){if((this.grid||b)&&!0===this.p.subGrid){var e=a(this).jqGrid("getInd",b,!0);e&&(e=a("td.sgexpanded",e)[0])&&a(e).trigger("click")}})},toggleSubGridRow:function(b){return this.each(function(){if((this.grid||b)&&!0===this.p.subGrid){var e=
  493. a(this).jqGrid("getInd",b,!0);if(e){var c=a("td.sgcollapsed",e)[0];c?a(c).trigger("click"):(c=a("td.sgexpanded",e)[0])&&a(c).trigger("click")}}})}})})(jQuery);
  494. 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=0<c.length,f=!c&&0<f.length,g=c||f,d=[],h=[];jQuery("th",jQuery(this)).each(function(){0===d.length&&g?(d.push({name:"__selection__",index:"__selection__",width:0,hidden:!0}),h.push("__selection__")):(d.push({name:jQuery(this).attr("id")||jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),
  495. index:jQuery(this).attr("id")||jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),width:jQuery(this).width()||150}),h.push(jQuery(this).html()))});var k=[],l=[],p=[];jQuery("tbody > tr",jQuery(this)).each(function(){var a={},b=0;jQuery("td",jQuery(this)).each(function(){if(0===b&&g){var c=jQuery("input",jQuery(this)),e=c.attr("value");l.push(e||k.length);c.is(":checked")&&p.push(e);a[d[b].name]=c.attr("value")}else a[d[b].name]=jQuery(this).html();b++});0<b&&k.push(a)});
  496. jQuery(this).empty();jQuery(this).addClass("scroll");jQuery(this).jqGrid(jQuery.extend({datatype:"local",width:a,colNames:h,colModel:d,multiselect:c},b||{}));for(a=0;a<k.length;a++)f=null,0<l.length&&(f=l[a])&&f.replace&&(f=encodeURIComponent(f).replace(/[.\-%]/g,"_")),null===f&&(f=a+1),jQuery(this).jqGrid("addRowData",f,k[a]);for(a=0;a<p.length;a++)jQuery(this).jqGrid("setSelection",p[a])}})}
  497. (function(a){a.jgrid.extend({setTreeNode:function(b,e){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,d=c.p.treeReader.leaf_field,h=c.p.treeReader.level_field,k=c.p.treeReader.icon_field,l=c.p.treeReader.loaded,p,m,r,q;b<e;)q=a.jgrid.stripPref(c.p.idPrefix,c.rows[b].id),q=c.p.data[c.p._index[q]],"nested"!==c.p.treeGridModel||q[d]||(p=parseInt(q[c.p.treeReader.left_field],10),m=parseInt(q[c.p.treeReader.right_field],10),q[d]=m===
  498. p+1?"true":"false",c.rows[b].cells[c.p._treeleafpos].innerHTML=q[d]),p=parseInt(q[h],10),0===c.p.tree_root_level?(r=p+1,m=p):(r=p,m=p-1),r="<div class='tree-wrap tree-wrap-"+c.p.direction+"' style='width:"+18*r+"px;'>",r+="<div style='"+("rtl"===c.p.direction?"right:":"left:")+18*m+"px;' class='ui-icon ",void 0!==q[l]&&(q[l]="true"===q[l]||!0===q[l]?!0:!1),"true"===q[d]||!0===q[d]?(r+=(void 0!==q[k]&&""!==q[k]?q[k]:c.p.treeIcons.leaf)+" tree-leaf treeclick",q[d]=!0,m="leaf"):(q[d]=!1,m=""),q[g]=("true"===
  499. q[g]||!0===q[g]?!0:!1)&&(q[l]||void 0===q[l]),r=!1===q[g]?r+(!0===q[d]?"'":c.p.treeIcons.plus+" tree-plus treeclick'"):r+(!0===q[d]?"'":c.p.treeIcons.minus+" tree-minus treeclick'"),r+="></div></div>",a(c.rows[b].cells[f]).wrapInner("<span class='cell-wrapper"+m+"'></span>").prepend(r),p!==parseInt(c.p.tree_root_level,10)&&((q=(q=a(c).jqGrid("getNodeParent",q))&&q.hasOwnProperty(g)?q[g]:!0)||a(c.rows[b]).css("display","none")),a(c.rows[b].cells[f]).find("div.treeclick").bind("click",function(b){b=
  500. a.jgrid.stripPref(c.p.idPrefix,a(b.target||b.srcElement,c.rows).closest("tr.jqgrow")[0].id);b=c.p._index[b];c.p.data[b][d]||(c.p.data[b][g]?(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}),!0===c.p.ExpandColClick&&a(c.rows[b].cells[f]).find("span.cell-wrapper").css("cursor","pointer").bind("click",function(b){b=a.jgrid.stripPref(c.p.idPrefix,a(b.target||b.srcElement,c.rows).closest("tr.jqgrow")[0].id);
  501. var e=c.p._index[b];c.p.data[e][d]||(c.p.data[e][g]?(a(c).jqGrid("collapseRow",c.p.data[e]),a(c).jqGrid("collapseNode",c.p.data[e])):(a(c).jqGrid("expandRow",c.p.data[e]),a(c).jqGrid("expandNode",c.p.data[e])));a(c).jqGrid("setSelection",b);return!1}),b++})},setTreeGrid:function(){return this.each(function(){var b=this,e=0,c,f=!1,g,d,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;null===
  502. b.p.rowTotal&&(b.p.rowNum=1E4);b.p.multiselect=!1;b.p.rowList=[];b.p.expColInd=0;c="ui-icon-triangle-1-"+("rtl"===b.p.direction?"w":"e");b.p.treeIcons=a.extend({plus:c,minus:"ui-icon-triangle-1-s",leaf:"ui-icon-radio-off"},b.p.treeIcons||{});"nested"===b.p.treeGridModel?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):"adjacency"===b.p.treeGridModel&&(b.p.treeReader=a.extend({level_field:"level",
  503. 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))for(d in c=b.p.colModel[g].name,c!==b.p.ExpandColumn||f||(f=!0,b.p.expColInd=e),e++,b.p.treeReader)b.p.treeReader.hasOwnProperty(d)&&b.p.treeReader[d]===c&&h.push(c);a.each(b.p.treeReader,function(c,d){d&&-1===a.inArray(d,h)&&("leaf_field"===c&&(b.p._treeleafpos=e),e++,b.p.colNames.push(d),b.p.colModel.push({name:d,width:1,
  504. hidden:!0,sortable:!1,resizable:!1,hidedlg:!0,editable:!0,search:!1}))})}})},expandRow:function(b){this.each(function(){var e=this;if(e.grid&&e.p.treeGrid){var c=a(e).jqGrid("getNodeChildren",b),f=e.p.treeReader.expanded_field;a(c).each(function(){var b=e.p.idPrefix+a.jgrid.getAccessor(this,e.p.localReader.id);a(a(e).jqGrid("getGridRowById",b)).css("display","");this[f]&&a(e).jqGrid("expandRow",this)})}})},collapseRow:function(b){this.each(function(){var e=this;if(e.grid&&e.p.treeGrid){var c=a(e).jqGrid("getNodeChildren",
  505. b),f=e.p.treeReader.expanded_field;a(c).each(function(){var b=e.p.idPrefix+a.jgrid.getAccessor(this,e.p.localReader.id);a(a(e).jqGrid("getGridRowById",b)).css("display","none");this[f]&&a(e).jqGrid("collapseRow",this)})}})},getRootNodes:function(){var b=[];this.each(function(){var e=this;if(e.grid&&e.p.treeGrid)switch(e.p.treeGridModel){case "nested":var c=e.p.treeReader.level_field;a(e.p.data).each(function(){parseInt(this[c],10)===parseInt(e.p.tree_root_level,10)&&b.push(this)});break;case "adjacency":var f=
  506. e.p.treeReader.parent_id_field;a(e.p.data).each(function(){null!==this[f]&&"null"!==String(this[f]).toLowerCase()||b.push(this)})}});return b},getNodeDepth:function(b){var e=null;this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":e=parseInt(b[this.p.treeReader.level_field],10)-parseInt(this.p.tree_root_level,10);break;case "adjacency":e=a(this).jqGrid("getNodeAncestors",b).length}});return e},getNodeParent:function(b){var e=null;this.each(function(){if(this.grid&&
  507. 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,d=parseInt(b[c],10),h=parseInt(b[f],10),k=parseInt(b[g],10);a(this.p.data).each(function(){if(parseInt(this[g],10)===k-1&&parseInt(this[c],10)<d&&parseInt(this[f],10)>h)return e=this,!1});break;case "adjacency":for(var l=this.p.treeReader.parent_id_field,p=this.p.localReader.id,m=this.p._index[b[p]];m--;)if(this.p.data[m][p]===a.jgrid.stripPref(this.p.idPrefix,
  508. b[l])){e=this.p.data[m];break}}});return e},getNodeChildren:function(b){var e=[];this.each(function(){var c=this;if(c.grid&&c.p.treeGrid)switch(c.p.treeGridModel){case "nested":var f=c.p.treeReader.left_field,g=c.p.treeReader.right_field,d=c.p.treeReader.level_field,h=parseInt(b[f],10),k=parseInt(b[g],10),l=parseInt(b[d],10);a(this.p.data).each(function(){parseInt(this[d],10)===l+1&&parseInt(this[f],10)>h&&parseInt(this[g],10)<k&&e.push(this)});break;case "adjacency":var p=c.p.treeReader.parent_id_field,
  509. m=c.p.localReader.id;a(this.p.data).each(function(){this[p]==a.jgrid.stripPref(c.p.idPrefix,b[m])&&e.push(this)})}});return e},getFullTreeNode:function(b){var e=[];this.each(function(){var c=this,f;if(c.grid&&c.p.treeGrid)switch(c.p.treeGridModel){case "nested":var g=c.p.treeReader.left_field,d=c.p.treeReader.right_field,h=c.p.treeReader.level_field,k=parseInt(b[g],10),l=parseInt(b[d],10),p=parseInt(b[h],10);a(this.p.data).each(function(){parseInt(this[h],10)>=p&&parseInt(this[g],10)>=k&&parseInt(this[g],
  510. 10)<=l&&e.push(this)});break;case "adjacency":if(b){e.push(b);var m=c.p.treeReader.parent_id_field,r=c.p.localReader.id;a(this.p.data).each(function(b){f=e.length;for(b=0;b<f;b++)if(a.jgrid.stripPref(c.p.idPrefix,e[b][r])===this[m]){e.push(this);break}})}}});return e},getNodeAncestors:function(b){var e=[];this.each(function(){if(this.grid&&this.p.treeGrid)for(var c=a(this).jqGrid("getNodeParent",b);c;)e.push(c),c=a(this).jqGrid("getNodeParent",c)});return e},isVisibleNode:function(b){var e=!0;this.each(function(){if(this.grid&&
  511. this.p.treeGrid){var c=a(this).jqGrid("getNodeAncestors",b),f=this.p.treeReader.expanded_field;a(c).each(function(){e=e&&this[f];if(!e)return!1})}});return e},isNodeLoaded:function(b){var e;this.each(function(){if(this.grid&&this.p.treeGrid){var c=this.p.treeReader.leaf_field,f=this.p.treeReader.loaded;e=void 0!==b?void 0!==b[f]?b[f]:b[c]||0<a(this).jqGrid("getNodeChildren",b).length?!0:!1:!1}});return e},expandNode:function(b){return this.each(function(){if(this.grid&&this.p.treeGrid){var e=this.p.treeReader.expanded_field,
  512. c=this.p.treeReader.parent_id_field,f=this.p.treeReader.loaded,g=this.p.treeReader.level_field,d=this.p.treeReader.left_field,h=this.p.treeReader.right_field;if(!b[e]){var k=a.jgrid.getAccessor(b,this.p.localReader.id),l=a("#"+this.p.idPrefix+a.jgrid.jqID(k),this.grid.bDiv)[0],p=this.p._index[k];a(this).jqGrid("isNodeLoaded",this.p.data[p])?(b[e]=!0,a("div.treeclick",l).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus")):this.grid.hDiv.loading||(b[e]=!0,
  513. 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,"nested"===this.p.treeGridModel?a(this).jqGrid("setGridParam",{postData:{nodeid:k,n_left:b[d],n_right:b[h],n_level:b[g]}}):a(this).jqGrid("setGridParam",{postData:{nodeid:k,parentid:b[c],n_level:b[g]}}),a(this).trigger("reloadGrid"),b[f]=!0,"nested"===this.p.treeGridModel?a(this).jqGrid("setGridParam",{postData:{nodeid:"",
  514. 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){var e=this.p.treeReader.expanded_field;b[e]&&(b[e]=!1,e=a.jgrid.getAccessor(b,this.p.localReader.id),e=a("#"+this.p.idPrefix+a.jgrid.jqID(e),this.grid.bDiv)[0],a("div.treeclick",e).removeClass(this.p.treeIcons.minus+" tree-minus").addClass(this.p.treeIcons.plus+" tree-plus"))}})},SortTree:function(b,
  515. e,c,f){return this.each(function(){if(this.grid&&this.p.treeGrid){var g,d,h,k=[],l=this,p;g=a(this).jqGrid("getRootNodes");g=a.jgrid.from(g);g.orderBy(b,e,c,f);p=g.select();g=0;for(d=p.length;g<d;g++)h=p[g],k.push(h),a(this).jqGrid("collectChildrenSortTree",k,h,b,e,c,f);a.each(k,function(b){var c=a.jgrid.getAccessor(this,l.p.localReader.id);a("#"+a.jgrid.jqID(l.p.id)+" tbody tr:eq("+b+")").after(a("tr#"+a.jgrid.jqID(c),l.grid.bDiv))});k=p=g=null}})},collectChildrenSortTree:function(b,e,c,f,g,d){return this.each(function(){if(this.grid&&
  516. this.p.treeGrid){var h,k,l,p;h=a(this).jqGrid("getNodeChildren",e);h=a.jgrid.from(h);h.orderBy(c,f,g,d);p=h.select();h=0;for(k=p.length;h<k;h++)l=p[h],b.push(l),a(this).jqGrid("collectChildrenSortTree",b,l,c,f,g,d)}})},setTreeRow:function(b,e){var c=!1;this.each(function(){this.grid&&this.p.treeGrid&&(c=a(this).jqGrid("setRowData",b,e))});return c},delTreeNode:function(b){return this.each(function(){var e=this.p.localReader.id,c,f=this.p.treeReader.left_field,g=this.p.treeReader.right_field,d,h,k;
  517. if(this.grid&&this.p.treeGrid&&(c=this.p._index[b],void 0!==c)){d=parseInt(this.p.data[c][g],10);h=d-parseInt(this.p.data[c][f],10)+1;var l=a(this).jqGrid("getFullTreeNode",this.p.data[c]);if(0<l.length)for(c=0;c<l.length;c++)a(this).jqGrid("delRowData",l[c][e]);if("nested"===this.p.treeGridModel){e=a.jgrid.from(this.p.data).greater(f,d,{stype:"integer"}).select();if(e.length)for(k in e)e.hasOwnProperty(k)&&(e[k][f]=parseInt(e[k][f],10)-h);e=a.jgrid.from(this.p.data).greater(g,d,{stype:"integer"}).select();
  518. if(e.length)for(k in e)e.hasOwnProperty(k)&&(e[k][g]=parseInt(e[k][g],10)-h)}}})},addChildNode:function(b,e,c,f){var g=this[0];if(c){var d=g.p.treeReader.expanded_field,h=g.p.treeReader.leaf_field,k=g.p.treeReader.level_field,l=g.p.treeReader.parent_id_field,p=g.p.treeReader.left_field,m=g.p.treeReader.right_field,r=g.p.treeReader.loaded,q,n,t,u,w;q=0;var s=e,x;void 0===f&&(f=!1);if(void 0===b||null===b){w=g.p.data.length-1;if(0<=w)for(;0<=w;)q=Math.max(q,parseInt(g.p.data[w][g.p.localReader.id],
  519. 10)),w--;b=q+1}var A=a(g).jqGrid("getInd",e);x=!1;void 0===e||null===e||""===e?(s=e=null,q="last",u=g.p.tree_root_level,w=g.p.data.length+1):(q="after",n=g.p._index[e],t=g.p.data[n],e=t[g.p.localReader.id],u=parseInt(t[k],10)+1,w=a(g).jqGrid("getFullTreeNode",t),w.length?(s=w=w[w.length-1][g.p.localReader.id],w=a(g).jqGrid("getInd",s)+1):w=a(g).jqGrid("getInd",e)+1,t[h]&&(x=!0,t[d]=!0,a(g.rows[A]).find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper").end().find("div.tree-leaf").removeClass(g.p.treeIcons.leaf+
  520. " tree-leaf").addClass(g.p.treeIcons.minus+" tree-minus"),g.p.data[n][h]=!1,t[r]=!0));n=w+1;void 0===c[d]&&(c[d]=!1);void 0===c[r]&&(c[r]=!1);c[k]=u;void 0===c[h]&&(c[h]=!0);"adjacency"===g.p.treeGridModel&&(c[l]=e);if("nested"===g.p.treeGridModel){var v;if(null!==e){h=parseInt(t[m],10);k=a.jgrid.from(g.p.data);k=k.greaterOrEquals(m,h,{stype:"integer"});k=k.select();if(k.length)for(v in k)k.hasOwnProperty(v)&&(k[v][p]=k[v][p]>h?parseInt(k[v][p],10)+2:k[v][p],k[v][m]=k[v][m]>=h?parseInt(k[v][m],10)+
  521. 2:k[v][m]);c[p]=h;c[m]=h+1}else{h=parseInt(a(g).jqGrid("getCol",m,!1,"max"),10);k=a.jgrid.from(g.p.data).greater(p,h,{stype:"integer"}).select();if(k.length)for(v in k)k.hasOwnProperty(v)&&(k[v][p]=parseInt(k[v][p],10)+2);k=a.jgrid.from(g.p.data).greater(m,h,{stype:"integer"}).select();if(k.length)for(v in k)k.hasOwnProperty(v)&&(k[v][m]=parseInt(k[v][m],10)+2);c[p]=h+1;c[m]=h+2}}if(null===e||a(g).jqGrid("isNodeLoaded",t)||x)a(g).jqGrid("addRowData",b,c,q,s),a(g).jqGrid("setTreeNode",w,n);t&&!t[d]&&
  522. f&&a(g.rows[A]).find("div.treeclick").click()}}})})(jQuery);
  523. (function(a){a.fn.jqDrag=function(a){return d(this,a,"d")};a.fn.jqResize=function(a,b){return d(this,a,"r",b)};a.jqDnR={dnr:{},e:0,drag:function(a){"d"==e.k?c.css({left:e.X+a.pageX-e.pX,top:e.Y+a.pageY-e.pY}):(c.css({width:Math.max(a.pageX-e.pX+e.W,0),height:Math.max(a.pageY-e.pY+e.H,0)}),g&&f.css({width:Math.max(a.pageX-g.pX+g.W,0),height:Math.max(a.pageY-g.pY+g.H,0)}));return!1},stop:function(){a(document).unbind("mousemove",b.drag).unbind("mouseup",b.stop)}};var b=a.jqDnR,e=b.dnr,c=b.e,f,g,d=function(b,
  524. d,m,r){return b.each(function(){d=d?a(d,b):b;d.bind("mousedown",{e:b,k:m},function(b){var d=b.data,l={};c=d.e;f=r?a(r):!1;if("relative"!=c.css("position"))try{c.position(l)}catch(m){}e={X:l.left||h("left")||0,Y:l.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:d.k};g=f&&"d"!=d.k?{X:l.left||k("left")||0,Y:l.top||k("top")||0,W:f[0].offsetWidth||k("width")||0,H:f[0].offsetHeight||k("height")||0,pX:b.pageX,pY:b.pageY,k:d.k}:!1;if(a("input.hasDatepicker",
  525. c[0])[0])try{a("input.hasDatepicker",c[0]).datepicker("hide")}catch(p){}a(document).mousemove(a.jqDnR.drag).mouseup(a.jqDnR.stop);return!1})})},h=function(a){return parseInt(c.css(a),10)||!1},k=function(a){return parseInt(f.css(a),10)||!1}})(jQuery);
  526. (function(a){a.fn.jqm=function(c){var d={overlay:50,closeoverlay:!0,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:f,ajaxText:"",target:f,modal:f,toTop:f,onShow:f,onHide:f,onLoad:f};return this.each(function(){if(this._jqm)return e[this._jqm].c=a.extend({},e[this._jqm].c,c);b++;this._jqm=b;e[b]={c:a.extend(d,a.jqm.params,c),a:f,w:a(this).addClass("jqmID"+b),s:b};d.trigger&&a(this).jqmAddTrigger(d.trigger)})};a.fn.jqmAddClose=function(a){return k(this,a,"jqmHide")};a.fn.jqmAddTrigger=
  527. 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,h){var k=e[b],r=k.c,q="."+r.closeClass,n=parseInt(k.w.css("z-index")),n=0<n?n:3E3,t=a("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":n-1,opacity:r.overlay/100});if(k.a)return f;k.t=h;k.a=!0;k.w.css("z-index",n);r.modal?(c[0]||setTimeout(function(){d("bind")},
  528. 1),c.push(b)):0<r.overlay?r.closeoverlay&&k.w.jqmAddClose(t):t=f;k.o=t?t.addClass(r.overlayClass).prependTo("body"):f;r.ajax?(n=r.target||k.w,t=r.ajax,n="string"==typeof n?a(n,k.w):a(n),t="@"==t.substr(0,1)?a(h).attr(t.substring(1)):t,n.html(r.ajaxText).load(t,function(){r.onLoad&&r.onLoad.call(this,k);q&&k.w.jqmAddClose(a(q,k.w));g(k)})):q&&k.w.jqmAddClose(a(q,k.w));r.toTop&&k.o&&k.w.before('<span id="jqmP'+k.w[0]._jqm+'"></span>').insertAfter(k.o);r.onShow?r.onShow(k):k.w.show();g(k);return f},
  529. close:function(b){b=e[b];if(!b.a)return f;b.a=f;c[0]&&(c.pop(),c[0]||d("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 f},params:{}};var b=0,e=a.jqm.hash,c=[],f=!1,g=function(b){try{a(":input:visible",b.w)[0].focus()}catch(c){}},d=function(b){a(document)[b]("keypress",h)[b]("keydown",h)[b]("mousedown",h)},h=function(b){var d=e[c[c.length-1]],f=!a(b.target).parents(".jqmID"+d.s)[0];f&&(a(".jqmID"+d.s).each(function(){var c=
  530. a(this),d=c.offset();if(d.top<=b.pageY&&b.pageY<=d.top+c.height()&&d.left<=b.pageX&&b.pageX<=d.left+c.width())return f=!1}),g(d));return!f},k=function(b,c,d){return b.each(function(){var b=this._jqm;a(c).each(function(){this[d]||(this[d]=[],a(this).click(function(){for(var a in{jqmShow:1,jqmHide:1})for(var b in this[a])if(e[this[a][b]])e[this[a][b]].w[a](this);return f}));this[d].push(b)})})}})(jQuery);
  531. (function(a){a.fmatter={};a.extend(a.fmatter,{isBoolean:function(a){return"boolean"===typeof a},isObject:function(b){return b&&("object"===typeof b||a.isFunction(b))||!1},isString:function(a){return"string"===typeof a},isNumber:function(a){return"number"===typeof a&&isFinite(a)},isValue:function(a){return this.isObject(a)||this.isString(a)||this.isNumber(a)||this.isBoolean(a)},isEmpty:function(b){if(!this.isString(b)&&this.isValue(b))return!1;if(!this.isValue(b))return!0;b=a.trim(b).replace(/\&nbsp\;/ig,
  532. "").replace(/\&#160\;/ig,"");return""===b}});a.fn.fmatter=function(b,e,c,f,g){var d=e;c=a.extend({},a.jgrid.formatter,c);try{d=a.fn.fmatter[b].call(this,e,c,f,g)}catch(h){}return d};a.fmatter.util={NumberFormat:function(b,e){a.fmatter.isNumber(b)||(b*=1);if(a.fmatter.isNumber(b)){var c=0>b,f=String(b),g=e.decimalSeparator||".",d;if(a.fmatter.isNumber(e.decimalPlaces)){var h=e.decimalPlaces,f=Math.pow(10,h),f=String(Math.round(b*f)/f);d=f.lastIndexOf(".");if(0<h)for(0>d?(f+=g,d=f.length-1):"."!==g&&
  533. (f=f.replace(".",g));f.length-1-d<h;)f+="0"}if(e.thousandsSeparator){h=e.thousandsSeparator;d=f.lastIndexOf(g);d=-1<d?d:f.length;var g=f.substring(d),k=-1,l;for(l=d;0<l;l--)k++,0===k%3&&l!==d&&(!c||1<l)&&(g=h+g),g=f.charAt(l-1)+g;f=g}f=e.prefix?e.prefix+f:f;return f=e.suffix?f+e.suffix:f}return b}};a.fn.fmatter.defaultFormat=function(b,e){return a.fmatter.isValue(b)&&""!==b?b:e.defaultValue||"&#160;"};a.fn.fmatter.email=function(b,e){return a.fmatter.isEmpty(b)?a.fn.fmatter.defaultFormat(b,e):'<a href="mailto:'+
  534. b+'">'+b+"</a>"};a.fn.fmatter.checkbox=function(b,e){var c=a.extend({},e.checkbox),f;void 0!==e.colModel&&void 0!==e.colModel.formatoptions&&(c=a.extend({},c,e.colModel.formatoptions));f=!0===c.disabled?'disabled="disabled"':"";if(a.fmatter.isEmpty(b)||void 0===b)b=a.fn.fmatter.defaultFormat(b,c);b=String(b);b=(b+"").toLowerCase();return'<input type="checkbox" '+(0>b.search(/(false|f|0|no|n|off|undefined)/i)?" checked='checked' ":"")+' value="'+b+'" offval="no" '+f+"/>"};a.fn.fmatter.link=function(b,
  535. e){var c={target:e.target},f="";void 0!==e.colModel&&void 0!==e.colModel.formatoptions&&(c=a.extend({},c,e.colModel.formatoptions));c.target&&(f="target="+c.target);return a.fmatter.isEmpty(b)?a.fn.fmatter.defaultFormat(b,e):"<a "+f+' href="'+b+'">'+b+"</a>"};a.fn.fmatter.showlink=function(b,e){var c={baseLinkUrl:e.baseLinkUrl,showAction:e.showAction,addParam:e.addParam||"",target:e.target,idName:e.idName},f="";void 0!==e.colModel&&void 0!==e.colModel.formatoptions&&(c=a.extend({},c,e.colModel.formatoptions));
  536. c.target&&(f="target="+c.target);c=c.baseLinkUrl+c.showAction+"?"+c.idName+"="+e.rowId+c.addParam;return a.fmatter.isString(b)||a.fmatter.isNumber(b)?"<a "+f+' href="'+c+'">'+b+"</a>":a.fn.fmatter.defaultFormat(b,e)};a.fn.fmatter.integer=function(b,e){var c=a.extend({},e.integer);void 0!==e.colModel&&void 0!==e.colModel.formatoptions&&(c=a.extend({},c,e.colModel.formatoptions));return a.fmatter.isEmpty(b)?c.defaultValue:a.fmatter.util.NumberFormat(b,c)};a.fn.fmatter.number=function(b,e){var c=a.extend({},
  537. e.number);void 0!==e.colModel&&void 0!==e.colModel.formatoptions&&(c=a.extend({},c,e.colModel.formatoptions));return a.fmatter.isEmpty(b)?c.defaultValue:a.fmatter.util.NumberFormat(b,c)};a.fn.fmatter.currency=function(b,e){var c=a.extend({},e.currency);void 0!==e.colModel&&void 0!==e.colModel.formatoptions&&(c=a.extend({},c,e.colModel.formatoptions));return a.fmatter.isEmpty(b)?c.defaultValue:a.fmatter.util.NumberFormat(b,c)};a.fn.fmatter.date=function(b,e,c,f){c=a.extend({},e.date);void 0!==e.colModel&&
  538. void 0!==e.colModel.formatoptions&&(c=a.extend({},c,e.colModel.formatoptions));return c.reformatAfterEdit||"edit"!==f?a.fmatter.isEmpty(b)?a.fn.fmatter.defaultFormat(b,e):a.jgrid.parseDate(c.srcformat,b,c.newformat,c):a.fn.fmatter.defaultFormat(b,e)};a.fn.fmatter.select=function(b,e){b=String(b);var c=!1,f=[],g,d;void 0!==e.colModel.formatoptions?(c=e.colModel.formatoptions.value,g=void 0===e.colModel.formatoptions.separator?":":e.colModel.formatoptions.separator,d=void 0===e.colModel.formatoptions.delimiter?
  539. ";":e.colModel.formatoptions.delimiter):void 0!==e.colModel.editoptions&&(c=e.colModel.editoptions.value,g=void 0===e.colModel.editoptions.separator?":":e.colModel.editoptions.separator,d=void 0===e.colModel.editoptions.delimiter?";":e.colModel.editoptions.delimiter);if(c){var h=!0===(null!=e.colModel.editoptions&&!0===e.colModel.editoptions.multiple)?!0:!1,k=[];h&&(k=b.split(","),k=a.map(k,function(b){return a.trim(b)}));if(a.fmatter.isString(c)){var l=c.split(d),p=0,m;for(m=0;m<l.length;m++)if(d=
  540. l[m].split(g),2<d.length&&(d[1]=a.map(d,function(a,b){if(0<b)return a}).join(g)),h)-1<a.inArray(d[0],k)&&(f[p]=d[1],p++);else if(a.trim(d[0])===a.trim(b)){f[0]=d[1];break}}else a.fmatter.isObject(c)&&(h?f=a.map(k,function(a){return c[a]}):f[0]=c[b]||"")}b=f.join(", ");return""===b?a.fn.fmatter.defaultFormat(b,e):b};a.fn.fmatter.rowactions=function(b){var e=a(this).closest("tr.jqgrow"),c=e.attr("id"),f=a(this).closest("table.ui-jqgrid-btable").attr("id").replace(/_frozen([^_]*)$/,"$1"),f=a("#"+f),
  541. g=f[0],d=g.p,h=d.colModel[a.jgrid.getCellIndex(this)],k=h.frozen?a("tr#"+c+" td:eq("+a.jgrid.getCellIndex(this)+") > div",f):a(this).parent(),l={extraparam:{}},p=function(b){a.isFunction(l.afterRestore)&&l.afterRestore.call(g,b);k.find("div.ui-inline-edit,div.ui-inline-del").show();k.find("div.ui-inline-save,div.ui-inline-cancel").hide()};void 0!==h.formatoptions&&(l=a.extend(l,h.formatoptions));void 0!==d.editOptions&&(l.editOptions=d.editOptions);void 0!==d.delOptions&&(l.delOptions=d.delOptions);
  542. e.hasClass("jqgrid-new-row")&&(l.extraparam[d.prmNames.oper]=d.prmNames.addoper);e={keys:l.keys,oneditfunc:l.onEdit,successfunc:l.onSuccess,url:l.url,extraparam:l.extraparam,aftersavefunc:function(b,c){a.isFunction(l.afterSave)&&l.afterSave.call(g,b,c);k.find("div.ui-inline-edit,div.ui-inline-del").show();k.find("div.ui-inline-save,div.ui-inline-cancel").hide()},errorfunc:l.onError,afterrestorefunc:p,restoreAfterError:l.restoreAfterError,mtype:l.mtype};switch(b){case "edit":f.jqGrid("editRow",c,e);
  543. k.find("div.ui-inline-edit,div.ui-inline-del").hide();k.find("div.ui-inline-save,div.ui-inline-cancel").show();f.triggerHandler("jqGridAfterGridComplete");break;case "save":f.jqGrid("saveRow",c,e)&&(k.find("div.ui-inline-edit,div.ui-inline-del").show(),k.find("div.ui-inline-save,div.ui-inline-cancel").hide(),f.triggerHandler("jqGridAfterGridComplete"));break;case "cancel":f.jqGrid("restoreRow",c,p);k.find("div.ui-inline-edit,div.ui-inline-del").show();k.find("div.ui-inline-save,div.ui-inline-cancel").hide();
  544. f.triggerHandler("jqGridAfterGridComplete");break;case "del":f.jqGrid("delGridRow",c,l.delOptions);break;case "formedit":f.jqGrid("setSelection",c),f.jqGrid("editGridRow",c,l.editOptions)}};a.fn.fmatter.actions=function(b,e){var c={keys:!1,editbutton:!0,delbutton:!0,editformbutton:!1},f=e.rowId,g="";void 0!==e.colModel.formatoptions&&(c=a.extend(c,e.colModel.formatoptions));if(void 0===f||a.fmatter.isEmpty(f))return"";c.editformbutton?g+="<div title='"+a.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+
  545. ("id='jEditButton_"+f+"' onclick=jQuery.fn.fmatter.rowactions.call(this,'formedit'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ")+"><span class='ui-icon ui-icon-pencil'></span></div>":c.editbutton&&(g+="<div title='"+a.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+("id='jEditButton_"+f+"' onclick=jQuery.fn.fmatter.rowactions.call(this,'edit'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover') ")+
  546. "><span class='ui-icon ui-icon-pencil'></span></div>");c.delbutton&&(g+="<div title='"+a.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+("id='jDeleteButton_"+f+"' onclick=jQuery.fn.fmatter.rowactions.call(this,'del'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ")+"><span class='ui-icon ui-icon-trash'></span></div>");g+="<div title='"+a.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save' "+
  547. ("id='jSaveButton_"+f+"' onclick=jQuery.fn.fmatter.rowactions.call(this,'save'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ")+"><span class='ui-icon ui-icon-disk'></span></div>";g+="<div title='"+a.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel' "+("id='jCancelButton_"+f+"' onclick=jQuery.fn.fmatter.rowactions.call(this,'cancel'); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ")+
  548. "><span class='ui-icon ui-icon-cancel'></span></div>";return"<div style='margin-left:8px;'>"+g+"</div>"};a.unformat=function(b,e,c,f){var g,d=e.colModel.formatter,h=e.colModel.formatoptions||{},k=/([\.\*\_\'\(\)\{\}\+\?\\])/g,l=e.colModel.unformat||a.fn.fmatter[d]&&a.fn.fmatter[d].unformat;if(void 0!==l&&a.isFunction(l))g=l.call(this,a(b).text(),e,b);else if(void 0!==d&&a.fmatter.isString(d))switch(g=a.jgrid.formatter||{},d){case "integer":h=a.extend({},g.integer,h);e=h.thousandsSeparator.replace(k,
  549. "\\$1");e=new RegExp(e,"g");g=a(b).text().replace(e,"");break;case "number":h=a.extend({},g.number,h);e=h.thousandsSeparator.replace(k,"\\$1");e=new RegExp(e,"g");g=a(b).text().replace(e,"").replace(h.decimalSeparator,".");break;case "currency":h=a.extend({},g.currency,h);e=h.thousandsSeparator.replace(k,"\\$1");e=new RegExp(e,"g");g=a(b).text();h.prefix&&h.prefix.length&&(g=g.substr(h.prefix.length));h.suffix&&h.suffix.length&&(g=g.substr(0,g.length-h.suffix.length));g=g.replace(e,"").replace(h.decimalSeparator,
  550. ".");break;case "checkbox":h=e.colModel.editoptions?e.colModel.editoptions.value.split(":"):["Yes","No"];g=a("input",b).is(":checked")?h[0]:h[1];break;case "select":g=a.unformat.select(b,e,c,f);break;case "actions":return"";default:g=a(b).text()}return void 0!==g?g:!0===f?a(b).text():a.jgrid.htmlDecode(a(b).html())};a.unformat.select=function(b,e,c,f){c=[];b=a(b).text();if(!0===f)return b;f=a.extend({},void 0!==e.colModel.formatoptions?e.colModel.formatoptions:e.colModel.editoptions);e=void 0===f.separator?
  551. ":":f.separator;var g=void 0===f.delimiter?";":f.delimiter;if(f.value){var d=f.value;f=!0===f.multiple?!0:!1;var h=[];f&&(h=b.split(","),h=a.map(h,function(b){return a.trim(b)}));if(a.fmatter.isString(d)){var k=d.split(g),l=0,p;for(p=0;p<k.length;p++)if(g=k[p].split(e),2<g.length&&(g[1]=a.map(g,function(a,b){if(0<b)return a}).join(e)),f)-1<a.inArray(g[1],h)&&(c[l]=g[0],l++);else if(a.trim(g[1])===a.trim(b)){c[0]=g[0];break}}else if(a.fmatter.isObject(d)||a.isArray(d))f||(h[0]=b),c=a.map(h,function(b){var c;
  552. a.each(d,function(a,d){if(d===b)return c=a,!1});if(void 0!==c)return c});return c.join(", ")}return b||""};a.unformat.date=function(b,e){var c=a.jgrid.formatter.date||{};void 0!==e.formatoptions&&(c=a.extend({},c,e.formatoptions));return a.fmatter.isEmpty(b)?a.fn.fmatter.defaultFormat(b,e):a.jgrid.parseDate(c.newformat,b,c.srcformat,c)}})(jQuery);
  553. var xmlJsonClass={xml2json:function(a,b){9===a.nodeType&&(a=a.documentElement);var e=this.removeWhite(a),e=this.toObj(e),e=this.toJson(e,a.nodeName,"\t");return"{\n"+b+(b?e.replace(/\t/g,b):e.replace(/\t|\n/g,""))+"\n}"},json2xml:function(a,b){var e=function(a,b,c){var f="",l,p;if(a instanceof Array)if(0===a.length)f+=c+"<"+b+">__EMPTY_ARRAY_</"+b+">\n";else for(l=0,p=a.length;l<p;l+=1)var m=c+e(a[l],b,c+"\t")+"\n",f=f+m;else if("object"===typeof a){l=!1;f+=c+"<"+b;for(p in a)a.hasOwnProperty(p)&&
  554. ("@"===p.charAt(0)?f+=" "+p.substr(1)+'="'+a[p].toString()+'"':l=!0);f+=l?">":"/>";if(l){for(p in a)a.hasOwnProperty(p)&&("#text"===p?f+=a[p]:"#cdata"===p?f+="<![CDATA["+a[p]+"]]\x3e":"@"!==p.charAt(0)&&(f+=e(a[p],p,c+"\t")));f+=("\n"===f.charAt(f.length-1)?c:"")+"</"+b+">"}}else"function"===typeof a?f+=c+"<"+b+"><![CDATA["+a+"]]\x3e</"+b+">":(void 0===a&&(a=""),f='""'===a.toString()||0===a.toString().length?f+(c+"<"+b+">__EMPTY_STRING_</"+b+">"):f+(c+"<"+b+">"+a.toString()+"</"+b+">"));return f},
  555. c="",f;for(f in a)a.hasOwnProperty(f)&&(c+=e(a[f],f,""));return b?c.replace(/\t/g,b):c.replace(/\t|\n/g,"")},toObj:function(a){var b={},e=/function/i;if(1===a.nodeType){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,d;for(d=a.firstChild;d;d=d.nextSibling)1===d.nodeType?g=!0:3===d.nodeType&&d.nodeValue.match(/[^ \f\n\r\t\v]/)?c+=1:4===d.nodeType&&(f+=1);if(g)if(2>c&&2>f)for(this.removeWhite(a),
  556. d=a.firstChild;d;d=d.nextSibling)3===d.nodeType?b["#text"]=this.escape(d.nodeValue):4===d.nodeType?e.test(d.nodeValue)?b[d.nodeName]=[b[d.nodeName],d.nodeValue]:b["#cdata"]=this.escape(d.nodeValue):b[d.nodeName]?b[d.nodeName]instanceof Array?b[d.nodeName][b[d.nodeName].length]=this.toObj(d):b[d.nodeName]=[b[d.nodeName],this.toObj(d)]:b[d.nodeName]=this.toObj(d);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"]=
  557. this.escape(this.innerXml(a)):(b=this.escape(this.innerXml(a)),"__EMPTY_ARRAY_"===b?b="[]":"__EMPTY_STRING_"===b&&(b=""));else if(f)if(1<f)b=this.escape(this.innerXml(a));else for(d=a.firstChild;d;d=d.nextSibling)if(e.test(a.firstChild.nodeValue)){b=a.firstChild.nodeValue;break}else b["#cdata"]=this.escape(d.nodeValue)}a.attributes.length||a.firstChild||(b=null)}else 9===a.nodeType?b=this.toObj(a.documentElement):alert("unhandled node type: "+a.nodeType);return b},toJson:function(a,b,e,c){void 0===
  558. c&&(c=!0);var f=b?'"'+b+'"':"",g="\t",d="\n";c||(d=g="");if("[]"===a)f+=b?":[]":"[]";else if(a instanceof Array){var h,k,l=[];k=0;for(h=a.length;k<h;k+=1)l[k]=this.toJson(a[k],"",e+g,c);f+=(b?":[":"[")+(1<l.length?d+e+g+l.join(","+d+e+g)+d+e:l.join(""))+"]"}else if(null===a)f+=(b&&":")+"null";else if("object"===typeof a){h=[];for(k in a)a.hasOwnProperty(k)&&(h[h.length]=this.toJson(a[k],k,e+g,c));f+=(b?":{":"{")+(1<h.length?d+e+g+h.join(","+d+e+g)+d+e:h.join(""))+"}"}else f="string"===typeof a?f+
  559. ((b&&":")+'"'+a.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"'):f+((b&&":")+a.toString());return f},innerXml:function(a){var b="";if("innerHTML"in a)b=a.innerHTML;else{var e=function(a){var b="",g;if(1===a.nodeType){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+=e(g);b+="</"+a.nodeName+">"}else b+="/>"}else 3===a.nodeType?b+=a.nodeValue:4===a.nodeType&&
  560. (b+="<![CDATA["+a.nodeValue+"]]\x3e");return b};for(a=a.firstChild;a;a=a.nextSibling)b+=e(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(3===b.nodeType)if(b.nodeValue.match(/[^ \f\n\r\t\v]/))b=b.nextSibling;else{var e=b.nextSibling;a.removeChild(b);b=e}else 1===b.nodeType&&this.removeWhite(b),b=b.nextSibling;return a}};
  561. //@ sourceMappingURL=jquery.jqGrid.map.js