/* jqGrid 4.2.0 - jQuery Grid Copyright (c) 2008, Tony Tomov, tony@trirand.com Dual licensed under the MIT and GPL licenses http://www.opensource.org/licenses/mit-license.php http://www.gnu.org/licenses/gpl-2.0.html Date: 2011-10-11 */ (function(a){a.jgrid=a.jgrid||{};a.extend(a.jgrid,{htmlDecode:function(b){if(b&&(b==" "||b==" "||b.length==1&&b.charCodeAt(0)==160))return"";return!b?b:String(b).replace(/>/g,">").replace(/</g,"<").replace(/"/g,'"').replace(/&/g,"&")},htmlEncode:function(b){return!b?b:String(b).replace(/&/g,"&").replace(/\"/g,""").replace(//g,">")},format:function(b){var e=a.makeArray(arguments).slice(1);if(b===undefined)b="";return b.replace(/\{(\d+)\}/g, function(c,f){return e[f]})},getCellIndex:function(b){b=a(b);if(b.is("tr"))return-1;b=(!b.is("td")&&!b.is("th")?b.closest("td,th"):b)[0];if(a.browser.msie)return a.inArray(b,b.parentNode.cells);return b.cellIndex},stripHtml:function(b){b+="";var e=/<("[^"]*"|'[^']*'|[^'">])*>/gi;if(b)return(b=b.replace(e,""))&&b!==" "&&b!==" "?b.replace(/\"/g,"'"):"";else return b},stripPref:function(b,e){var c=Object.prototype.toString.call(b).slice(8,-1);if(c=="String"||c=="Number"){b=String(b);e=b!=""? String(e).replace(String(b),""):e}return e},stringToDoc:function(b){var e;if(typeof b!=="string")return b;try{e=(new DOMParser).parseFromString(b,"text/xml")}catch(c){e=new ActiveXObject("Microsoft.XMLDOM");e.async=false;e.loadXML(b)}return e&&e.documentElement&&e.documentElement.tagName!="parsererror"?e:null},parse:function(b){if(b.substr(0,9)=="while(1);")b=b.substr(9);if(b.substr(0,2)=="/*")b=b.substr(2,b.length-4);b||(b="{}");return a.jgrid.useJSON===true&&typeof JSON==="object"&&typeof JSON.parse=== "function"?JSON.parse(b):eval("("+b+")")},parseDate:function(b,e){var c={m:1,d:1,y:1970,h:0,i:0,s:0,u:0},f,g,h;f=/[\\\/:_;.,\t\T\s-]/;if(e&&e!==null&&e!==undefined){e=a.trim(e);e=e.split(f);b=b.split(f);var j=a.jgrid.formatter.date.monthNames,d=a.jgrid.formatter.date.AmPm,o=function(l,n){if(l===0){if(n==12)n=0}else if(n!=12)n+=12;return n};f=0;for(g=b.length;f11)e[f]=h+1-12}if(b[f]=="a"){h= a.inArray(e[f],d);if(h!==-1&&h<2&&e[f]==d[h]){e[f]=h;c.h=o(e[f],c.h)}}if(b[f]=="A"){h=a.inArray(e[f],d);if(h!==-1&&h>1&&e[f]==d[h]){e[f]=h-2;c.h=o(e[f],c.h)}}if(e[f]!==undefined)c[b[f].toLowerCase()]=parseInt(e[f],10)}c.m=parseInt(c.m,10)-1;f=c.y;if(f>=70&&f<=99)c.y=1900+c.y;else if(f>=0&&f<=69)c.y=2E3+c.y}return new Date(c.y,c.m,c.d,c.h,c.i,c.s,c.u)},jqID:function(b){return String(b).replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g,"\\$&")},guid:1,uidPref:"jqg",randId:function(b){return(b?b:a.jgrid.uidPref)+ a.jgrid.guid++},getAccessor:function(b,e){var c,f,g=[],h;if(typeof e==="function")return e(b);c=b[e];if(c===undefined)try{if(typeof e==="string")g=e.split(".");if(h=g.length)for(c=b;c&&h--;){f=g.shift();c=c[f]}}catch(j){}return c},getXmlData:function(b,e,c){var f=typeof e==="string"?e.match(/^(.*)\[(\w+)\]$/):null;if(typeof e==="function")return e(b);if(f&&f[2])return f[1]?a(f[1],b).attr(f[2]):a(b).attr(f[2]);else{b=a(e,b);if(c)return b;return b.length>0?a(b).text():undefined}},ajaxOptions:{},from:function(b){return new function(e, c){if(typeof e=="string")e=a.data(e);var f=this,g=e,h=true,j=false,d=c,o=/[\$,%]/g,l=null,n=null,m=0,p=false,k="",v=[],s=true;if(typeof e=="object"&&e.push){if(e.length>0)s=typeof e[0]!="object"?false:true}else throw"data provides is not an array";this._hasData=function(){return g===null?false:g.length===0?false:true};this._getStr=function(q){var r=[];j&&r.push("jQuery.trim(");r.push("String("+q+")");j&&r.push(")");h||r.push(".toLowerCase()");return r.join("")};this._strComp=function(q){return typeof q== "string"?".toString()":""};this._group=function(q,r){return{field:q.toString(),unique:r,items:[]}};this._toStr=function(q){if(j)q=a.trim(q);h||(q=q.toLowerCase());return q=q.toString().replace(/\\/g,"\\\\").replace(/\"/g,'\\"')};this._funcLoop=function(q){var r=[];a.each(g,function(w,y){r.push(q(y))});return r};this._append=function(q){var r;if(d===null)d="";else d+=k===""?" && ":k;for(r=0;rr)return w;return 0};this._performSort=function(){if(v.length!==0)g=f._doSort(g,0)};this._doSort=function(q,r){var w=v[r].by,y=v[r].dir,z=v[r].type,E=v[r].datefmt;if(r==v.length-1)return f._getOrder(q,w,y,z,E);r++;w=f._getGroup(q,w,y,z,E);y=[];for(z=0;z0};this.andNot=function(q,r,w){p=!p;return f.and(q,r,w)};this.orNot=function(q,r,w){p=!p;return f.or(q,r,w)}; this.not=function(q,r,w){return f.andNot(q,r,w)};this.and=function(q,r,w){k=" && ";if(q===undefined)return f;return f._repeatCommand(q,r,w)};this.or=function(q,r,w){k=" || ";if(q===undefined)return f;return f._repeatCommand(q,r,w)};this.orBegin=function(){m++;return f};this.orEnd=function(){if(d!==null)d+=")";return f};this.isNot=function(q){p=!p;return f.is(q)};this.is=function(q){f._append("this."+q);f._resetNegate();return f};this._compareValues=function(q,r,w,y,z){var E;E=s?"jQuery.jgrid.getAccessor(this,'"+ r+"')":"this";if(w===undefined)w=null;var D=w,B=z.stype===undefined?"text":z.stype;if(w!==null)switch(B){case "int":case "integer":D=isNaN(Number(D))||D===""?"0":D;E="parseInt("+E+",10)";D="parseInt("+D+",10)";break;case "float":case "number":case "numeric":D=String(D).replace(o,"");D=isNaN(Number(D))||D===""?"0":D;E="parseFloat("+E+")";D="parseFloat("+D+")";break;case "date":case "datetime":D=String(a.jgrid.parseDate(z.newfmt||"Y-m-d",D).getTime());E='jQuery.jgrid.parseDate("'+z.srcfmt+'",'+E+").getTime()"; break;default:E=f._getStr(E);D=f._getStr('"'+f._toStr(D)+'"')}f._append(E+" "+y+" "+D);f._setCommand(q,r);f._resetNegate();return f};this.equals=function(q,r,w){return f._compareValues(f.equals,q,r,"==",w)};this.notEquals=function(q,r,w){return f._compareValues(f.equals,q,r,"!==",w)};this.isNull=function(q,r,w){return f._compareValues(f.equals,q,null,"===",w)};this.greater=function(q,r,w){return f._compareValues(f.greater,q,r,">",w)};this.less=function(q,r,w){return f._compareValues(f.less,q,r,"<", w)};this.greaterOrEquals=function(q,r,w){return f._compareValues(f.greaterOrEquals,q,r,">=",w)};this.lessOrEquals=function(q,r,w){return f._compareValues(f.lessOrEquals,q,r,"<=",w)};this.startsWith=function(q,r){var w=r===undefined||r===null?q:r;w=j?a.trim(w.toString()).length:w.toString().length;if(s)f._append(f._getStr("jQuery.jgrid.getAccessor(this,'"+q+"')")+".substr(0,"+w+") == "+f._getStr('"'+f._toStr(r)+'"'));else{w=j?a.trim(r.toString()).length:r.toString().length;f._append(f._getStr("this")+ ".substr(0,"+w+") == "+f._getStr('"'+f._toStr(q)+'"'))}f._setCommand(f.startsWith,q);f._resetNegate();return f};this.endsWith=function(q,r){var w=r===undefined||r===null?q:r;w=j?a.trim(w.toString()).length:w.toString().length;s?f._append(f._getStr("jQuery.jgrid.getAccessor(this,'"+q+"')")+".substr("+f._getStr("jQuery.jgrid.getAccessor(this,'"+q+"')")+".length-"+w+","+w+') == "'+f._toStr(r)+'"'):f._append(f._getStr("this")+".substr("+f._getStr("this")+'.length-"'+f._toStr(q)+'".length,"'+f._toStr(q)+ '".length) == "'+f._toStr(q)+'"');f._setCommand(f.endsWith,q);f._resetNegate();return f};this.contains=function(q,r){s?f._append(f._getStr("jQuery.jgrid.getAccessor(this,'"+q+"')")+'.indexOf("'+f._toStr(r)+'",0) > -1'):f._append(f._getStr("this")+'.indexOf("'+f._toStr(q)+'",0) > -1');f._setCommand(f.contains,q);f._resetNegate();return f};this.groupBy=function(q,r,w,y){if(!f._hasData())return null;return f._getGroup(g,q,r,w,y)};this.orderBy=function(q,r,w,y){r=r===undefined||r===null?"a":a.trim(r.toString().toLowerCase()); if(w===null||w===undefined)w="text";if(y===null||y===undefined)y="Y-m-d";if(r=="desc"||r=="descending")r="d";if(r=="asc"||r=="ascending")r="a";v.push({by:q,dir:r,type:w,datefmt:y});return f};return f}(b,null)},extend:function(b){a.extend(a.fn.jqGrid,b);this.no_legacy_api||a.fn.extend(b)}});a.fn.jqGrid=function(b){if(typeof b=="string"){var e=a.jgrid.getAccessor(a.fn.jqGrid,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 f= a.extend(true,{url:"",height:150,page:1,rowNum:20,rowTotal:null,records:0,pager:"",pgbuttons:true,pginput:true,colModel:[],rowList:[],colNames:[],sortorder:"asc",sortname:"",datatype:"xml",mtype:"GET",altRows:false,selarrrow:[],savedRow:[],shrinkToFit:true,xmlReader:{},jsonReader:{},subGrid:false,subGridModel:[],reccount:0,lastpage:0,lastsort:0,selrow:null,beforeSelectRow:null,onSelectRow:null,onSortCol:null,ondblClickRow:null,onRightClickRow:null,onPaging:null,onSelectAll:null,loadComplete:null, gridComplete:null,loadError:null,loadBeforeSend:null,afterInsertRow:null,beforeRequest:null,beforeProcessing:null,onHeaderClick:null,viewrecords:false,loadonce:false,multiselect:false,multikey:false,editurl:null,search:false,caption:"",hidegrid:true,hiddengrid:false,postData:{},userData:{},treeGrid:false,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:false,gridstate:"visible",cellEdit:false,cellsubmit:"remote",nv:0,loadui:"enable",toolbar:[false,""],scroll:false,multiboxonly:false,deselectAfterSort:true,scrollrows:false,autowidth:false,scrollOffset:18,cellLayout:5,subGridWidth:20,multiselectWidth:20,gridview:false,rownumWidth:25,rownumbers:false,pagerpos:"center",recordpos:"right",footerrow:false,userDataOnFooter:false,hoverrows:true,altclass:"ui-priority-secondary", viewsortcols:[false,"vertical",true],resizeclass:"",autoencode:false,remapColumns:[],ajaxGridOptions:{},direction:"ltr",toppager:false,headertitles:false,scrollTimeout:40,data:[],_index:{},grouping:false,groupingView:{groupField:[],groupOrder:[],groupText:[],groupColumnShow:[],groupSummary:[],showSummaryOnHide:false,sortitems:[],sortnames:[],groupDataSorted:false,summary:[],summaryval:[],plusicon:"ui-icon-circlesmall-plus",minusicon:"ui-icon-circlesmall-minus"},ignoreCase:false,cmTemplate:{},idPrefix:""}, a.jgrid.defaults,b||{}),g={headers:[],cols:[],footers:[],dragStart:function(t,u,x){this.resizing={idx:t,startX:u.clientX,sOL:x[0]};this.hDiv.style.cursor="col-resize";this.curGbox=a("#rs_m"+a.jgrid.jqID(f.id),"#gbox_"+a.jgrid.jqID(f.id));this.curGbox.css({display:"block",left:x[0],top:x[1],height:x[2]});a.isFunction(f.resizeStart)&&f.resizeStart.call(this,u,t);document.onselectstart=function(){return false}},dragMove:function(t){if(this.resizing){var u=t.clientX-this.resizing.startX;t=this.headers[this.resizing.idx]; var x=f.direction==="ltr"?t.width+u:t.width-u,A;if(x>33){this.curGbox.css({left:this.resizing.sOL+u});if(f.forceFit===true){A=this.headers[this.resizing.idx+f.nv];u=f.direction==="ltr"?A.width-u:A.width+u;if(u>33){t.newWidth=x;A.newWidth=u}}else{this.newWidth=f.direction==="ltr"?f.tblwidth+u:f.tblwidth-u;t.newWidth=x}}}},dragEnd:function(){this.hDiv.style.cursor="default";if(this.resizing){var t=this.resizing.idx,u=this.headers[t].newWidth||this.headers[t].width;u=parseInt(u,10);this.resizing=false; a("#rs_m"+a.jgrid.jqID(f.id)).css("display","none");f.colModel[t].width=u;this.headers[t].width=u;this.headers[t].el.style.width=u+"px";this.cols[t].style.width=u+"px";if(this.footers.length>0)this.footers[t].style.width=u+"px";if(f.forceFit===true){u=this.headers[t+f.nv].newWidth||this.headers[t+f.nv].width;this.headers[t+f.nv].width=u;this.headers[t+f.nv].el.style.width=u+"px";this.cols[t+f.nv].style.width=u+"px";if(this.footers.length>0)this.footers[t+f.nv].style.width=u+"px";f.colModel[t+f.nv].width= u}else{f.tblwidth=this.newWidth||f.tblwidth;a("table:first",this.bDiv).css("width",f.tblwidth+"px");a("table:first",this.hDiv).css("width",f.tblwidth+"px");this.hDiv.scrollLeft=this.bDiv.scrollLeft;if(f.footerrow){a("table:first",this.sDiv).css("width",f.tblwidth+"px");this.sDiv.scrollLeft=this.bDiv.scrollLeft}}a.isFunction(f.resizeStop)&&f.resizeStop.call(this,u,t)}this.curGbox=null;document.onselectstart=function(){return true}},populateVisible:function(){g.timer&&clearTimeout(g.timer);g.timer= null;var t=a(g.bDiv).height();if(t){var u=a("table:first",g.bDiv),x,A;if(u[0].rows.length)try{A=(x=u[0].rows[1])?a(x).outerHeight()||g.prevRowHeight:g.prevRowHeight}catch(F){A=g.prevRowHeight}if(A){g.prevRowHeight=A;var T=f.rowNum;x=g.scrollTop=g.bDiv.scrollTop;var J=Math.round(u.position().top)-x,R=J+u.height();A*=T;var P,M,N;if(R=0||M<2||f.scroll===true){P=Math.round((R+x)/A)+1;J=-1}else J= 1}if(J>0){P=parseInt(x/A,10)+1;M=parseInt((x+t)/A,10)+2-P;N=true}if(M)if(!(f.lastpage&&P>f.lastpage||f.lastpage==1||P===f.page&&P===f.lastpage))if(g.hDiv.loading)g.timer=setTimeout(g.populateVisible,f.scrollTimeout);else{f.page=P;if(N){g.selectionPreserver(u[0]);g.emptyRows(g.bDiv,false,false)}g.populate(M)}}}},scrollGrid:function(t){if(f.scroll){var u=g.bDiv.scrollTop;if(g.scrollTop===undefined)g.scrollTop=0;if(u!=g.scrollTop){g.scrollTop=u;g.timer&&clearTimeout(g.timer);g.timer=setTimeout(g.populateVisible, f.scrollTimeout)}}g.hDiv.scrollLeft=g.bDiv.scrollLeft;if(f.footerrow)g.sDiv.scrollLeft=g.bDiv.scrollLeft;t&&t.stopPropagation()},selectionPreserver:function(t){var u=t.p,x=u.selrow,A=u.selarrrow?a.makeArray(u.selarrrow):null,F=t.grid.bDiv.scrollLeft,T=u.gridComplete;u.gridComplete=function(){u.selrow=null;u.selarrrow=[];if(u.multiselect&&A&&A.length>0)for(var J=0;J"),l,n=a.browser.msie?true:false,m=a.browser.webkit||a.browser.safari? true:false;d=this;d.p.direction=a.trim(d.p.direction.toLowerCase());if(a.inArray(d.p.direction,["ltr","rtl"])==-1)d.p.direction="ltr";j=d.p.direction;a(o).insertBefore(this);a(this).appendTo(o).removeClass("scroll");var p=a("
");a(p).insertBefore(o).attr({id:"gbox_"+this.id,dir:j});a(o).appendTo(p).attr("id","gview_"+this.id);l=n&&a.browser.version<=6?'': "";a("
").append(l).insertBefore(o);a("
"+this.p.loadtext+"
").insertBefore(o);a(this).attr({cellspacing:"0",cellpadding:"0",border:"0",role:"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});var k=function(t,u){t=parseInt(t,10);return isNaN(t)?u?u:0:t},v=function(t,u,x,A,F,T){var J=d.p.colModel[t],R=J.align,P='style="', M=J.classes,N=J.name,I=[];if(R)P+="text-align:"+R+";";if(J.hidden===true)P+="display:none;";if(u===0)P+="width: "+g.headers[t].width+"px;";else if(J.cellattr&&a.isFunction(J.cellattr))if((t=J.cellattr.call(d,F,x,A,J,T))&&typeof t==="string"){t=t.replace(/style/i,"style").replace(/title/i,"title");if(t.indexOf("title")>-1)J.title=false;if(t.indexOf("class")>-1)M=undefined;I=t.split("style");if(I.length===2){I[1]=a.trim(I[1].replace("=",""));if(I[1].indexOf("'")===0||I[1].indexOf('"')===0)I[1]=I[1].substring(1); P+=I[1].replace(/'/gi,'"')}else P+='"'}if(!I.length){I[0]="";P+='"'}P+=(M!==undefined?' class="'+M+'"':"")+(J.title&&x?' title="'+a.jgrid.stripHtml(x)+'"':"");P+=' aria-describedby="'+d.p.id+"_"+N+'"';return P+I[0]},s=function(t){return t===undefined||t===null||t===""?" ":d.p.autoencode?a.jgrid.htmlEncode(t):t+""},q=function(t,u,x,A,F){var T=d.p.colModel[x];if(typeof T.formatter!=="undefined"){t={rowId:t,colModel:T,gid:d.p.id,pos:x};u=a.isFunction(T.formatter)?T.formatter.call(d,u,t,A,F):a.fmatter? a.fn.fmatter(T.formatter,u,t,A,F):s(u)}else u=s(u);return u},r=function(t,u,x,A,F){u=q(t,u,x,F,"add");return'"+u+""},w=function(t,u,x){var A='';return'"+A+""},y=function(t,u,x,A){x=(parseInt(x,10)-1)*parseInt(A,10)+1+u;return'"+x+""},z=function(t){var u,x=[],A=0,F;for(F=0;Fdiv:first",t).css({height:"auto"}).children("div:first").css({height:0,display:"none"});t.scrollTop=0}if(x===true)if(d.p.treeGrid===true){d.p.data=[];d.p._index={}}},B=function(){var t=d.p.data.length,u,x,A;u=d.p.rownumbers===true?1:0;x=d.p.multiselect===true?1:0;A=d.p.subGrid===true?1:0;u=d.p.keyIndex===false||d.p.loadonce===true?d.p.localReader.id: d.p.colModel[d.p.keyIndex+x+A+u].name;for(x=0;x1?x:1;var M,N,I=0,Y,ga=0,ja=0,ca=0,ea,ta=[],ha,L={},U,Z,na=[],Fa=d.p.altRows=== true?" "+d.p.altclass:"";R.repeatitems||(ta=z(P));ea=d.p.keyIndex===false?R.id:d.p.keyIndex;if(ta.length>0&&!isNaN(ea)){if(d.p.remapColumns&&d.p.remapColumns.length)ea=a.inArray(ea,d.p.remapColumns);ea=ta[ea]}P=(ea+"").indexOf("[")===-1?ta.length?function(za,wa){return a(ea,za).text()||wa}:function(za,wa){return a(R.cell,za).eq(ea).text()||wa}:function(za,wa){return za.getAttribute(ea.replace(/[\[\]]/g,""))||wa};d.p.userData={};d.p.page=a.jgrid.getXmlData(t,R.page)||0;d.p.lastpage=a.jgrid.getXmlData(t, R.total);if(d.p.lastpage===undefined)d.p.lastpage=1;d.p.records=a.jgrid.getXmlData(t,R.records)||0;if(a.isFunction(R.userdata))d.p.userData=R.userdata.call(d,t)||{};else a.jgrid.getXmlData(t,R.userdata,true).each(function(){d.p.userData[this.getAttribute("name")]=a(this).text()});t=a.jgrid.getXmlData(t,R.root,true);(t=a.jgrid.getXmlData(t,R.row,true))||(t=[]);var va=t.length,pa=0,Aa={},Ca;if(t&&va){Ca=parseInt(d.p.rowNum,10);var Ia=d.p.scroll?a.jgrid.randId():1;if(F)Ca*=F+1;F=a.isFunction(d.p.afterInsertRow); var Ja="";if(d.p.grouping&&d.p.groupingView.groupCollapse===true)Ja=' style="display:none;"';for(;pa');if(d.p.rownumbers===true){na.push(y(0,pa,d.p.page,d.p.rowNum));ca=1}if(d.p.multiselect===true){na.push(w(Z,ca,pa));ga=1}if(d.p.subGrid===true){na.push(a(d).jqGrid("addSubGridCell",ga+ca,pa+x));ja=1}if(R.repeatitems){ha|| (ha=E(ga+ja+ca));var La=a.jgrid.getXmlData(U,R.cell,true);a.each(ha,function(za){var wa=La[this];if(!wa)return false;Y=wa.textContent||wa.text;L[d.p.colModel[za+ga+ja+ca].name]=Y;na.push(r(Z,Y,za+ga+ja+ca,pa+x,U))})}else for(M=0;M");if(d.p.grouping){M=d.p.groupingView.groupField.length;for(var Ma=[],Ka=0;Ka-1?d.p.treeANode:0;if(d.p.grouping){a(d).jqGrid("groupingRender",Aa,d.p.colModel.length);Aa=null}else d.p.treeGrid===true&&N>0?a(d.rows[N]).after(na.join("")):a("tbody:first",u).append(na.join(""))}if(d.p.subGrid===true)try{a(d).jqGrid("addSubGrid", ga+ca)}catch(Oa){}d.p.totaltime=new Date-T;if(I>0)if(d.p.records===0)d.p.records=va;na=null;if(d.p.treeGrid===true)try{a(d).jqGrid("setTreeNode",N+1,I+N+1)}catch(Pa){}if(!d.p.treeGrid&&!d.p.scroll)d.grid.bDiv.scrollTop=0;d.p.reccount=I;d.p.treeANode=-1;d.p.userDataOnFooter&&a(d).jqGrid("footerData","set",d.p.userData,true);if(J){d.p.records=va;d.p.lastpage=Math.ceil(va/Ca)}A||d.updatepager(false,true);if(J)for(;I1?x:1;var J,R=d.p.datatype!="local"&&d.p.loadonce||d.p.datatype=="jsonstring"; if(R){d.p.data=[];d.p._index={};d.p.localReader.id="_id_"}d.p.reccount=0;if(d.p.datatype=="local"){u=d.p.localReader;J="local"}else{u=d.p.jsonReader;J="json"}var P=0,M,N,I=[],Y,ga=0,ja=0,ca=0,ea,ta,ha={},L,U,Z=[],na=d.p.altRows===true?" "+d.p.altclass:"";d.p.page=a.jgrid.getAccessor(t,u.page)||0;ea=a.jgrid.getAccessor(t,u.total);d.p.lastpage=ea===undefined?1:ea;d.p.records=a.jgrid.getAccessor(t,u.records)||0;d.p.userData=a.jgrid.getAccessor(t,u.userdata)||{};u.repeatitems||(Y=I=z(J));J=d.p.keyIndex=== false?u.id:d.p.keyIndex;if(I.length>0&&!isNaN(J)){if(d.p.remapColumns&&d.p.remapColumns.length)J=a.inArray(J,d.p.remapColumns);J=I[J]}(ta=a.jgrid.getAccessor(t,u.root))||(ta=[]);ea=ta.length;t=0;var Fa=parseInt(d.p.rowNum,10),va=d.p.scroll?a.jgrid.randId():1;if(F)Fa*=F+1;var pa=a.isFunction(d.p.afterInsertRow),Aa={},Ca="";if(d.p.grouping&&d.p.groupingView.groupCollapse===true)Ca=' style="display:none;"';for(;t');if(d.p.rownumbers===true){Z.push(y(0,t,d.p.page,d.p.rowNum));ca=1}if(d.p.multiselect){Z.push(w(U,ca,t));ga=1}if(d.p.subGrid){Z.push(a(d).jqGrid("addSubGridCell",ga+ca,t+x));ja=1}if(u.repeatitems){if(u.cell)F=a.jgrid.getAccessor(F,u.cell);Y||(Y=E(ga+ja+ca))}for(N=0;N");if(d.p.grouping){M=d.p.groupingView.groupField.length;N=[];for(var Ia=0;Ia-1?d.p.treeANode:0;if(d.p.grouping)a(d).jqGrid("groupingRender",Aa,d.p.colModel.length);else d.p.treeGrid===true&&L>0?a(d.rows[L]).after(Z.join("")):a("#"+a.jgrid.jqID(d.p.id)+" tbody:first").append(Z.join(""))}if(d.p.subGrid===true)try{a(d).jqGrid("addSubGrid",ga+ca)}catch(Ja){}d.p.totaltime=new Date-T;if(P>0)if(d.p.records===0)d.p.records=ea;if(d.p.treeGrid===true)try{a(d).jqGrid("setTreeNode",L+1,P+L+1)}catch(La){}if(!d.p.treeGrid&&!d.p.scroll)d.grid.bDiv.scrollTop= 0;d.p.reccount=P;d.p.treeANode=-1;d.p.userDataOnFooter&&a(d).jqGrid("footerData","set",d.p.userData,true);if(R){d.p.records=ea;d.p.lastpage=Math.ceil(ea/Fa)}A||d.updatepager(false,true);if(R)for(;P0&&na&&I.or();try{t(L.groups[Z])}catch(Aa){alert(Aa)}U++}na&&I.orEnd()}if(L.rules!==undefined){if(U>0){na=I.select();I=a.jgrid.from(na);if(d.p.ignoreCase)I=I.ignoreCase()}try{(Fa=L.rules.length&&L.groupOp.toString().toUpperCase()=== "OR")&&I.orBegin();for(Z=0;Z0&&va&&va==="OR")I=I.or();I=N[pa.op](I,va)(pa.field,pa.data,A[pa.field])}U++}Fa&&I.orEnd()}catch(Ca){alert(Ca)}}}var u,x=false,A={},F=[],T=[],J,R,P;if(a.isArray(d.p.data)){var M=d.p.grouping?d.p.groupingView:false;a.each(d.p.colModel,function(){R=this.sorttype||"text";if(R=="date"||R=="datetime"){if(this.formatter&&typeof this.formatter==="string"&&this.formatter=="date"){J= this.formatoptions&&this.formatoptions.srcformat?this.formatoptions.srcformat:a.jgrid.formatter.date.srcformat;P=this.formatoptions&&this.formatoptions.newformat?this.formatoptions.newformat:a.jgrid.formatter.date.newformat}else J=P=this.datefmt||"Y-m-d";A[this.name]={stype:R,srcfmt:J,newfmt:P}}else A[this.name]={stype:R,srcfmt:"",newfmt:""};if(d.p.grouping&&this.name==M.groupField[0]){var L=this.name;if(typeof this.index!="undefined")L=this.index;F[0]=A[L];T.push(L)}if(!x&&(this.index==d.p.sortname|| this.name==d.p.sortname)){u=this.name;x=true}});if(d.p.treeGrid)a(d).jqGrid("SortTree",u,d.p.sortorder,A[u].stype,A[u].srcfmt);else{var N={eq:function(L){return L.equals},ne:function(L){return L.notEquals},lt:function(L){return L.less},le:function(L){return L.lessOrEquals},gt:function(L){return L.greater},ge:function(L){return L.greaterOrEquals},cn:function(L){return L.contains},nc:function(L,U){return U==="OR"?L.orNot().contains:L.andNot().contains},bw:function(L){return L.startsWith},bn:function(L, U){return U==="OR"?L.orNot().startsWith:L.andNot().startsWith},en:function(L,U){return U==="OR"?L.orNot().endsWith:L.andNot().endsWith},ew:function(L){return L.endsWith},ni:function(L,U){return U==="OR"?L.orNot().equals:L.andNot().equals},"in":function(L){return L.equals},nu:function(L){return L.isNull},nn:function(L,U){return U==="OR"?L.orNot().isNull:L.andNot().isNull}},I=a.jgrid.from(d.p.data);if(d.p.ignoreCase)I=I.ignoreCase();if(d.p.search===true){var Y=d.p.postData.filters;if(Y){if(typeof Y== "string")Y=a.jgrid.parse(Y);t(Y)}else try{I=N[d.p.postData.searchOper](I)(d.p.postData.searchField,d.p.postData.searchString,A[d.p.postData.searchField])}catch(ga){}}if(d.p.grouping){I.orderBy(T,M.groupOrder[0],F[0].stype,F[0].srcfmt);M.groupDataSorted=true}if(u&&d.p.sortorder&&x)d.p.sortorder.toUpperCase()=="DESC"?I.orderBy(d.p.sortname,"d",A[u].stype,A[u].srcfmt):I.orderBy(d.p.sortname,"a",A[u].stype,A[u].srcfmt);Y=I.select();var ja=parseInt(d.p.rowNum,10),ca=Y.length,ea=parseInt(d.p.page,10),ta= Math.ceil(ca/ja),ha={};Y=Y.slice((ea-1)*ja,ea*ja);A=I=null;ha[d.p.localReader.total]=ta;ha[d.p.localReader.page]=ea;ha[d.p.localReader.records]=ca;ha[d.p.localReader.root]=Y;ha[d.p.localReader.userdata]=d.p.userData;Y=null;return ha}}},V=function(){d.grid.hDiv.loading=true;if(!d.p.hiddengrid)switch(d.p.loadui){case "enable":a("#load_"+a.jgrid.jqID(d.p.id)).show();break;case "block":a("#lui_"+a.jgrid.jqID(d.p.id)).show();a("#load_"+a.jgrid.jqID(d.p.id)).show()}},la=function(){d.grid.hDiv.loading=false; switch(d.p.loadui){case "enable":a("#load_"+a.jgrid.jqID(d.p.id)).hide();break;case "block":a("#lui_"+a.jgrid.jqID(d.p.id)).hide();a("#load_"+a.jgrid.jqID(d.p.id)).hide()}},ia=function(t){if(!d.grid.hDiv.loading){var u=d.p.scroll&&t===false,x={},A,F=d.p.prmNames;if(d.p.page<=0)d.p.page=1;if(F.search!==null)x[F.search]=d.p.search;if(F.nd!==null)x[F.nd]=(new Date).getTime();if(F.rows!==null)x[F.rows]=d.p.rowNum;if(F.page!==null)x[F.page]=d.p.page;if(F.sort!==null)x[F.sort]=d.p.sortname;if(F.order!== null)x[F.order]=d.p.sortorder;if(d.p.rowTotal!==null&&F.totalrows!==null)x[F.totalrows]=d.p.rowTotal;var T=d.p.loadComplete,J=a.isFunction(T);J||(T=null);var R=0;t=t||1;if(t>1)if(F.npage!==null){x[F.npage]=t;R=t-1;t=1}else T=function(M){d.p.page++;d.grid.hDiv.loading=false;J&&d.p.loadComplete.call(d,M);ia(t-1)};else F.npage!==null&&delete d.p.postData[F.npage];if(d.p.grouping){a(d).jqGrid("groupingSetup");if(d.p.groupingView.groupDataSorted===true)x[F.sort]=d.p.groupingView.groupField[0]+" "+d.p.groupingView.groupOrder[0]+ ", "+x[F.sort]}a.extend(d.p.postData,x);var P=!d.p.scroll?1:d.rows.length-1;if(a.isFunction(d.p.datatype))d.p.datatype.call(d,d.p.postData,"load_"+d.p.id);else{if(a.isFunction(d.p.beforeRequest)){x=d.p.beforeRequest.call(d);if(x===undefined)x=true;if(x===false)return}A=d.p.datatype.toLowerCase();switch(A){case "json":case "jsonp":case "xml":case "script":a.ajax(a.extend({url:d.p.url,type:d.p.mtype,dataType:A,data:a.isFunction(d.p.serializeGridData)?d.p.serializeGridData.call(d,d.p.postData):d.p.postData, success:function(M,N,I){a.isFunction(d.p.beforeProcessing)&&d.p.beforeProcessing.call(d,M,N,I);A==="xml"?K(M,d.grid.bDiv,P,t>1,R):C(M,d.grid.bDiv,P,t>1,R);T&&T.call(d,M);u&&d.grid.populateVisible();if(d.p.loadonce||d.p.treeGrid)d.p.datatype="local";t===1&&la()},error:function(M,N,I){a.isFunction(d.p.loadError)&&d.p.loadError.call(d,M,N,I);t===1&&la()},beforeSend:function(M,N){var I=true;if(a.isFunction(d.p.loadBeforeSend))I=d.p.loadBeforeSend.call(d,M,N);if(I===undefined)I=true;if(I===false)return false; else V()}},a.jgrid.ajaxOptions,d.p.ajaxGridOptions));break;case "xmlstring":V();x=a.jgrid.stringToDoc(d.p.datastr);K(x,d.grid.bDiv);J&&d.p.loadComplete.call(d,x);d.p.datatype="local";d.p.datastr=null;la();break;case "jsonstring":V();x=typeof d.p.datastr=="string"?a.jgrid.parse(d.p.datastr):d.p.datastr;C(x,d.grid.bDiv);J&&d.p.loadComplete.call(d,x);d.p.datatype="local";d.p.datastr=null;la();break;case "local":case "clientside":V();d.p.datatype="local";x=ba();C(x,d.grid.bDiv,P,t>1,R);T&&T.call(d,x); u&&d.grid.populateVisible();la()}}}},fa=function(t){a("#cb_"+a.jgrid.jqID(d.p.id),d.grid.hDiv)[d.p.useProp?"prop":"attr"]("checked",t);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",t)};l=function(t,u){var x="",A="",F="",T,J,R,P,M=function(N){var I;if(a.isFunction(d.p.onPaging))I=d.p.onPaging.call(d,N);d.p.selrow=null; if(d.p.multiselect){d.p.selarrrow=[];fa(false)}d.p.savedRow=[];if(I=="stop")return false;return true};t=t.substr(1);u+="_"+t;T="pg_"+t;J=t+"_left";R=t+"_center";P=t+"_right";a("#"+a.jgrid.jqID(t)).append("
").attr("dir","ltr");if(d.p.rowList.length>0){F="";F+=""}if(j=="rtl")A+=F;if(d.p.pginput===true)x=""+a.jgrid.format(d.p.pgtext||"","", "")+"";if(d.p.pgbuttons===true){J=["first"+u,"prev"+u,"next"+u,"last"+u];j=="rtl"&&J.reverse();A+="";A+="";A+=x!==""?""+x+"": "";A+="";A+=""}else if(x!=="")A+=x;if(j=="ltr")A+=F;A+="";d.p.viewrecords===true&&a("td#"+t+"_"+d.p.recordpos,"#"+T).append("
");a("td#"+t+"_"+d.p.pagerpos,"#"+T).append(A);F=a(".ui-jqgrid").css("font-size")|| "11px";a(document.body).append("");A=a(A).clone().appendTo("#testpg").width();a("#testpg").remove();if(A>0){if(x!=="")A+=50;a("td#"+t+"_"+d.p.pagerpos,"#"+T).width(A)}d.p._nvtd=[];d.p._nvtd[0]=A?Math.floor((d.p.width-A)/2):Math.floor(d.p.width/3);d.p._nvtd[1]=0;A=null;a(".ui-pg-selbox","#"+T).bind("change",function(){d.p.page=Math.round(d.p.rowNum*(d.p.page-1)/this.value-0.5)+1;d.p.rowNum= this.value;if(u)a(".ui-pg-selbox",d.p.pager).val(this.value);else d.p.toppager&&a(".ui-pg-selbox",d.p.toppager).val(this.value);if(!M("records"))return false;ia();return false});if(d.p.pgbuttons===true){a(".ui-pg-button","#"+T).hover(function(){if(a(this).hasClass("ui-state-disabled"))this.style.cursor="default";else{a(this).addClass("ui-state-hover");this.style.cursor="pointer"}},function(){if(!a(this).hasClass("ui-state-disabled")){a(this).removeClass("ui-state-hover");this.style.cursor="default"}}); a("#first"+a.jgrid.jqID(u)+", #prev"+a.jgrid.jqID(u)+", #next"+a.jgrid.jqID(u)+", #last"+a.jgrid.jqID(u)).click(function(){var N=k(d.p.page,1),I=k(d.p.lastpage,1),Y=false,ga=true,ja=true,ca=true,ea=true;if(I===0||I===1)ea=ca=ja=ga=false;else if(I>1&&N>=1)if(N===1)ja=ga=false;else{if(!(N>1&&N1&&N===0){ea=ca=false;N=I-1}if(this.id==="first"+u&&ga){d.p.page=1;Y=true}if(this.id==="prev"+u&&ja){d.p.page=N-1;Y=true}if(this.id==="next"+u&&ca){d.p.page=N+1;Y=true}if(this.id=== "last"+u&&ea){d.p.page=I;Y=true}if(Y){if(!M(this.id))return false;ia()}return false})}d.p.pginput===true&&a("input.ui-pg-input","#"+T).keypress(function(N){if((N.charCode?N.charCode:N.keyCode?N.keyCode:0)==13){d.p.page=a(this).val()>0?a(this).val():d.p.page;if(!M("user"))return false;ia();return false}return this})};var xa=function(t,u,x,A){if(d.p.colModel[u].sortable)if(!(d.p.savedRow.length>0)){if(!x){if(d.p.lastsort==u)if(d.p.sortorder=="asc")d.p.sortorder="desc";else{if(d.p.sortorder=="desc")d.p.sortorder= "asc"}else d.p.sortorder=d.p.colModel[u].firstsortorder||"asc";d.p.page=1}if(A)if(d.p.lastsort==u&&d.p.sortorder==A&&!x)return;else d.p.sortorder=A;x=d.grid.headers[d.p.lastsort].el;A=d.grid.headers[u].el;a("span.ui-grid-ico-sort",x).addClass("ui-state-disabled");a(x).attr("aria-selected","false");a("span.ui-icon-"+d.p.sortorder,A).removeClass("ui-state-disabled");a(A).attr("aria-selected","true");if(!d.p.viewsortcols[0])if(d.p.lastsort!=u){a("span.s-ico",x).hide();a("span.s-ico",A).show()}t=t.substring(5+ d.p.id.length+1);d.p.sortname=d.p.colModel[u].index||t;x=d.p.sortorder;if(a.isFunction(d.p.onSortCol))if(d.p.onSortCol.call(d,t,u,x)=="stop"){d.p.lastsort=u;return}if(d.p.datatype=="local")d.p.deselectAfterSort&&a(d).jqGrid("resetSelection");else{d.p.selrow=null;d.p.multiselect&&fa(false);d.p.selarrrow=[];d.p.savedRow=[]}if(d.p.scroll){x=d.grid.bDiv.scrollLeft;D(d.grid.bDiv,true,false);d.grid.hDiv.scrollLeft=x}d.p.subGrid&&d.p.datatype=="local"&&a("td.sgexpanded","#"+a.jgrid.jqID(d.p.id)).each(function(){a(this).trigger("click")}); ia();d.p.lastsort=u;if(d.p.sortname!=t&&u)d.p.lastsort=u}},ya=function(t){var u,x={},A=m?0:d.p.cellLayout;for(u=x[0]=x[1]=x[2]=0;u<=t;u++)if(d.p.colModel[u].hidden===false)x[0]+=d.p.colModel[u].width+A;if(d.p.direction=="rtl")x[0]=d.p.width-x[0];x[0]-=d.grid.bDiv.scrollLeft;if(a(d.grid.cDiv).is(":visible"))x[1]+=a(d.grid.cDiv).height()+parseInt(a(d.grid.cDiv).css("padding-top"),10)+parseInt(a(d.grid.cDiv).css("padding-bottom"),10);if(d.p.toolbar[0]===true&&(d.p.toolbar[1]=="top"||d.p.toolbar[1]== "both"))x[1]+=a(d.grid.uDiv).height()+parseInt(a(d.grid.uDiv).css("border-top-width"),10)+parseInt(a(d.grid.uDiv).css("border-bottom-width"),10);if(d.p.toppager)x[1]+=a(d.grid.topDiv).height()+parseInt(a(d.grid.topDiv).css("border-bottom-width"),10);x[2]+=a(d.grid.bDiv).height()+a(d.grid.hDiv).height();return x},Da=function(t){var u,x=d.grid.headers,A=a.jgrid.getCellIndex(t);for(u=0;u");this.p.colModel.unshift({name:"cb",width:m?d.p.multiselectWidth+d.p.cellLayout:d.p.multiselectWidth,sortable:false,resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}if(this.p.rownumbers){this.p.colNames.unshift("");this.p.colModel.unshift({name:"rn",width:d.p.rownumWidth,sortable:false, resizable:false,hidedlg:true,search:false,align:"center",fixed:true})}d.p.xmlReader=a.extend(true,{root:"rows",row:"row",page:"rows>page",total:"rows>total",records:"rows>records",repeatitems:true,cell:"cell",id:"[id]",userdata:"userdata",subgrid:{root:"rows",row:"row",repeatitems:true,cell:"cell"}},d.p.xmlReader);d.p.jsonReader=a.extend(true,{root:"rows",page:"page",total:"total",records:"records",repeatitems:true,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:true,cell:"cell"}}, d.p.jsonReader);d.p.localReader=a.extend(true,{root:"rows",page:"page",total:"total",records:"records",repeatitems:false,cell:"cell",id:"id",userdata:"userdata",subgrid:{root:"rows",repeatitems:true,cell:"cell"}},d.p.localReader);if(d.p.scroll){d.p.pgbuttons=false;d.p.pginput=false;d.p.rowList=[]}d.p.data.length&&B();var ra="",G,H,W,Q,$,S,O,da;H=da="";if(d.p.shrinkToFit===true&&d.p.forceFit===true)for(h=d.p.colModel.length-1;h>=0;h--)if(!d.p.colModel[h].hidden){d.p.colModel[h].resizable= false;break}if(d.p.viewsortcols[1]=="horizontal"){da=" ui-i-asc";H=" ui-i-desc"}G=n?"class='ui-th-div-ie'":"";da="";for(h=0;h";H=d.p.colModel[h].index||d.p.colModel[h].name;ra+="
"+d.p.colNames[h];d.p.colModel[h].width=d.p.colModel[h].width?parseInt(d.p.colModel[h].width,10):150;if(typeof d.p.colModel[h].title!=="boolean")d.p.colModel[h].title=true;if(H==d.p.sortname)d.p.lastsort=h;ra+=da+"
"}ra+="";da=null;a(this).append(ra); 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 X=[],oa;a("#cb_"+a.jgrid.jqID(d.p.id),this).bind("click",function(){d.p.selarrrow=[];var t=d.p.frozenColumns===true?d.p.id+"_frozen":"";if(this.checked){a(d.rows).each(function(u){if(u>0)if(!a(this).hasClass("ui-subgrid")&&!a(this).hasClass("jqgroup")&&!a(this).hasClass("ui-state-disabled")){a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(this.id))[d.p.useProp? "prop":"attr"]("checked",true);a(this).addClass("ui-state-highlight").attr("aria-selected","true");d.p.selarrrow.push(this.id);d.p.selrow=this.id;if(t){a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(this.id),d.grid.fbDiv)[d.p.useProp?"prop":"attr"]("checked",true);a("#"+a.jgrid.jqID(this.id),d.grid.fbDiv).addClass("ui-state-highlight")}}});oa=true;X=[]}else{a(d.rows).each(function(u){if(u>0)if(!a(this).hasClass("ui-subgrid")&&!a(this).hasClass("ui-state-disabled")){a("#jqg_"+a.jgrid.jqID(d.p.id)+ "_"+a.jgrid.jqID(this.id))[d.p.useProp?"prop":"attr"]("checked",false);a(this).removeClass("ui-state-highlight").attr("aria-selected","false");X.push(this.id);if(t){a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(this.id),d.grid.fbDiv)[d.p.useProp?"prop":"attr"]("checked",false);a("#"+a.jgrid.jqID(this.id),d.grid.fbDiv).removeClass("ui-state-highlight")}}});d.p.selrow=null;oa=false}if(a.isFunction(d.p.onSelectAll))d.p.onSelectAll.call(d,oa?d.p.selarrrow:X,oa)})}if(d.p.autowidth===true){ra=a(p).innerWidth(); d.p.width=ra>0?ra:"nw"}(function(){var t=0,u=m?0:d.p.cellLayout,x=0,A,F=d.p.scrollOffset,T,J=false,R,P=0,M=0,N;a.each(d.p.colModel,function(){if(typeof this.hidden==="undefined")this.hidden=false;this.widthOrg=T=k(this.width,0);if(this.hidden===false){t+=T+u;if(this.fixed)P+=T+u;else x++;M++}});if(isNaN(d.p.width))d.p.width=g.width=t;else g.width=d.p.width;d.p.tblwidth=t;if(d.p.shrinkToFit===false&&d.p.forceFit===true)d.p.forceFit=false;if(d.p.shrinkToFit===true&&x>0){R=g.width-u*x-P;if(!isNaN(d.p.height)){R-= F;J=true}t=0;a.each(d.p.colModel,function(I){if(this.hidden===false&&!this.fixed){this.width=T=Math.round(R*this.width/(d.p.tblwidth-u*x-P));t+=T;A=I}});N=0;if(J){if(g.width-P-(t+u*x)!==F)N=g.width-P-(t+u*x)-F}else if(!J&&Math.abs(g.width-P-(t+u*x))!==1)N=g.width-P-(t+u*x);d.p.colModel[A].width+=N;d.p.tblwidth=t+N+u*x+P;if(d.p.tblwidth>d.p.width){d.p.colModel[A].width-=d.p.tblwidth-parseInt(d.p.width,10);d.p.tblwidth=d.p.width}}})();a(p).css("width",g.width+"px").append("
 
");a(o).css("width",g.width+"px");ra=a("thead:first",d).get(0);var aa="";if(d.p.footerrow)aa+="";o=a("tr:first",ra);var ua="";d.p.disableClick=false;a("th",o).each(function(t){W=d.p.colModel[t].width;if(typeof d.p.colModel[t].resizable=== "undefined")d.p.colModel[t].resizable=true;if(d.p.colModel[t].resizable){Q=document.createElement("span");a(Q).html(" ").addClass("ui-jqgrid-resize ui-jqgrid-resize-"+j);a.browser.opera||a(Q).css("cursor","col-resize");a(this).addClass(d.p.resizeclass)}else Q="";a(this).css("width",W+"px").prepend(Q);var u="";if(d.p.colModel[t].hidden){a(this).css("display","none");u="display:none;"}ua+="";g.headers[t]={width:W,el:this};$=d.p.colModel[t].sortable; if(typeof $!=="boolean")$=d.p.colModel[t].sortable=true;u=d.p.colModel[t].name;u=="cb"||u=="subgrid"||u=="rn"||d.p.viewsortcols[2]&&a(">div",this).addClass("ui-jqgrid-sortable");if($)if(d.p.viewsortcols[0]){a("div span.s-ico",this).show();t==d.p.lastsort&&a("div span.ui-icon-"+d.p.sortorder,this).removeClass("ui-state-disabled")}else if(t==d.p.lastsort){a("div span.s-ico",this).show();a("div span.ui-icon-"+d.p.sortorder,this).removeClass("ui-state-disabled")}if(d.p.footerrow)aa+=""}).mousedown(function(t){if(a(t.target).closest("th>span.ui-jqgrid-resize").length==1){var u=Da(this);if(d.p.forceFit===true){var x=d.p,A=u,F;for(F=u+1;F
 
").append(ra); var sa=d.p.caption&&d.p.hiddengrid===true?true:false;h=a("
");ra=null;g.hDiv=document.createElement("div");a(g.hDiv).css({width:g.width+"px"}).addClass("ui-state-default ui-jqgrid-hdiv").append(h);a(h).append(o);o=null;sa&&a(g.hDiv).hide();if(d.p.pager){if(typeof d.p.pager=="string"){if(d.p.pager.substr(0,1)!="#")d.p.pager="#"+d.p.pager}else d.p.pager="#"+a(d.p.pager).attr("id");a(d.p.pager).css({width:g.width+"px"}).appendTo(p).addClass("ui-state-default ui-jqgrid-pager ui-corner-bottom"); sa&&a(d.p.pager).hide();l(d.p.pager,"")}d.p.cellEdit===false&&d.p.hoverrows===true&&a(d).bind("mouseover",function(t){O=a(t.target).closest("tr.jqgrow");a(O).attr("class")!=="ui-subgrid"&&a(O).addClass("ui-state-hover")}).bind("mouseout",function(t){O=a(t.target).closest("tr.jqgrow");a(O).removeClass("ui-state-hover")});var ka,qa;a(d).before(g.hDiv).click(function(t){S=t.target;O=a(S,d.rows).closest("tr.jqgrow");if(a(O).length===0||O[0].className.indexOf("ui-state-disabled")>-1||a(S,d).closest("table.ui-jqgrid-btable")[0].id.replace("_frozen", "")!==d.id)return this;var u=a(S).hasClass("cbox"),x=true;if(a.isFunction(d.p.beforeSelectRow))x=d.p.beforeSelectRow.call(d,O[0].id,t);if(S.tagName=="A"||(S.tagName=="INPUT"||S.tagName=="TEXTAREA"||S.tagName=="OPTION"||S.tagName=="SELECT")&&!u)return this;if(x===true){if(d.p.cellEdit===true)if(d.p.multiselect&&u)a(d).jqGrid("setSelection",O[0].id,true);else{ka=O[0].rowIndex;qa=a.jgrid.getCellIndex(S);try{a(d).jqGrid("editCell",ka,qa,true)}catch(A){}}else if(d.p.multikey)if(t[d.p.multikey])a(d).jqGrid("setSelection", O[0].id,true);else{if(d.p.multiselect&&u){u=a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+O[0].id).is(":checked");a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+O[0].id)[d.p.useProp?"prop":"attr"]("checked",u)}}else{if(d.p.multiselect&&d.p.multiboxonly)if(!u){var F=d.p.frozenColumns?d.p.id+"_frozen":"";a(d.p.selarrrow).each(function(T,J){var R=d.rows.namedItem(J);a(R).removeClass("ui-state-highlight");a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(J))[d.p.useProp?"prop":"attr"]("checked",false);if(F){a("#"+a.jgrid.jqID(J), "#"+a.jgrid.jqID(F)).removeClass("ui-state-highlight");a("#jqg_"+a.jgrid.jqID(d.p.id)+"_"+a.jgrid.jqID(J),"#"+a.jgrid.jqID(F))[d.p.useProp?"prop":"attr"]("checked",false)}});d.p.selarrrow=[]}a(d).jqGrid("setSelection",O[0].id,true)}if(a.isFunction(d.p.onCellSelect)){ka=O[0].id;qa=a.jgrid.getCellIndex(S);d.p.onCellSelect.call(d,ka,qa,a(S).html(),t)}}return this}).bind("reloadGrid",function(t,u){if(d.p.treeGrid===true)d.p.datatype=d.p.treedatatype;u&&u.current&&d.grid.selectionPreserver(d);if(d.p.datatype== "local"){a(d).jqGrid("resetSelection");d.p.data.length&&B()}else if(!d.p.treeGrid){d.p.selrow=null;if(d.p.multiselect){d.p.selarrrow=[];fa(false)}d.p.savedRow=[]}d.p.scroll&&D(d.grid.bDiv,true,false);if(u&&u.page){var x=u.page;if(x>d.p.lastpage)x=d.p.lastpage;if(x<1)x=1;d.p.page=x;d.grid.bDiv.scrollTop=d.grid.prevRowHeight?(x-1)*d.grid.prevRowHeight*d.p.rowNum:0}if(d.grid.prevRowHeight&&d.p.scroll){delete d.p.lastpage;d.grid.populateVisible()}else d.grid.populate();return false});a.isFunction(this.p.ondblClickRow)&& a(this).dblclick(function(t){S=t.target;O=a(S,d.rows).closest("tr.jqgrow");if(a(O).length===0)return false;ka=O[0].rowIndex;qa=a.jgrid.getCellIndex(S);d.p.ondblClickRow.call(d,a(O).attr("id"),ka,qa,t);return false});a.isFunction(this.p.onRightClickRow)&&a(this).bind("contextmenu",function(t){S=t.target;O=a(S,d.rows).closest("tr.jqgrow");if(a(O).length===0)return false;d.p.multiselect||a(d).jqGrid("setSelection",O[0].id,true);ka=O[0].rowIndex;qa=a.jgrid.getCellIndex(S);d.p.onRightClickRow.call(d,a(O).attr("id"), ka,qa,t);return false});g.bDiv=document.createElement("div");if(n)if(String(d.p.height).toLowerCase()==="auto")d.p.height="100%";a(g.bDiv).append(a('
').append("
").append(this)).addClass("ui-jqgrid-bdiv").css({height:d.p.height+(isNaN(d.p.height)?"":"px"),width:g.width+"px"}).scroll(g.scrollGrid);a("table:first",g.bDiv).css({width:d.p.tblwidth+"px"});if(n){a("tbody",this).size()==2&&a("tbody:gt(0)",this).remove(); d.p.multikey&&a(g.bDiv).bind("selectstart",function(){return false})}else d.p.multikey&&a(g.bDiv).bind("mousedown",function(){return false});sa&&a(g.bDiv).hide();g.cDiv=document.createElement("div");var Ha=d.p.hidegrid===true?a("").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){Ha.addClass("ui-state-hover")},function(){Ha.removeClass("ui-state-hover")}).append("").css(j=="rtl"?"left": "right","0px"):"";a(g.cDiv).append(Ha).append(""+d.p.caption+"").addClass("ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix");a(g.cDiv).insertBefore(g.hDiv);if(d.p.toolbar[0]){g.uDiv=document.createElement("div");if(d.p.toolbar[1]=="top")a(g.uDiv).insertBefore(g.hDiv);else d.p.toolbar[1]=="bottom"&&a(g.uDiv).insertAfter(g.hDiv);if(d.p.toolbar[1]=="both"){g.ubDiv=document.createElement("div");a(g.uDiv).insertBefore(g.hDiv).addClass("ui-userdata ui-state-default").attr("id", "t_"+this.id);a(g.ubDiv).insertAfter(g.hDiv).addClass("ui-userdata ui-state-default").attr("id","tb_"+this.id);sa&&a(g.ubDiv).hide()}else a(g.uDiv).width(g.width).addClass("ui-userdata ui-state-default").attr("id","t_"+this.id);sa&&a(g.uDiv).hide()}if(d.p.toppager){d.p.toppager=a.jgrid.jqID(d.p.id)+"_toppager";g.topDiv=a("
")[0];d.p.toppager="#"+d.p.toppager;a(g.topDiv).insertBefore(g.hDiv).addClass("ui-state-default ui-jqgrid-toppager").width(g.width);l(d.p.toppager, "_t")}if(d.p.footerrow){g.sDiv=a("
")[0];h=a("
");a(g.sDiv).append(h).insertAfter(g.hDiv).width(g.width);a(h).append(aa);g.footers=a(".ui-jqgrid-ftable",g.sDiv)[0].rows[0].cells;if(d.p.rownumbers)g.footers[0].className="ui-state-default jqgrid-rownum";sa&&a(g.sDiv).hide()}h=null;if(d.p.caption){var Ba=d.p.datatype;if(d.p.hidegrid===true){a(".ui-jqgrid-titlebar-close",g.cDiv).click(function(t){var u=a.isFunction(d.p.onHeaderClick), x=".ui-jqgrid-bdiv, .ui-jqgrid-hdiv, .ui-jqgrid-pager, .ui-jqgrid-sdiv",A,F=this;if(d.p.toolbar[0]===true){if(d.p.toolbar[1]=="both")x+=", #"+a(g.ubDiv).attr("id");x+=", #"+a(g.uDiv).attr("id")}A=a(x,"#gview_"+a.jgrid.jqID(d.p.id)).length;if(d.p.gridstate=="visible")a(x,"#gbox_"+a.jgrid.jqID(d.p.id)).slideUp("fast",function(){A--;if(A===0){a("span",F).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();if(u)sa||d.p.onHeaderClick.call(d,d.p.gridstate,t)}});else d.p.gridstate=="hidden"&&a(x,"#gbox_"+a.jgrid.jqID(d.p.id)).slideDown("fast",function(){A--;if(A===0){a("span",F).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");if(sa){d.p.datatype=Ba;ia();sa=false}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();if(u)sa|| d.p.onHeaderClick.call(d,d.p.gridstate,t)}});return false});if(sa){d.p.datatype="local";a(".ui-jqgrid-titlebar-close",g.cDiv).trigger("click")}}}else a(g.cDiv).hide();a(g.hDiv).after(g.bDiv).mousemove(function(t){if(g.resizing){g.dragMove(t);return false}});a(".ui-jqgrid-labels",g.hDiv).bind("selectstart",function(){return false});a(document).mouseup(function(){if(g.resizing){g.dragEnd();return false}return true});d.formatCol=v;d.sortData=xa;d.updatepager=function(t,u){var x,A,F,T,J,R,P,M="",N=d.p.pager? "_"+a.jgrid.jqID(d.p.pager.substr(1)):"",I=d.p.toppager?"_"+d.p.toppager.substr(1):"";F=parseInt(d.p.page,10)-1;if(F<0)F=0;F*=parseInt(d.p.rowNum,10);J=F+d.p.reccount;if(d.p.scroll){x=a("tbody:first > tr:gt(0)",d.grid.bDiv);F=J-x.length;d.p.reccount=x.length;if(A=x.outerHeight()||d.grid.prevRowHeight){x=F*A;A*=parseInt(d.p.records,10);a(">div:first",d.grid.bDiv).css({height:A}).children("div:first").css({height:x,display:x?"":"none"})}d.grid.bDiv.scrollLeft=d.grid.hDiv.scrollLeft}M=d.p.pager?d.p.pager: "";M+=d.p.toppager?M?","+d.p.toppager:d.p.toppager:"";if(M){P=a.jgrid.formatter.integer||{};x=k(d.p.page);A=k(d.p.lastpage);a(".selbox",M)[this.p.useProp?"prop":"attr"]("disabled",false);if(d.p.pginput===true){a(".ui-pg-input",M).val(d.p.page);T=d.p.toppager?"#sp_1"+N+",#sp_1"+I:"#sp_1"+N;a(T).html(a.fmatter?a.fmatter.util.NumberFormat(d.p.lastpage,P):d.p.lastpage)}if(d.p.viewrecords)if(d.p.reccount===0)a(".ui-paging-info",M).html(d.p.emptyrecords);else{T=F+1;R=d.p.records;if(a.fmatter){T=a.fmatter.util.NumberFormat(T, P);J=a.fmatter.util.NumberFormat(J,P);R=a.fmatter.util.NumberFormat(R,P)}a(".ui-paging-info",M).html(a.jgrid.format(d.p.recordtext,T,J,R))}if(d.p.pgbuttons===true){if(x<=0)x=A=0;if(x==1||x===0){a("#first"+N+", #prev"+N).addClass("ui-state-disabled").removeClass("ui-state-hover");d.p.toppager&&a("#first_t"+I+", #prev_t"+I).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{a("#first"+N+", #prev"+N).removeClass("ui-state-disabled");d.p.toppager&&a("#first_t"+I+", #prev_t"+I).removeClass("ui-state-disabled")}if(x== A||x===0){a("#next"+N+", #last"+N).addClass("ui-state-disabled").removeClass("ui-state-hover");d.p.toppager&&a("#next_t"+I+", #last_t"+I).addClass("ui-state-disabled").removeClass("ui-state-hover")}else{a("#next"+N+", #last"+N).removeClass("ui-state-disabled");d.p.toppager&&a("#next_t"+I+", #last_t"+I).removeClass("ui-state-disabled")}}}t===true&&d.p.rownumbers===true&&a("td.jqgrid-rownum",d.rows).each(function(Y){a(this).html(F+1+Y)});u&&d.p.jqgdnd&&a(d).jqGrid("gridDnD","updateDnD");a.isFunction(d.p.gridComplete)&& d.p.gridComplete.call(d);a.isFunction(d.p._complete)&&d.p._complete.call(d)};d.refreshIndex=B;d.setHeadCheckBox=fa;d.formatter=function(t,u,x,A,F){return q(t,u,x,A,F)};a.extend(g,{populate:ia,emptyRows:D});this.grid=g;d.addXmlData=function(t){K(t,d.grid.bDiv)};d.addJSONData=function(t){C(t,d.grid.bDiv)};this.grid.cols=this.rows[0].cells;ia();d.p.hiddengrid=false;a(window).unload(function(){d=null})}}}})};a.jgrid.extend({getGridParam:function(b){var e=this[0];if(e&&e.grid)return b?typeof e.p[b]!="undefined"? e.p[b]:null:e.p},setGridParam:function(b){return this.each(function(){this.grid&&typeof b==="object"&&a.extend(true,this.p,b)})},getDataIDs:function(){var b=[],e=0,c,f=0;this.each(function(){if((c=this.rows.length)&&c>0)for(;e= n+m)a(f.grid.bDiv)[0].scrollTop=p-(n+m)+l+m;else if(p-1)){if(f.p.scrollrows===true){g=f.rows.namedItem(b).rowIndex;g>=0&&c(g)}if(f.p.frozenColumns===true)o=f.p.id+"_frozen";if(f.p.multiselect){f.setHeadCheckBox(false);f.p.selrow=h.id;j=a.inArray(f.p.selrow,f.p.selarrrow);if(j===-1){h.className!=="ui-subgrid"&& a(h).addClass("ui-state-highlight").attr("aria-selected","true");g=true;f.p.selarrrow.push(f.p.selrow)}else{h.className!=="ui-subgrid"&&a(h).removeClass("ui-state-highlight").attr("aria-selected","false");g=false;f.p.selarrrow.splice(j,1);d=f.p.selarrrow[0];f.p.selrow=d===undefined?null:d}a("#jqg_"+a.jgrid.jqID(f.p.id)+"_"+a.jgrid.jqID(f.p.selrow))[f.p.useProp?"prop":"attr"]("checked",g);if(o){j===-1?a("#"+a.jgrid.jqID(b),"#"+a.jgrid.jqID(o)).addClass("ui-state-highlight"):a("#"+a.jgrid.jqID(b),"#"+ a.jgrid.jqID(o)).removeClass("ui-state-highlight");a("#jqg_"+a.jgrid.jqID(f.p.id)+"_"+a.jgrid.jqID(b),"#"+a.jgrid.jqID(o))[f.p.useProp?"prop":"attr"]("checked",g)}f.p.onSelectRow&&e&&f.p.onSelectRow.call(f,h.id,g)}else if(h.className!=="ui-subgrid"){if(f.p.selrow!=h.id){a(f.rows.namedItem(f.p.selrow)).removeClass("ui-state-highlight").attr({"aria-selected":"false",tabindex:"-1"});a(h).addClass("ui-state-highlight").attr({"aria-selected":"true",tabindex:"0"});if(o){a("#"+a.jgrid.jqID(f.p.selrow),"#"+ a.jgrid.jqID(o)).removeClass("ui-state-highlight");a("#"+a.jgrid.jqID(b),"#"+a.jgrid.jqID(o)).addClass("ui-state-highlight")}g=true}else g=false;f.p.selrow=h.id;f.p.onSelectRow&&e&&f.p.onSelectRow.call(f,h.id,g)}}}})},resetSelection:function(b){return this.each(function(){var e=this,c,f;if(typeof b!=="undefined"){f=b===e.p.selrow?e.p.selrow:b;a("#"+a.jgrid.jqID(e.p.id)+" tbody:first tr#"+a.jgrid.jqID(f)).removeClass("ui-state-highlight").attr("aria-selected","false");if(e.p.multiselect){a("#jqg_"+ a.jgrid.jqID(e.p.id)+"_"+a.jgrid.jqID(f))[e.p.useProp?"prop":"attr"]("checked",false);e.setHeadCheckBox(false)}f=null}else if(e.p.multiselect){a(e.p.selarrrow).each(function(g,h){c=e.rows.namedItem(h);a(c).removeClass("ui-state-highlight").attr("aria-selected","false");a("#jqg_"+a.jgrid.jqID(e.p.id)+"_"+a.jgrid.jqID(h))[e.p.useProp?"prop":"attr"]("checked",false)});e.setHeadCheckBox(false);e.p.selarrrow=[]}else if(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");e.p.selrow=null}if(e.p.cellEdit===true)if(parseInt(e.p.iCol,10)>=0&&parseInt(e.p.iRow,10)>=0){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")}e.p.savedRow=[]})},getRowData:function(b){var e={},c,f=false,g,h=0;this.each(function(){var j=this,d,o;if(typeof b=="undefined"){f=true;c=[];g=j.rows.length}else{o=j.rows.namedItem(b);if(!o)return e;g=2}for(;h span:first",o).html(d).attr(h):a("td:eq("+v+")",o).html(d).attr(h)}});if(j.p.datatype=="local"){var m=j.p._index[b]; if(j.p.treeGrid)for(var p in j.p.treeReader)n.hasOwnProperty(j.p.treeReader[p])&&delete n[j.p.treeReader[p]];if(typeof m!="undefined")j.p.data[m]=a.extend(true,j.p.data[m],n);n=null}}catch(k){g=false}if(g)if(l==="string")a(o).addClass(c);else l==="object"&&a(o).css(c)});return g},addRowData:function(b,e,c,f){c||(c="last");var g=false,h,j,d,o,l,n,m,p,k="",v,s,q,r,w;if(e){if(a.isArray(e)){v=true;c="last";s=b}else{e=[e];v=false}this.each(function(){var y=e.length;l=this.p.rownumbers===true?1:0;d=this.p.multiselect=== true?1:0;o=this.p.subGrid===true?1:0;if(!v)if(typeof b!="undefined")b+="";else{b=a.jgrid.randId();if(this.p.keyIndex!==false){s=this.p.colModel[this.p.keyIndex+d+o+l].name;if(typeof e[0][s]!="undefined")b=e[0][s]}}q=this.p.altclass;for(var z=0,E="",D={},B=a.isFunction(this.p.afterInsertRow)?true:false;z0"}if(d){p='';k=this.formatCol(l,1,"",null,b,true);j+='"+p+""}if(o)j+=a(this).jqGrid("addSubGridCell",d+l,1);for(m=d+o+l;m"+p+""}j=''+j+"";if(this.rows.length===0)a("table:first",this.grid.bDiv).append(j);else switch(c){case "last":a(this.rows[this.rows.length-1]).after(j);n=this.rows.length-1;break;case "first":a(this.rows[0]).after(j);n=1;break;case "after":if(n= this.rows.namedItem(f))a(this.rows[n.rowIndex+1]).hasClass("ui-subgrid")?a(this.rows[n.rowIndex+1]).after(j):a(n).after(j);n++;break;case "before":if(n=this.rows.namedItem(f)){a(n).before(j);n=n.rowIndex}n--}this.p.subGrid===true&&a(this).jqGrid("addSubGrid",d+l,n);this.p.records++;this.p.reccount++;B&&this.p.afterInsertRow.call(this,b,r,r);z++;if(this.p.datatype=="local"){D[this.p.localReader.id]=b;this.p._index[b]=this.p.data.length;this.p.data.push(D);D={}}}if(this.p.altRows===true&&!v)if(c=="last")(this.rows.length- 1)%2==1&&a(this.rows[this.rows.length-1]).addClass(q);else a(this.rows).each(function(C){C%2==1?a(this).addClass(q):a(this).removeClass(q)});this.updatepager(true,true);g=true})}return g},footerData:function(b,e,c){function f(o){for(var l in o)if(o.hasOwnProperty(l))return false;return true}var g,h=false,j={},d;if(typeof b=="undefined")b="get";if(typeof c!="boolean")c=true;b=b.toLowerCase();this.each(function(){var o=this,l;if(!o.grid||!o.p.footerrow)return false;if(b=="set")if(f(e))return false; h=true;a(this.p.colModel).each(function(n){g=this.name;if(b=="set"){if(e[g]!==undefined){l=c?o.formatter("",e[g],n,e,"edit"):e[g];d=this.title?{title:a.jgrid.stripHtml(l)}:{};a("tr.footrow td:eq("+n+")",o.grid.sDiv).html(l).attr(d);h=true}}else if(b=="get")j[g]=a("tr.footrow td:eq("+n+")",o.grid.sDiv).html()})});return b=="get"?j:h},showHideCol:function(b,e){return this.each(function(){var c=this,f=false,g=a.browser.webkit||a.browser.safari?0:c.p.cellLayout,h;if(c.grid){if(typeof b==="string")b=[b]; e=e!="none"?"":"none";var j=e===""?true:false,d=c.p.groupHeader&&(typeof c.p.groupHeader==="object"||a.isFunction(c.p.groupHeader));d&&a(c).jqGrid("destroyGroupHeader",false);a(this.p.colModel).each(function(o){if(a.inArray(this.name,b)!==-1&&this.hidden===j){a("tr",c.grid.hDiv).each(function(){a(this.cells[o]).css("display",e)});a(c.rows).each(function(){a(this.cells[o]).css("display",e)});c.p.footerrow&&a("tr.footrow td:eq("+o+")",c.grid.sDiv).css("display",e);h=this.widthOrg?this.widthOrg:parseInt(this.width, 10);if(e==="none")c.p.tblwidth-=h+g;else c.p.tblwidth+=h+g;this.hidden=!j;f=true}});if(f===true)a(c).jqGrid("setGridWidth",c.p.shrinkToFit===true?c.p.tblwidth:c.p.width);d&&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",b,"")})},remapColumns:function(b,e,c){function f(j){var d;d=j.length?a.makeArray(j):a.extend({},j);a.each(b,function(o){j[o]= d[this]})}function g(j,d){a(">tr"+(d||""),j).each(function(){var o=this,l=a.makeArray(o.cells);a.each(b,function(){var n=l[this];n&&o.appendChild(n)})})}var h=this.get(0);f(h.p.colModel);f(h.p.colNames);f(h.grid.headers);g(a("thead:first",h.grid.hDiv),c&&":not(.ui-jqgrid-labels)");e&&g(a("#"+a.jgrid.jqID(h.p.id)+" tbody:first"),".jqgfirstrow, tr.jqgrow, tr.jqfoot");h.p.footerrow&&g(a("tbody:first",h.grid.sDiv));if(h.p.remapColumns)if(h.p.remapColumns.length)f(h.p.remapColumns);else h.p.remapColumns= a.makeArray(b);h.p.lastsort=a.inArray(h.p.lastsort,b);if(h.p.treeGrid)h.p.expColInd=a.inArray(h.p.expColInd,b)},setGridWidth:function(b,e){return this.each(function(){if(this.grid){var c=this,f,g=0,h=a.browser.webkit||a.browser.safari?0:c.p.cellLayout,j,d=0,o=false,l=c.p.scrollOffset,n,m=0,p=0,k;if(typeof e!="boolean")e=c.p.shrinkToFit;if(!isNaN(b)){b=parseInt(b,10);c.grid.width=c.p.width=b;a("#gbox_"+a.jgrid.jqID(c.p.id)).css("width",b+"px");a("#gview_"+a.jgrid.jqID(c.p.id)).css("width",b+"px"); a(c.grid.bDiv).css("width",b+"px");a(c.grid.hDiv).css("width",b+"px");c.p.pager&&a(c.p.pager).css("width",b+"px");c.p.toppager&&a(c.p.toppager).css("width",b+"px");if(c.p.toolbar[0]===true){a(c.grid.uDiv).css("width",b+"px");c.p.toolbar[1]=="both"&&a(c.grid.ubDiv).css("width",b+"px")}c.p.footerrow&&a(c.grid.sDiv).css("width",b+"px");if(e===false&&c.p.forceFit===true)c.p.forceFit=false;if(e===true){a.each(c.p.colModel,function(){if(this.hidden===false){f=this.widthOrg?this.widthOrg:parseInt(this.width, 10);g+=f+h;if(this.fixed)m+=f+h;else d++;p++}});if(d===0)return;c.p.tblwidth=g;n=b-h*d-m;if(!isNaN(c.p.height))if(a(c.grid.bDiv)[0].clientHeight0;a.each(c.p.colModel,function(s){if(this.hidden===false&&!this.fixed){f=this.widthOrg?this.widthOrg:parseInt(this.width,10);f=Math.round(n*f/(c.p.tblwidth-h*d-m));if(!(f<0)){this.width=f;g+=f;c.grid.headers[s].width=f;c.grid.headers[s].el.style.width=f+"px";if(c.p.footerrow)c.grid.footers[s].style.width= f+"px";if(v)c.grid.cols[s].style.width=f+"px";j=s}}});if(!j)return;k=0;if(o){if(b-m-(g+h*d)!==l)k=b-m-(g+h*d)-l}else if(Math.abs(b-m-(g+h*d))!==1)k=b-m-(g+h*d);c.p.colModel[j].width+=k;c.p.tblwidth=g+k+h*d+m;if(c.p.tblwidth>b){o=c.p.tblwidth-parseInt(b,10);c.p.tblwidth=b;f=c.p.colModel[j].width-=o}else f=c.p.colModel[j].width;c.grid.headers[j].width=f;c.grid.headers[j].el.style.width=f+"px";if(v)c.grid.cols[j].style.width=f+"px";if(c.p.footerrow)c.grid.footers[j].style.width=f+"px"}if(c.p.tblwidth){a("table:first", c.grid.bDiv).css("width",c.p.tblwidth+"px");a("table:first",c.grid.hDiv).css("width",c.p.tblwidth+"px");c.grid.hDiv.scrollLeft=c.grid.bDiv.scrollLeft;c.p.footerrow&&a("table:first",c.grid.sDiv).css("width",c.p.tblwidth+"px")}}}})},setGridHeight:function(b){return this.each(function(){if(this.grid){a(this.grid.bDiv).css({height:b+(isNaN(b)?"":"px")});this.p.height=b;this.p.scroll&&this.grid.populateVisible()}})},setCaption:function(b){return this.each(function(){this.p.caption=b;a("span.ui-jqgrid-title, span.ui-jqgrid-title-rtl", this.grid.cDiv).html(b);a(this.grid.cDiv).show()})},setLabel:function(b,e,c,f){return this.each(function(){var g=-1;if(this.grid)if(typeof b!="undefined"){a(this.p.colModel).each(function(d){if(this.name==b){g=d;return false}});if(g>=0){var h=a("tr.ui-jqgrid-labels th:eq("+g+")",this.grid.hDiv);if(e){var j=a(".s-ico",h);a("[id^=jqgh_]",h).empty().html(e).append(j);this.p.colNames[g]=e}if(c)typeof c==="string"?a(h).addClass(c):a(h).css(c);typeof f==="object"&&a(h).attr(f)}}})},setCell:function(b,e, c,f,g,h){return this.each(function(){var j=-1,d,o;if(this.grid){if(isNaN(e))a(this.p.colModel).each(function(n){if(this.name==e){j=n;return false}});else j=parseInt(e,10);if(j>=0)if(d=this.rows.namedItem(b)){var l=a("td:eq("+j+")",d);if(c!==""||h===true){d=this.formatter(b,c,j,d,"edit");o=this.p.colModel[j].title?{title:a.jgrid.stripHtml(d)}:{};this.p.treeGrid&&a(".tree-wrap",a(l)).length>0?a("span",a(l)).html(d).attr(o):a(l).html(d).attr(o);if(this.p.datatype=="local"){d=this.p.colModel[j];c=d.formatter&& typeof d.formatter==="string"&&d.formatter=="date"?a.unformat.date(c,d):c;o=this.p._index[b];if(typeof o!="undefined")this.p.data[o][d.name]=c}}if(typeof f==="string")a(l).addClass(f);else f&&a(l).css(f);typeof g==="object"&&a(l).attr(g)}}})},getCell:function(b,e){var c=false;this.each(function(){var f=-1;if(this.grid){if(isNaN(e))a(this.p.colModel).each(function(j){if(this.name===e){f=j;return false}});else f=parseInt(e,10);if(f>=0){var g=this.rows.namedItem(b);if(g)try{c=a.unformat(a("td:eq("+f+ ")",g),{rowId:g.id,colModel:this.p.colModel[f]},f)}catch(h){c=a.jgrid.htmlDecode(a("td:eq("+f+")",g).html())}}}});return c},getCol:function(b,e,c){var f=[],g,h=0,j,d,o;e=typeof e!="boolean"?false:e;if(typeof c=="undefined")c=false;this.each(function(){var l=-1;if(this.grid){if(isNaN(b))a(this.p.colModel).each(function(k){if(this.name===b){l=k;return false}});else l=parseInt(b,10);if(l>=0){var n=this.rows.length,m=0;if(n&&n>0){for(;m=0)e=this.p.data[c]}});return e}})})(jQuery); (function(a){a.jgrid.extend({getColProp:function(b){var e={},c=this[0];if(!c.grid)return false;c=c.p.colModel;for(var f=0;f0?true:false;if(b.stringResult===true||c.p.datatype=="local"){var k='{"groupOp":"'+b.groupOp+'","rules":[',v=0;a.each(j,function(r,w){if(v>0)k+=",";k+='{"field":"'+r+'",';k+='"op":"'+n[r]+'",';w+="";k+='"data":"'+w.replace(/\\/g,"\\\\").replace(/\"/g, '\\"')+'"}';v++});k+="]}";a.extend(c.p.postData,{filters:k});a.each(["searchField","searchString","searchOper"],function(r,w){c.p.postData.hasOwnProperty(w)&&delete c.p.postData[w]})}else a.extend(c.p.postData,j);var s;if(c.p.searchurl){s=c.p.url;a(c).jqGrid("setGridParam",{url:c.p.searchurl})}var q=false;if(a.isFunction(b.beforeSearch))q=b.beforeSearch.call(c);q||a(c).jqGrid("setGridParam",{search:p}).trigger("reloadGrid",[{page:1}]);s&&a(c).jqGrid("setGridParam",{url:s});a.isFunction(b.afterSearch)&& b.afterSearch()},g=a(""),h;a.each(c.p.colModel,function(){var j=this,d,o,l,n;o=a("");d=a("
");this.hidden===true&&a(o).css("display","none");this.search=this.search===false?false:true;if(typeof this.stype=="undefined")this.stype="text";l=a.extend({},this.searchoptions||{});if(this.search)switch(this.stype){case "select":if(n= this.surl||l.dataUrl)a.ajax(a.extend({url:n,dataType:"html",success:function(s){if(l.buildSelect!==undefined)(s=l.buildSelect(s))&&a(d).append(s);else a(d).append(s);l.defaultValue&&a("select",d).val(l.defaultValue);a("select",d).attr({name:j.index||j.name,id:"gs_"+j.name});l.attr&&a("select",d).attr(l.attr);a("select",d).css({width:"100%"});l.dataInit!==undefined&&l.dataInit(a("select",d)[0]);l.dataEvents!==undefined&&e(a("select",d)[0],l.dataEvents);b.autosearch===true&&a("select",d).change(function(){f(); return false});s=null}},a.jgrid.ajaxOptions,c.p.ajaxSelectOptions||{}));else{var m;if(j.searchoptions&&j.searchoptions.value)m=j.searchoptions.value;else if(j.editoptions&&j.editoptions.value)m=j.editoptions.value;if(m){n=document.createElement("select");n.style.width="100%";a(n).attr({name:j.index||j.name,id:"gs_"+j.name});var p,k;if(typeof m==="string"){m=m.split(";");for(var v=0;v");l.attr&&a("input",d).attr(l.attr);l.dataInit!==undefined&&l.dataInit(a("input",d)[0]);l.dataEvents!==undefined&&e(a("input",d)[0],l.dataEvents);if(b.autosearch===true)b.searchOnEnter?a("input",d).keypress(function(s){if((s.charCode?s.charCode:s.keyCode?s.keyCode:0)==13){f();return false}return this}):a("input",d).keydown(function(s){switch(s.which){case 13:return false;case 9:case 16:case 37:case 38:case 39:case 40:case 27:break;default:h&&clearTimeout(h);h=setTimeout(function(){f()}, 500)}})}a(o).append(d);a(g).append(o)});a("table thead",c.grid.hDiv).append(g);this.ftoolbar=true;this.triggerToolbar=f;this.clearToolbar=function(j){var d={},o,l=0,n;j=typeof j!="boolean"?true:j;a.each(c.p.colModel,function(){o=this.searchoptions&&this.searchoptions.defaultValue?this.searchoptions.defaultValue:"";n=this.index||this.name;switch(this.stype){case "select":var q;a("#gs_"+a.jgrid.jqID(this.name)+" option",this.frozen===true&&c.p.frozenColumns===true?c.grid.fhDiv:c.grid.hDiv).each(function(y){if(y=== 0)this.selected=true;if(a(this).text()==o){this.selected=true;q=a(this).val();return false}});if(q){d[n]=q;l++}else try{delete c.p.postData[n]}catch(r){}break;case "text":a("#gs_"+a.jgrid.jqID(this.name),this.frozen===true&&c.p.frozenColumns===true?c.grid.fhDiv:c.grid.hDiv).val(o);if(o){d[n]=o;l++}else try{delete c.p.postData[n]}catch(w){}}});var m=l>0?true:false;if(b.stringResult===true||c.p.datatype=="local"){var p='{"groupOp":"'+b.groupOp+'","rules":[',k=0;a.each(d,function(q,r){if(k>0)p+=","; p+='{"field":"'+q+'",';p+='"op":"eq",';r+="";p+='"data":"'+r.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"}';k++});p+="]}";a.extend(c.p.postData,{filters:p});a.each(["searchField","searchString","searchOper"],function(q,r){c.p.postData.hasOwnProperty(r)&&delete c.p.postData[r]})}else a.extend(c.p.postData,d);var v;if(c.p.searchurl){v=c.p.url;a(c).jqGrid("setGridParam",{url:c.p.searchurl})}var s=false;if(a.isFunction(b.beforeClear))s=b.beforeClear.call(c);s||j&&a(c).jqGrid("setGridParam",{search:m}).trigger("reloadGrid", [{page:1}]);v&&a(c).jqGrid("setGridParam",{url:v});a.isFunction(b.afterClear)&&b.afterClear()};this.toggleToolbar=function(){var j=a("tr.ui-search-toolbar",c.grid.hDiv),d=c.p.frozenColumns===true?a("tr.ui-search-toolbar",c.grid.hDiv):false;if(j.css("display")=="none"){j.show();d&&d.show()}else{j.hide();d&&d.hide()}}}})},destroyGroupHeader:function(b){if(typeof b=="undefined")b=true;return this.each(function(){var e,c,f,g,h,j;c=this.grid;var d=a("table.ui-jqgrid-htable thead",c.hDiv),o=this.p.colModel; if(c){e=a("",{role:"rowheader"}).addClass("ui-jqgrid-labels");g=c.headers;c=0;for(f=g.length;c0)j[0].style.height="";h.children("div")[0].style.top=""}a(d).children("tr.ui-jqgrid-labels").remove();a(d).prepend(e);b===true&&a(this).jqGrid("setGridParam",{groupHeader:null})}})},setGroupHeaders:function(b){b=a.extend({useColSpanStyle:false, groupHeaders:[]},b||{});return this.each(function(){this.p.groupHeader=b;var e=this,c,f,g=0,h,j,d,o,l,n=e.p.colModel,m=n.length,p=e.grid.headers,k=a("table.ui-jqgrid-htable",e.grid.hDiv),v=k.children("thead").children("tr.ui-jqgrid-labels:last").addClass("jqg-second-row-header");h=k.children("thead");var s,q=k.find(".jqg-first-row-header");if(q.html()===null)q=a("",{role:"row","aria-hidden":"true"}).addClass("jqg-first-row-header").css("height","auto");else q.empty();var r,w=function(y,z){for(var E= 0,D=z.length;E",{role:"rowheader"}).addClass("ui-jqgrid-labels jqg-third-row-header");for(c=0;c",{role:"gridcell"}).css(j).addClass("ui-first-th-"+e.p.direction).appendTo(q);d.style.width="";j=w(f.name,b.groupHeaders);if(j>=0){j=b.groupHeaders[j];g=j.numberOfColumns;l=j.titleText;for(j=f=0;j",{colspan:String(f),role:"columnheader"}).addClass("ui-state-default ui-th-column-header ui-th-"+e.p.direction).css({height:"22px","border-top":"0px none"}).html(l);e.p.headertitles&&j.attr("title",j.text());f===0&&j.hide();o.before(j);h.append(d);g-=1}else if(g===0)if(b.useColSpanStyle)o.attr("rowspan","2");else{a("",{role:"columnheader"}).addClass("ui-state-default ui-th-column-header ui-th-"+e.p.direction).css({display:f.hidden?"none":"","border-top":"0px none"}).insertBefore(o); h.append(d)}else{h.append(d);g--}}n=a(e).children("thead");n.prepend(q);h.insertAfter(v);k.append(n);if(b.useColSpanStyle){k.find("span.ui-jqgrid-resize").each(function(){var y=a(this).parent();if(y.is(":visible"))this.style.cssText="height: "+y.height()+"px !important; cursor: col-resize;"});k.find("div.ui-jqgrid-sortable").each(function(){var y=a(this),z=y.parent();z.is(":visible")&&z.is(":has(span.ui-jqgrid-resize)")&&y.css("top",(z.height()-y.outerHeight())/2+"px")})}if(a.isFunction(e.p.resizeStop))s= e.p.resizeStop;r=n.find("tr.jqg-first-row-header");e.p.resizeStop=function(y,z){r.find("th").eq(z).width(y);a.isFunction(s)&&s.call(e,y,z)}})},setFrozenColumns:function(){return this.each(function(){if(this.grid){var b=this,e=b.p.colModel,c=0,f=e.length,g=-1,h=false;if(!(b.p.subGrid==true||b.p.treeGrid===true||b.p.cellEdit==true||b.p.sortable||b.p.scroll||b.p.grouping)){b.p.rownumbers&&c++;for(b.p.multiselect&&c++;c=0&&h){e=b.p.caption?a(b.grid.cDiv).outerHeight(): 0;c=a(".ui-jqgrid-htable","#gview_"+a.jgrid.jqID(b.p.id)).height();b.p.orgEvents={};if(b.p.toppager)e+=a(b.grid.topDiv).outerHeight();if(b.p.toolbar[0]==true)if(b.p.toolbar[1]!="bottom")e+=a(b.grid.uDiv).outerHeight();b.grid.fhDiv=a('
');b.grid.fbDiv=a('
'); a("#gview_"+a.jgrid.jqID(b.p.id)).append(b.grid.fhDiv);e=a(".ui-jqgrid-htable","#gview_"+a.jgrid.jqID(b.p.id)).clone(true);a("tr",e).each(function(){a("th:gt("+g+")",this).remove()});a(e).width(1);a(b.grid.fhDiv).append(e).mousemove(function(j){if(b.grid.resizing){b.grid.dragMove(j);return false}});if(a.isFunction(b.p.resizeStop))b.p.orgEvents.resizeStop=b.p.resizeStop;b.p.resizeStop=function(j,d){var o=a(".ui-jqgrid-htable",b.grid.fhDiv);a("th:eq("+d+")",o).width(j);o=a(".ui-jqgrid-btable",b.grid.fbDiv); a("tr:first td:eq("+d+")",o).width(j);if(a.isFunction(b.p.orgEvents.resizeStop))b.p.orgEvents.resizeStop.call(b,j,d);else b.p.orgEvents.resizeStop=null};b.p.orgEvents.onSortCol=a.isFunction(b.p.onSortCol)?b.p.onSortCol:null;b.p.onSortCol=function(j,d,o){var l=a("th:eq("+b.p.lastsort+")",b.grid.fhDiv),n=a("th:eq("+d+")",b.grid.fhDiv);a("span.ui-grid-ico-sort",l).addClass("ui-state-disabled");a(l).attr("aria-selected","false");a("span.ui-icon-"+b.p.sortorder,n).removeClass("ui-state-disabled");a(n).attr("aria-selected", "true");if(!b.p.viewsortcols[0])if(b.p.lastsort!=d){a("span.s-ico",l).hide();a("span.s-ico",n).show()}a.isFunction(b.p.orgEvents.onSortCol)&&b.p.orgEvents.onSortCol.call(b,j,d,o)};a("#gview_"+a.jgrid.jqID(b.p.id)).append(b.grid.fbDiv);jQuery(b.grid.bDiv).scroll(function(){jQuery(b.grid.fbDiv).scrollTop(jQuery(this).scrollTop())});b.p.orgEvents.complete=a.isFunction(b.p._complete)?b.p._complete:null;b.p.hoverrows===true&&a("#"+a.jgrid.jqID(b.p.id)).unbind("mouseover").unbind("mouseout");b.p._complete= function(){a("#"+a.jgrid.jqID(b.p.id)+"_frozen").remove();jQuery(b.grid.fbDiv).height(jQuery(b.grid.bDiv).height()-16);var j=a("#"+a.jgrid.jqID(b.p.id)).clone(true);a("tr",j).each(function(){a("td:gt("+g+")",this).remove()});a(j).width(1).attr("id",a.jgrid.jqID(b.p.id)+"_frozen");a(b.grid.fbDiv).append(j);if(b.p.hoverrows===true){a("tr.jqgrow",j).hover(function(){a(this).addClass("ui-state-hover");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)+"_frozen").removeClass("ui-state-hover")})}j=null;a.isFunction(b.p.orgEvents.complete)&&b.p.orgEvents.complete.call(b)};b.p.frozenColumns= true}}}})},destroyFrozenColumns:function(){return this.each(function(){if(this.grid)if(this.p.frozenColumns===true){a(this.grid.fhDiv).remove();a(this.grid.fbDiv).remove();this.grid.fhDiv=null;this.grid.fbDiv=null;this.p._complete=this.p.orgEvents.complete;this.p.resizeStop=this.p.orgEvents.resizeStop;this.p.onSortCol=this.p.orgEvents.onSortCol;this.p.orgEvents=null;if(this.p.hoverrows==true){var b;a("#"+a.jgrid.jqID(this.p.id)).bind("mouseover",function(e){b=a(e.target).closest("tr.jqgrow");a(b).attr("class")!== "ui-subgrid"&&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=false}})}})})(jQuery); (function(a){a.fn.jqm=function(n){var m={overlay:50,closeoverlay:true,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:g,ajaxText:"",target:g,modal:g,toTop:g,onShow:g,onHide:g,onLoad:g};return this.each(function(){if(this._jqm)return e[this._jqm].c=a.extend({},e[this._jqm].c,n);b++;this._jqm=b;e[b]={c:a.extend(m,a.jqm.params,n),a:g,w:a(this).addClass("jqmID"+b),s:b};m.trigger&&a(this).jqmAddTrigger(m.trigger)})};a.fn.jqmAddClose=function(n){return l(this,n,"jqmHide")};a.fn.jqmAddTrigger= function(n){return l(this,n,"jqmShow")};a.fn.jqmShow=function(n){return this.each(function(){a.jqm.open(this._jqm,n)})};a.fn.jqmHide=function(n){return this.each(function(){a.jqm.close(this._jqm,n)})};a.jqm={hash:{},open:function(n,m){var p=e[n],k=p.c,v="."+k.closeClass,s=parseInt(p.w.css("z-index"));s=s>0?s:3E3;var q=a("
").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":s-1,opacity:k.overlay/100});if(p.a)return g;p.t=m;p.a=true;p.w.css("z-index",s);if(k.modal){c[0]|| setTimeout(function(){d("bind")},1);c.push(n)}else if(k.overlay>0)k.closeoverlay&&p.w.jqmAddClose(q);else q=g;p.o=q?q.addClass(k.overlayClass).prependTo("body"):g;if(f){a("html,body").css({height:"100%",width:"100%"});if(q){q=q.css({position:"absolute"})[0];for(var r in{Top:1,Left:1})q.style.setExpression(r.toLowerCase(),"(_=(document.documentElement.scroll"+r+" || document.body.scroll"+r+"))+'px'")}}if(k.ajax){s=k.target||p.w;q=k.ajax;s=typeof s=="string"?a(s,p.w):a(s);q=q.substr(0,1)=="@"?a(m).attr(q.substring(1)): q;s.html(k.ajaxText).load(q,function(){k.onLoad&&k.onLoad.call(this,p);v&&p.w.jqmAddClose(a(v,p.w));h(p)})}else v&&p.w.jqmAddClose(a(v,p.w));k.toTop&&p.o&&p.w.before('').insertAfter(p.o);k.onShow?k.onShow(p):p.w.show();h(p);return g},close:function(n){n=e[n];if(!n.a)return g;n.a=g;if(c[0]){c.pop();c[0]||d("unbind")}n.c.toTop&&n.o&&a("#jqmP"+n.w[0]._jqm).after(n.w).remove();if(n.c.onHide)n.c.onHide(n);else{n.w.hide();n.o&&n.o.remove()}return g},params:{}};var b= 0,e=a.jqm.hash,c=[],f=a.browser.msie&&a.browser.version=="6.0",g=false,h=function(n){var m=a('').css({opacity:0});if(f)if(n.o)n.o.html('

').prepend(m);else a("iframe.jqm",n.w)[0]||n.w.prepend(m);j(n)},j=function(n){try{a(":input:visible",n.w)[0].focus()}catch(m){}},d=function(n){a(document)[n]("keypress",o)[n]("keydown",o)[n]("mousedown",o)},o=function(n){var m=e[c[c.length-1]];(n=!a(n.target).parents(".jqmID"+ m.s)[0])&&j(m);return!n},l=function(n,m,p){return n.each(function(){var k=this._jqm;a(m).each(function(){if(!this[p]){this[p]=[];a(this).click(function(){for(var v in{jqmShow:1,jqmHide:1})for(var s in this[v])if(e[this[v][s]])e[this[v][s]].w[v](this);return g})}this[p].push(k)})})}})(jQuery); (function(a){a.fn.jqDrag=function(j){return g(this,j,"d")};a.fn.jqResize=function(j,d){return g(this,j,"r",d)};a.jqDnR={dnr:{},e:0,drag:function(j){if(e.k=="d")c.css({left:e.X+j.pageX-e.pX,top:e.Y+j.pageY-e.pY});else{c.css({width:Math.max(j.pageX-e.pX+e.W,0),height:Math.max(j.pageY-e.pY+e.H,0)});M1&&f.css({width:Math.max(j.pageX-M1.pX+M1.W,0),height:Math.max(j.pageY-M1.pY+M1.H,0)})}return false},stop:function(){a(document).unbind("mousemove",b.drag).unbind("mouseup",b.stop)}};var b=a.jqDnR,e=b.dnr, c=b.e,f,g=function(j,d,o,l){return j.each(function(){d=d?a(d,j):j;d.bind("mousedown",{e:j,k:o},function(n){var m=n.data,p={};c=m.e;f=l?a(l):false;if(c.css("position")!="relative")try{c.position(p)}catch(k){}e={X:p.left||h("left")||0,Y:p.top||h("top")||0,W:h("width")||c[0].scrollWidth||0,H:h("height")||c[0].scrollHeight||0,pX:n.pageX,pY:n.pageY,k:m.k};M1=f&&m.k!="d"?{X:p.left||f1("left")||0,Y:p.top||f1("top")||0,W:f[0].offsetWidth||f1("width")||0,H:f[0].offsetHeight||f1("height")||0,pX:n.pageX,pY:n.pageY, k:m.k}:false;if(a("input.hasDatepicker",c[0])[0])try{a("input.hasDatepicker",c[0]).datepicker("hide")}catch(v){}a(document).mousemove(a.jqDnR.drag).mouseup(a.jqDnR.stop);return false})})},h=function(j){return parseInt(c.css(j))||false};f1=function(j){return parseInt(f.css(j))||false}})(jQuery); var xmlJsonClass={xml2json:function(a,b){if(a.nodeType===9)a=a.documentElement;var e=this.toJson(this.toObj(this.removeWhite(a)),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(g,h,j){var d="",o,l;if(g instanceof Array)if(g.length===0)d+=j+"<"+h+">__EMPTY_ARRAY_\n";else{o=0;for(l=g.length;o":"/>";if(o){for(l in g)if(g.hasOwnProperty(l))if(l==="#text")d+=g[l];else if(l==="#cdata")d+="";else if(l.charAt(0)!=="@")d+=e(g[l],l,j+"\t");d+=(d.charAt(d.length-1)==="\n"?j:"")+""}}else if(typeof g==="function")d+=j+"<"+h+">";else{if(g===undefined)g="";d+=g.toString()==='""'||g.toString().length===0?j+"<"+h+">__EMPTY_STRING_":j+"<"+h+">"+g.toString()+""}return d}, c="",f;for(f in a)if(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(a.nodeType===1){if(a.attributes.length){var c;for(c=0;c1)b=this.escape(this.innerXml(a));else for(h=a.firstChild;h;h=h.nextSibling)if(e.test(a.firstChild.nodeValue)){b=a.firstChild.nodeValue;break}else b["#cdata"]=this.escape(h.nodeValue)}if(!a.attributes.length&&!a.firstChild)b=null}else if(a.nodeType===9)b=this.toObj(a.documentElement); else alert("unhandled node type: "+a.nodeType);return b},toJson:function(a,b,e,c){if(c===undefined)c=true;var f=b?'"'+b+'"':"",g="\t",h="\n";if(!c)h=g="";if(a==="[]")f+=b?":[]":"[]";else if(a instanceof Array){var j,d,o=[];d=0;for(j=a.length;d1?h+e+g+o.join(","+h+e+g)+h+e:o.join(""))+"]"}else if(a===null)f+=(b&&":")+"null";else if(typeof a==="object"){j=[];for(d in a)if(a.hasOwnProperty(d))j[j.length]=this.toJson(a[d],d,e+g,c);f+=(b? ":{":"{")+(j.length>1?h+e+g+j.join(","+h+e+g)+h+e:j.join(""))+"}"}else f+=typeof a==="string"?(b&&":")+'"'+a.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')+'"':(b&&":")+'"'+a.toString()+'"';return f},innerXml:function(a){var b="";if("innerHTML"in a)b=a.innerHTML;else{var e=function(c){var f="",g;if(c.nodeType===1){f+="<"+c.nodeName;for(g=0;g"}else f+="/>"}else if(c.nodeType===3)f+=c.nodeValue;else if(c.nodeType===4)f+="";return f};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(b.nodeType===3)if(b.nodeValue.match(/[^ \f\n\r\t\v]/))b=b.nextSibling;else{var e=b.nextSibling;a.removeChild(b); b=e}else{b.nodeType===1&&this.removeWhite(b);b=b.nextSibling}return a}}; (function(a){a.fmatter={};a.extend(a.fmatter,{isBoolean:function(b){return typeof b==="boolean"},isObject:function(b){return b&&(typeof b==="object"||a.isFunction(b))||false},isString:function(b){return typeof b==="string"},isNumber:function(b){return typeof b==="number"&&isFinite(b)},isNull:function(b){return b===null},isUndefined:function(b){return typeof b==="undefined"},isValue:function(b){return this.isObject(b)||this.isString(b)||this.isNumber(b)||this.isBoolean(b)},isEmpty:function(b){if(!this.isString(b)&& this.isValue(b))return false;else if(!this.isValue(b))return true;b=a.trim(b).replace(/\ \;/ig,"").replace(/\ \;/ig,"");return b===""}});a.fn.fmatter=function(b,e,c,f,g){var h=e;c=a.extend({},a.jgrid.formatter,c);if(a.fn.fmatter[b])h=a.fn.fmatter[b](e,c,f,g);return h};a.fmatter.util={NumberFormat:function(b,e){a.fmatter.isNumber(b)||(b*=1);if(a.fmatter.isNumber(b)){var c=b<0,f=b+"",g=e.decimalSeparator?e.decimalSeparator:".",h;if(a.fmatter.isNumber(e.decimalPlaces)){var j=e.decimalPlaces; f=Math.pow(10,j);f=Math.round(b*f)/f+"";h=f.lastIndexOf(".");if(j>0){if(h<0){f+=g;h=f.length-1}else if(g!==".")f=f.replace(".",g);for(;f.length-1-h-1?h:f.length;g=f.substring(h);for(var d=-1,o=h;o>0;o--){d++;if(d%3===0&&o!==h&&(!c||o>1))g=j+g;g=f.charAt(o-1)+g}f=g}f=e.prefix?e.prefix+f:f;return f=e.suffix?f+e.suffix:f}else return b},DateFormat:function(b,e,c,f){var g=/^\/Date\((([-+])?[0-9]+)(([-+])([0-9]{2})([0-9]{2}))?\)\/$/, h=typeof e==="string"?e.match(g):null;g=function(r,w){r=String(r);for(w=parseInt(w,10)||2;r.length11)e[h]=d+1-12}if(e[h])j[b[h].toLowerCase()]=parseInt(e[h],10)}if(j.f)j.m=j.f;if(j.m===0&&j.y===0&&j.d===0)return" ";j.m=parseInt(j.m,10)-1;d=j.y;if(d>=70&&d<=99)j.y=1900+j.y;else if(d>=0&&d<=69)j.y=2E3+j.y;d=new Date(j.y,j.m,j.d,j.h,j.i,j.s,j.u)}if(c in f.masks)c=f.masks[c];else c||(c="Y-m-d");b=d.getHours();e=d.getMinutes();j=d.getDate();h=d.getMonth()+1;o=d.getTimezoneOffset();var n=d.getSeconds(),m=d.getMilliseconds(),p=d.getDay(),k=d.getFullYear(),v=(p+6)%7+1,s=(new Date(k,h-1,j)-new Date(k,0,1))/864E5,q={d:g(j),D:l.i18n.dayNames[p],j:j,l:l.i18n.dayNames[p+7],N:v,S:f.S(j),w:p,z:s,W:v<5?Math.floor((s+v-1)/7)+1:Math.floor((s+v-1)/7)||(((new Date(k-1,0,1)).getDay()+6)%7<4?53:52),F:l.i18n.monthNames[h-1+12],m:g(h),M:l.i18n.monthNames[h-1],n:h,t:"?", L:"?",o:"?",Y:k,y:String(k).substring(2),a:b<12?f.AmPm[0]:f.AmPm[1],A:b<12?f.AmPm[2]:f.AmPm[3],B:"?",g:b%12||12,G:b,h:g(b%12||12),H:g(b),i:g(e),s:g(n),u:m,e:"?",I:"?",O:(o>0?"-":"+")+g(Math.floor(Math.abs(o)/60)*100+Math.abs(o)%60,4),P:"?",T:(String(d).match(/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g)||[""]).pop().replace(/[^-+\dA-Z]/g,""),Z:"?",c:"?",r:"?",U:Math.floor(d/1E3)};return c.replace(/\\.|[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]/g, function(r){return r in q?q[r]:r.substring(1)})}};a.fn.fmatter.defaultFormat=function(b,e){return a.fmatter.isValue(b)&&b!==""?b:e.defaultValue?e.defaultValue:" "};a.fn.fmatter.email=function(b,e){return a.fmatter.isEmpty(b)?a.fn.fmatter.defaultFormat(b,e):''+b+""};a.fn.fmatter.checkbox=function(b,e){var c=a.extend({},e.checkbox),f;a.fmatter.isUndefined(e.colModel.formatoptions)||(c=a.extend({},c,e.colModel.formatoptions));f=c.disabled===true?'disabled="disabled"': "";if(a.fmatter.isEmpty(b)||a.fmatter.isUndefined(b))b=a.fn.fmatter.defaultFormat(b,c);b+="";b=b.toLowerCase();return'"};a.fn.fmatter.link=function(b,e){var c={target:e.target},f="";a.fmatter.isUndefined(e.colModel.formatoptions)||(c=a.extend({},c,e.colModel.formatoptions));if(c.target)f="target="+c.target;return a.fmatter.isEmpty(b)?a.fn.fmatter.defaultFormat(b,e):"'+b+""};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="";a.fmatter.isUndefined(e.colModel.formatoptions)||(c=a.extend({},c,e.colModel.formatoptions));if(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)?"'+b+"":a.fn.fmatter.defaultFormat(b,e)};a.fn.fmatter.integer= function(b,e){var c=a.extend({},e.integer);a.fmatter.isUndefined(e.colModel.formatoptions)||(c=a.extend({},c,e.colModel.formatoptions));if(a.fmatter.isEmpty(b))return c.defaultValue;return a.fmatter.util.NumberFormat(b,c)};a.fn.fmatter.number=function(b,e){var c=a.extend({},e.number);a.fmatter.isUndefined(e.colModel.formatoptions)||(c=a.extend({},c,e.colModel.formatoptions));if(a.fmatter.isEmpty(b))return c.defaultValue;return a.fmatter.util.NumberFormat(b,c)};a.fn.fmatter.currency=function(b,e){var c= a.extend({},e.currency);a.fmatter.isUndefined(e.colModel.formatoptions)||(c=a.extend({},c,e.colModel.formatoptions));if(a.fmatter.isEmpty(b))return c.defaultValue;return a.fmatter.util.NumberFormat(b,c)};a.fn.fmatter.date=function(b,e,c,f){c=a.extend({},e.date);a.fmatter.isUndefined(e.colModel.formatoptions)||(c=a.extend({},c,e.colModel.formatoptions));return!c.reformatAfterEdit&&f=="edit"?a.fn.fmatter.defaultFormat(b,e):a.fmatter.isEmpty(b)?a.fn.fmatter.defaultFormat(b,e):a.fmatter.util.DateFormat(c.srcformat, b,c.newformat,c)};a.fn.fmatter.select=function(b,e){b+="";var c=false,f=[],g;if(a.fmatter.isUndefined(e.colModel.formatoptions)){if(!a.fmatter.isUndefined(e.colModel.editoptions)){c=e.colModel.editoptions.value;g=e.colModel.editoptions.separator===undefined?":":e.colModel.editoptions.separator}}else{c=e.colModel.formatoptions.value;g=e.colModel.formatoptions.separator===undefined?":":e.colModel.formatoptions.separator}if(c){var h=e.colModel.editoptions.multiple===true?true:false,j=[],d;if(h){j=b.split(","); j=a.map(j,function(m){return a.trim(m)})}if(a.fmatter.isString(c))for(var o=c.split(";"),l=0,n=0;n2)d[1]=jQuery.map(d,function(m,p){if(p>0)return m}).join(":");if(h){if(jQuery.inArray(d[0],j)>-1){f[l]=d[1];l++}}else if(a.trim(d[0])==a.trim(b)){f[0]=d[1];break}}else if(a.fmatter.isObject(c))if(h)f=jQuery.map(j,function(m){return c[m]});else f[0]=c[b]||""}b=f.join(", ");return b===""?a.fn.fmatter.defaultFormat(b,e):b};a.fn.fmatter.rowactions=function(b,e,c, f){var g={keys:false,onEdit:null,onSuccess:null,afterSave:null,onError:null,afterRestore:null,extraparam:{oper:"edit"},url:null,delOptions:{},editOptions:{}};b=a.jgrid.jqID(b);e=a.jgrid.jqID(e);f=a("#"+e)[0].p.colModel[f];a.fmatter.isUndefined(f.formatoptions)||(g=a.extend(g,f.formatoptions));if(!a.fmatter.isUndefined(a("#"+e)[0].p.editOptions))g.editOptions=a("#"+e)[0].p.editOptions;if(!a.fmatter.isUndefined(a("#"+e)[0].p.delOptions))g.delOptions=a("#"+e)[0].p.delOptions;f=function(j){g.afterSave&& g.afterSave(j);a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del","#"+e+".ui-jqgrid-btable:first").show();a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel","#"+e+".ui-jqgrid-btable:first").hide()};var h=function(j){g.afterRestore&&g.afterRestore(j);a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del","#"+e+".ui-jqgrid-btable:first").show();a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel","#"+e+".ui-jqgrid-btable:first").hide()};switch(c){case "edit":a("#"+ e).jqGrid("editRow",b,g.keys,g.onEdit,g.onSuccess,g.url,g.extraparam,f,g.onError,h);a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del","#"+e+".ui-jqgrid-btable:first").hide();a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel","#"+e+".ui-jqgrid-btable:first").show();break;case "save":if(a("#"+e).jqGrid("saveRow",b,g.onSuccess,g.url,g.extraparam,f,g.onError,h)){a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del","#"+e+".ui-jqgrid-btable:first").show();a("tr#"+b+" div.ui-inline-save, tr#"+ b+" div.ui-inline-cancel","#"+e+".ui-jqgrid-btable:first").hide()}break;case "cancel":a("#"+e).jqGrid("restoreRow",b,h);a("tr#"+b+" div.ui-inline-edit, tr#"+b+" div.ui-inline-del","#"+e+".ui-jqgrid-btable:first").show();a("tr#"+b+" div.ui-inline-save, tr#"+b+" div.ui-inline-cancel","#"+e+".ui-jqgrid-btable:first").hide();break;case "del":a("#"+e).jqGrid("delGridRow",b,g.delOptions);break;case "formedit":a("#"+e).jqGrid("setSelection",b);a("#"+e).jqGrid("editGridRow",b,g.editOptions)}};a.fn.fmatter.actions= function(b,e){var c={keys:false,editbutton:true,delbutton:true,editformbutton:false};a.fmatter.isUndefined(e.colModel.formatoptions)||(c=a.extend(c,e.colModel.formatoptions));var f=e.rowId,g="",h;if(typeof f=="undefined"||a.fmatter.isEmpty(f))return"";if(c.editformbutton){h="onclick=jQuery.fn.fmatter.rowactions('"+f+"','"+e.gid+"','formedit',"+e.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";g=g+"

"}else if(c.editbutton){h="onclick=jQuery.fn.fmatter.rowactions('"+f+"','"+e.gid+"','edit',"+e.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover') ";g=g+"
"}if(c.delbutton){h= "onclick=jQuery.fn.fmatter.rowactions('"+f+"','"+e.gid+"','del',"+e.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";g=g+"
"}h="onclick=jQuery.fn.fmatter.rowactions('"+f+"','"+e.gid+"','save',"+e.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); "; g=g+"";h="onclick=jQuery.fn.fmatter.rowactions('"+f+"','"+e.gid+"','cancel',"+e.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";g=g+""; return"
"+g+"
"};a.unformat=function(b,e,c,f){var g,h=e.colModel.formatter,j=e.colModel.formatoptions||{},d=/([\.\*\_\'\(\)\{\}\+\?\\])/g,o=e.colModel.unformat||a.fn.fmatter[h]&&a.fn.fmatter[h].unformat;if(typeof o!=="undefined"&&a.isFunction(o))g=o(a(b).text(),e,b);else if(!a.fmatter.isUndefined(h)&&a.fmatter.isString(h)){g=a.jgrid.formatter||{};switch(h){case "integer":j=a.extend({},g.integer,j);e=j.thousandsSeparator.replace(d,"\\$1");g=a(b).text().replace(RegExp(e, "g"),"");break;case "number":j=a.extend({},g.number,j);e=j.thousandsSeparator.replace(d,"\\$1");g=a(b).text().replace(RegExp(e,"g"),"").replace(j.decimalSeparator,".");break;case "currency":j=a.extend({},g.currency,j);e=j.thousandsSeparator.replace(d,"\\$1");g=a(b).text().replace(RegExp(e,"g"),"").replace(j.decimalSeparator,".").replace(j.prefix,"").replace(j.suffix,"");break;case "checkbox":j=e.colModel.editoptions?e.colModel.editoptions.value.split(":"):["Yes","No"];g=a("input",b).is(":checked")? j[0]:j[1];break;case "select":g=a.unformat.select(b,e,c,f);break;case "actions":return"";default:g=a(b).text()}}return g!==undefined?g:f===true?a(b).text():a.jgrid.htmlDecode(a(b).html())};a.unformat.select=function(b,e,c,f){c=[];b=a(b).text();if(f===true)return b;e=a.extend({},e.colModel.editoptions);if(e.value){var g=e.value;e=e.multiple===true?true:false;f=[];var h;if(e){f=b.split(",");f=a.map(f,function(l){return a.trim(l)})}if(a.fmatter.isString(g))for(var j=g.split(";"),d=0,o=0;o2)h[1]=jQuery.map(h,function(l,n){if(n>0)return l}).join(":");if(e){if(jQuery.inArray(h[1],f)>-1){c[d]=h[0];d++}}else if(a.trim(h[1])==a.trim(b)){c[0]=h[0];break}}else if(a.fmatter.isObject(g)||a.isArray(g)){e||(f[0]=b);c=jQuery.map(f,function(l){var n;a.each(g,function(m,p){if(p==l){n=m;return false}});if(typeof n!="undefined")return n})}return c.join(", ")}else return b||""};a.unformat.date=function(b,e){var c=a.jgrid.formatter.date||{};a.fmatter.isUndefined(e.formatoptions)|| (c=a.extend({},c,e.formatoptions));return a.fmatter.isEmpty(b)?a.fn.fmatter.defaultFormat(b,e):a.fmatter.util.DateFormat(c.newformat,b,c.srcformat,c)}})(jQuery); (function(a){a.extend(a.jgrid,{showModal:function(b){b.w.show()},closeModal:function(b){b.w.hide().attr("aria-hidden","true");b.o&&b.o.remove()},hideModal:function(b,e){e=a.extend({jqm:true,gb:""},e||{});if(e.onClose){var c=e.onClose(b);if(typeof c=="boolean"&&!c)return}if(a.fn.jqm&&e.jqm===true)a(b).attr("aria-hidden","true").jqmHide();else{if(e.gb!=="")try{a(".jqgrid-overlay:first",e.gb).hide()}catch(f){}a(b).hide().attr("aria-hidden","true")}},findPos:function(b){var e=0,c=0;if(b.offsetParent){do{e+= b.offsetLeft;c+=b.offsetTop}while(b=b.offsetParent)}return[e,c]},createModal:function(b,e,c,f,g,h,j){var d=document.createElement("div"),o,l=this;j=a.extend({},j||{});o=a(c.gbox).attr("dir")=="rtl"?true:false;d.className="ui-widget ui-widget-content ui-corner-all ui-jqdialog";d.id=b.themodal;var n=document.createElement("div");n.className="ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";n.id=b.modalhead;a(n).append(""+c.caption+"");var m= a("").hover(function(){m.addClass("ui-state-hover")},function(){m.removeClass("ui-state-hover")}).append("");a(n).append(m);if(o){d.dir="rtl";a(".ui-jqdialog-title",n).css("float","right");a(".ui-jqdialog-titlebar-close",n).css("left","0.3em")}else{d.dir="ltr";a(".ui-jqdialog-title",n).css("float","left");a(".ui-jqdialog-titlebar-close",n).css("right","0.3em")}var p=document.createElement("div"); a(p).addClass("ui-jqdialog-content ui-widget-content").attr("id",b.modalcontent);a(p).append(e);d.appendChild(p);a(d).prepend(n);if(h===true)a("body").append(d);else typeof h=="string"?a(h).append(d):a(d).insertBefore(f);a(d).css(j);if(typeof c.jqModal==="undefined")c.jqModal=true;e={};if(a.fn.jqm&&c.jqModal===true){if(c.left===0&&c.top===0&&c.overlay){j=[];j=this.findPos(g);c.left=j[0]+4;c.top=j[1]+4}e.top=c.top+"px";e.left=c.left}else if(c.left!==0||c.top!==0){e.left=c.left;e.top=c.top+"px"}a("a.ui-jqdialog-titlebar-close", n).click(function(){var s=a("#"+b.themodal).data("onClose")||c.onClose,q=a("#"+b.themodal).data("gbox")||c.gbox;l.hideModal("#"+b.themodal,{gb:q,jqm:c.jqModal,onClose:s});return false});if(c.width===0||!c.width)c.width=300;if(c.height===0||!c.height)c.height=200;if(!c.zIndex){f=a(f).parents("*[role=dialog]").filter(":first").css("z-index");c.zIndex=f?parseInt(f,10)+2:950}f=0;if(o&&e.left&&!h){f=a(c.gbox).width()-(!isNaN(c.width)?parseInt(c.width,10):0)-8;e.left=parseInt(e.left,10)+parseInt(f,10)}if(e.left)e.left+= "px";a(d).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"});if(typeof c.drag=="undefined")c.drag=true;if(typeof c.resize=="undefined")c.resize=true;if(c.drag){a(n).css("cursor","move");if(a.fn.jqDrag)a(d).jqDrag(n);else try{a(d).draggable({handle:a("#"+n.id)})}catch(k){}}if(c.resize)if(a.fn.jqResize){a(d).append("
"); a("#"+b.themodal).jqResize(".jqResize",b.scrollelm?"#"+b.scrollelm:false)}else try{a(d).resizable({handles:"se, sw",alsoResize:b.scrollelm?"#"+b.scrollelm:false})}catch(v){}c.closeOnEscape===true&&a(d).keydown(function(s){if(s.which==27){s=a("#"+b.themodal).data("onClose")||c.onClose;l.hideModal(this,{gb:c.gbox,jqm:c.jqModal,onClose:s})}})},viewModal:function(b,e){e=a.extend({toTop:true,overlay:10,modal:false,overlayClass:"ui-widget-overlay",onShow:this.showModal,onHide:this.closeModal,gbox:"",jqm:true, jqM:true},e||{});if(a.fn.jqm&&e.jqm===true)e.jqM?a(b).attr("aria-hidden","false").jqm(e).jqmShow():a(b).attr("aria-hidden","false").jqmShow();else{if(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:true,resize:false,caption:""+b+"",left:250,top:170,zIndex:1E3,jqModal:true,modal:false,closeOnEscape:true, align:"center",buttonalign:"center",buttons:[]};a.extend(g,f||{});var h=g.jqModal,j=this;if(a.fn.jqm&&!h)h=false;b="";if(g.buttons.length>0)for(f=0;f"+g.buttons[f].text+""}f=isNaN(g.dataheight)?g.dataheight:g.dataheight+"px";var d="
";d+="
"+e+"
";d+=c?"
"+c+""+b+"
":b!==""?"
"+ b+"
":"";d+="
";try{a("#info_dialog").attr("aria-hidden")=="false"&&this.hideModal("#info_dialog",{jqm:h});a("#info_dialog").remove()}catch(o){}this.createModal({themodal:"info_dialog",modalhead:"info_head",modalcontent:"info_content",scrollelm:"infocnt"},d,g,"","",true);b&&a.each(g.buttons,function(n){a("#"+this.id,"#info_id").bind("click",function(){g.buttons[n].onClick.call(a("#info_dialog"));return false})});a("#closedialog","#info_id").click(function(){j.hideModal("#info_dialog",{jqm:h}); return false});a(".fm-button","#info_dialog").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});a.isFunction(g.beforeOpen)&&g.beforeOpen();this.viewModal("#info_dialog",{onHide:function(n){n.w.hide().remove();n.o&&n.o.remove()},modal:g.modal,jqm:h});a.isFunction(g.afterOpen)&&g.afterOpen();try{a("#info_dialog").focus()}catch(l){}},createEl:function(b,e,c,f,g){function h(k,v){a.isFunction(v.dataInit)&&v.dataInit(k);v.dataEvents&&a.each(v.dataEvents, function(){this.data!==undefined?a(k).bind(this.type,this.data,this.fn):a(k).bind(this.type,this.fn)});return v}function j(k,v,s){var q=["dataInit","dataEvents","dataUrl","buildSelect","sopt","searchhidden","defaultValue","attr"];if(typeof s!="undefined"&&a.isArray(s))q=a.extend(q,s);a.each(v,function(r,w){a.inArray(r,q)===-1&&a(k).attr(r,w)});v.hasOwnProperty("id")||a(k).attr("id",a.jgrid.randId())}var d="";switch(b){case "textarea":d=document.createElement("textarea");if(f)e.cols||a(d).css({width:"98%"}); else if(!e.cols)e.cols=20;if(!e.rows)e.rows=2;if(c==" "||c==" "||c.length==1&&c.charCodeAt(0)==160)c="";d.value=c;j(d,e);e=h(d,e);a(d).attr({role:"textbox",multiline:"true"});break;case "checkbox":d=document.createElement("input");d.type="checkbox";if(e.value){b=e.value.split(":");if(c===b[0]){d.checked=true;d.defaultChecked=true}d.value=b[0];a(d).attr("offval",b[1])}else{b=c.toLowerCase();if(b.search(/(false|0|no|off|undefined)/i)<0&&b!==""){d.checked=true;d.defaultChecked=true;d.value= c}else d.value="on";a(d).attr("offval","off")}j(d,e,["value"]);e=h(d,e);a(d).attr("role","checkbox");break;case "select":d=document.createElement("select");d.setAttribute("role","select");f=[];if(e.multiple===true){b=true;d.multiple="multiple";a(d).attr("aria-multiselectable","true")}else b=false;if(typeof e.dataUrl!="undefined")a.ajax(a.extend({url:e.dataUrl,type:"GET",dataType:"html",context:{elem:d,options:e,vl:c},success:function(k){var v=[],s=this.elem,q=this.vl,r=a.extend({},this.options),w= r.multiple===true;if(typeof r.buildSelect!="undefined")k=r.buildSelect(k);if(k=a(k).html()){a(s).append(k);j(s,r);r=h(s,r);if(typeof r.size==="undefined")r.size=w?3:1;if(w){v=q.split(",");v=a.map(v,function(y){return a.trim(y)})}else v[0]=a.trim(q);setTimeout(function(){a("option",s).each(function(){a(this).attr("role","option");if(a.inArray(a.trim(a(this).text()),v)>-1||a.inArray(a.trim(a(this).val()),v)>-1)this.selected="selected"})},0)}}},g||{}));else if(e.value){var o;if(typeof e.size==="undefined")e.size= b?3:1;if(b){f=c.split(",");f=a.map(f,function(k){return a.trim(k)})}if(typeof e.value==="function")e.value=e.value();var l,n,m=e.separator===undefined?":":e.separator;if(typeof e.value==="string"){l=e.value.split(";");for(o=0;o2)n[1]=a.map(n,function(k,v){if(v>0)return k}).join(":");g=document.createElement("option");g.setAttribute("role","option");g.value=n[0];g.innerHTML=n[1];d.appendChild(g);if(!b&&(a.trim(n[0])==a.trim(c)||a.trim(n[1])==a.trim(c)))g.selected= "selected";if(b&&(a.inArray(a.trim(n[1]),f)>-1||a.inArray(a.trim(n[0]),f)>-1))g.selected="selected"}}else if(typeof e.value==="object"){m=e.value;for(o in m)if(m.hasOwnProperty(o)){g=document.createElement("option");g.setAttribute("role","option");g.value=o;g.innerHTML=m[o];d.appendChild(g);if(!b&&(a.trim(o)==a.trim(c)||a.trim(m[o])==a.trim(c)))g.selected="selected";if(b&&(a.inArray(a.trim(m[o]),f)>-1||a.inArray(a.trim(o),f)>-1))g.selected="selected"}}j(d,e,["value"]);e=h(d,e)}break;case "text":case "password":case "button":o= b=="button"?"button":"textbox";d=document.createElement("input");d.type=b;d.value=c;j(d,e);e=h(d,e);if(b!="button")if(f)e.size||a(d).css({width:"98%"});else if(!e.size)e.size=20;a(d).attr("role",o);break;case "image":case "file":d=document.createElement("input");d.type=b;j(d,e);e=h(d,e);break;case "custom":d=document.createElement("span");try{if(a.isFunction(e.custom_element))if(m=e.custom_element.call(this,c,e)){m=a(m).addClass("customelement").attr({id:e.id,name:e.name});a(d).empty().append(m)}else throw"e2"; else throw"e1";}catch(p){p=="e1"&&this.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose);p=="e2"?this.info_dialog(a.jgrid.errors.errcap,"function 'custom_element' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):this.info_dialog(a.jgrid.errors.errcap,typeof p==="string"?p:p.message,a.jgrid.edit.bClose)}}return d},checkDate:function(b,e){var c={},f;b=b.toLowerCase();f=b.indexOf("/")!=-1?"/":b.indexOf("-")!=-1?"-":b.indexOf(".")!=-1?".":"/"; b=b.split(f);e=e.split(f);if(e.length!=3)return false;f=-1;for(var g,h=-1,j=-1,d=0;d12)return false}if(h===-1)return false;else{o=c[b[h]].toString();if(o.length<1||c[b[h]]<1||c[b[h]]>31||c[b[j]]==2&&c[b[h]]>(c[b[f]]%4===0&&(c[b[f]]%100!==0||c[b[f]]%400===0)?29:28)||c[b[h]]>d[c[b[j]]])return false}return true},isEmpty:function(b){return b.match(/^\s+$/)||b===""?true:false},checkTime:function(b){var e=/^(\d{1,2}):(\d{2})([ap]m)?$/;if(!this.isEmpty(b))if(b=b.match(e)){if(b[3]){if(b[1]< 1||b[1]>12)return false}else if(b[1]>23)return false;if(b[2]>59)return false}else return false;return true},checkValues:function(b,e,c,f,g){var h,j;if(typeof f==="undefined")if(typeof e=="string"){f=0;for(g=c.p.colModel.length;f=0)h=c.p.colModel[e].editrules}else{h=f;j=g===undefined?"_":g}if(h){j||(j=c.p.colNames[e]);if(h.required===true)if(this.isEmpty(b))return[false, j+": "+a.jgrid.edit.msg.required,""];f=h.required===false?false:true;if(h.number===true)if(!(f===false&&this.isEmpty(b)))if(isNaN(b))return[false,j+": "+a.jgrid.edit.msg.number,""];if(typeof h.minValue!="undefined"&&!isNaN(h.minValue))if(parseFloat(b)parseFloat(h.maxValue))return[false,j+": "+a.jgrid.edit.msg.maxValue+" "+h.maxValue,""];if(h.email=== true)if(!(f===false&&this.isEmpty(b))){g=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i; if(!g.test(b))return[false,j+": "+a.jgrid.edit.msg.email,""]}if(h.integer===true)if(!(f===false&&this.isEmpty(b))){if(isNaN(b))return[false,j+": "+a.jgrid.edit.msg.integer,""];if(b%1!==0||b.indexOf(".")!=-1)return[false,j+": "+a.jgrid.edit.msg.integer,""]}if(h.date===true)if(!(f===false&&this.isEmpty(b))){e=c.p.colModel[e].formatoptions&&c.p.colModel[e].formatoptions.newformat?c.p.colModel[e].formatoptions.newformat:c.p.colModel[e].datefmt||"Y-m-d";if(!this.checkDate(e,b))return[false,j+": "+a.jgrid.edit.msg.date+ " - "+e,""]}if(h.time===true)if(!(f===false&&this.isEmpty(b)))if(!this.checkTime(b))return[false,j+": "+a.jgrid.edit.msg.date+" - hh:mm (am/pm)",""];if(h.url===true)if(!(f===false&&this.isEmpty(b))){g=/^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;if(!g.test(b))return[false,j+": "+a.jgrid.edit.msg.url,""]}if(h.custom===true)if(!(f===false&&this.isEmpty(b)))if(a.isFunction(h.custom_func)){b=h.custom_func.call(c,b,j);return a.isArray(b)? b:[false,a.jgrid.edit.msg.customarray,""]}else return[false,a.jgrid.edit.msg.customfcheck,""]}return[true,"",""]}})})(jQuery); (function(a){a.fn.jqFilter=function(b){if(typeof b==="string"){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(true,{filter:null,columns:[],onChange:null,afterRedraw:null,checkValues:null,error:false,errmsg:"",errorcheck:true,showQuery:true,sopt:null,ops:[{name:"eq",description:"equal",operator:"="},{name:"ne",description:"not equal",operator:"<>"},{name:"lt",description:"less",operator:"<"},{name:"le",description:"less or equal", operator:"<="},{name:"gt",description:"greater",operator:">"},{name:"ge",description:"greater or equal",operator:">="},{name:"bw",description:"begins with",operator:"LIKE"},{name:"bn",description:"does not begin with",operator:"NOT LIKE"},{name:"in",description:"in",operator:"IN"},{name:"ni",description:"not in",operator:"NOT IN"},{name:"ew",description:"ends with",operator:"LIKE"},{name:"en",description:"does not end with",operator:"NOT LIKE"},{name:"cn",description:"contains",operator:"LIKE"},{name:"nc", description:"does not contain",operator:"NOT LIKE"},{name:"nu",description:"is null",operator:"IS NULL"},{name:"nn",description:"is not null",operator:"IS NOT NULL"}],numopts:["eq","ne","lt","le","gt","ge","nu","nn","in","ni"],stropts:["eq","ne","bw","bn","ew","en","cn","nc","nu","nn","in","ni"],_gridsopt:[],groupOps:[{op:"AND",text:"AND"},{op:"OR",text:"OR"}],groupButton:true,ruleButtons:true,direction:"ltr"},b||{});return this.each(function(){if(!this.filter){this.p=f;if(this.p.filter===null||this.p.filter=== undefined)this.p.filter={groupOp:this.p.groupOps[0].op,rules:[],groups:[]};var g,h=this.p.columns.length,j,d=/msie/i.test(navigator.userAgent)&&!window.opera;if(this.p._gridsopt.length)for(g=0;g");var o=function(l,n){var m=[true,""];if(a.isFunction(n.searchrules))m= n.searchrules(l,n);else if(a.jgrid&&a.jgrid.checkValues)try{m=a.jgrid.checkValues(l,-1,null,n.searchrules,n.label)}catch(p){}if(m&&m.length&&m[0]===false){f.error=!m[0];f.errmsg=m[1]}};this.onchange=function(){this.p.error=false;this.p.errmsg="";return a.isFunction(this.p.onChange)?this.p.onChange.call(this,this.p):false};this.reDraw=function(){a("table.group:first",this).remove();var l=this.createTableForGroup(f.filter,null);a(this).append(l);a.isFunction(this.p.afterRedraw)&&this.p.afterRedraw.call(this, this.p)};this.createTableForGroup=function(l,n){var m=this,p,k=a("
"),v="left";if(this.p.direction=="rtl"){v="right";k.attr("dir","rtl")}n===null&&k.append("");var s=a("");k.append(s);v=a("");s.append(v);if(this.p.ruleButtons===true){var q=a(""); v.append(q);s="";var r;for(p=0;p"+m.p.groupOps[p].text+""}q.append(s).bind("change",function(){l.groupOp=a(q).val();m.onchange()})}s="";if(this.p.groupButton){s=a("");s.bind("click",function(){if(l.groups===undefined)l.groups=[];l.groups.push({groupOp:f.groupOps[0].op,rules:[], groups:[]});m.reDraw();m.onchange();return false})}v.append(s);if(this.p.ruleButtons===true){s=a("");var w;s.bind("click",function(){if(l.rules===undefined)l.rules=[];for(p=0;p");v.append(s);s.bind("click",function(){for(p=0;p");k.append(v);s=a(""); v.append(s);s=a("");s.append(this.createTableForGroup(l.groups[p],l));v.append(s)}if(l.groupOp===undefined)l.groupOp=m.p.groupOps[0].op;if(l.rules!==undefined)for(p=0;p"),k,v,s,q,r="",w;p.append("");var y=a("");p.append(y);var z=a(""),E,D=[];y.append(z);z.bind("change", function(){l.field=a(z).val();s=a(this).parents("tr:first");for(k=0;k"+m.p.ops[E].description+"";V++}}a(".selectopts",s).empty().append(ba);a(".selectopts",s)[0].selectedIndex=0;if(a.browser.msie&&a.browser.version<9){ba=parseInt(a("select.selectopts",s)[0].offsetWidth)+1;a(".selectopts",s).width(ba);a(".selectopts",s).css("width","auto")}a(".data",s).empty().append(C);a(".input-elm", s).bind("change",function(){l.data=a(this).val();m.onchange()});setTimeout(function(){l.data=a(C).val();m.onchange()},0)}});for(k=y=0;k"+m.p.columns[k].label+""}}z.append(r);r=a(""); p.append(r);q=f.columns[y];q.searchoptions.id=a.jgrid.randId();if(d&&q.inputtype==="text")if(!q.searchoptions.size)q.searchoptions.size=10;y=a.jgrid.createEl(q.inputtype,q.searchoptions,l.data,true,m.p.ajaxSelectOptions,true);var K=a("");r.append(K);K.bind("change",function(){l.op=a(K).val();s=a(this).parents("tr:first");var C=a(".input-elm",s)[0];if(l.op==="nu"||l.op==="nn"){l.data="";C.value="";C.setAttribute("readonly","true");C.setAttribute("disabled","true")}else{C.removeAttribute("readonly"); C.removeAttribute("disabled")}m.onchange()});v=q.searchoptions.sopt?q.searchoptions.sopt:m.p.sopt?m.p.sopt:q.searchtype==="string"?f.stropts:m.p.numopts;r="";a.each(m.p.ops,function(){D.push(this.name)});for(k=0;k"+m.p.ops[E].description+""}}K.append(r);r=a("");p.append(r);r.append(y);a(y).addClass("input-elm").bind("change",function(){l.data= a(this).val();m.onchange()});r=a("");p.append(r);if(this.p.ruleButtons===true){y=a("");r.append(y);y.bind("click",function(){for(k=0;k1)n+=" "+l.groupOp+" ";try{n+=this.getStringForGroup(l.groups[m])}catch(p){alert(p)}}if(l.rules!== undefined)try{for(m=0;m1)n+=" "+l.groupOp+" ";n+=this.getStringForRule(l.rules[m])}}catch(k){alert(k)}n+=")";return n==="()"?"":n};this.getStringForRule=function(l){var n="",m="",p,k;for(p=0;p1)p+=m.groupOp==="OR"?" || ":" && ";p+=l(m.groups[k])}if(m.rules!==undefined)for(k=0;k1)p+=m.groupOp==="OR"?" || ":" && ";var v=m.rules[k];if(n.p.errorcheck){var s=void 0,q=void 0;for(s=0;s
").insertBefore("#gview_"+f.p.id),l="left",n="";if(f.p.direction=="rtl"){l="right";n= " style='text-align:left'";o.attr("dir","rtl")}var m=a.extend([],f.p.colModel),p=""+e.Find+"",k=""+e.Reset+"",v="",s="",q,r=false,w=-1;if(e.showQuery)v= "Query";if(e.columns.length)m=e.columns;else a.each(m,function(z,E){if(!E.label)E.label=f.p.colNames[z];if(!r){var D=typeof E.search==="undefined"?true:E.search,B=E.hidden===true;if(E.searchoptions&&E.searchoptions.searchhidden===true&&D||D&&!B){r=true;q=E.index||E.name;w=z}}});if(!d&&q||e.multipleSearch===false){var y="eq";if(w>=0&&m[w].searchoptions&& m[w].searchoptions.sopt)y=m[w].searchoptions.sopt[0];else if(e.sopt&&e.sopt.length)y=e.sopt[0];d={groupOp:"AND",rules:[{field:q,op:y,data:""}]}}r=false;if(e.tmplNames&&e.tmplNames.length){r=true;s=e.tmplLabel;s+=""}l="

"+k+s+""+v+p+"
";a("#"+g).jqFilter({columns:m,filter:e.loadDefaults?d:null,showQuery:e.showQuery,errorcheck:e.errorcheck,sopt:e.sopt,groupButton:e.multipleGroup,ruleButtons:e.multipleSearch,afterRedraw:e.afterRedraw,_gridsopt:a.jgrid.search.odata,ajaxSelectOptions:f.p.ajaxSelectOptions,onChange:function(){this.p.showQuery&&a(".query",this).html(this.toUserFriendlyString())},direction:f.p.direction});o.append(l);r&&e.tmplFilters&&e.tmplFilters.length&& a(".ui-template",o).bind("change",function(){var z=a(this).val();z=="default"?a("#"+g).jqFilter("addFilter",d):a("#"+g).jqFilter("addFilter",e.tmplFilters[parseInt(z,10)]);return false});if(e.multipleGroup===true)e.multipleSearch=true;if(a.isFunction(e.onInitializeSearch))e.onInitializeSearch(a("#"+g));e.gbox="#gbox_"+g;e.layer?a.jgrid.createModal(j,o,e,"#gview_"+f.p.id,a("#gbox_"+f.p.id)[0],"#"+e.layer,{position:"relative"}):a.jgrid.createModal(j,o,e,"#gview_"+f.p.id,a("#gbox_"+f.p.id)[0]);v&&a("#"+ g+"_query").bind("click",function(){a(".queryresult",o).toggle();return false});if(e.stringResult===undefined)e.stringResult=e.multipleSearch;a("#"+g+"_search").bind("click",function(){var z=a("#"+g),E={},D,B=z.jqFilter("filterData");if(e.errorcheck){z[0].hideError();e.showQuery||z.jqFilter("toSQLString");if(z[0].p.error){z[0].showError();return false}}if(e.stringResult){try{D=xmlJsonClass.toJson(B,"","",false)}catch(K){try{D=JSON.stringify(B)}catch(C){}}if(typeof D==="string"){E[e.sFilter]=D;a.each([e.sField, e.sValue,e.sOper],function(){E[this]=""})}}else if(e.multipleSearch){E[e.sFilter]=B;a.each([e.sField,e.sValue,e.sOper],function(){E[this]=""})}else{E[e.sField]=B.rules[0].field;E[e.sValue]=B.rules[0].data;E[e.sOper]=B.rules[0].op;E[e.sFilter]=""}f.p.search=true;a.extend(f.p.postData,E);if(a.isFunction(e.onSearch))e.onSearch();a(f).trigger("reloadGrid",[{page:1}]);e.closeAfterSearch&&a.jgrid.hideModal("#"+j.themodal,{gb:"#gbox_"+f.p.id,jqm:e.jqModal,onClose:e.onClose});return false});a("#"+g+"_reset").bind("click", function(){var z={},E=a("#"+g);f.p.search=false;if(e.multipleSearch===false)z[e.sField]=z[e.sValue]=z[e.sOper]="";else z[e.sFilter]="";E[0].resetFilter();r&&a(".ui-template",o).val("default");a.extend(f.p.postData,z);if(a.isFunction(e.onReset))e.onReset();a(f).trigger("reloadGrid",[{page:1}]);return false});c();a(".fm-button:not(.ui-state-disabled)",o).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},editGridRow:function(e,c){c=a.extend({top:0, left:0,width:300,height:"auto",dataheight:"auto",modal:false,overlay:30,drag:true,resize:true,url:null,mtype:"POST",clearAfterAdd:true,closeAfterEdit:false,reloadAfterSubmit:true,onInitializeForm:null,beforeInitData:null,beforeShowForm:null,afterShowForm:null,beforeSubmit:null,afterSubmit:null,onclickSubmit:null,afterComplete:null,onclickPgButtons:null,afterclickPgButtons:null,editData:{},recreateForm:false,jqModal:true,closeOnEscape:false,addedrow:"first",topinfo:"",bottominfo:"",saveicon:[],closeicon:[], savekey:[false,13],navkeys:[false,38,40],checkOnSubmit:false,checkOnUpdate:false,_savedData:{},processing:false,onClose:null,ajaxEditOptions:{},serializeEditData:null,viewPagerButtons:true},a.jgrid.edit,c||{});b[a(this)[0].p.id]=c;return this.each(function(){function f(){a("#"+q+" > tbody > tr > td > .FormElement").each(function(){var G=a(".customelement",this);if(G.length){var H=a(G[0]).attr("name");a.each(k.p.colModel,function(){if(this.name===H&&this.editoptions&&a.isFunction(this.editoptions.custom_value)){try{C[H]= this.editoptions.custom_value(a("#"+a.jgrid.jqID(H),"#"+q),"get");if(C[H]===undefined)throw"e1";}catch(Q){Q==="e1"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,Q.message,jQuery.jgrid.edit.bClose)}return true}})}else{switch(a(this).get(0).type){case "checkbox":if(a(this).is(":checked"))C[this.name]=a(this).val();else{G=a(this).attr("offval");C[this.name]=G}break;case "select-one":C[this.name]= a("option:selected",this).val();ba[this.name]=a("option:selected",this).text();break;case "select-multiple":C[this.name]=a(this).val();C[this.name]=C[this.name]?C[this.name].join(","):"";var W=[];a("option:selected",this).each(function(Q,$){W[Q]=a($).text()});ba[this.name]=W.join(",");break;case "password":case "text":case "textarea":case "button":C[this.name]=a(this).val()}if(k.p.autoencode)C[this.name]=a.jgrid.htmlEncode(C[this.name])}});return true}function g(G,H,W,Q){var $,S,O,da=0,X,oa,aa,ua= [],ma=false,sa="",ka;for(ka=1;ka<=Q;ka++)sa+="  ";if(G!="_empty")ma=a(H).jqGrid("getInd",G);a(H.p.colModel).each(function(qa){$=this.name;oa=(S=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false)?"style='display:none'":"";if($!=="cb"&&$!=="subgrid"&&this.editable===true&&$!=="rn"){if(ma===false)X="";else if($==H.p.ExpandColumn&&H.p.treeGrid===true)X=a("td:eq("+qa+")",H.rows[ma]).text();else{try{X=a.unformat(a("td:eq("+ qa+")",H.rows[ma]),{rowId:G,colModel:this},qa)}catch(Ha){X=this.edittype&&this.edittype=="textarea"?a("td:eq("+qa+")",H.rows[ma]).text():a("td:eq("+qa+")",H.rows[ma]).html()}if(!X||X==" "||X==" "||X.length==1&&X.charCodeAt(0)==160)X=""}var Ba=a.extend({},this.editoptions||{},{id:$,name:$}),t=a.extend({},{elmprefix:"",elmsuffix:"",rowabove:false,rowcontent:""},this.formoptions||{}),u=parseInt(t.rowpos,10)||da+1,x=parseInt((parseInt(t.colpos,10)||1)*2,10);if(G=="_empty"&&Ba.defaultValue)X= a.isFunction(Ba.defaultValue)?Ba.defaultValue():Ba.defaultValue;if(!this.edittype)this.edittype="text";if(k.p.autoencode)X=a.jgrid.htmlDecode(X);aa=a.jgrid.createEl(this.edittype,Ba,X,false,a.extend({},a.jgrid.ajaxOptions,H.p.ajaxSelectOptions||{}));if(X===""&&this.edittype=="checkbox")X=a(aa).attr("offval");if(X===""&&this.edittype=="select")X=a("option:eq(0)",aa).text();if(b[k.p.id].checkOnSubmit||b[k.p.id].checkOnUpdate)b[k.p.id]._savedData[$]=X;a(aa).addClass("FormElement");if(this.edittype== "text"||this.edittype=="textarea")a(aa).addClass("ui-widget-content ui-corner-all");O=a(W).find("tr[rowpos="+u+"]");if(t.rowabove){Ba=a(""+t.rowcontent+"");a(W).append(Ba);Ba[0].rp=u}if(O.length===0){O=a("").addClass("FormData").attr("id","tr_"+$);a(O).append(sa);a(W).append(O);O[0].rp=u}a("td:eq("+(x-2)+")",O[0]).html(typeof t.label==="undefined"?H.p.colNames[qa]:t.label);a("td:eq("+(x-1)+")",O[0]).append(t.elmprefix).append(aa).append(t.elmsuffix); ua[da]=qa;da++}});if(da>0){ka=a("");ka[0].rp=da+999;a(W).append(ka);if(b[k.p.id].checkOnSubmit||b[k.p.id].checkOnUpdate)b[k.p.id]._savedData[H.p.id+"_id"]=G}return ua}function h(G,H,W){var Q,$=0,S,O,da,X,oa;if(b[k.p.id].checkOnSubmit||b[k.p.id].checkOnUpdate){b[k.p.id]._savedData={};b[k.p.id]._savedData[H.p.id+ "_id"]=G}var aa=H.p.colModel;if(G=="_empty"){a(aa).each(function(){Q=this.name;da=a.extend({},this.editoptions||{});if((O=a("#"+a.jgrid.jqID(Q),"#"+W))&&O.length&&O[0]!==null){X="";if(da.defaultValue){X=a.isFunction(da.defaultValue)?da.defaultValue():da.defaultValue;if(O[0].type=="checkbox"){oa=X.toLowerCase();if(oa.search(/(false|0|no|off|undefined)/i)<0&&oa!==""){O[0].checked=true;O[0].defaultChecked=true;O[0].value=X}else{O[0].checked=false;O[0].defaultChecked=false}}else O.val(X)}else if(O[0].type== "checkbox"){O[0].checked=false;O[0].defaultChecked=false;X=a(O).attr("offval")}else if(O[0].type&&O[0].type.substr(0,6)=="select")O[0].selectedIndex=0;else O.val(X);if(b[k.p.id].checkOnSubmit===true||b[k.p.id].checkOnUpdate)b[k.p.id]._savedData[Q]=X}});a("#id_g","#"+W).val(G)}else{var ua=a(H).jqGrid("getInd",G,true);if(ua){a('td[role="gridcell"]',ua).each(function(ma){Q=aa[ma].name;if(Q!=="cb"&&Q!=="subgrid"&&Q!=="rn"&&aa[ma].editable===true){if(Q==H.p.ExpandColumn&&H.p.treeGrid===true)S=a(this).text(); else try{S=a.unformat(a(this),{rowId:G,colModel:aa[ma]},ma)}catch(sa){S=aa[ma].edittype=="textarea"?a(this).text():a(this).html()}if(k.p.autoencode)S=a.jgrid.htmlDecode(S);if(b[k.p.id].checkOnSubmit===true||b[k.p.id].checkOnUpdate)b[k.p.id]._savedData[Q]=S;Q=a.jgrid.jqID(Q);switch(aa[ma].edittype){case "password":case "text":case "button":case "image":case "textarea":if(S==" "||S==" "||S.length==1&&S.charCodeAt(0)==160)S="";a("#"+Q,"#"+W).val(S);break;case "select":var ka=S.split(",");ka= a.map(ka,function(Ha){return a.trim(Ha)});a("#"+Q+" option","#"+W).each(function(){this.selected=!aa[ma].editoptions.multiple&&(a.trim(S)==a.trim(a(this).text())||ka[0]==a.trim(a(this).text())||ka[0]==a.trim(a(this).val()))?true:aa[ma].editoptions.multiple?a.inArray(a.trim(a(this).text()),ka)>-1||a.inArray(a.trim(a(this).val()),ka)>-1?true:false:false});break;case "checkbox":S+="";if(aa[ma].editoptions&&aa[ma].editoptions.value)if(aa[ma].editoptions.value.split(":")[0]==S){a("#"+Q,"#"+W)[k.p.useProp? "prop":"attr"]("checked",true);a("#"+Q,"#"+W)[k.p.useProp?"prop":"attr"]("defaultChecked",true)}else{a("#"+Q,"#"+W)[k.p.useProp?"prop":"attr"]("checked",false);a("#"+Q,"#"+W)[k.p.useProp?"prop":"attr"]("defaultChecked",false)}else{S=S.toLowerCase();if(S.search(/(false|0|no|off|undefined)/i)<0&&S!==""){a("#"+Q,"#"+W)[k.p.useProp?"prop":"attr"]("checked",true);a("#"+Q,"#"+W)[k.p.useProp?"prop":"attr"]("defaultChecked",true)}else{a("#"+Q,"#"+W)[k.p.useProp?"prop":"attr"]("checked",false);a("#"+Q,"#"+ W)[k.p.useProp?"prop":"attr"]("defaultChecked",false)}}break;case "custom":try{if(aa[ma].editoptions&&a.isFunction(aa[ma].editoptions.custom_value))aa[ma].editoptions.custom_value(a("#"+Q,"#"+W),"set",S);else throw"e1";}catch(qa){qa=="e1"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,qa.message,jQuery.jgrid.edit.bClose)}}$++}});$>0&&a("#id_g","#"+q).val(G)}}}function j(){var G, H=[true,"",""],W={},Q=k.p.prmNames,$,S,O,da;if(a.isFunction(b[k.p.id].beforeCheckValues)){var X=b[k.p.id].beforeCheckValues(C,a("#"+s),C[k.p.id+"_id"]=="_empty"?Q.addoper:Q.editoper);if(X&&typeof X==="object")C=X}for(O in C)if(C.hasOwnProperty(O)){H=a.jgrid.checkValues(C[O],O,k);if(H[0]===false)break}o();if(H[0]){if(a.isFunction(b[k.p.id].onclickSubmit))W=b[k.p.id].onclickSubmit(b[k.p.id],C)||{};if(a.isFunction(b[k.p.id].beforeSubmit))H=b[k.p.id].beforeSubmit(C,a("#"+s))}if(H[0]&&!b[k.p.id].processing){b[k.p.id].processing= true;a("#sData","#"+q+"_2").addClass("ui-state-active");S=Q.oper;$=Q.id;C[S]=a.trim(C[k.p.id+"_id"])=="_empty"?Q.addoper:Q.editoper;if(C[S]!=Q.addoper)C[$]=C[k.p.id+"_id"];else if(C[$]===undefined)C[$]=C[k.p.id+"_id"];delete C[k.p.id+"_id"];C=a.extend(C,b[k.p.id].editData,W);if(k.p.treeGrid===true){if(C[S]==Q.addoper){da=a(k).jqGrid("getGridParam","selrow");C[k.p.treeGridModel=="adjacency"?k.p.treeReader.parent_id_field:"parent_id"]=da}for(i in k.p.treeReader){W=k.p.treeReader[i];if(C.hasOwnProperty(W))C[S]== Q.addoper&&i==="parent_id_field"||delete C[W]}}C[$]=a.jgrid.stripPref(k.p.idPrefix,C[$]);W=a.extend({url:b[k.p.id].url?b[k.p.id].url:a(k).jqGrid("getGridParam","editurl"),type:b[k.p.id].mtype,data:a.isFunction(b[k.p.id].serializeEditData)?b[k.p.id].serializeEditData(C):C,complete:function(oa,aa){C[$]=k.p.idPrefix+C[$];if(aa!="success"){H[0]=false;H[1]=a.isFunction(b[k.p.id].errorTextFormat)?b[k.p.id].errorTextFormat(oa):aa+" Status: '"+oa.statusText+"'. Error code: "+oa.status}else if(a.isFunction(b[k.p.id].afterSubmit))H= b[k.p.id].afterSubmit(oa,C);if(H[0]===false){a("#FormError>td","#"+q).html(H[1]);a("#FormError","#"+q).show()}else{a.each(k.p.colModel,function(){if(ba[this.name]&&this.formatter&&this.formatter=="select")try{delete ba[this.name]}catch(sa){}});C=a.extend(C,ba);k.p.autoencode&&a.each(C,function(sa,ka){C[sa]=a.jgrid.htmlDecode(ka)});if(C[S]==Q.addoper){H[2]||(H[2]=a.jgrid.randId());C[$]=H[2];if(b[k.p.id].closeAfterAdd){if(b[k.p.id].reloadAfterSubmit)a(k).trigger("reloadGrid");else if(k.p.treeGrid=== true)a(k).jqGrid("addChildNode",H[2],da,C);else{a(k).jqGrid("addRowData",H[2],C,c.addedrow);a(k).jqGrid("setSelection",H[2])}a.jgrid.hideModal("#"+r.themodal,{gb:"#gbox_"+v,jqm:c.jqModal,onClose:b[k.p.id].onClose})}else if(b[k.p.id].clearAfterAdd){if(b[k.p.id].reloadAfterSubmit)a(k).trigger("reloadGrid");else k.p.treeGrid===true?a(k).jqGrid("addChildNode",H[2],da,C):a(k).jqGrid("addRowData",H[2],C,c.addedrow);h("_empty",k,s)}else if(b[k.p.id].reloadAfterSubmit)a(k).trigger("reloadGrid");else k.p.treeGrid=== true?a(k).jqGrid("addChildNode",H[2],da,C):a(k).jqGrid("addRowData",H[2],C,c.addedrow)}else{if(b[k.p.id].reloadAfterSubmit){a(k).trigger("reloadGrid");b[k.p.id].closeAfterEdit||setTimeout(function(){a(k).jqGrid("setSelection",C[$])},1E3)}else k.p.treeGrid===true?a(k).jqGrid("setTreeRow",C[$],C):a(k).jqGrid("setRowData",C[$],C);b[k.p.id].closeAfterEdit&&a.jgrid.hideModal("#"+r.themodal,{gb:"#gbox_"+v,jqm:c.jqModal,onClose:b[k.p.id].onClose})}if(a.isFunction(b[k.p.id].afterComplete)){G=oa;setTimeout(function(){b[k.p.id].afterComplete(G, C,a("#"+s));G=null},500)}if(b[k.p.id].checkOnSubmit||b[k.p.id].checkOnUpdate){a("#"+s).data("disabled",false);if(b[k.p.id]._savedData[k.p.id+"_id"]!="_empty")for(var ua in b[k.p.id]._savedData)if(C[ua])b[k.p.id]._savedData[ua]=C[ua]}}b[k.p.id].processing=false;a("#sData","#"+q+"_2").removeClass("ui-state-active");try{a(":input:visible","#"+s)[0].focus()}catch(ma){}}},a.jgrid.ajaxOptions,b[k.p.id].ajaxEditOptions);if(!W.url&&!b[k.p.id].useDataProxy)if(a.isFunction(k.p.dataProxy))b[k.p.id].useDataProxy= true;else{H[0]=false;H[1]+=" "+a.jgrid.errors.nourl}if(H[0])if(b[k.p.id].useDataProxy){O=k.p.dataProxy.call(k,W,"set_"+k.p.id);if(typeof O=="undefined")O=[true,""];if(O[0]===false){H[0]=false;H[1]=O[1]||"Error deleting the selected row!"}else{W.data.oper==Q.addoper&&b[k.p.id].closeAfterAdd&&a.jgrid.hideModal("#"+r.themodal,{gb:"#gbox_"+v,jqm:c.jqModal,onClose:b[k.p.id].onClose});W.data.oper==Q.editoper&&b[k.p.id].closeAfterEdit&&a.jgrid.hideModal("#"+r.themodal,{gb:"#gbox_"+v,jqm:c.jqModal,onClose:b[k.p.id].onClose})}}else a.ajax(W)}if(H[0]=== false){a("#FormError>td","#"+q).html(H[1]);a("#FormError","#"+q).show()}}function d(G,H){var W=false,Q;for(Q in G)if(G[Q]!=H[Q]){W=true;break}return W}function o(){a.each(k.p.colModel,function(G,H){if(H.editoptions&&H.editoptions.NullIfEmpty===true)if(C.hasOwnProperty(H.name)&&C[H.name]=="")C[H.name]="null"})}function l(){var G=true;a("#FormError","#"+q).hide();if(b[k.p.id].checkOnUpdate){C={};ba={};f();V=a.extend({},C,ba);if(la=d(V,b[k.p.id]._savedData)){a("#"+s).data("disabled",true);a(".confirm", "#"+r.themodal).show();G=false}}return G}function n(){if(e!=="_empty"&&typeof k.p.savedRow!=="undefined"&&k.p.savedRow.length>0&&a.isFunction(a.fn.jqGrid.restoreRow))for(var G=0;G").data("disabled",false);var xa=a("
");if(z){D=z(a("#"+s));if(typeof D=="undefined")D=true}if(D===false)return;n();a(k.p.colModel).each(function(){var G=this.formoptions;B=Math.max(B,G?G.colpos||0:0);K=Math.max(K,G?G.rowpos||0:0)});a(fa).append(xa);z=a("");z[0].rp=0;a(xa).append(z);z=a(""+b[k.p.id].topinfo+"");z[0].rp=0;a(xa).append(z);D=(z=k.p.direction=="rtl"?true:false)?"nData":"pData";var ya=z?"pData":"nData";g(e,k,xa,B);D="";ya=""; var Da=""+c.bSubmit+"",Ea=""+c.bCancel+"";D=""; D+="";D+="

"+Da+Ea+"
";if(K>0){var Ga=[];a.each(a(xa)[0].rows,function(G,H){Ga[G]=H});Ga.sort(function(G,H){if(G.rp>H.rp)return 1;if(G.rp").append(fa).append(D);a.jgrid.createModal(r,fa,c,"#gview_"+k.p.id, a("#gbox_"+k.p.id)[0]);if(z){a("#pData, #nData","#"+q+"_2").css("float","right");a(".EditButton","#"+q+"_2").css("text-align","left")}b[k.p.id].topinfo&&a(".tinfo","#"+q).show();b[k.p.id].bottominfo&&a(".binfo","#"+q+"_2").show();D=fa=null;a("#"+r.themodal).keydown(function(G){var H=G.target;if(a("#"+s).data("disabled")===true)return false;if(b[k.p.id].savekey[0]===true&&G.which==b[k.p.id].savekey[1])if(H.tagName!="TEXTAREA"){a("#sData","#"+q+"_2").trigger("click");return false}if(G.which===27){if(!l())return false; ra&&a.jgrid.hideModal(this,{gb:c.gbox,jqm:c.jqModal,onClose:b[k.p.id].onClose});return false}if(b[k.p.id].navkeys[0]===true){if(a("#id_g","#"+q).val()=="_empty")return true;if(G.which==b[k.p.id].navkeys[1]){a("#pData","#"+q+"_2").trigger("click");return false}if(G.which==b[k.p.id].navkeys[2]){a("#nData","#"+q+"_2").trigger("click");return false}}});if(c.checkOnUpdate){a("a.ui-jqdialog-titlebar-close span","#"+r.themodal).removeClass("jqmClose");a("a.ui-jqdialog-titlebar-close","#"+r.themodal).unbind("click").click(function(){if(!l())return false; a.jgrid.hideModal("#"+r.themodal,{gb:"#gbox_"+v,jqm:c.jqModal,onClose:b[k.p.id].onClose});return false})}c.saveicon=a.extend([true,"left","ui-icon-disk"],c.saveicon);c.closeicon=a.extend([true,"left","ui-icon-close"],c.closeicon);if(c.saveicon[0]===true)a("#sData","#"+q+"_2").addClass(c.saveicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");if(c.closeicon[0]===true)a("#cData","#"+q+"_2").addClass(c.closeicon[1]=="right"?"fm-button-icon-right": "fm-button-icon-left").append("");if(b[k.p.id].checkOnSubmit||b[k.p.id].checkOnUpdate){Da=""+c.bYes+"";ya=""+c.bNo+"";Ea=""+ c.bExit+"";fa=c.zIndex||999;fa++;a("
"+c.saveData+"

"+Da+ya+Ea+"
").insertAfter("#"+s);a("#sNew","#"+r.themodal).click(function(){j(); a("#"+s).data("disabled",false);a(".confirm","#"+r.themodal).hide();return false});a("#nNew","#"+r.themodal).click(function(){a(".confirm","#"+r.themodal).hide();a("#"+s).data("disabled",false);setTimeout(function(){a(":input","#"+s)[0].focus()},0);return false});a("#cNew","#"+r.themodal).click(function(){a(".confirm","#"+r.themodal).hide();a("#"+s).data("disabled",false);a.jgrid.hideModal("#"+r.themodal,{gb:"#gbox_"+v,jqm:c.jqModal,onClose:b[k.p.id].onClose});return false})}E&&E(a("#"+s));e=="_empty"|| !b[k.p.id].viewPagerButtons?a("#pData,#nData","#"+q+"_2").hide():a("#pData,#nData","#"+q+"_2").show();w&&w(a("#"+s));a("#"+r.themodal).data("onClose",b[k.p.id].onClose);a.jgrid.viewModal("#"+r.themodal,{gbox:"#gbox_"+v,jqm:c.jqModal,overlay:c.overlay,modal:c.modal});ia||a(".jqmOverlay").click(function(){if(!l())return false;a.jgrid.hideModal("#"+r.themodal,{gb:"#gbox_"+v,jqm:c.jqModal,onClose:b[k.p.id].onClose});return false});y&&y(a("#"+s));a(".fm-button","#"+r.themodal).hover(function(){a(this).addClass("ui-state-hover")}, function(){a(this).removeClass("ui-state-hover")});a("#sData","#"+q+"_2").click(function(){C={};ba={};a("#FormError","#"+q).hide();f();if(C[k.p.id+"_id"]=="_empty")j();else if(c.checkOnSubmit===true){V=a.extend({},C,ba);if(la=d(V,b[k.p.id]._savedData)){a("#"+s).data("disabled",true);a(".confirm","#"+r.themodal).show()}else j()}else j();return false});a("#cData","#"+q+"_2").click(function(){if(!l())return false;a.jgrid.hideModal("#"+r.themodal,{gb:"#gbox_"+v,jqm:c.jqModal,onClose:b[k.p.id].onClose}); return false});a("#nData","#"+q+"_2").click(function(){if(!l())return false;a("#FormError","#"+q).hide();var G=p();G[0]=parseInt(G[0],10);if(G[0]!=-1&&G[1][G[0]+1]){if(a.isFunction(c.onclickPgButtons))c.onclickPgButtons("next",a("#"+s),G[1][G[0]]);h(G[1][G[0]+1],k,s);a(k).jqGrid("setSelection",G[1][G[0]+1]);a.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons("next",a("#"+s),G[1][G[0]+1]);m(G[0]+1,G[1].length-1)}return false});a("#pData","#"+q+"_2").click(function(){if(!l())return false;a("#FormError", "#"+q).hide();var G=p();if(G[0]!=-1&&G[1][G[0]-1]){if(a.isFunction(c.onclickPgButtons))c.onclickPgButtons("prev",a("#"+s),G[1][G[0]]);h(G[1][G[0]-1],k,s);a(k).jqGrid("setSelection",G[1][G[0]-1]);a.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons("prev",a("#"+s),G[1][G[0]-1]);m(G[0]-1,G[1].length-1)}return false})}w=p();m(w[0],w[1].length-1)}})},viewGridRow:function(e,c){c=a.extend({top:0,left:0,width:0,height:"auto",dataheight:"auto",modal:false,overlay:30,drag:true,resize:true,jqModal:true, closeOnEscape:false,labelswidth:"30%",closeicon:[],navkeys:[false,38,40],onClose:null,beforeShowForm:null,beforeInitData:null,viewPagerButtons:true},a.jgrid.view,c||{});return this.each(function(){function f(){if(c.closeOnEscape===true||c.navkeys[0]===true)setTimeout(function(){a(".ui-jqdialog-titlebar-close","#"+p.modalhead).focus()},0)}function g(B,K,C,ba){for(var V,la,ia,fa=0,xa,ya,Da=[],Ea=false,Ga="  ", ra="",G=["integer","number","currency"],H=0,W=0,Q,$,S,O=1;O<=ba;O++)ra+=O==1?Ga:"  ";a(K.p.colModel).each(function(){la=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false;if(!la&&this.align==="right")if(this.formatter&&a.inArray(this.formatter,G)!==-1)H=Math.max(H,parseInt(this.width,10));else W=Math.max(W,parseInt(this.width,10))});Q=H!== 0?H:W!==0?W:0;Ea=a(K).jqGrid("getInd",B);a(K.p.colModel).each(function(da){V=this.name;$=false;ya=(la=this.editrules&&this.editrules.edithidden===true?false:this.hidden===true?true:false)?"style='display:none'":"";S=typeof this.viewable!="boolean"?true:this.viewable;if(V!=="cb"&&V!=="subgrid"&&V!=="rn"&&S){xa=Ea===false?"":V==K.p.ExpandColumn&&K.p.treeGrid===true?a("td:eq("+da+")",K.rows[Ea]).text():a("td:eq("+da+")",K.rows[Ea]).html();$=this.align==="right"&&Q!==0?true:false;a.extend({},this.editoptions|| {},{id:V,name:V});var X=a.extend({},{rowabove:false,rowcontent:""},this.formoptions||{}),oa=parseInt(X.rowpos,10)||fa+1,aa=parseInt((parseInt(X.colpos,10)||1)*2,10);if(X.rowabove){var ua=a(""+X.rowcontent+"");a(C).append(ua);ua[0].rp=oa}ia=a(C).find("tr[rowpos="+oa+"]");if(ia.length===0){ia=a("").addClass("FormData").attr("id","trv_"+V);a(ia).append(ra);a(C).append(ia);ia[0].rp=oa}a("td:eq("+(aa-2)+")",ia[0]).html(""+ (typeof X.label==="undefined"?K.p.colNames[da]:X.label)+"");a("td:eq("+(aa-1)+")",ia[0]).append(""+xa+"").attr("id","v_"+V);$&&a("td:eq("+(aa-1)+") span",ia[0]).css({"text-align":"right",width:Q+"px"});Da[fa]=da;fa++}});if(fa>0){B=a("");B[0].rp=fa+99;a(C).append(B)}return Da}function h(B, K){var C,ba,V=0,la,ia;if(ia=a(K).jqGrid("getInd",B,true)){a("td",ia).each(function(fa){C=K.p.colModel[fa].name;ba=K.p.colModel[fa].editrules&&K.p.colModel[fa].editrules.edithidden===true?false:K.p.colModel[fa].hidden===true?true:false;if(C!=="cb"&&C!=="subgrid"&&C!=="rn"){la=C==K.p.ExpandColumn&&K.p.treeGrid===true?a(this).text():a(this).html();a.extend({},K.p.colModel[fa].editoptions||{});C=a.jgrid.jqID("v_"+C);a("#"+C+" span","#"+m).html(la);ba&&a("#"+C,"#"+m).parents("tr:first").hide();V++}}); V>0&&a("#id_g","#"+m).val(B)}}function j(B,K){B===0?a("#pData","#"+m+"_2").addClass("ui-state-disabled"):a("#pData","#"+m+"_2").removeClass("ui-state-disabled");B==K?a("#nData","#"+m+"_2").addClass("ui-state-disabled"):a("#nData","#"+m+"_2").removeClass("ui-state-disabled")}function d(){var B=a(o).jqGrid("getDataIDs"),K=a("#id_g","#"+m).val();return[a.inArray(K,B),B]}var o=this;if(o.grid&&e){var l=o.p.id,n="ViewGrid_"+l,m="ViewTbl_"+l,p={themodal:"viewmod"+l,modalhead:"viewhd"+l,modalcontent:"viewcnt"+ l,scrollelm:n},k=a.isFunction(c.beforeInitData)?c.beforeInitData:false,v=true,s=1,q=0;if(a("#"+p.themodal).html()!==null){if(k){v=k(a("#"+n));if(typeof v=="undefined")v=true}if(v===false)return;a(".ui-jqdialog-title","#"+p.modalhead).html(c.caption);a("#FormError","#"+m).hide();h(e,o);a.isFunction(c.beforeShowForm)&&c.beforeShowForm(a("#"+n));a.jgrid.viewModal("#"+p.themodal,{gbox:"#gbox_"+l,jqm:c.jqModal,jqM:false,overlay:c.overlay,modal:c.modal});f()}else{var r=isNaN(c.dataheight)?c.dataheight: c.dataheight+"px";r=a("
");var w=a("
");if(k){v=k(a("#"+n));if(typeof v=="undefined")v=true}if(v===false)return;a(o.p.colModel).each(function(){var B=this.formoptions;s=Math.max(s,B?B.colpos||0:0);q=Math.max(q,B?B.rowpos||0:0)});a(r).append(w);g(e,o,w, s);k=o.p.direction=="rtl"?true:false;v="";var y="",z=""+c.bClose+"";if(q>0){var E=[]; a.each(a(w)[0].rows,function(B,K){E[B]=K});E.sort(function(B,K){if(B.rp>K.rp)return 1;if(B.rp").append(r).append("
"+z+"
");a.jgrid.createModal(p, r,c,"#gview_"+o.p.id,a("#gview_"+o.p.id)[0]);if(k){a("#pData, #nData","#"+m+"_2").css("float","right");a(".EditButton","#"+m+"_2").css("text-align","left")}c.viewPagerButtons||a("#pData, #nData","#"+m+"_2").hide();r=null;a("#"+p.themodal).keydown(function(B){if(B.which===27){D&&a.jgrid.hideModal(this,{gb:c.gbox,jqm:c.jqModal,onClose:c.onClose});return false}if(c.navkeys[0]===true){if(B.which===c.navkeys[1]){a("#pData","#"+m+"_2").trigger("click");return false}if(B.which===c.navkeys[2]){a("#nData", "#"+m+"_2").trigger("click");return false}}});c.closeicon=a.extend([true,"left","ui-icon-close"],c.closeicon);if(c.closeicon[0]===true)a("#cData","#"+m+"_2").addClass(c.closeicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");a.isFunction(c.beforeShowForm)&&c.beforeShowForm(a("#"+n));a.jgrid.viewModal("#"+p.themodal,{gbox:"#gbox_"+l,jqm:c.jqModal,modal:c.modal});a(".fm-button:not(.ui-state-disabled)","#"+m+"_2").hover(function(){a(this).addClass("ui-state-hover")}, function(){a(this).removeClass("ui-state-hover")});f();a("#cData","#"+m+"_2").click(function(){a.jgrid.hideModal("#"+p.themodal,{gb:"#gbox_"+l,jqm:c.jqModal,onClose:c.onClose});return false});a("#nData","#"+m+"_2").click(function(){a("#FormError","#"+m).hide();var B=d();B[0]=parseInt(B[0],10);if(B[0]!=-1&&B[1][B[0]+1]){if(a.isFunction(c.onclickPgButtons))c.onclickPgButtons("next",a("#"+n),B[1][B[0]]);h(B[1][B[0]+1],o);a(o).jqGrid("setSelection",B[1][B[0]+1]);a.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons("next", a("#"+n),B[1][B[0]+1]);j(B[0]+1,B[1].length-1)}f();return false});a("#pData","#"+m+"_2").click(function(){a("#FormError","#"+m).hide();var B=d();if(B[0]!=-1&&B[1][B[0]-1]){if(a.isFunction(c.onclickPgButtons))c.onclickPgButtons("prev",a("#"+n),B[1][B[0]]);h(B[1][B[0]-1],o);a(o).jqGrid("setSelection",B[1][B[0]-1]);a.isFunction(c.afterclickPgButtons)&&c.afterclickPgButtons("prev",a("#"+n),B[1][B[0]-1]);j(B[0]-1,B[1].length-1)}f();return false})}r=d();j(r[0],r[1].length-1)}})},delGridRow:function(e,c){c= a.extend({top:0,left:0,width:240,height:"auto",dataheight:"auto",modal:false,overlay:30,drag:true,resize:true,url:"",mtype:"POST",reloadAfterSubmit:true,beforeShowForm:null,beforeInitData:null,afterShowForm:null,beforeSubmit:null,onclickSubmit:null,afterSubmit:null,jqModal:true,closeOnEscape:false,delData:{},delicon:[],cancelicon:[],onClose:null,ajaxDelOptions:{},processing:false,serializeDelData:null,useDataProxy:false},a.jgrid.del,c||{});b[a(this)[0].p.id]=c;return this.each(function(){var f=this; if(f.grid)if(e){var g=a.isFunction(b[f.p.id].beforeShowForm),h=a.isFunction(b[f.p.id].afterShowForm),j=a.isFunction(b[f.p.id].beforeInitData)?b[f.p.id].beforeInitData:false,d=f.p.id,o={},l=true,n="DelTbl_"+d,m,p,k,v,s={themodal:"delmod"+d,modalhead:"delhd"+d,modalcontent:"delcnt"+d,scrollelm:n};if(jQuery.isArray(e))e=e.join();if(a("#"+s.themodal).html()!==null){if(j){l=j(a("#"+n));if(typeof l=="undefined")l=true}if(l===false)return;a("#DelData>td","#"+n).text(e);a("#DelError","#"+n).hide();if(b[f.p.id].processing=== true){b[f.p.id].processing=false;a("#dData","#"+n).removeClass("ui-state-active")}g&&b[f.p.id].beforeShowForm(a("#"+n));a.jgrid.viewModal("#"+s.themodal,{gbox:"#gbox_"+d,jqm:b[f.p.id].jqModal,jqM:false,overlay:b[f.p.id].overlay,modal:b[f.p.id].modal})}else{var q=isNaN(b[f.p.id].dataheight)?b[f.p.id].dataheight:b[f.p.id].dataheight+"px";q="
";q+="";q+=""; q+="";q+='";q+="
'+b[f.p.id].msg+"
 
";q+="

"+(""+c.bSubmit+"")+ " "+(""+c.bCancel+"")+"
";c.gbox="#gbox_"+d;a.jgrid.createModal(s,q,c,"#gview_"+f.p.id,a("#gview_"+f.p.id)[0]);if(j){l=j(a("#"+n));if(typeof l=="undefined")l=true}if(l===false)return;a(".fm-button","#"+n+"_2").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});c.delicon=a.extend([true,"left","ui-icon-scissors"],b[f.p.id].delicon); c.cancelicon=a.extend([true,"left","ui-icon-cancel"],b[f.p.id].cancelicon);if(c.delicon[0]===true)a("#dData","#"+n+"_2").addClass(c.delicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");if(c.cancelicon[0]===true)a("#eData","#"+n+"_2").addClass(c.cancelicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("");a("#dData","#"+n+"_2").click(function(){var r=[true,""];o= {};var w=a("#DelData>td","#"+n).text();if(a.isFunction(b[f.p.id].onclickSubmit))o=b[f.p.id].onclickSubmit(b[f.p.id],w)||{};if(a.isFunction(b[f.p.id].beforeSubmit))r=b[f.p.id].beforeSubmit(w);if(r[0]&&!b[f.p.id].processing){b[f.p.id].processing=true;a(this).addClass("ui-state-active");k=f.p.prmNames;m=a.extend({},b[f.p.id].delData,o);v=k.oper;m[v]=k.deloper;p=k.id;w=w.split(",");for(var y in w)if(w.hasOwnProperty(y))w[y]=a.jgrid.stripPref(f.p.idPrefix,w[y]);m[p]=w.join();y=a.extend({url:b[f.p.id].url? b[f.p.id].url:a(f).jqGrid("getGridParam","editurl"),type:b[f.p.id].mtype,data:a.isFunction(b[f.p.id].serializeDelData)?b[f.p.id].serializeDelData(m):m,complete:function(z,E){if(E!="success"){r[0]=false;r[1]=a.isFunction(b[f.p.id].errorTextFormat)?b[f.p.id].errorTextFormat(z):E+" Status: '"+z.statusText+"'. Error code: "+z.status}else if(a.isFunction(b[f.p.id].afterSubmit))r=b[f.p.id].afterSubmit(z,m);if(r[0]===false){a("#DelError>td","#"+n).html(r[1]);a("#DelError","#"+n).show()}else{if(b[f.p.id].reloadAfterSubmit&& f.p.datatype!="local")a(f).trigger("reloadGrid");else{var D=[];D=w.split(",");if(f.p.treeGrid===true)try{a(f).jqGrid("delTreeNode",f.p.idPrefix+D[0])}catch(B){}else for(var K=0;Ktd","#"+n).html(r[1]);a("#DelError","#"+n).show()}return false});a("#eData","#"+n+"_2").click(function(){a.jgrid.hideModal("#"+s.themodal,{gb:"#gbox_"+d,jqm:b[f.p.id].jqModal,onClose:b[f.p.id].onClose});return false});g&&b[f.p.id].beforeShowForm(a("#"+n));a.jgrid.viewModal("#"+s.themodal,{gbox:"#gbox_"+d,jqm:b[f.p.id].jqModal,overlay:b[f.p.id].overlay,modal:b[f.p.id].modal})}h&&b[f.p.id].afterShowForm(a("#"+n));b[f.p.id].closeOnEscape===true&&setTimeout(function(){a(".ui-jqdialog-titlebar-close", "#"+s.modalhead).focus()},0)}})},navGrid:function(e,c,f,g,h,j,d){c=a.extend({edit:true,editicon:"ui-icon-pencil",add:true,addicon:"ui-icon-plus",del:true,delicon:"ui-icon-trash",search:true,searchicon:"ui-icon-search",refresh:true,refreshicon:"ui-icon-refresh",refreshstate:"firstpage",view:false,viewicon:"ui-icon-document",position:"left",closeOnEscape:true,beforeRefresh:null,afterRefresh:null,cloneToTop:false,alertwidth:200,alertheight:"auto",alerttop:null,alertleft:null,alertzIndex:null},a.jgrid.nav, c||{});return this.each(function(){if(!this.nav){var o={themodal:"alertmod",modalhead:"alerthd",modalcontent:"alertcnt"},l=this,n;if(!(!l.grid||typeof e!="string")){if(a("#"+o.themodal).html()===null){if(!c.alerttop&&!c.alertleft){if(typeof window.innerWidth!="undefined"){c.alertleft=window.innerWidth;c.alerttop=window.innerHeight}else if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!==0){c.alertleft=document.documentElement.clientWidth; c.alerttop=document.documentElement.clientHeight}else{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(o,"
"+c.alerttext+"
",{gbox:"#gbox_"+l.p.id,jqModal:true,drag:true,resize:true,caption:c.alertcap,top:c.alerttop,left:c.alertleft,width:c.alertwidth,height:c.alertheight,closeOnEscape:c.closeOnEscape,zIndex:c.alertzIndex},"","",true)}var m= 1;if(c.cloneToTop&&l.p.toppager)m=2;for(var p=0;p"),v,s;if(p===0){v=e;s=l.p.id;if(v==l.p.toppager){s+="_top";m=1}}else{v=l.p.toppager;s=l.p.id+"_top"}l.p.direction=="rtl"&&a(k).attr("dir","rtl").css("float","right");if(c.add){g=g||{};n=a("");a(n).append("
"+c.addtext+"
");a("tr",k).append(n);a(n,k).attr({title:c.addtitle||"",id:g.id||"add_"+s}).click(function(){a(this).hasClass("ui-state-disabled")||(a.isFunction(c.addfunc)?c.addfunc():a(l).jqGrid("editGridRow","new",g));return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});n=null}if(c.edit){n=a("");f=f||{};a(n).append("
"+c.edittext+"
");a("tr",k).append(n);a(n,k).attr({title:c.edittitle||"",id:f.id||"edit_"+s}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var q=l.p.selrow;if(q)a.isFunction(c.editfunc)?c.editfunc(q):a(l).jqGrid("editGridRow",q,f);else{a.jgrid.viewModal("#"+o.themodal,{gbox:"#gbox_"+l.p.id,jqm:true});a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}); n=null}if(c.view){n=a("");d=d||{};a(n).append("
"+c.viewtext+"
");a("tr",k).append(n);a(n,k).attr({title:c.viewtitle||"",id:d.id||"view_"+s}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var q=l.p.selrow;if(q)a.isFunction(c.viewfunc)?c.viewfunc(q):a(l).jqGrid("viewGridRow",q,d);else{a.jgrid.viewModal("#"+o.themodal,{gbox:"#gbox_"+l.p.id,jqm:true});a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled")|| a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});n=null}if(c.del){n=a("");h=h||{};a(n).append("
"+c.deltext+"
");a("tr",k).append(n);a(n,k).attr({title:c.deltitle||"",id:h.id||"del_"+s}).click(function(){if(!a(this).hasClass("ui-state-disabled")){var q;if(l.p.multiselect){q=l.p.selarrrow;if(q.length===0)q=null}else q=l.p.selrow;if(q)"function"==typeof c.delfunc? c.delfunc(q):a(l).jqGrid("delGridRow",q,h);else{a.jgrid.viewModal("#"+o.themodal,{gbox:"#gbox_"+l.p.id,jqm:true});a("#jqg_alrt").focus()}}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});n=null}if(c.add||c.edit||c.del||c.view)a("tr",k).append("");if(c.search){n=a(""); j=j||{};a(n).append("
"+c.searchtext+"
");a("tr",k).append(n);a(n,k).attr({title:c.searchtitle||"",id:j.id||"search_"+s}).click(function(){a(this).hasClass("ui-state-disabled")||a(l).jqGrid("searchGrid",j);return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});j.showOnLoad&&j.showOnLoad===true&&a(n,k).click();n=null}if(c.refresh){n= a("");a(n).append("
"+c.refreshtext+"
");a("tr",k).append(n);a(n,k).attr({title:c.refreshtitle||"",id:"refresh_"+s}).click(function(){if(!a(this).hasClass("ui-state-disabled")){a.isFunction(c.beforeRefresh)&&c.beforeRefresh();l.p.search=false;try{var q=l.p.id;l.p.postData.filters="";a("#fbox_"+q).jqFilter("resetFilter");a.isFunction(l.clearToolbar)&&l.clearToolbar(false)}catch(r){}switch(c.refreshstate){case "firstpage":a(l).trigger("reloadGrid", [{page:1}]);break;case "current":a(l).trigger("reloadGrid",[{current:true}])}a.isFunction(c.afterRefresh)&&c.afterRefresh()}return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});n=null}n=a(".ui-jqgrid").css("font-size")||"11px";a("body").append("");n=a(k).clone().appendTo("#testpg2").width(); a("#testpg2").remove();a(v+"_"+c.position,v).append(k);if(l.p._nvtd){if(n>l.p._nvtd[0]){a(v+"_"+c.position,v).width(n);l.p._nvtd[0]=n}l.p._nvtd[1]=n}k=n=n=null;this.nav=true}}}})},navButtonAdd:function(e,c){c=a.extend({caption:"newButton",title:"",buttonicon:"ui-icon-newwin",onClickButton:null,position:"last",cursor:"pointer"},c||{});return this.each(function(){if(this.grid){if(e.indexOf("#")!==0)e="#"+e;var f=a(".navtable",e)[0],g=this;if(f)if(!(c.id&&a("#"+c.id,f).html()!==null)){var h=a(""); c.buttonicon.toString().toUpperCase()=="NONE"?a(h).addClass("ui-pg-button ui-corner-all").append("
"+c.caption+"
"):a(h).addClass("ui-pg-button ui-corner-all").append("
"+c.caption+"
");c.id&&a(h).attr("id",c.id);if(c.position=="first")f.rows[0].cells.length===0?a("tr",f).append(h):a("tr td:eq(0)",f).before(h);else a("tr",f).append(h);a(h,f).attr("title",c.title||"").click(function(j){a(this).hasClass("ui-state-disabled")|| a.isFunction(c.onClickButton)&&c.onClickButton.call(g,j);return false}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},navSeparatorAdd:function(e,c){c=a.extend({sepclass:"ui-separator",sepcontent:""},c||{});return this.each(function(){if(this.grid){if(e.indexOf("#")!==0)e="#"+e;var f=a(".navtable",e)[0];if(f){var g=""+c.sepcontent+"";a("tr",f).append(g)}}})},GridToForm:function(e,c){return this.each(function(){var f=this;if(f.grid){var g=a(f).jqGrid("getRowData",e);if(g)for(var h in g)a("[name="+a.jgrid.jqID(h)+"]",c).is("input:radio")||a("[name="+a.jgrid.jqID(h)+"]",c).is("input:checkbox")?a("[name="+a.jgrid.jqID(h)+"]",c).each(function(){if(a(this).val()==g[h])a(this)[f.p.useProp?"prop":"attr"]("checked",true);else a(this)[f.p.useProp?"prop":"attr"]("checked",false)}):a("[name="+a.jgrid.jqID(h)+ "]",c).val(g[h])}})},FormToGrid:function(e,c,f,g){return this.each(function(){if(this.grid){f||(f="set");g||(g="first");var h=a(c).serializeArray(),j={};a.each(h,function(d,o){j[o.name]=o.value});if(f=="add")a(this).jqGrid("addRowData",e,j,g);else f=="set"&&a(this).jqGrid("setRowData",e,j)}})}})})(jQuery); (function(a){a.jgrid.extend({editRow:function(b,e,c,f,g,h,j,d,o){var l={keys:e||false,oneditfunc:c||null,successfunc:f||null,url:g||null,extraparam:h||{},aftersavefunc:j||null,errorfunc:d||null,afterrestorefunc:o||null,restoreAfterError:true,mtype:"POST"},n=a.makeArray(arguments).slice(1),m;m=n[0]&&typeof n[0]=="object"&&!a.isFunction(n[0])?a.extend(l,n[0]):l;return this.each(function(){var p=this,k,v,s=0,q=null,r={},w,y;if(p.grid){w=a(p).jqGrid("getInd",b,true);if(w!==false)if((a(w).attr("editable")|| "0")=="0"&&!a(w).hasClass("not-editable-row")){y=p.p.colModel;a("td",w).each(function(z){k=y[z].name;var E=p.p.treeGrid===true&&k==p.p.ExpandColumn;if(E)v=a("span:first",this).html();else try{v=a.unformat(this,{rowId:b,colModel:y[z]},z)}catch(D){v=y[z].edittype&&y[z].edittype=="textarea"?a(this).text():a(this).html()}if(k!="cb"&&k!="subgrid"&&k!="rn"){if(p.p.autoencode)v=a.jgrid.htmlDecode(v);r[k]=v;if(y[z].editable===true){if(q===null)q=z;E?a("span:first",this).html(""):a(this).html("");var B=a.extend({}, y[z].editoptions||{},{id:b+"_"+k,name:k});if(!y[z].edittype)y[z].edittype="text";if(v==" "||v==" "||v.length==1&&v.charCodeAt(0)==160)v="";B=a.jgrid.createEl(y[z].edittype,B,v,true,a.extend({},a.jgrid.ajaxOptions,p.p.ajaxSelectOptions||{}));a(B).addClass("editable");E?a("span:first",this).append(B):a(this).append(B);y[z].edittype=="select"&&typeof y[z].editoptions!=="undefined"&&y[z].editoptions.multiple===true&&typeof y[z].editoptions.dataUrl==="undefined"&&a.browser.msie&&a(B).width(a(B).width()); s++}}});if(s>0){r.id=b;p.p.savedRow.push(r);a(w).attr("editable","1");a("td:eq("+q+") input",w).focus();m.keys===true&&a(w).bind("keydown",function(z){z.keyCode===27&&a(p).jqGrid("restoreRow",b,o);if(z.keyCode===13){if(z.target.tagName=="TEXTAREA")return true;a(p).jqGrid("saveRow",b,m);return false}z.stopPropagation()});a.isFunction(m.oneditfunc)&&m.oneditfunc.call(p,b)}}}})},saveRow:function(b,e,c,f,g,h,j){var d={successfunc:e||null,url:c||null,extraparam:f||{},aftersavefunc:g||null,errorfunc:h|| null,afterrestorefunc:j||null,restoreAfterError:true,mtype:"POST"},o=a.makeArray(arguments).slice(1),l;l=o[0]&&typeof o[0]=="object"&&!a.isFunction(o[0])?a.extend(d,o[0]):d;var n=false,m=this[0],p,k={},v={},s={},q,r,w;if(!m.grid)return n;w=a(m).jqGrid("getInd",b,true);if(w===false)return n;d=a(w).attr("editable");l.url=l.url?l.url:m.p.editurl;if(d==="1"){var y;a("td",w).each(function(D){y=m.p.colModel[D];p=y.name;if(p!="cb"&&p!="subgrid"&&y.editable===true&&p!="rn"&&!a(this).hasClass("not-editable-cell")){switch(y.edittype){case "checkbox":var B= ["Yes","No"];if(y.editoptions)B=y.editoptions.value.split(":");k[p]=a("input",this).is(":checked")?B[0]:B[1];break;case "text":case "password":case "textarea":case "button":k[p]=a("input, textarea",this).val();break;case "select":if(y.editoptions.multiple){B=a("select",this);var K=[];k[p]=a(B).val();k[p]=k[p]?k[p].join(","):"";a("select option:selected",this).each(function(ba,V){K[ba]=a(V).text()});v[p]=K.join(",")}else{k[p]=a("select option:selected",this).val();v[p]=a("select option:selected",this).text()}if(y.formatter&& y.formatter=="select")v={};break;case "custom":try{if(y.editoptions&&a.isFunction(y.editoptions.custom_value)){k[p]=y.editoptions.custom_value.call(m,a(".customelement",this),"get");if(k[p]===undefined)throw"e2";}else throw"e1";}catch(C){C=="e1"&&a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);C=="e2"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose): a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,C.message,jQuery.jgrid.edit.bClose)}}r=a.jgrid.checkValues(k[p],D,m);if(r[0]===false){r[1]=k[p]+" "+r[1];return false}if(m.p.autoencode)k[p]=a.jgrid.htmlEncode(k[p]);if(l.url!=="clientArray"&&y.editoptions&&y.editoptions.NullIfEmpty===true)if(k[p]=="")s[p]="null"}});if(r[0]===false){try{var z=a.jgrid.findPos(a("#"+a.jgrid.jqID(b),m.grid.bDiv)[0]);a.jgrid.info_dialog(a.jgrid.errors.errcap,r[1],a.jgrid.edit.bClose,{left:z[0],top:z[1]})}catch(E){alert(r[1])}return n}d= m.p.prmNames;o=d.oper;z=d.id;if(k){k[o]=d.editoper;k[z]=b;if(typeof m.p.inlineData=="undefined")m.p.inlineData={};k=a.extend({},k,m.p.inlineData,l.extraparam)}if(l.url=="clientArray"){k=a.extend({},k,v);m.p.autoencode&&a.each(k,function(D,B){k[D]=a.jgrid.htmlDecode(B)});z=a(m).jqGrid("setRowData",b,k);a(w).attr("editable","0");for(d=0;d=0&&m.p.savedRow.splice(q,1);a.isFunction(l.aftersavefunc)&&l.aftersavefunc.call(m,b,z);n=true;a(w).unbind("keydown")}else{a("#lui_"+ m.p.id).show();s=a.extend({},k,s);s[z]=a.jgrid.stripPref(m.p.idPrefix,s[z]);a.ajax(a.extend({url:l.url,data:a.isFunction(m.p.serializeRowData)?m.p.serializeRowData.call(m,s):s,type:l.mtype,async:false,complete:function(D,B){a("#lui_"+m.p.id).hide();if(B==="success")if((a.isFunction(l.successfunc)?l.successfunc.call(m,D):true)===true){m.p.autoencode&&a.each(k,function(C,ba){k[C]=a.jgrid.htmlDecode(ba)});k=a.extend({},k,v);a(m).jqGrid("setRowData",b,k);a(w).attr("editable","0");for(var K=0;K=0&&m.p.savedRow.splice(q,1);a.isFunction(l.aftersavefunc)&&l.aftersavefunc.call(m,b,D);n=true;a(w).unbind("keydown")}else{a.isFunction(l.errorfunc)&&l.errorfunc.call(m,b,D,B);l.restoreAfterError===true&&a(m).jqGrid("restoreRow",b,l.afterrestorefunc)}},error:function(D,B){a("#lui_"+m.p.id).hide();if(a.isFunction(l.errorfunc))l.errorfunc.call(m,b,D,B);else try{jQuery.jgrid.info_dialog(jQuery.jgrid.errors.errcap,'
'+D.responseText+"
",jQuery.jgrid.edit.bClose, {buttonalign:"right"})}catch(K){alert(D.responseText)}l.restoreAfterError===true&&a(m).jqGrid("restoreRow",b,l.afterrestorefunc)}},a.jgrid.ajaxOptions,m.p.ajaxRowOptions||{}))}}return n},restoreRow:function(b,e){return this.each(function(){var c=this,f,g,h={};if(c.grid){g=a(c).jqGrid("getInd",b,true);if(g!==false){for(var j=0;j=0){if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker","#"+a.jgrid.jqID(g.id)).datepicker("hide")}catch(d){}a.each(c.p.colModel, function(){if(this.editable===true&&this.name in c.p.savedRow[f]&&!a(this).hasClass("not-editable-cell"))h[this.name]=c.p.savedRow[f][this.name]});a(c).jqGrid("setRowData",b,h);a(g).attr("editable","0").unbind("keydown");c.p.savedRow.splice(f,1)}a.isFunction(e)&&e.call(c,b)}}})}})})(jQuery); (function(a){a.jgrid.extend({editCell:function(b,e,c){return this.each(function(){var f=this,g,h,j,d;if(!(!f.grid||f.p.cellEdit!==true)){e=parseInt(e,10);f.p.selrow=f.rows[b].id;f.p.knv||a(f).jqGrid("GridNav");if(f.p.savedRow.length>0){if(c===true)if(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("#"+f.p.knv).attr("tabindex","-1").focus()},0);d=f.p.colModel[e];g=d.name;if(!(g=="subgrid"||g=="cb"||g=="rn")){j=a("td:eq("+ e+")",f.rows[b]);if(d.editable===true&&c===true&&!j.hasClass("not-editable-cell")){if(parseInt(f.p.iCol,10)>=0&&parseInt(f.p.iRow,10)>=0){a("td:eq("+f.p.iCol+")",f.rows[f.p.iRow]).removeClass("edit-cell ui-state-highlight");a(f.rows[f.p.iRow]).removeClass("selected-row ui-state-hover")}a(j).addClass("edit-cell ui-state-highlight");a(f.rows[b]).addClass("selected-row ui-state-hover");try{h=a.unformat(j,{rowId:f.rows[b].id,colModel:d},e)}catch(o){h=d.edittype&&d.edittype=="textarea"?a(j).text():a(j).html()}if(f.p.autoencode)h= a.jgrid.htmlDecode(h);if(!d.edittype)d.edittype="text";f.p.savedRow.push({id:b,ic:e,name:g,v:h});if(h==" "||h==" "||h.length==1&&h.charCodeAt(0)==160)h="";if(a.isFunction(f.p.formatCell)){var l=f.p.formatCell.call(f,f.rows[b].id,g,h,b,e);if(l!==undefined)h=l}l=a.extend({},d.editoptions||{},{id:b+"_"+g,name:g});var n=a.jgrid.createEl(d.edittype,l,h,true,a.extend({},a.jgrid.ajaxOptions,f.p.ajaxSelectOptions||{}));a.isFunction(f.p.beforeEditCell)&&f.p.beforeEditCell.call(f,f.rows[b].id,g,h, b,e);a(j).html("").append(n).attr("tabindex","0");window.setTimeout(function(){a(n).focus()},0);a("input, select, textarea",j).bind("keydown",function(m){if(m.keyCode===27)if(a("input.hasDatepicker",j).length>0)a(".ui-datepicker").is(":hidden")?a(f).jqGrid("restoreCell",b,e):a("input.hasDatepicker",j).datepicker("hide");else a(f).jqGrid("restoreCell",b,e);m.keyCode===13&&a(f).jqGrid("saveCell",b,e);if(m.keyCode==9)if(f.grid.hDiv.loading)return false;else m.shiftKey?a(f).jqGrid("prevCell",b,e):a(f).jqGrid("nextCell", b,e);m.stopPropagation()});a.isFunction(f.p.afterEditCell)&&f.p.afterEditCell.call(f,f.rows[b].id,g,h,b,e)}else{if(parseInt(f.p.iCol,10)>=0&&parseInt(f.p.iRow,10)>=0){a("td:eq("+f.p.iCol+")",f.rows[f.p.iRow]).removeClass("edit-cell ui-state-highlight");a(f.rows[f.p.iRow]).removeClass("selected-row ui-state-hover")}j.addClass("edit-cell ui-state-highlight");a(f.rows[b]).addClass("selected-row ui-state-hover");if(a.isFunction(f.p.onSelectCell)){h=j.html().replace(/\ \;/ig,"");f.p.onSelectCell.call(f, f.rows[b].id,g,h,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||c.p.cellEdit!==true)){f=c.p.savedRow.length>=1?0:null;if(f!==null){var g=a("td:eq("+e+")",c.rows[b]),h,j,d=c.p.colModel[e],o=d.name,l=a.jgrid.jqID(o);switch(d.edittype){case "select":if(d.editoptions.multiple){l=a("#"+b+"_"+l,c.rows[b]);var n=[];if(h=a(l).val())h.join(",");else h="";a("option:selected",l).each(function(r,w){n[r]=a(w).text()});j=n.join(",")}else{h=a("#"+b+ "_"+l+">option:selected",c.rows[b]).val();j=a("#"+b+"_"+l+">option:selected",c.rows[b]).text()}if(d.formatter)j=h;break;case "checkbox":var m=["Yes","No"];if(d.editoptions)m=d.editoptions.value.split(":");j=h=a("#"+b+"_"+l,c.rows[b]).is(":checked")?m[0]:m[1];break;case "password":case "text":case "textarea":case "button":j=h=a("#"+b+"_"+l,c.rows[b]).val();break;case "custom":try{if(d.editoptions&&a.isFunction(d.editoptions.custom_value)){h=d.editoptions.custom_value.call(c,a(".customelement",g),"get"); if(h===undefined)throw"e2";else j=h}else throw"e1";}catch(p){p=="e1"&&a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.nodefined,jQuery.jgrid.edit.bClose);p=="e2"?a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,jQuery.jgrid.edit.bClose):a.jgrid.info_dialog(jQuery.jgrid.errors.errcap,p.message,jQuery.jgrid.edit.bClose)}}if(j!==c.p.savedRow[f].v){if(a.isFunction(c.p.beforeSaveCell))if(f=c.p.beforeSaveCell.call(c, c.rows[b].id,o,h,b,e))j=h=f;var k=a.jgrid.checkValues(h,e,c);if(k[0]===true){f={};if(a.isFunction(c.p.beforeSubmitCell))(f=c.p.beforeSubmitCell.call(c,c.rows[b].id,o,h,b,e))||(f={});a("input.hasDatepicker",g).length>0&&a("input.hasDatepicker",g).datepicker("hide");if(c.p.cellsubmit=="remote")if(c.p.cellurl){var v={};if(c.p.autoencode)h=a.jgrid.htmlEncode(h);v[o]=h;m=c.p.prmNames;d=m.id;l=m.oper;v[d]=a.jgrid.stripPref(c.p.idPrefix,c.rows[b].id);v[l]=m.editoper;v=a.extend(f,v);a("#lui_"+c.p.id).show(); c.grid.hDiv.loading=true;a.ajax(a.extend({url:c.p.cellurl,data:a.isFunction(c.p.serializeCellData)?c.p.serializeCellData.call(c,v):v,type:"POST",complete:function(r,w){a("#lui_"+c.p.id).hide();c.grid.hDiv.loading=false;if(w=="success")if(a.isFunction(c.p.afterSubmitCell)){var y=c.p.afterSubmitCell.call(c,r,v.id,o,h,b,e);if(y[0]===true){a(g).empty();a(c).jqGrid("setCell",c.rows[b].id,e,j,false,false,true);a(g).addClass("dirty-cell");a(c.rows[b]).addClass("edited");a.isFunction(c.p.afterSaveCell)&& c.p.afterSaveCell.call(c,c.rows[b].id,o,h,b,e);c.p.savedRow.splice(0,1)}else{a.jgrid.info_dialog(a.jgrid.errors.errcap,y[1],a.jgrid.edit.bClose);a(c).jqGrid("restoreCell",b,e)}}else{a(g).empty();a(c).jqGrid("setCell",c.rows[b].id,e,j,false,false,true);a(g).addClass("dirty-cell");a(c.rows[b]).addClass("edited");a.isFunction(c.p.afterSaveCell)&&c.p.afterSaveCell.call(c,c.rows[b].id,o,h,b,e);c.p.savedRow.splice(0,1)}},error:function(r,w){a("#lui_"+c.p.id).hide();c.grid.hDiv.loading=false;a.isFunction(c.p.errorCell)? c.p.errorCell.call(c,r,w):a.jgrid.info_dialog(a.jgrid.errors.errcap,r.status+" : "+r.statusText+"
"+w,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(s){}if(c.p.cellsubmit=="clientArray"){a(g).empty();a(c).jqGrid("setCell",c.rows[b].id,e,j,false,false,true);a(g).addClass("dirty-cell");a(c.rows[b]).addClass("edited"); a.isFunction(c.p.afterSaveCell)&&c.p.afterSaveCell.call(c,c.rows[b].id,o,h,b,e);c.p.savedRow.splice(0,1)}}else try{window.setTimeout(function(){a.jgrid.info_dialog(a.jgrid.errors.errcap,h+" "+k[1],a.jgrid.edit.bClose)},100);a(c).jqGrid("restoreCell",b,e)}catch(q){}}else a(c).jqGrid("restoreCell",b,e)}a.browser.opera?a("#"+c.p.knv).attr("tabindex","-1").focus():window.setTimeout(function(){a("#"+c.p.knv).attr("tabindex","-1").focus()},0)}})},restoreCell:function(b,e){return this.each(function(){var c= this,f;if(!(!c.grid||c.p.cellEdit!==true)){f=c.p.savedRow.length>=1?0:null;if(f!==null){var g=a("td:eq("+e+")",c.rows[b]);if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker",g).datepicker("hide")}catch(h){}a(g).empty().attr("tabindex","-1");a(c).jqGrid("setCell",c.rows[b].id,e,c.p.savedRow[f].v,false,false,true);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()},0)}})},nextCell:function(b,e){return this.each(function(){var c=false;if(!(!this.grid||this.p.cellEdit!==true)){for(var f=e+1;f0&&a(this).jqGrid("saveCell",b,e)}})},prevCell:function(b,e){return this.each(function(){var c=false;if(!(!this.grid||this.p.cellEdit!==true)){for(var f=e-1;f>=0;f--)if(this.p.colModel[f].editable===true){c= f;break}if(c!==false)a(this).jqGrid("editCell",b,c,true);else this.p.savedRow.length>0&&a(this).jqGrid("saveCell",b,e)}})},GridNav:function(){return this.each(function(){function b(j,d,o){if(o.substr(0,1)=="v"){var l=a(c.grid.bDiv)[0].clientHeight,n=a(c.grid.bDiv)[0].scrollTop,m=c.rows[j].offsetTop+c.rows[j].clientHeight,p=c.rows[j].offsetTop;if(o=="vd")if(m>=l)a(c.grid.bDiv)[0].scrollTop=a(c.grid.bDiv)[0].scrollTop+c.rows[j].clientHeight;if(o=="vu")if(p=o+parseInt(l,10))a(c.grid.bDiv)[0].scrollLeft=a(c.grid.bDiv)[0].scrollLeft+c.rows[j].cells[d].clientWidth;else if(n=0;l--)if(c.p.colModel[l].hidden!==true){o=l;break}}if(d== "rgt"){o=j-1;for(l=j;l"),g,h;a(f).insertBefore(c.grid.cDiv);a("#"+c.p.knv).focus().keydown(function(j){h=j.keyCode;if(c.p.direction=="rtl")if(h==37)h=39;else if(h==39)h=37; switch(h){case 38:if(c.p.iRow-1>0){b(c.p.iRow-1,c.p.iCol,"vu");a(c).jqGrid("editCell",c.p.iRow-1,c.p.iCol,false)}break;case 40:if(c.p.iRow+1<=c.rows.length-1){b(c.p.iRow+1,c.p.iCol,"vd");a(c).jqGrid("editCell",c.p.iRow+1,c.p.iCol,false)}break;case 37:if(c.p.iCol-1>=0){g=e(c.p.iCol-1,"lft");b(c.p.iRow,g,"h");a(c).jqGrid("editCell",c.p.iRow,g,false)}break;case 39:if(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,false)}break;case 13:parseInt(c.p.iCol, 10)>=0&&parseInt(c.p.iRow,10)>=0&&a(c).jqGrid("editCell",c.p.iRow,c.p.iCol,true)}return false})}})},getChangedCells:function(b){var e=[];b||(b="all");this.each(function(){var c=this,f;!c.grid||c.p.cellEdit!==true||a(c.rows).each(function(g){var h={};if(a(this).hasClass("edited")){a("td",this).each(function(j){f=c.p.colModel[j].name;if(f!=="cb"&&f!=="subgrid")if(b=="dirty"){if(a(this).hasClass("dirty-cell"))try{h[f]=a.unformat(this,{rowId:c.rows[g].id,colModel:c.p.colModel[j]},j)}catch(d){h[f]=a.jgrid.htmlDecode(a(this).html())}}else try{h[f]= a.unformat(this,{rowId:c.rows[g].id,colModel:c.p.colModel[j]},j)}catch(o){h[f]=a.jgrid.htmlDecode(a(this).html())}});h.id=this.id;e.push(h)}})});return e}})})(jQuery); (function(a){a.jgrid.extend({setSubGrid:function(){return this.each(function(){var b;this.p.subGridOptions=a.extend({plusicon:"ui-icon-plus",minusicon:"ui-icon-minus",openicon:"ui-icon-carat-1-sw",expandOnLoad:false,delayOnLoad:50,selectOnExpand:false,reloadOnExpand:true},this.p.subGridOptions||{});this.p.colNames.unshift("");this.p.colModel.unshift({name:"subgrid",width:a.browser.safari?this.p.subGridWidth+this.p.cellLayout:this.p.subGridWidth,sortable:false,resizable:false,hidedlg:true,search:false, fixed:true});b=this.p.subGridModel;if(b[0]){b[0].align=a.extend([],b[0].align||[]);for(var e=0;e"},addSubGrid:function(b,e){return this.each(function(){var c= this;if(c.grid){var f=function(s,q,r){q=a("").html(q);a(s).append(q)},g=function(s,q){var r,w,y,z=a("
"),E=a("");for(w=0;w");a(r).html(c.p.subGridModel[0].name[w]);a(r).width(c.p.subGridModel[0].width[w]);a(E).append(r)}a(z).append(E);if(s){y= c.p.xmlReader.subgrid;a(y.root+" "+y.row,s).each(function(){E=a("");if(y.repeatitems===true)a(y.cell,this).each(function(B){f(E,a(this).text()||" ",B)});else{var D=c.p.subGridModel[0].mapping||c.p.subGridModel[0].name;if(D)for(w=0;w"),B=a("");for(w=0;w");a(r).html(c.p.subGridModel[0].name[w]);a(r).width(c.p.subGridModel[0].width[w]);a(B).append(r)}a(D).append(B);if(s){z=c.p.jsonReader.subgrid;r=s[z.root];if(typeof r!=="undefined")for(w=0;w"); if(z.repeatitems===true){if(z.cell)y=y[z.cell];for(E=0;E0){v=e;k=e+1}for(;v=1?" ":"";m=true;if(a.isFunction(c.p.subGridBeforeExpand))m=c.p.subGridBeforeExpand.call(c,o+"_"+d,d);if(m===false)return false;a(s).after(""+l+"
");a.isFunction(c.p.subGridRowExpanded)?c.p.subGridRowExpanded.call(c,o+"_"+d,d):j(s)}else a(p).show();a(this).html("").removeClass("sgcollapsed").addClass("sgexpanded");c.p.subGridOptions.selectOnExpand&&a(c).jqGrid("setSelection", d)}else if(a(this).hasClass("sgexpanded")){m=true;if(a.isFunction(c.p.subGridRowColapsed)){d=s.id;m=c.p.subGridRowColapsed.call(c,o+"_"+d,d)}if(m===false)return false;if(c.p.subGridOptions.reloadOnExpand===true)a(p).remove(".ui-subgrid");else a(p).hasClass("ui-subgrid")&&a(p).hide();a(this).html("").removeClass("sgexpanded").addClass("sgcollapsed")}return false});c.p.subGridOptions.expandOnLoad===true&& a(c.rows[v].cells[b]).trigger("click");v++}c.subGridXml=function(s,q){g(s,q)};c.subGridJson=function(s,q){h(s,q)}}})},expandSubGridRow:function(b){return this.each(function(){if(this.grid||b)if(this.p.subGrid===true){var e=a(this).jqGrid("getInd",b,true);if(e)(e=a("td.sgcollapsed",e)[0])&&a(e).trigger("click")}})},collapseSubGridRow:function(b){return this.each(function(){if(this.grid||b)if(this.p.subGrid===true){var e=a(this).jqGrid("getInd",b,true);if(e)(e=a("td.sgexpanded",e)[0])&&a(e).trigger("click")}})}, toggleSubGridRow:function(b){return this.each(function(){if(this.grid||b)if(this.p.subGrid===true){var e=a(this).jqGrid("getInd",b,true);if(e){var c=a("td.sgcollapsed",e)[0];if(c)a(c).trigger("click");else(c=a("td.sgexpanded",e)[0])&&a(c).trigger("click")}}})}})})(jQuery); (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,h=c.p.treeReader.leaf_field,j=c.p.treeReader.level_field,d=c.p.treeReader.icon_field,o=c.p.treeReader.loaded,l,n,m,p;b";m+="
").prepend(m);if(l!==parseInt(c.p.tree_root_level,10))(p=(p=a(c).jqGrid("getNodeParent",p))&&p.hasOwnProperty(g)?p[g]:true)||a(c.rows[b]).css("display","none");a(c.rows[b].cells[f]).find("div.treeclick").bind("click",function(k){k=a(k.target||k.srcElement,c.rows).closest("tr.jqgrow")[0].id; k=c.p._index[k];if(!c.p.data[k][h])if(c.p.data[k][g]){a(c).jqGrid("collapseRow",c.p.data[k]);a(c).jqGrid("collapseNode",c.p.data[k])}else{a(c).jqGrid("expandRow",c.p.data[k]);a(c).jqGrid("expandNode",c.p.data[k])}return false});c.p.ExpandColClick===true&&a(c.rows[b].cells[f]).find("span.cell-wrapper").css("cursor","pointer").bind("click",function(k){k=a(k.target||k.srcElement,c.rows).closest("tr.jqgrow")[0].id;var v=c.p._index[k];if(!c.p.data[v][h])if(c.p.data[v][g]){a(c).jqGrid("collapseRow",c.p.data[v]); a(c).jqGrid("collapseNode",c.p.data[v])}else{a(c).jqGrid("expandRow",c.p.data[v]);a(c).jqGrid("expandNode",c.p.data[v])}a(c).jqGrid("setSelection",k);return false});b++}})},setTreeGrid:function(){return this.each(function(){var b=this,e=0,c=false,f,g,h=[];if(b.p.treeGrid){b.p.treedatatype||a.extend(b.p,{treedatatype:b.p.datatype});b.p.subGrid=false;b.p.altRows=false;b.p.pgbuttons=false;b.p.pginput=false;b.p.gridview=true;if(b.p.rowTotal===null)b.p.rowNum=1E4;b.p.multiselect=false;b.p.rowList=[];b.p.expColInd= 0;b.p.treeIcons=a.extend({plus:"ui-icon-triangle-1-"+(b.p.direction=="rtl"?"w":"e"),minus:"ui-icon-triangle-1-s",leaf:"ui-icon-radio-off"},b.p.treeIcons||{});if(b.p.treeGridModel=="nested")b.p.treeReader=a.extend({level_field:"level",left_field:"lft",right_field:"rgt",leaf_field:"isLeaf",expanded_field:"expanded",loaded:"loaded",icon_field:"icon"},b.p.treeReader);else if(b.p.treeGridModel=="adjacency")b.p.treeReader=a.extend({level_field:"level",parent_id_field:"parent",leaf_field:"isLeaf",expanded_field:"expanded", loaded:"loaded",icon_field:"icon"},b.p.treeReader);for(g in b.p.colModel)if(b.p.colModel.hasOwnProperty(g)){f=b.p.colModel[g].name;if(f==b.p.ExpandColumn&&!c){c=true;b.p.expColInd=e}e++;for(var j in b.p.treeReader)b.p.treeReader[j]==f&&h.push(f)}a.each(b.p.treeReader,function(d,o){if(o&&a.inArray(o,h)===-1){if(d==="leaf_field")b.p._treeleafpos=e;e++;b.p.colNames.push(o);b.p.colModel.push({name:o,width:1,hidden:true,sortable:false,resizable:false,hidedlg:true,editable:true,search:false})}})}})},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 g=a.jgrid.getAccessor(this,e.p.localReader.id);a("#"+g,e.grid.bDiv).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",b),f=e.p.treeReader.expanded_field;a(c).each(function(){var g=a.jgrid.getAccessor(this,e.p.localReader.id);a("#"+g,e.grid.bDiv).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=e.p.treeReader.parent_id_field;a(e.p.data).each(function(){if(this[f]===null||String(this[f]).toLowerCase()=="null")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&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var c=this.p.treeReader.left_field,f=this.p.treeReader.right_field,g=this.p.treeReader.level_field,h=parseInt(b[c], 10),j=parseInt(b[f],10),d=parseInt(b[g],10);a(this.p.data).each(function(){if(parseInt(this[g],10)===d-1&&parseInt(this[c],10)j){e=this;return false}});break;case "adjacency":var o=this.p.treeReader.parent_id_field,l=this.p.localReader.id;a(this.p.data).each(function(){if(this[l]==b[o]){e=this;return false}})}});return e},getNodeChildren:function(b){var e=[];this.each(function(){if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var c=this.p.treeReader.left_field, f=this.p.treeReader.right_field,g=this.p.treeReader.level_field,h=parseInt(b[c],10),j=parseInt(b[f],10),d=parseInt(b[g],10);a(this.p.data).each(function(){parseInt(this[g],10)===d+1&&parseInt(this[c],10)>h&&parseInt(this[f],10)=o&&parseInt(this[f],10)>=j&&parseInt(this[f],10)<=d&&e.push(this)});break;case "adjacency":if(b){e.push(b);var l=this.p.treeReader.parent_id_field,n=this.p.localReader.id;a(this.p.data).each(function(m){c=e.length;for(m=0;m0?true:false:false}});return e},expandNode:function(b){return this.each(function(){if(this.grid&&this.p.treeGrid){var e=this.p.treeReader.expanded_field,c=this.p.treeReader.parent_id_field,f=this.p.treeReader.loaded,g=this.p.treeReader.level_field,h=this.p.treeReader.left_field,j=this.p.treeReader.right_field;if(!b[e]){var d=a.jgrid.getAccessor(b,this.p.localReader.id),o=a("#"+d,this.grid.bDiv)[0],l=this.p._index[d]; if(a(this).jqGrid("isNodeLoaded",this.p.data[l])){b[e]=true;a("div.treeclick",o).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus")}else{b[e]=true;a("div.treeclick",o).removeClass(this.p.treeIcons.plus+" tree-plus").addClass(this.p.treeIcons.minus+" tree-minus");this.p.treeANode=o.rowIndex;this.p.datatype=this.p.treedatatype;this.p.treeGridModel=="nested"?a(this).jqGrid("setGridParam",{postData:{nodeid:d,n_left:b[h],n_right:b[j],n_level:b[g]}}):a(this).jqGrid("setGridParam", {postData:{nodeid:d,parentid:b[c],n_level:b[g]}});a(this).trigger("reloadGrid");b[f]=true;this.p.treeGridModel=="nested"?a(this).jqGrid("setGridParam",{postData:{nodeid:"",n_left:"",n_right:"",n_level:""}}):a(this).jqGrid("setGridParam",{postData:{nodeid:"",parentid:"",n_level:""}})}}}})},collapseNode:function(b){return this.each(function(){if(this.grid&&this.p.treeGrid){var e=this.p.treeReader.expanded_field;if(b[e]){b[e]=false;e=a.jgrid.getAccessor(b,this.p.localReader.id);e=a("#"+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,e,c,f){return this.each(function(){if(this.grid&&this.p.treeGrid){var g,h,j,d=[],o=this,l;g=a(this).jqGrid("getRootNodes");g=a.jgrid.from(g);g.orderBy(b,e,c,f);l=g.select();g=0;for(h=l.length;g0)for(var o=0;o=0)for(;s>=0;){m=Math.max(m,parseInt(f.p.data[s][f.p.localReader.id], 10));s--}b=m+1}var w=a(f).jqGrid("getInd",e);r=false;if(e===undefined||e===null||e===""){q=e=null;m="last";v=f.p.tree_root_level;s=f.p.data.length+1}else{m="after";p=f.p._index[e];k=f.p.data[p];e=k[f.p.localReader.id];v=parseInt(k[j],10)+1;s=a(f).jqGrid("getFullTreeNode",k);if(s.length){q=s=s[s.length-1][f.p.localReader.id];s=a(f).jqGrid("getInd",q)+1}else s=a(f).jqGrid("getInd",e)+1;if(k[h]){r=true;k[g]=true;a(f.rows[w]).find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper").end().find("div.tree-leaf").removeClass(f.p.treeIcons.leaf+ " tree-leaf").addClass(f.p.treeIcons.minus+" tree-minus");f.p.data[p][h]=false;k[n]=true}}p=s+1;c[g]=false;c[n]=true;c[j]=v;c[h]=true;if(f.p.treeGridModel==="adjacency")c[d]=e;if(f.p.treeGridModel==="nested"){var y;if(e!==null){h=parseInt(k[l],10);j=a.jgrid.from(f.p.data);j=j.greaterOrEquals(l,h,{stype:"integer"});j=j.select();if(j.length)for(y in j){j[y][o]=j[y][o]>h?parseInt(j[y][o],10)+2:j[y][o];j[y][l]=j[y][l]>=h?parseInt(j[y][l],10)+2:j[y][l]}c[o]=h;c[l]=h+1}else{h=parseInt(a(f).jqGrid("getCol", l,false,"max"),10);j=a.jgrid.from(f.p.data).greater(o,h,{stype:"integer"}).select();if(j.length)for(y in j)j[y][o]=parseInt(j[y][o],10)+2;j=a.jgrid.from(f.p.data).greater(l,h,{stype:"integer"}).select();if(j.length)for(y in j)j[y][l]=parseInt(j[y][l],10)+2;c[o]=h+1;c[l]=h+2}}if(e===null||a(f).jqGrid("isNodeLoaded",k)||r){a(f).jqGrid("addRowData",b,c,m,q);a(f).jqGrid("setTreeNode",s,p)}k&&!k[g]&&a(f.rows[w]).find("div.treeclick").click()}}})})(jQuery); (function(a){a.jgrid.extend({groupingSetup:function(){return this.each(function(){var b=this.p.groupingView;if(b!==null&&(typeof b==="object"||a.isFunction(b)))if(b.groupField.length){if(typeof b.visibiltyOnNextGrouping=="undefined")b.visibiltyOnNextGrouping=[];for(var e=0;e";try{o=c.formatter(j,f.sortnames[0][m],l,f.sortitems[0])}catch(k){o=f.sortnames[0][m]}g+= ''+h+a.jgrid.format(f.groupText[0],o,b[p].length)+"";for(var v=0;v