You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
490 lines
239 KiB
JavaScript
490 lines
239 KiB
JavaScript
2 years ago
|
/*
|
||
|
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,"<").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;f<g;f++){if(b[f]=="M"){h=a.inArray(e[f],j);if(h!==-1&&h<12)e[f]=h+1}if(b[f]=="F"){h=a.inArray(e[f],j);if(h!==-1&&h>11)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;r<m;r++)d+="(";if(p)d+="!";d+="("+q+")";p=false;k="";m=0};this._setCommand=function(q,r){l=q;n=r};this._resetNegate=
|
||
|
function(){p=false};this._repeatCommand=function(q,r){if(l===null)return f;if(q!==null&&r!==null)return l(q,r);if(n===null)return l(q);if(!s)return l(q);return l(n,q)};this._equals=function(q,r){return f._compare(q,r,1)===0};this._compare=function(q,r,w){if(w===undefined)w=1;if(q===undefined)q=null;if(r===undefined)r=null;if(q===null&&r===null)return 0;if(q===null&&r!==null)return 1;if(q!==null&&r===null)return-1;if(!h&&typeof q!=="number"&&typeof r!=="number"){q=String(q).toLowerCase();r=String(r).toLowerCase()}if(q<
|
||
|
r)return-w;if(q>r)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;z<w.length;z++){E=f._doSort(w[z].items,r);for(var D=0;D<E.length;D++)y.push(E[D])}return y};this._getOrder=function(q,r,w,y,z){var E=[],D=[],B=w=="a"?1:-1,K,C;if(y===undefined)y="text";C=y=="float"||y=="number"||y=="currency"||y=="numeric"?
|
||
|
function(V){V=parseFloat(String(V).replace(o,""));return isNaN(V)?0:V}:y=="int"||y=="integer"?function(V){return V?parseFloat(String(V).replace(o,"")):0}:y=="date"||y=="datetime"?function(V){return a.jgrid.parseDate(z,V).getTime()}:a.isFunction(y)?y:function(V){V||(V="");return a.trim(String(V).toUpperCase())};a.each(q,function(V,la){K=r!==""?a.jgrid.getAccessor(la,r):la;if(K===undefined)K="";K=C(K,la);D.push({vSort:K,index:V})});D.sort(function(V,la){V=V.vSort;la=la.vSort;return f._compare(V,la,
|
||
|
B)});y=0;for(var ba=q.length;y<ba;){w=D[y].index;E.push(q[w]);y++}return E};this._getGroup=function(q,r,w,y,z){var E=[],D=null,B=null,K;a.each(f._getOrder(q,r,w,y,z),function(C,ba){K=a.jgrid.getAccessor(ba,r);if(K===undefined)K="";if(!f._equals(B,K)){B=K;D!==null&&E.push(D);D=f._group(r,K)}D.items.push(ba)});D!==null&&E.push(D);return E};this.ignoreCase=function(){h=false;return f};this.useCase=function(){h=true;return f};this.trim=function(){j=true;return f};this.noTrim=function(){j=false;return f};
|
||
|
this.execute=function(){var q=d,r=[];if(q===null)return f;a.each(g,function(){eval(q)&&r.push(this)});g=r;return f};this.data=function(){return g};this.select=function(q){f._performSort();if(!f._hasData())return[];f.execute();if(a.isFunction(q)){var r=[];a.each(g,function(w,y){r.push(q(y))});return r}return g};this.hasMatch=function(){if(!f._hasData())return false;f.execute();return g.length>0};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<t&&J<=0&&(f.lastpage===undefined||parseInt((R+x+A-1)/A,10)<=f.lastpage)){M=parseInt((t-R+A-1)/A,10);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<A.length;J++)A[J]!=x&&a(t).jqGrid("setSelection",A[J],false);x&&a(t).jqGrid("setSelection",x,false);t.grid.bDiv.scrollLeft=F;u.gridComplete=
|
||
|
T;u.gridComplete&&T()}}};if(this.tagName.toUpperCase()!="TABLE")alert("Element is not a table");else{a(this).empty().attr("tabindex","1");this.p=f;this.p.useProp=!!a.fn.prop;var h,j,d;if(this.p.colNames.length===0)for(h=0;h<this.p.colModel.length;h++)this.p.colNames[h]=this.p.colModel[h].label||this.p.colModel[h].name;if(this.p.colNames.length!==this.p.colModel.length)alert(a.jgrid.errors.model);else{var o=a("<div class='ui-jqgrid-view'></div>"),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("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");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?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':
|
||
|
"";a("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+this.id+"'></div>").append(l).insertBefore(o);a("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").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'<td role="gridcell" '+v(x,A,u,F,t,true)+">"+u+"</td>"},w=function(t,u,x){var A='<input role="checkbox" type="checkbox" id="jqg_'+d.p.id+"_"+t+'" class="cbox" name="jqg_'+d.p.id+"_"+t+'"/>';return'<td role="gridcell" '+v(u,x,"",null,t,true)+">"+A+"</td>"},y=function(t,u,x,A){x=(parseInt(x,10)-1)*parseInt(A,10)+1+u;return'<td role="gridcell" class="ui-state-default jqgrid-rownum" '+v(t,u,x,null,
|
||
|
u,true)+">"+x+"</td>"},z=function(t){var u,x=[],A=0,F;for(F=0;F<d.p.colModel.length;F++){u=d.p.colModel[F];if(u.name!=="cb"&&u.name!=="subgrid"&&u.name!=="rn"){x[A]=t=="local"?u.name:t=="xml"||t==="xmlstring"?u.xmlmap||u.name:u.jsonmap||u.name;A++}}return x},E=function(t){var u=d.p.remapColumns;if(!u||!u.length)u=a.map(d.p.colModel,function(x,A){return A});if(t)u=a.map(u,function(x){return x<t?null:x-t});return u},D=function(t,u,x){if(d.p.deepempty)a("#"+a.jgrid.jqID(d.p.id)+" tbody:first tr:gt(0)").remove();
|
||
|
else{var A=a("#"+a.jgrid.jqID(d.p.id)+" tbody:first tr:first")[0];a("#"+a.jgrid.jqID(d.p.id)+" tbody:first").empty().append(A)}if(u&&d.p.scroll){a(">div: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;x<t;x++){A=a.jgrid.getAccessor(d.p.data[x],u);d.p._index[A]=x}},K=function(t,u,x,A,F){var T=new Date,J=d.p.datatype!="local"&&d.p.loadonce||d.p.datatype=="xmlstring",R=d.p.xmlReader,P=d.p.datatype=="local"?"local":"xml";if(J){d.p.data=[];d.p._index={};d.p.localReader.id="_id_"}d.p.reccount=0;if(a.isXMLDoc(t)){if(d.p.treeANode===-1&&!d.p.scroll){D(u,false,true);x=1}else x=x>1?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<va;){U=t[pa];Z=P(U,Ia+pa);Z=d.p.idPrefix+Z;M=x===0?0:x+1;M=(M+pa)%2==1?Fa:"";na.push("<tr"+Ja+' id="'+Z+'" tabindex="-1" role="row" class ="ui-widget-content jqgrow ui-row-'+d.p.direction+""+M+'">');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<ta.length;M++){Y=a.jgrid.getXmlData(U,ta[M]);L[d.p.colModel[M+ga+ja+ca].name]=Y;na.push(r(Z,Y,M+ga+ja+ca,pa+x,U))}na.push("</tr>");if(d.p.grouping){M=d.p.groupingView.groupField.length;for(var Ma=[],Ka=0;Ka<M;Ka++)Ma.push(L[d.p.groupingView.groupField[Ka]]);Aa=a(d).jqGrid("groupingPrepare",
|
||
|
na,Ma,Aa,L);na=[]}if(J||d.p.treeGrid===true){L._id_=Z;d.p.data.push(L);d.p._index[Z]=d.p.data.length-1}if(d.p.gridview===false){a("tbody:first",u).append(na.join(""));F&&d.p.afterInsertRow.call(d,Z,L,U);na=[]}L={};I++;pa++;if(I==Ca)break}}if(d.p.gridview===true){N=d.p.treeANode>-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(;I<va;){U=t[I];Z=P(U,I);Z=d.p.idPrefix+Z;if(R.repeatitems){ha||(ha=E(ga+ja+ca));var Na=
|
||
|
a.jgrid.getXmlData(U,R.cell,true);a.each(ha,function(za){var wa=Na[this];if(!wa)return false;Y=wa.textContent||wa.text;L[d.p.colModel[za+ga+ja+ca].name]=Y})}else for(M=0;M<ta.length;M++){Y=a.jgrid.getXmlData(U,ta[M]);L[d.p.colModel[M+ga+ja+ca].name]=Y}L._id_=Z;d.p.data.push(L);d.p._index[Z]=d.p.data.length-1;L={};I++}}},C=function(t,u,x,A,F){var T=new Date;if(t){if(d.p.treeANode===-1&&!d.p.scroll){D(u,false,true);x=1}else x=x>1?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<ea;){F=ta[t];U=a.jgrid.getAccessor(F,J);if(U===undefined){U=va+t;if(I.length===0)if(u.cell)U=
|
||
|
a.jgrid.getAccessor(F,u.cell)[J]||U}U=d.p.idPrefix+U;M=x===1?0:x;M=(M+t)%2==1?na:"";Z.push("<tr"+Ca+' id="'+U+'" tabindex="-1" role="row" class= "ui-widget-content jqgrow ui-row-'+d.p.direction+""+M+'">');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<Y.length;N++){M=a.jgrid.getAccessor(F,
|
||
|
Y[N]);Z.push(r(U,M,N+ga+ja+ca,t+x,F));ha[d.p.colModel[N+ga+ja+ca].name]=M}Z.push("</tr>");if(d.p.grouping){M=d.p.groupingView.groupField.length;N=[];for(var Ia=0;Ia<M;Ia++)N.push(ha[d.p.groupingView.groupField[Ia]]);Aa=a(d).jqGrid("groupingPrepare",Z,N,Aa,ha);Z=[]}if(R||d.p.treeGrid===true){ha._id_=U;d.p.data.push(ha);d.p._index[U]=d.p.data.length-1}if(d.p.gridview===false){a("#"+a.jgrid.jqID(d.p.id)+" tbody:first").append(Z.join(""));pa&&d.p.afterInsertRow.call(d,U,ha,F);Z=[]}ha={};P++;t++;if(P==
|
||
|
Fa)break}if(d.p.gridview===true){L=d.p.treeANode>-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(;P<ea&&ta[P];){F=ta[P];U=a.jgrid.getAccessor(F,J);if(U===undefined){U=va+P;if(I.length===0)if(u.cell)U=a.jgrid.getAccessor(F,u.cell)[J]||U}if(F){U=d.p.idPrefix+U;if(u.repeatitems){if(u.cell)F=a.jgrid.getAccessor(F,u.cell);Y||(Y=E(ga+ja+ca))}for(N=0;N<Y.length;N++){M=a.jgrid.getAccessor(F,Y[N]);ha[d.p.colModel[N+
|
||
|
ga+ja+ca].name]=M}ha._id_=U;d.p.data.push(ha);d.p._index[U]=d.p.data.length-1;ha={}}P++}}},ba=function(){function t(L){var U=0,Z,na,Fa,va,pa;if(L.groups!==undefined){(na=L.groups.length&&L.groupOp.toString().toUpperCase()==="OR")&&I.orBegin();for(Z=0;Z<L.groups.length;Z++){U>0&&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;Z<L.rules.length;Z++){pa=L.rules[Z];va=L.groupOp.toString().toUpperCase();if(N[pa.op]&&pa.field){if(U>0&&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="<table cellspacing='0' cellpadding='0' border='0' style='table-layout:auto;' class='ui-pg-table'><tbody><tr>",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("<div id='"+T+"' class='ui-pager-control' role='group'><table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table' style='width:100%;table-layout:fixed;height:100%;' role='row'><tbody><tr><td id='"+J+"' align='left'></td><td id='"+R+"' align='center' style='white-space:pre;'></td><td id='"+
|
||
|
P+"' align='right'></td></tr></tbody></table></div>").attr("dir","ltr");if(d.p.rowList.length>0){F="<td dir='"+j+"'>";F+="<select class='ui-pg-selbox' role='listbox'>";for(J=0;J<d.p.rowList.length;J++)F+='<option role="option" value="'+d.p.rowList[J]+'"'+(d.p.rowNum==d.p.rowList[J]?' selected="selected"':"")+">"+d.p.rowList[J]+"</option>";F+="</select></td>"}if(j=="rtl")A+=F;if(d.p.pginput===true)x="<td dir='"+j+"'>"+a.jgrid.format(d.p.pgtext||"","<input class='ui-pg-input' type='text' size='2' maxlength='7' value='0' role='textbox'/>",
|
||
|
"<span id='sp_1_"+a.jgrid.jqID(t)+"'></span>")+"</td>";if(d.p.pgbuttons===true){J=["first"+u,"prev"+u,"next"+u,"last"+u];j=="rtl"&&J.reverse();A+="<td id='"+J[0]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-first'></span></td>";A+="<td id='"+J[1]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-prev'></span></td>";A+=x!==""?"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>"+x+"<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>":
|
||
|
"";A+="<td id='"+J[2]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-next'></span></td>";A+="<td id='"+J[3]+"' class='ui-pg-button ui-corner-all'><span class='ui-icon ui-icon-seek-end'></span></td>"}else if(x!=="")A+=x;if(j=="ltr")A+=F;A+="</tr></tbody></table>";d.p.viewrecords===true&&a("td#"+t+"_"+d.p.recordpos,"#"+T).append("<div dir='"+j+"' style='text-align:"+d.p.recordpos+"' class='ui-paging-info'></div>");a("td#"+t+"_"+d.p.pagerpos,"#"+T).append(A);F=a(".ui-jqgrid").css("font-size")||
|
||
|
"11px";a(document.body).append("<div id='testpg' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+F+";visibility:hidden;' ></div>");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&&N<I))if(N===I)ea=ca=false}else if(I>1&&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<x.length;u++)if(t===x[u].el){A=u;break}return A};this.p.id=this.id;if(a.inArray(d.p.multikey,["shiftKey","altKey",
|
||
|
"ctrlKey"])==-1)d.p.multikey=false;d.p.keyIndex=false;for(h=0;h<d.p.colModel.length;h++){d.p.colModel[h]=a.extend(true,{},d.p.cmTemplate,d.p.colModel[h].template||{},d.p.colModel[h]);if(d.p.keyIndex===false&&d.p.colModel[h].key===true)d.p.keyIndex=h}d.p.sortorder=d.p.sortorder.toLowerCase();if(d.p.grouping===true){d.p.scroll=false;d.p.rownumbers=false;d.p.subGrid=false;d.p.treeGrid=false;d.p.gridview=true}if(this.p.treeGrid===true){try{a(this).jqGrid("setTreeGrid")}catch(Ea){}if(d.p.datatype!="local")d.p.localReader=
|
||
|
{id:"_id_"}}if(this.p.subGrid)try{a(d).jqGrid("setSubGrid")}catch(Ga){}if(this.p.multiselect){this.p.colNames.unshift("<input role='checkbox' id='cb_"+this.p.id+"' class='cbox' type='checkbox'/>");this.p.colModel.unshift({name:"cb",width: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="<thead><tr class='ui-jqgrid-labels' role='rowheader'>",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="<span class='s-ico' style='display:none'><span sort='asc' class='ui-grid-ico-sort ui-icon-asc"+da+" ui-state-disabled ui-icon ui-icon-triangle-1-n ui-sort-"+j+"'></span>";da+="<span sort='desc' class='ui-grid-ico-sort ui-icon-desc"+H+" ui-state-disabled ui-icon ui-icon-triangle-1-s ui-sort-"+j+"'></span></span>";for(h=0;h<this.p.colNames.length;h++){H=d.p.headertitles?' title="'+a.jgrid.stripHtml(d.p.colNames[h])+
|
||
|
'"':"";ra+="<th id='"+d.p.id+"_"+d.p.colModel[h].name+"' role='columnheader' class='ui-state-default ui-th-column ui-th-"+j+"'"+H+">";H=d.p.colModel[h].index||d.p.colModel[h].name;ra+="<div id='jqgh_"+d.p.id+"_"+d.p.colModel[h].name+"' "+G+">"+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+"</div></th>"}ra+="</tr></thead>";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("<div class='ui-jqgrid-resize-mark' id='rs_m"+
|
||
|
d.p.id+"'> </div>");a(o).css("width",g.width+"px");ra=a("thead:first",d).get(0);var aa="";if(d.p.footerrow)aa+="<table role='grid' style='width:"+d.p.tblwidth+"px' class='ui-jqgrid-ftable' cellspacing='0' cellpadding='0' border='0'><tbody><tr role='row' class='ui-widget-content footrow footrow-"+j+"'>";o=a("tr:first",ra);var ua="<tr class='jqgfirstrow' role='row' style='height:auto'>";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+="<td role='gridcell' style='height:0px;width:"+W+"px;"+u+"'></td>";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+="<td role='gridcell' "+
|
||
|
v(t,0,"",null,"",false)+"> </td>"}).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<d.p.colModel.length;F++)if(d.p.colModel[F].hidden!==true){A=F;break}x.nv=A-u}g.dragStart(u,t,ya(u));return false}}).click(function(t){if(d.p.disableClick)return d.p.disableClick=false;var u="th>div.ui-jqgrid-sortable",x,A;d.p.viewsortcols[2]||(u="th>div>span>span.ui-grid-ico-sort");t=a(t.target).closest(u);if(t.length==
|
||
|
1){u=Da(this);if(!d.p.viewsortcols[2]){x=true;A=t.attr("sort")}xa(a("div",this)[0].id,u,x,A);return false}});if(d.p.sortable&&a.fn.sortable)try{a(d).jqGrid("sortableColumns",o)}catch(ma){}if(d.p.footerrow)aa+="</tr></tbody></table>";ua+="</tr>";this.appendChild(document.createElement("tbody"));a(this).addClass("ui-jqgrid-btable").append(ua);ua=null;o=a("<table class='ui-jqgrid-htable' style='width:"+d.p.tblwidth+"px' role='grid' aria-labelledby='gbox_"+this.id+"' cellspacing='0' cellpadding='0' border='0'></table>").append(ra);
|
||
|
var sa=d.p.caption&&d.p.hiddengrid===true?true:false;h=a("<div class='ui-jqgrid-hbox"+(j=="rtl"?"-rtl":"")+"'></div>");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('<div style="position:relative;'+(n&&a.browser.version<8?"height:0.01%;":"")+'"></div>').append("<div></div>").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("<a role='link' href='javascript:void(0)'/>").addClass("ui-jqgrid-titlebar-close HeaderButton").hover(function(){Ha.addClass("ui-state-hover")},function(){Ha.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-circle-triangle-n'></span>").css(j=="rtl"?"left":
|
||
|
"right","0px"):"";a(g.cDiv).append(Ha).append("<span class='ui-jqgrid-title"+(j=="rtl"?"-rtl":"")+"'>"+d.p.caption+"</span>").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("<div id='"+d.p.toppager+"'></div>")[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("<div class='ui-jqgrid-sdiv'></div>")[0];h=a("<div class='ui-jqgrid-hbox"+(j=="rtl"?"-rtl":"")+"'></div>");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<c;){if(a(this.rows[e]).hasClass("jqgrow")){b[f]=this.rows[e].id;f++}e++}});return b},setSelection:function(b,e){return this.each(function(){function c(l){var n=a(f.grid.bDiv)[0].clientHeight,m=a(f.grid.bDiv)[0].scrollTop,p=f.rows[l].offsetTop;l=f.rows[l].clientHeight;if(p+l>=
|
||
|
n+m)a(f.grid.bDiv)[0].scrollTop=p-(n+m)+l+m;else if(p<n+m)if(p<m)a(f.grid.bDiv)[0].scrollTop=p}var f=this,g,h,j,d,o;if(b!==undefined){e=e===false?false:true;h=f.rows.namedItem(b+"");if(!(!h||!h.className||h.className.indexOf("ui-state-disabled")>-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<g;){if(f)o=j.rows[h];if(a(o).hasClass("jqgrow")){a("td",
|
||
|
o).each(function(l){d=j.p.colModel[l].name;if(d!=="cb"&&d!=="subgrid"&&d!=="rn")if(j.p.treeGrid===true&&d==j.p.ExpandColumn)e[d]=a.jgrid.htmlDecode(a("span:first",this).html());else try{e[d]=a.unformat(this,{rowId:o.id,colModel:j.p.colModel[l]},l)}catch(n){e[d]=a.jgrid.htmlDecode(a(this).html())}});if(f){c.push(e);e={}}}h++}});return c?c:e},delRowData:function(b){var e=false,c,f;this.each(function(){if(c=this.rows.namedItem(b)){a(c).remove();this.p.records--;this.p.reccount--;this.updatepager(true,
|
||
|
false);e=true;if(this.p.multiselect){f=a.inArray(b,this.p.selarrrow);f!=-1&&this.p.selarrrow.splice(f,1)}if(b==this.p.selrow)this.p.selrow=null}else return false;if(this.p.datatype=="local"){var g=this.p._index[b];if(typeof g!="undefined"){this.p.data.splice(g,1);this.refreshIndex()}}if(this.p.altRows===true&&e){var h=this.p.altclass;a(this.rows).each(function(j){j%2==1?a(this).addClass(h):a(this).removeClass(h)})}});return e},setRowData:function(b,e,c){var f,g=true,h;this.each(function(){if(!this.grid)return false;
|
||
|
var j=this,d,o,l=typeof c,n={};o=j.rows.namedItem(b);if(!o)return false;if(e)try{a(this.p.colModel).each(function(v){f=this.name;if(e[f]!==undefined){n[f]=this.formatter&&typeof this.formatter==="string"&&this.formatter=="date"?a.unformat.date(e[f],this):e[f];d=j.formatter(b,e[f],v,e,"edit");h=this.title?{title:a.jgrid.stripHtml(d)}:{};j.p.treeGrid===true&&f==j.p.ExpandColumn?a("td:eq("+v+") > 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;z<y;){r=e[z];j="";if(v){try{b=r[s]}catch(K){b=a.jgrid.randId()}E=this.p.altRows===true?(this.rows.length-1)%2===0?q:"":""}b=this.p.idPrefix+b;if(l){k=this.formatCol(0,1,"",null,b,true);j+='<td role="gridcell" aria-describedby="'+
|
||
|
this.p.id+'_rn" class="ui-state-default jqgrid-rownum" '+k+">0</td>"}if(d){p='<input role="checkbox" type="checkbox" id="jqg_'+this.p.id+"_"+b+'" class="cbox"/>';k=this.formatCol(l,1,"",null,b,true);j+='<td role="gridcell" aria-describedby="'+this.p.id+'_cb" '+k+">"+p+"</td>"}if(o)j+=a(this).jqGrid("addSubGridCell",d+l,1);for(m=d+o+l;m<this.p.colModel.length;m++){w=this.p.colModel[m];h=w.name;D[h]=w.formatter&&typeof w.formatter==="string"&&w.formatter=="date"?a.unformat.date(r[h],w):r[h];p=this.formatter(b,
|
||
|
a.jgrid.getAccessor(r,h),m,r,"edit");k=this.formatCol(m,1,p,r,b,true);j+='<td role="gridcell" aria-describedby="'+this.p.id+"_"+h+'" '+k+">"+p+"</td>"}j='<tr id="'+b+'" role="row" tabindex="-1" class="ui-widget-content jqgrow ui-row-'+this.p.direction+" "+E+'">'+j+"</tr>";if(this.rows.length===0)a("table:first",this.grid.bDiv).append(j);else switch(c){case "last":a(this.rows[this.rows.length-1]).after(j);n=this.rows.length-1;break;case "first":a(this.rows[0]).after(j);n=1;break;case "after":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].clientHeight<a(c.grid.bDiv)[0].scrollHeight||c.rows.length===1){o=true;n-=l}g=0;var v=c.grid.cols.length>0;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<n;){if(a(this.rows[m]).hasClass("jqgrow")){try{g=a.unformat(a(this.rows[m].cells[l]),
|
||
|
{rowId:this.rows[m].id,colModel:this.p.colModel[l]},l)}catch(p){g=a.jgrid.htmlDecode(this.rows[m].cells[l].innerHTML)}if(c){o=parseFloat(g);h+=o;if(m===0)d=j=o;else{j=Math.min(j,o);d=Math.max(d,o)}}else e?f.push({id:this.rows[m].id,value:g}):f.push(g)}m++}if(c)switch(c.toLowerCase()){case "sum":f=h;break;case "avg":f=h/n;break;case "count":f=n;break;case "min":f=j;break;case "max":f=d}}}}});return f},clearGridData:function(b){return this.each(function(){if(this.grid){if(typeof b!="boolean")b=false;
|
||
|
if(this.p.deepempty)a("#"+a.jgrid.jqID(this.p.id)+" tbody:first tr:gt(0)").remove();else{var e=a("#"+a.jgrid.jqID(this.p.id)+" tbody:first tr:first")[0];a("#"+a.jgrid.jqID(this.p.id)+" tbody:first").empty().append(e)}this.p.footerrow&&b&&a(".ui-jqgrid-ftable td",this.grid.sDiv).html(" ");this.p.selrow=null;this.p.selarrrow=[];this.p.savedRow=[];this.p.records=0;this.p.page=1;this.p.lastpage=0;this.p.reccount=0;this.p.data=[];this.p._index={};this.updatepager(true,false)}})},getInd:function(b,
|
||
|
e){var c=false,f;this.each(function(){if(f=this.rows.namedItem(b))c=e===true?f:f.rowIndex});return c},bindKeys:function(b){var e=a.extend({onEnter:null,onSpace:null,onLeftKey:null,onRightKey:null,scrollingRows:true},b||{});return this.each(function(){var c=this;a("body").is("[role]")||a("body").attr("role","application");c.p.scrollrows=e.scrollingRows;a(c).keydown(function(f){var g=a(c).find("tr[tabindex=0]")[0],h,j,d,o=c.p.treeReader.expanded_field;if(g){d=c.p._index[g.id];if(f.keyCode===37||f.keyCode===
|
||
|
38||f.keyCode===39||f.keyCode===40){if(f.keyCode===38){j=g.previousSibling;h="";if(j)if(a(j).is(":hidden"))for(;j;){j=j.previousSibling;if(!a(j).is(":hidden")&&a(j).hasClass("jqgrow")){h=j.id;break}}else h=j.id;a(c).jqGrid("setSelection",h)}if(f.keyCode===40){j=g.nextSibling;h="";if(j)if(a(j).is(":hidden"))for(;j;){j=j.nextSibling;if(!a(j).is(":hidden")&&a(j).hasClass("jqgrow")){h=j.id;break}}else h=j.id;a(c).jqGrid("setSelection",h)}if(f.keyCode===37){c.p.treeGrid&&c.p.data[d][o]&&a(g).find("div.treeclick").trigger("click");
|
||
|
a.isFunction(e.onLeftKey)&&e.onLeftKey.call(c,c.p.selrow)}if(f.keyCode===39){c.p.treeGrid&&!c.p.data[d][o]&&a(g).find("div.treeclick").trigger("click");a.isFunction(e.onRightKey)&&e.onRightKey.call(c,c.p.selrow)}}else if(f.keyCode===13)a.isFunction(e.onEnter)&&e.onEnter.call(c,c.p.selrow);else f.keyCode===32&&a.isFunction(e.onSpace)&&e.onSpace.call(c,c.p.selrow)}})})},unbindKeys:function(){return this.each(function(){a(this).unbind("keydown")})},getLocalRow:function(b){var e=false,c;this.each(function(){if(typeof b!==
|
||
|
"undefined"){c=this.p._index[b];if(c>=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;f<c.length;f++)if(c[f].name==b){e=c[f];break}return e},setColProp:function(b,e){return this.each(function(){if(this.grid)if(e)for(var c=this.p.colModel,f=0;f<c.length;f++)if(c[f].name==b){a.extend(this.p.colModel[f],e);break}})},sortGrid:function(b,e,c){return this.each(function(){var f=-1;if(this.grid){if(!b)b=this.p.sortname;for(var g=0;g<this.p.colModel.length;g++)if(this.p.colModel[g].index==
|
||
|
b||this.p.colModel[g].name==b){f=g;break}if(f!=-1){g=this.p.colModel[f].sortable;if(typeof g!=="boolean")g=true;if(typeof e!=="boolean")e=false;g&&this.sortData("jqgh_"+this.p.id+"_"+b,f,e,c)}}})},GridDestroy:function(){return this.each(function(){if(this.grid){this.p.pager&&a(this.p.pager).remove();var b=this.id;try{a("#gbox_"+b).remove()}catch(e){}}})},GridUnload:function(){return this.each(function(){if(this.grid){var b={id:a(this).attr("id"),cl:a(this).attr("class")};this.p.pager&&a(this.p.pager).empty().removeClass("ui-state-default ui-jqgrid-pager corner-bottom");
|
||
|
var e=document.createElement("table");a(e).attr({id:b.id});e.className=b.cl;b=this.id;a(e).removeClass("ui-jqgrid-btable");if(a(this.p.pager).parents("#gbox_"+b).length===1){a(e).insertBefore("#gbox_"+b).show();a(this.p.pager).insertBefore("#gbox_"+b)}else a(e).insertBefore("#gbox_"+b).show();a("#gbox_"+b).remove()}})},setGridState:function(b){return this.each(function(){if(this.grid)if(b=="hidden"){a(".ui-jqgrid-bdiv, .ui-jqgrid-hdiv","#gview_"+this.p.id).slideUp("fast");this.p.pager&&a(this.p.pager).slideUp("fast");
|
||
|
this.p.toppager&&a(this.p.toppager).slideUp("fast");if(this.p.toolbar[0]===true){this.p.toolbar[1]=="both"&&a(this.grid.ubDiv).slideUp("fast");a(this.grid.uDiv).slideUp("fast")}this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+this.p.id).slideUp("fast");a(".ui-jqgrid-titlebar-close span",this.grid.cDiv).removeClass("ui-icon-circle-triangle-n").addClass("ui-icon-circle-triangle-s");this.p.gridstate="hidden"}else if(b=="visible"){a(".ui-jqgrid-hdiv, .ui-jqgrid-bdiv","#gview_"+this.p.id).slideDown("fast");
|
||
|
this.p.pager&&a(this.p.pager).slideDown("fast");this.p.toppager&&a(this.p.toppager).slideDown("fast");if(this.p.toolbar[0]===true){this.p.toolbar[1]=="both"&&a(this.grid.ubDiv).slideDown("fast");a(this.grid.uDiv).slideDown("fast")}this.p.footerrow&&a(".ui-jqgrid-sdiv","#gbox_"+this.p.id).slideDown("fast");a(".ui-jqgrid-titlebar-close span",this.grid.cDiv).removeClass("ui-icon-circle-triangle-s").addClass("ui-icon-circle-triangle-n");this.p.gridstate="visible"}})},filterToolbar:function(b){b=a.extend({autosearch:true,
|
||
|
searchOnEnter:true,beforeSearch:null,afterSearch:null,beforeClear:null,afterClear:null,searchurl:"",stringResult:false,groupOp:"AND",defaultSearch:"bw"},b||{});return this.each(function(){function e(j,d){var o=a(j);o[0]&&jQuery.each(d,function(){this.data!==undefined?o.bind(this.type,this.data,this.fn):o.bind(this.type,this.fn)})}var c=this;if(!this.ftoolbar){var f=function(){var j={},d=0,o,l,n={},m;a.each(c.p.colModel,function(){l=this.index||this.name;m=this.searchoptions&&this.searchoptions.sopt?
|
||
|
this.searchoptions.sopt[0]:this.stype=="select"?"eq":b.defaultSearch;if(o=a("#gs_"+a.jgrid.jqID(this.name),this.frozen===true&&c.p.frozenColumns===true?c.grid.fhDiv:c.grid.hDiv).val()){j[l]=o;n[l]=m;d++}else try{delete c.p.postData[l]}catch(r){}});var p=d>0?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("<tr class='ui-search-toolbar' role='rowheader'></tr>"),h;a.each(c.p.colModel,function(){var j=this,d,o,l,n;o=a("<th role='columnheader' class='ui-state-default ui-th-column ui-th-"+c.p.direction+"'></th>");d=a("<div style='width:100%;position:relative;height:100%;padding-right:0.3em;'></div>");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<m.length;v++){p=m[v].split(":");k=document.createElement("option");k.value=p[0];k.innerHTML=p[1];n.appendChild(k)}}else if(typeof m===
|
||
|
"object")for(p in m)if(m.hasOwnProperty(p)){k=document.createElement("option");k.value=p;k.innerHTML=m[p];n.appendChild(k)}l.defaultValue&&a(n).val(l.defaultValue);l.attr&&a(n).attr(l.attr);l.dataInit!==undefined&&l.dataInit(n);l.dataEvents!==undefined&&e(n,l.dataEvents);a(d).append(n);b.autosearch===true&&a(n).change(function(){f();return false})}}break;case "text":n=l.defaultValue?l.defaultValue:"";a(d).append("<input type='text' style='width:95%;padding:0px;' name='"+(j.index||j.name)+"' id='gs_"+
|
||
|
j.name+"' value='"+n+"'/>");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("<tr>",{role:"rowheader"}).addClass("ui-jqgrid-labels");g=c.headers;c=0;for(f=g.length;c<f;c++){h=o[c].hidden?"none":"";h=a(g[c].el).width(g[c].width).removeAttr("rowSpan").css("display",h);e.append(h);j=h.children("span.ui-jqgrid-resize");if(j.length>0)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("<tr>",{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<D;E++)if(z[E].startColumnName===y)return E;return-1};a(e).prepend(h);h=a("<tr>",{role:"rowheader"}).addClass("ui-jqgrid-labels jqg-third-row-header");for(c=0;c<m;c++){d=p[c].el;o=a(d);f=n[c];j={height:"0px",width:p[c].width+"px",display:f.hidden?"none":""};a("<th>",{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<g&&c+j<m;j++)n[c+j].hidden||
|
||
|
f++;j=a("<th>",{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("<th>",{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<f;){if(e[c].frozen===true){h=true;g=c}else break;c++}if(g>=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('<div style="position:absolute;left:0px;top:'+e+"px;height:"+c+'px;" class="frozen-div ui-state-default ui-jqgrid-hdiv"></div>');b.grid.fbDiv=a('<div style="position:absolute;left:0px;top:'+(parseInt(e,10)+parseInt(c,10)+1)+'px;overflow-y:hidden" class="frozen-bdiv ui-jqgrid-bdiv"></div>');
|
||
|
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("<div></div>").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('<span id="jqmP'+p.w[0]._jqm+'"></span>').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('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0});if(f)if(n.o)n.o.html('<p style="width:100%;height:100%"/>').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_</"+h+">\n";else{o=0;for(l=g.length;o<l;o+=1){var n=j+e(g[o],h,j+"\t")+"\n";d+=n}}else if(typeof g==="object"){o=false;d+=j+"<"+h;for(l in g)if(g.hasOwnProperty(l))if(l.charAt(0)===
|
||
|
"@")d+=" "+l.substr(1)+'="'+g[l].toString()+'"';else o=true;d+=o?">":"/>";if(o){for(l in g)if(g.hasOwnProperty(l))if(l==="#text")d+=g[l];else if(l==="#cdata")d+="<![CDATA["+g[l]+"]]\>";else if(l.charAt(0)!=="@")d+=e(g[l],l,j+"\t");d+=(d.charAt(d.length-1)==="\n"?j:"")+"</"+h+">"}}else if(typeof g==="function")d+=j+"<"+h+"><![CDATA["+g+"]]\></"+h+">";else{if(g===undefined)g="";d+=g.toString()==='""'||g.toString().length===0?j+"<"+h+">__EMPTY_STRING_</"+h+">":j+"<"+h+">"+g.toString()+"</"+h+">"}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;c<a.attributes.length;c+=1)b["@"+a.attributes[c].nodeName]=(a.attributes[c].nodeValue||"").toString()}if(a.firstChild){var f=c=0,g=false,h;for(h=a.firstChild;h;h=h.nextSibling)if(h.nodeType===1)g=true;else if(h.nodeType===3&&h.nodeValue.match(/[^ \f\n\r\t\v]/))c+=1;else if(h.nodeType===4)f+=1;
|
||
|
if(g)if(c<2&&f<2){this.removeWhite(a);for(h=a.firstChild;h;h=h.nextSibling)if(h.nodeType===3)b["#text"]=this.escape(h.nodeValue);else if(h.nodeType===4)if(e.test(h.nodeValue))b[h.nodeName]=[b[h.nodeName],h.nodeValue];else b["#cdata"]=this.escape(h.nodeValue);else if(b[h.nodeName])if(b[h.nodeName]instanceof Array)b[h.nodeName][b[h.nodeName].length]=this.toObj(h);else b[h.nodeName]=[b[h.nodeName],this.toObj(h)];else b[h.nodeName]=this.toObj(h)}else if(a.attributes.length)b["#text"]=this.escape(this.innerXml(a));
|
||
|
else b=this.escape(this.innerXml(a));else if(c)if(a.attributes.length)b["#text"]=this.escape(this.innerXml(a));else{b=this.escape(this.innerXml(a));if(b==="__EMPTY_ARRAY_")b="[]";else if(b==="__EMPTY_STRING_")b=""}else if(f)if(f>1)b=this.escape(this.innerXml(a));else for(h=a.firstChild;h;h=h.nextSibling)if(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;d<j;d+=1)o[d]=this.toJson(a[d],"",e+g,c);f+=(b?":[":"[")+(o.length>1?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<c.attributes.length;g+=1)f+=" "+c.attributes[g].nodeName+'="'+(c.attributes[g].nodeValue||"").toString()+'"';if(c.firstChild){f+=">";for(g=c.firstChild;g;g=g.nextSibling)f+=
|
||
|
e(g);f+="</"+c.nodeName+">"}else f+="/>"}else if(c.nodeType===3)f+=c.nodeValue;else if(c.nodeType===4)f+="<![CDATA["+c.nodeValue+"]]\>";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<j;)f+="0"}}if(e.thousandsSeparator){j=e.thousandsSeparator;h=f.lastIndexOf(g);h=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.length<w;)r="0"+r;return r};var j={m:1,d:1,y:1970,h:0,i:0,s:0,u:0},d=0,o,l=["i18n"];l.i18n={dayNames:f.dayNames,monthNames:f.monthNames};if(b in f.masks)b=f.masks[b];if(!isNaN(e-0)&&String(b).toLowerCase()=="u")d=new Date(parseFloat(e)*1E3);else if(e.constructor===Date)d=e;else if(h!==null){d=new Date(parseInt(h[1],10));if(h[3]){b=Number(h[5])*60+Number(h[6]);b*=h[4]=="-"?1:-1;b-=d.getTimezoneOffset();d.setTime(Number(Number(d)+
|
||
|
b*6E4))}}else{e=String(e).split(/[\\\/:_;.,\t\T\s-]/);b=b.split(/[\\\/:_;.,\t\T\s-]/);h=0;for(o=b.length;h<o;h++){if(b[h]=="M"){d=a.inArray(e[h],l.i18n.monthNames);if(d!==-1&&d<12)e[h]=d+1}if(b[h]=="F"){d=a.inArray(e[h],l.i18n.monthNames);if(d!==-1&&d>11)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):'<a href="mailto:'+b+'">'+b+"</a>"};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'<input type="checkbox" '+(b.search(/(false|0|no|off)/i)<0?" checked='checked' ":"")+' value="'+b+'" offval="no" '+f+"/>"};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):"<a "+f+' href="'+
|
||
|
b+'">'+b+"</a>"};a.fn.fmatter.showlink=function(b,e){var c={baseLinkUrl:e.baseLinkUrl,showAction:e.showAction,addParam:e.addParam||"",target:e.target,idName:e.idName},f="";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)?"<a "+f+' href="'+c+'">'+b+"</a>":a.fn.fmatter.defaultFormat(b,e)};a.fn.fmatter.integer=
|
||
|
function(b,e){var c=a.extend({},e.integer);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;n<o.length;n++){d=o[n].split(g);if(d.length>2)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+"<div title='"+a.jgrid.nav.edittitle+
|
||
|
"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+h+"><span class='ui-icon ui-icon-pencil'></span></div>"}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+"<div title='"+a.jgrid.nav.edittitle+"' style='float:left;cursor:pointer;' class='ui-pg-div ui-inline-edit' "+h+"><span class='ui-icon ui-icon-pencil'></span></div>"}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+"<div title='"+a.jgrid.nav.deltitle+"' style='float:left;margin-left:5px;' class='ui-pg-div ui-inline-del' "+h+"><span class='ui-icon ui-icon-trash'></span></div>"}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+"<div title='"+a.jgrid.edit.bSubmit+"' style='float:left;display:none' class='ui-pg-div ui-inline-save' "+h+"><span class='ui-icon ui-icon-disk'></span></div>";h="onclick=jQuery.fn.fmatter.rowactions('"+f+"','"+e.gid+"','cancel',"+e.pos+"); onmouseover=jQuery(this).addClass('ui-state-hover'); onmouseout=jQuery(this).removeClass('ui-state-hover'); ";g=g+"<div title='"+a.jgrid.edit.bCancel+"' style='float:left;display:none;margin-left:5px;' class='ui-pg-div ui-inline-cancel' "+h+"><span class='ui-icon ui-icon-cancel'></span></div>";
|
||
|
return"<div style='margin-left:8px;'>"+g+"</div>"};a.unformat=function(b,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;o<j.length;o++){h=
|
||
|
j[o].split(":");if(h.length>2)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("<span class='ui-jqdialog-title'>"+c.caption+"</span>");var m=
|
||
|
a("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>").hover(function(){m.addClass("ui-state-hover")},function(){m.removeClass("ui-state-hover")}).append("<span class='ui-icon ui-icon-closethick'></span>");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("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>");
|
||
|
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>"+b+"</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.length;f++){if(typeof g.buttons[f].id=="undefined")g.buttons[f].id="info_button_"+f;b+="<a href='javascript:void(0)' id='"+g.buttons[f].id+"' class='fm-button ui-state-default ui-corner-all'>"+g.buttons[f].text+"</a>"}f=isNaN(g.dataheight)?g.dataheight:g.dataheight+"px";var d="<div id='info_id'>";d+="<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+
|
||
|
f+";"+("text-align:"+g.align+";")+"'>"+e+"</div>";d+=c?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+g.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+c+"</a>"+b+"</div>":b!==""?"<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+g.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+
|
||
|
b+"</div>":"";d+="</div>";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;o<l.length;o++){n=l[o].split(m);if(n.length>2)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;d<b.length;d++){g=isNaN(e[d])?0:parseInt(e[d],10);c[b[d]]=g;g=b[d];if(g.indexOf("y")!=-1)f=d;if(g.indexOf("m")!=-1)j=d;if(g.indexOf("d")!=-1)h=d}g=b[f]=="y"||b[f]=="yyyy"?4:b[f]=="yy"?2:-1;d=function(l){for(var n=1;n<=l;n++){this[n]=31;if(n==4||n==6||n==9||n==11)this[n]=30;if(n==2)this[n]=29}return this}(12);var o;if(f===-1)return false;else{o=c[b[f]].toString();if(g==2&&o.length==1)g=1;if(o.length!=g||c[b[f]]===0&&
|
||
|
e[f]!="00")return false}if(j===-1)return false;else{o=c[b[j]].toString();if(o.length<1||c[b[j]]<1||c[b[j]]>12)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<g;f++)if(c.p.colModel[f].name==e){h=c.p.colModel[f].editrules;e=f;try{j=c.p.colModel[f].formoptions.label}catch(d){}break}}else{if(e>=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.minValue))return[false,j+": "+a.jgrid.edit.msg.minValue+" "+h.minValue,""];if(typeof h.maxValue!="undefined"&&!isNaN(h.maxValue))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<this.p._gridsopt.length;g++)this.p.ops[g].description=this.p._gridsopt[g];this.p.initFilter=a.extend(true,{},this.p.filter);if(h){for(g=0;g<h;g++){j=this.p.columns[g];if(j.stype)j.inputtype=j.stype;else if(!j.inputtype)j.inputtype="text";if(j.sorttype)j.searchtype=j.sorttype;else if(!j.searchtype)j.searchtype=
|
||
|
"string";if(j.hidden===undefined)j.hidden=false;if(!j.label)j.label=j.name;if(j.index)j.name=j.index;if(!j.hasOwnProperty("searchoptions"))j.searchoptions={};if(!j.hasOwnProperty("searchrules"))j.searchrules={}}this.p.showQuery&&a(this).append("<table class='queryresult ui-widget ui-widget-content' style='display:block;max-width:440px;border:0px none;' dir='"+this.p.direction+"'><tbody><tr><td class='query'></td></tr></tbody></table>");var 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("<table class='group ui-widget ui-widget-content' style='border:0px none;'><tbody></tbody></table>"),v="left";if(this.p.direction=="rtl"){v="right";k.attr("dir","rtl")}n===null&&k.append("<tr class='error' style='display:none;'><th colspan='5' class='ui-state-error' align='"+v+"'></th></tr>");var s=a("<tr></tr>");k.append(s);v=a("<th colspan='5' align='"+v+"'></th>");s.append(v);if(this.p.ruleButtons===true){var q=a("<select class='opsel'></select>");
|
||
|
v.append(q);s="";var r;for(p=0;p<f.groupOps.length;p++){r=l.groupOp===m.p.groupOps[p].op?" selected='selected'":"";s+="<option value='"+m.p.groupOps[p].op+"'"+r+">"+m.p.groupOps[p].text+"</option>"}q.append(s).bind("change",function(){l.groupOp=a(q).val();m.onchange()})}s="<span></span>";if(this.p.groupButton){s=a("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>");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("<input type='button' value='+' title='Add rule' class='add-rule ui-add'/>");var w;s.bind("click",function(){if(l.rules===undefined)l.rules=[];for(p=0;p<m.p.columns.length;p++){var y=typeof m.p.columns[p].search==="undefined"?true:m.p.columns[p].search,z=m.p.columns[p].hidden===true;if(m.p.columns[p].searchoptions.searchhidden===true&&y||y&&!z){w=m.p.columns[p];break}}l.rules.push({field:w.name,op:(w.searchoptions.sopt?
|
||
|
w.searchoptions.sopt:m.p.sopt?m.p.sopt:w.searchtype==="string"?m.p.stropts:m.p.numopts)[0],data:""});m.reDraw();return false});v.append(s)}if(n!==null){s=a("<input type='button' value='-' title='Delete group' class='delete-group'/>");v.append(s);s.bind("click",function(){for(p=0;p<n.groups.length;p++)if(n.groups[p]===l){n.groups.splice(p,1);break}m.reDraw();m.onchange();return false})}if(l.groups!==undefined)for(p=0;p<l.groups.length;p++){v=a("<tr></tr>");k.append(v);s=a("<td class='first'></td>");
|
||
|
v.append(s);s=a("<td colspan='4'></td>");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<l.rules.length;p++)k.append(this.createTableRowForRule(l.rules[p],l));return k};this.createTableRowForRule=function(l,n){var m=this,p=a("<tr></tr>"),k,v,s,q,r="",w;p.append("<td class='first'></td>");var y=a("<td class='columns'></td>");p.append(y);var z=a("<select></select>"),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.columns.length;k++)if(m.p.columns[k].name===l.field){q=m.p.columns[k];break}if(q){q.searchoptions.id=a.jgrid.randId();if(d&&q.inputtype==="text")if(!q.searchoptions.size)q.searchoptions.size=10;var C=a.jgrid.createEl(q.inputtype,q.searchoptions,"",true,m.p.ajaxSelectOptions,true);a(C).addClass("input-elm");v=q.searchoptions.sopt?q.searchoptions.sopt:m.p.sopt?m.p.sopt:q.searchtype==="string"?m.p.stropts:m.p.numopts;var ba="",
|
||
|
V=0;D=[];a.each(m.p.ops,function(){D.push(this.name)});for(k=0;k<v.length;k++){E=a.inArray(v[k],D);if(E!==-1){if(V===0)l.op=m.p.ops[E].name;ba+="<option value='"+m.p.ops[E].name+"'>"+m.p.ops[E].description+"</option>";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.length;k++){w=typeof m.p.columns[k].search==="undefined"?true:m.p.columns[k].search;var B=m.p.columns[k].hidden===true;if(m.p.columns[k].searchoptions.searchhidden===true&&w||w&&!B){w="";if(l.field===m.p.columns[k].name){w=" selected='selected'";y=k}r+="<option value='"+m.p.columns[k].name+"'"+w+">"+m.p.columns[k].label+"</option>"}}z.append(r);r=a("<td class='operators'></td>");
|
||
|
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("<select class='selectopts'></select>");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<v.length;k++){E=a.inArray(v[k],D);if(E!==-1){w=l.op===m.p.ops[E].name?" selected='selected'":"";r+="<option value='"+m.p.ops[E].name+"'"+w+">"+m.p.ops[E].description+"</option>"}}K.append(r);r=a("<td class='data'></td>");p.append(r);r.append(y);a(y).addClass("input-elm").bind("change",function(){l.data=
|
||
|
a(this).val();m.onchange()});r=a("<td></td>");p.append(r);if(this.p.ruleButtons===true){y=a("<input type='button' value='-' title='Delete rule' class='delete-rule ui-del'/>");r.append(y);y.bind("click",function(){for(k=0;k<n.rules.length;k++)if(n.rules[k]===l){n.rules.splice(k,1);break}m.reDraw();m.onchange();return false})}return p};this.getStringForGroup=function(l){var n="(",m;if(l.groups!==undefined)for(m=0;m<l.groups.length;m++){if(n.length>1)n+=" "+l.groupOp+" ";try{n+=this.getStringForGroup(l.groups[m])}catch(p){alert(p)}}if(l.rules!==
|
||
|
undefined)try{for(m=0;m<l.rules.length;m++){if(n.length>1)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;p<this.p.ops.length;p++)if(this.p.ops[p].name===l.op){n=this.p.ops[p].operator;m=this.p.ops[p].name;break}for(p=0;p<this.p.columns.length;p++)if(this.p.columns[p].name===l.field){k=this.p.columns[p];break}p=l.data;if(m==="bw"||m==="bn")p+="%";if(m==="ew"||m==="en")p="%"+p;if(m===
|
||
|
"cn"||m==="nc")p="%"+p+"%";if(m==="in"||m==="ni")p=" ("+p+")";f.errorcheck&&o(l.data,k);return a.inArray(k.searchtype,["int","integer","float","number","currency"])!==-1||m==="nn"||m==="nu"?l.field+" "+n+" "+p:l.field+" "+n+' "'+p+'"'};this.resetFilter=function(){this.p.filter=a.extend(true,{},this.p.initFilter);this.reDraw();this.onchange()};this.hideError=function(){a("th.ui-state-error",this).html("");a("tr.error",this).hide()};this.showError=function(){a("th.ui-state-error",this).html(this.p.errmsg);
|
||
|
a("tr.error",this).show()};this.toUserFriendlyString=function(){return this.getStringForGroup(f.filter)};this.toString=function(){function l(m){var p="(",k;if(m.groups!==undefined)for(k=0;k<m.groups.length;k++){if(p.length>1)p+=m.groupOp==="OR"?" || ":" && ";p+=l(m.groups[k])}if(m.rules!==undefined)for(k=0;k<m.rules.length;k++){if(p.length>1)p+=m.groupOp==="OR"?" || ":" && ";var v=m.rules[k];if(n.p.errorcheck){var s=void 0,q=void 0;for(s=0;s<n.p.columns.length;s++)if(n.p.columns[s].name===v.field){q=
|
||
|
n.p.columns[s];break}q&&o(v.data,q)}p+=v.op+"(item."+v.field+",'"+v.data+"')"}p+=")";return p==="()"?"":p}var n=this;return l(this.p.filter)};this.reDraw();if(this.p.showQuery)this.onchange();this.filter=true}}})};a.extend(a.fn.jqFilter,{toSQLString:function(){var b="";this.each(function(){b=this.toUserFriendlyString()});return b},filterData:function(){var b;this.each(function(){b=this.p.filter});return b},getParameter:function(b){if(b!==undefined)if(this.p.hasOwnProperty(b))return this.p[b];return this.p},
|
||
|
resetFilter:function(){return this.each(function(){this.resetFilter()})},addFilter:function(b){if(typeof b==="string")b=jQuery.jgrid.parse(b);this.each(function(){this.p.filter=b;this.reDraw();this.onchange()})}})})(jQuery);
|
||
|
(function(a){var b={};a.jgrid.extend({searchGrid:function(e){e=a.extend({recreateFilter:false,drag:true,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",loadDefaults:true,beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,afterRedraw:null,closeAfterSearch:false,closeAfterReset:false,closeOnEscape:false,multipleSearch:false,multipleGroup:false,top:0,left:0,jqModal:true,modal:false,resize:true,width:450,height:"auto",dataheight:"auto",showQuery:false,errorcheck:true,
|
||
|
sopt:null,stringResult:undefined,onClose:null,onSearch:null,onReset:null,toTop:true,overlay:30,columns:[],tmplNames:null,tmplFilters:null,tmplLabel:" Template: ",showOnLoad:false,layer:null},a.jgrid.search,e||{});return this.each(function(){function c(){if(a.isFunction(e.beforeShowSearch)){h=e.beforeShowSearch(a("#"+g));if(typeof h==="undefined")h=true}if(h){a.jgrid.viewModal("#"+j.themodal,{gbox:"#gbox_"+g,jqm:e.jqModal,modal:e.modal,overlay:e.overlay,toTop:e.toTop});a.isFunction(e.afterShowSearch)&&
|
||
|
e.afterShowSearch(a("#"+g))}}var f=this;if(f.grid){var g="fbox_"+f.p.id,h=true,j={themodal:"searchmod"+g,modalhead:"searchhd"+g,modalcontent:"searchcnt"+g,scrollelm:g},d=f.p.postData[e.sFilter];if(typeof d==="string")d=a.jgrid.parse(d);e.recreateFilter===true&&a("#"+j.themodal).remove();if(a("#"+j.themodal).html()!==null)c();else{var o=a("<div><div id='"+g+"' class='searchFilter' style='overflow:auto'></div></div>").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="<a href='javascript:void(0)' id='"+g+"_search' class='fm-button ui-state-default ui-corner-all fm-button-icon-right ui-reset'><span class='ui-icon ui-icon-search'></span>"+e.Find+"</a>",k="<a href='javascript:void(0)' id='"+g+"_reset' class='fm-button ui-state-default ui-corner-all fm-button-icon-left ui-search'><span class='ui-icon ui-icon-arrowreturnthick-1-w'></span>"+e.Reset+"</a>",v="",s="",q,r=false,w=-1;if(e.showQuery)v=
|
||
|
"<a href='javascript:void(0)' id='"+g+"_query' class='fm-button ui-state-default ui-corner-all fm-button-icon-left'><span class='ui-icon ui-icon-comment'></span>Query</a>";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+="<select class='ui-template'>";s+="<option value='default'>Default</option>";a.each(e.tmplNames,function(z,E){s+="<option value='"+z+"'>"+E+"</option>"});s+="</select>"}l="<table class='EditTable' style='border:0px none;margin-top:5px' id='"+g+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='EditButton' style='text-align:"+
|
||
|
l+"'>"+k+s+"</td><td class='EditButton' "+n+">"+v+p+"</td></tr></tbody></table>";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+="<td class='CaptionTD'> </td><td class='DataTD'> </td>";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("<tr><td class='contentinfo' colspan='"+Q*2+"'>"+t.rowcontent+"</td></tr>");a(W).append(Ba);Ba[0].rp=u}if(O.length===0){O=a("<tr "+oa+" rowpos='"+u+"'></tr>").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("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(Q*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='"+H.p.id+"_id' value='"+G+"'/></td></tr>");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<k.p.savedRow.length;G++)if(k.p.savedRow[G].id==e){a(k).jqGrid("restoreRow",e);break}}function m(G,H){G===0?a("#pData","#"+q+"_2").addClass("ui-state-disabled"):a("#pData","#"+q+"_2").removeClass("ui-state-disabled");G==H?a("#nData","#"+q+"_2").addClass("ui-state-disabled"):a("#nData","#"+q+"_2").removeClass("ui-state-disabled")}
|
||
|
function p(){var G=a(k).jqGrid("getDataIDs"),H=a("#id_g","#"+q).val();return[a.inArray(H,G),G]}var k=this;if(k.grid&&e){var v=k.p.id,s="FrmGrid_"+v,q="TblGrid_"+v,r={themodal:"editmod"+v,modalhead:"edithd"+v,modalcontent:"editcnt"+v,scrollelm:s},w=a.isFunction(b[k.p.id].beforeShowForm)?b[k.p.id].beforeShowForm:false,y=a.isFunction(b[k.p.id].afterShowForm)?b[k.p.id].afterShowForm:false,z=a.isFunction(b[k.p.id].beforeInitData)?b[k.p.id].beforeInitData:false,E=a.isFunction(b[k.p.id].onInitializeForm)?
|
||
|
b[k.p.id].onInitializeForm:false,D=true,B=1,K=0,C,ba,V,la;if(e==="new"){e="_empty";c.caption=b[k.p.id].addCaption}else c.caption=b[k.p.id].editCaption;c.recreateForm===true&&a("#"+r.themodal).html()!==null&&a("#"+r.themodal).remove();var ia=true;if(c.checkOnUpdate&&c.jqModal&&!c.modal)ia=false;if(a("#"+r.themodal).html()!==null){if(z){D=z(a("#"+s));if(typeof D=="undefined")D=true}if(D===false)return;n();a(".ui-jqdialog-title","#"+r.modalhead).html(c.caption);a("#FormError","#"+q).hide();if(b[k.p.id].topinfo){a(".topinfo",
|
||
|
"#"+q).html(b[k.p.id].topinfo);a(".tinfo","#"+q).show()}else a(".tinfo","#"+q).hide();if(b[k.p.id].bottominfo){a(".bottominfo","#"+q+"_2").html(b[k.p.id].bottominfo);a(".binfo","#"+q+"_2").show()}else a(".binfo","#"+q+"_2").hide();h(e,k,s);e=="_empty"||!b[k.p.id].viewPagerButtons?a("#pData, #nData","#"+q+"_2").hide():a("#pData, #nData","#"+q+"_2").show();if(b[k.p.id].processing===true){b[k.p.id].processing=false;a("#sData","#"+q+"_2").removeClass("ui-state-active")}if(a("#"+s).data("disabled")===
|
||
|
true){a(".confirm","#"+r.themodal).hide();a("#"+s).data("disabled",false)}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,jqM:false,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))}else{var fa=isNaN(c.dataheight)?c.dataheight:c.dataheight+"px";fa=a("<form name='FormPost' id='"+
|
||
|
s+"' class='FormGrid' onSubmit='return false;' style='width:100%;overflow:auto;position:relative;height:"+fa+";'></form>").data("disabled",false);var xa=a("<table id='"+q+"' class='EditTable' cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>");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("<tr id='FormError' style='display:none'><td class='ui-state-error' colspan='"+
|
||
|
B*2+"'></td></tr>");z[0].rp=0;a(xa).append(z);z=a("<tr style='display:none' class='tinfo'><td class='topinfo' colspan='"+B*2+"'>"+b[k.p.id].topinfo+"</td></tr>");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="<a href='javascript:void(0)' id='"+D+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>";ya="<a href='javascript:void(0)' id='"+ya+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>";
|
||
|
var Da="<a href='javascript:void(0)' id='sData' class='fm-button ui-state-default ui-corner-all'>"+c.bSubmit+"</a>",Ea="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+c.bCancel+"</a>";D="<table border='0' cellspacing='0' cellpadding='0' class='EditTable' id='"+q+"_2'><tbody><tr><td colspan='2'><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr id='Act_Buttons'><td class='navButton'>"+(z?ya+D:D+ya)+"</td><td class='EditButton'>"+Da+Ea+"</td></tr>";
|
||
|
D+="<tr style='display:none' class='binfo'><td class='bottominfo' colspan='2'>"+b[k.p.id].bottominfo+"</td></tr>";D+="</tbody></table>";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<H.rp)return-1;return 0});a.each(Ga,function(G,H){a("tbody",xa).append(H)})}c.gbox="#gbox_"+v;var ra=false;if(c.closeOnEscape===true){c.closeOnEscape=false;ra=true}fa=a("<span></span>").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("<span class='ui-icon "+c.saveicon[2]+"'></span>");if(c.closeicon[0]===true)a("#cData","#"+q+"_2").addClass(c.closeicon[1]=="right"?"fm-button-icon-right":
|
||
|
"fm-button-icon-left").append("<span class='ui-icon "+c.closeicon[2]+"'></span>");if(b[k.p.id].checkOnSubmit||b[k.p.id].checkOnUpdate){Da="<a href='javascript:void(0)' id='sNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+c.bYes+"</a>";ya="<a href='javascript:void(0)' id='nNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+c.bNo+"</a>";Ea="<a href='javascript:void(0)' id='cNew' class='fm-button ui-state-default ui-corner-all' style='z-index:1002'>"+
|
||
|
c.bExit+"</a>";fa=c.zIndex||999;fa++;a("<div class='ui-widget-overlay jqgrid-overlay confirm' style='z-index:"+fa+";display:none;'> "+(a.browser.msie&&a.browser.version==6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':"")+"</div><div class='confirm ui-widget-content ui-jqconfirm' style='z-index:"+(fa+1)+"'>"+c.saveData+"<br/><br/>"+Da+ya+Ea+"</div>").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="<td class='CaptionTD form-view-label ui-widget-content' width='"+c.labelswidth+"'> </td><td class='DataTD form-view-data ui-helper-reset ui-widget-content'> </td>",
|
||
|
ra="",G=["integer","number","currency"],H=0,W=0,Q,$,S,O=1;O<=ba;O++)ra+=O==1?Ga:"<td class='CaptionTD form-view-label ui-widget-content'> </td><td class='DataTD form-view-data ui-widget-content'> </td>";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("<tr><td class='contentinfo' colspan='"+ba*2+"'>"+X.rowcontent+"</td></tr>");a(C).append(ua);ua[0].rp=oa}ia=a(C).find("tr[rowpos="+oa+"]");if(ia.length===0){ia=a("<tr "+ya+" rowpos='"+oa+"'></tr>").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("<b>"+
|
||
|
(typeof X.label==="undefined"?K.p.colNames[da]:X.label)+"</b>");a("td:eq("+(aa-1)+")",ia[0]).append("<span>"+xa+"</span>").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("<tr class='FormData' style='display:none'><td class='CaptionTD'></td><td colspan='"+(ba*2-1)+"' class='DataTD'><input class='FormElement' id='id_g' type='text' name='id' value='"+B+"'/></td></tr>");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("<form name='FormPost' id='"+n+"' class='FormGrid' style='width:100%;overflow:auto;position:relative;height:"+r+";'></form>");var w=a("<table id='"+m+"' class='EditTable' cellspacing='1' cellpadding='2' border='0' style='table-layout:fixed'><tbody></tbody></table>");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="<a href='javascript:void(0)' id='"+(k?"nData":"pData")+"' class='fm-button ui-state-default ui-corner-left'><span class='ui-icon ui-icon-triangle-1-w'></span></a>";var y="<a href='javascript:void(0)' id='"+(k?"pData":"nData")+"' class='fm-button ui-state-default ui-corner-right'><span class='ui-icon ui-icon-triangle-1-e'></span></a>",z="<a href='javascript:void(0)' id='cData' class='fm-button ui-state-default ui-corner-all'>"+c.bClose+"</a>";if(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<K.rp)return-1;return 0});a.each(E,function(B,K){a("tbody",w).append(K)})}c.gbox="#gbox_"+l;var D=false;if(c.closeOnEscape===true){c.closeOnEscape=false;D=true}r=a("<span></span>").append(r).append("<table border='0' class='EditTable' id='"+m+"_2'><tbody><tr id='Act_Buttons'><td class='navButton' width='"+c.labelswidth+"'>"+(k?y+v:v+y)+"</td><td class='EditButton'>"+z+"</td></tr></tbody></table>");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("<span class='ui-icon "+c.closeicon[2]+"'></span>");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="<div id='"+n+"' class='formdata' style='width:100%;overflow:auto;position:relative;height:"+q+";'>";q+="<table class='DelTable'><tbody>";q+="<tr id='DelError' style='display:none'><td class='ui-state-error'></td></tr>";
|
||
|
q+="<tr id='DelData' style='display:none'><td >"+e+"</td></tr>";q+='<tr><td class="delmsg" style="white-space:pre;">'+b[f.p.id].msg+"</td></tr><tr><td > </td></tr>";q+="</tbody></table></div>";q+="<table cellspacing='0' cellpadding='0' border='0' class='EditTable' id='"+n+"_2'><tbody><tr><td><hr class='ui-widget-content' style='margin:1px'/></td></tr><tr><td class='DelButton EditButton'>"+("<a href='javascript:void(0)' id='dData' class='fm-button ui-state-default ui-corner-all'>"+c.bSubmit+"</a>")+
|
||
|
" "+("<a href='javascript:void(0)' id='eData' class='fm-button ui-state-default ui-corner-all'>"+c.bCancel+"</a>")+"</td></tr></tbody></table>";c.gbox="#gbox_"+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("<span class='ui-icon "+c.delicon[2]+"'></span>");if(c.cancelicon[0]===true)a("#eData","#"+n+"_2").addClass(c.cancelicon[1]=="right"?"fm-button-icon-right":"fm-button-icon-left").append("<span class='ui-icon "+c.cancelicon[2]+"'></span>");a("#dData","#"+n+"_2").click(function(){var 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;K<D.length;K++)a(f).jqGrid("delRowData",f.p.idPrefix+D[K]);f.p.selrow=null;f.p.selarrrow=[]}a.isFunction(b[f.p.id].afterComplete)&&setTimeout(function(){b[f.p.id].afterComplete(z,w)},500)}b[f.p.id].processing=false;a("#dData","#"+n+"_2").removeClass("ui-state-active");r[0]&&a.jgrid.hideModal("#"+s.themodal,{gb:"#gbox_"+d,jqm:c.jqModal,
|
||
|
onClose:b[f.p.id].onClose})}},a.jgrid.ajaxOptions,b[f.p.id].ajaxDelOptions);if(!y.url&&!b[f.p.id].useDataProxy)if(a.isFunction(f.p.dataProxy))b[f.p.id].useDataProxy=true;else{r[0]=false;r[1]+=" "+a.jgrid.errors.nourl}if(r[0])if(b[f.p.id].useDataProxy){y=f.p.dataProxy.call(f,y,"del_"+f.p.id);if(typeof y=="undefined")y=[true,""];if(y[0]===false){r[0]=false;r[1]=y[1]||"Error deleting the selected row!"}else a.jgrid.hideModal("#"+s.themodal,{gb:"#gbox_"+d,jqm:c.jqModal,onClose:b[f.p.id].onClose})}else a.ajax(y)}if(r[0]===
|
||
|
false){a("#DelError>td","#"+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,"<div>"+c.alerttext+"</div><span tabindex='0'><span tabindex='-1' id='jqg_alrt'></span></span>",{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<m;p++){var k=a("<table cellspacing='0' cellpadding='0' border='0' class='ui-pg-table navtable' style='float:left;table-layout:auto;'><tbody><tr></tr></tbody></table>"),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("<td class='ui-pg-button ui-corner-all'></td>");a(n).append("<div class='ui-pg-div'><span class='ui-icon "+
|
||
|
c.addicon+"'></span>"+c.addtext+"</div>");a("tr",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("<td class='ui-pg-button ui-corner-all'></td>");f=f||{};a(n).append("<div class='ui-pg-div'><span class='ui-icon "+
|
||
|
c.editicon+"'></span>"+c.edittext+"</div>");a("tr",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("<td class='ui-pg-button ui-corner-all'></td>");d=d||{};a(n).append("<div class='ui-pg-div'><span class='ui-icon "+c.viewicon+"'></span>"+c.viewtext+"</div>");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("<td class='ui-pg-button ui-corner-all'></td>");h=h||{};a(n).append("<div class='ui-pg-div'><span class='ui-icon "+c.delicon+"'></span>"+c.deltext+"</div>");a("tr",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("<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='ui-separator'></span></td>");if(c.search){n=a("<td class='ui-pg-button ui-corner-all'></td>");
|
||
|
j=j||{};a(n).append("<div class='ui-pg-div'><span class='ui-icon "+c.searchicon+"'></span>"+c.searchtext+"</div>");a("tr",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("<td class='ui-pg-button ui-corner-all'></td>");a(n).append("<div class='ui-pg-div'><span class='ui-icon "+c.refreshicon+"'></span>"+c.refreshtext+"</div>");a("tr",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("<div id='testpg2' class='ui-jqgrid ui-widget ui-widget-content' style='font-size:"+n+";visibility:hidden;' ></div>");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("<td></td>");
|
||
|
c.buttonicon.toString().toUpperCase()=="NONE"?a(h).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'>"+c.caption+"</div>"):a(h).addClass("ui-pg-button ui-corner-all").append("<div class='ui-pg-div'><span class='ui-icon "+c.buttonicon+"'></span>"+c.caption+"</div>");c.id&&a(h).attr("id",c.id);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="<td class='ui-pg-button ui-state-disabled' style='width:4px;'><span class='"+c.sepclass+
|
||
|
"'></span>"+c.sepcontent+"</td>";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<m.p.savedRow.length;d++)if(m.p.savedRow[d].id==b){q=d;break}q>=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<m.p.savedRow.length;K++)if(m.p.savedRow[K].id==
|
||
|
b){q=K;break}q>=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,'<div class="ui-state-error">'+D.responseText+"</div>",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<c.p.savedRow.length;j++)if(c.p.savedRow[j].id==b){f=j;break}if(f>=0){if(a.isFunction(a.fn.datepicker))try{a("input.hasDatepicker","#"+a.jgrid.jqID(g.id)).datepicker("hide")}catch(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+"<br/>"+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;f<this.p.colModel.length;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)}})},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<n)a(c.grid.bDiv)[0].scrollTop=a(c.grid.bDiv)[0].scrollTop-
|
||
|
c.rows[j].clientHeight}if(o=="h"){o=a(c.grid.bDiv)[0].clientWidth;l=a(c.grid.bDiv)[0].scrollLeft;n=c.rows[j].cells[d].offsetLeft;if(c.rows[j].cells[d].offsetLeft+c.rows[j].cells[d].clientWidth>=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<l)a(c.grid.bDiv)[0].scrollLeft=a(c.grid.bDiv)[0].scrollLeft-c.rows[j].cells[d].clientWidth}}function e(j,d){var o,l;if(d=="lft"){o=j+1;for(l=j;l>=0;l--)if(c.p.colModel[l].hidden!==true){o=l;break}}if(d==
|
||
|
"rgt"){o=j-1;for(l=j;l<c.p.colModel.length;l++)if(c.p.colModel[l].hidden!==true){o=l;break}}return o}var c=this;if(!(!c.grid||c.p.cellEdit!==true)){c.p.knv=c.p.id+"_kn";var f=a("<span style='width:0px;height:0px;background-color:black;' tabindex='0'><span tabindex='-1' style='width:0px;height:0px;background-color:grey' id='"+c.p.knv+"'></span></span>"),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<b[0].name.length;e++)b[0].align[e]=b[0].align[e]||"left"}})},addSubGridCell:function(b,e){var c="",f,g;this.each(function(){c=this.formatCol(b,e);g=this.p.id;f=this.p.subGridOptions.plusicon});return'<td role="grid" aria-describedby="'+g+'_subgrid" class="ui-sgcollapsed sgcollapsed" '+c+"><a href='javascript:void(0);'><span class='ui-icon "+f+"'></span></a></td>"},addSubGrid:function(b,e){return this.each(function(){var c=
|
||
|
this;if(c.grid){var f=function(s,q,r){q=a("<td align='"+c.p.subGridModel[0].align[r]+"'></td>").html(q);a(s).append(q)},g=function(s,q){var r,w,y,z=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),E=a("<tr></tr>");for(w=0;w<c.p.subGridModel[0].name.length;w++){r=a("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+c.p.direction+"'></th>");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("<tr class='ui-widget-content ui-subtblcell'></tr>");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<D.length;w++)f(E,a(D[w],this).text()||" ",w)}a(z).append(E)})}r=a("table:first",c.grid.bDiv).attr("id")+"_";a("#"+r+q).append(z);c.grid.hDiv.loading=false;a("#load_"+c.p.id).hide();return false},h=function(s,q){var r,
|
||
|
w,y,z,E,D=a("<table cellspacing='0' cellpadding='0' border='0'><tbody></tbody></table>"),B=a("<tr></tr>");for(w=0;w<c.p.subGridModel[0].name.length;w++){r=a("<th class='ui-state-default ui-th-subgrid ui-th-column ui-th-"+c.p.direction+"'></th>");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<r.length;w++){y=r[w];B=a("<tr class='ui-widget-content ui-subtblcell'></tr>");
|
||
|
if(z.repeatitems===true){if(z.cell)y=y[z.cell];for(E=0;E<y.length;E++)f(B,y[E]||" ",E)}else{var K=c.p.subGridModel[0].mapping||c.p.subGridModel[0].name;if(K.length)for(E=0;E<K.length;E++)f(B,y[K[E]]||" ",E)}a(D).append(B)}}w=a("table:first",c.grid.bDiv).attr("id")+"_";a("#"+w+q).append(D);c.grid.hDiv.loading=false;a("#load_"+c.p.id).hide();return false},j=function(s){var q,r,w,y;q=a(s).attr("id");r={nd_:(new Date).getTime()};r[c.p.prmNames.subgridid]=q;if(!c.p.subGridModel[0])return false;
|
||
|
if(c.p.subGridModel[0].params)for(y=0;y<c.p.subGridModel[0].params.length;y++)for(w=0;w<c.p.colModel.length;w++)if(c.p.colModel[w].name==c.p.subGridModel[0].params[y])r[c.p.colModel[w].name]=a("td:eq("+w+")",s).text().replace(/\ \;/ig,"");if(!c.grid.hDiv.loading){c.grid.hDiv.loading=true;a("#load_"+c.p.id).show();if(!c.p.subgridtype)c.p.subgridtype=c.p.datatype;if(a.isFunction(c.p.subgridtype))c.p.subgridtype.call(c,r);else c.p.subgridtype=c.p.subgridtype.toLowerCase();switch(c.p.subgridtype){case "xml":case "json":a.ajax(a.extend({type:c.p.mtype,
|
||
|
url:c.p.subGridUrl,dataType:c.p.subgridtype,data:a.isFunction(c.p.serializeSubGridData)?c.p.serializeSubGridData.call(c,r):r,complete:function(z){c.p.subgridtype=="xml"?g(z.responseXML,q):h(a.jgrid.parse(z.responseText),q)}},a.jgrid.ajaxOptions,c.p.ajaxSubgridOptions||{}))}}return false},d,o,l,n=0,m,p;a.each(c.p.colModel,function(){if(this.hidden===true||this.name=="rn"||this.name=="cb")n++});var k=c.rows.length,v=1;if(e!==undefined&&e>0){v=e;k=e+1}for(;v<k;){a(c.rows[v]).hasClass("jqgrow")&&a(c.rows[v].cells[b]).bind("click",
|
||
|
function(){var s=a(this).parent("tr")[0];p=s.nextSibling;if(a(this).hasClass("sgcollapsed")){o=c.p.id;d=s.id;if(c.p.subGridOptions.reloadOnExpand===true||c.p.subGridOptions.reloadOnExpand===false&&!a(p).hasClass("ui-subgrid")){l=b>=1?"<td colspan='"+b+"'> </td>":"";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("<tr role='row' class='ui-subgrid'>"+l+"<td class='ui-widget-content subgrid-cell'><span class='ui-icon "+
|
||
|
c.p.subGridOptions.openicon+"'></span></td><td colspan='"+parseInt(c.p.colNames.length-1-n,10)+"' class='ui-widget-content subgrid-data'><div id="+o+"_"+d+" class='tablediv'></div></td></tr>");a.isFunction(c.p.subGridRowExpanded)?c.p.subGridRowExpanded.call(c,o+"_"+d,d):j(s)}else a(p).show();a(this).html("<a href='javascript:void(0);'><span class='ui-icon "+c.p.subGridOptions.minusicon+"'></span></a>").removeClass("sgcollapsed").addClass("sgexpanded");c.p.subGridOptions.selectOnExpand&&a(c).jqGrid("setSelection",
|
||
|
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("<a href='javascript:void(0);'><span class='ui-icon "+c.p.subGridOptions.plusicon+"'></span></a>").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<e;){p=c.p.data[c.p._index[c.rows[b].id]];if(c.p.treeGridModel=="nested")if(!p[h]){l=parseInt(p[c.p.treeReader.left_field],10);n=parseInt(p[c.p.treeReader.right_field],10);p[h]=n===l+1?"true":"false";c.rows[b].cells[c.p._treeleafpos].innerHTML=
|
||
|
p[h]}l=parseInt(p[j],10);if(c.p.tree_root_level===0){m=l+1;n=l}else{m=l;n=l-1}m="<div class='tree-wrap tree-wrap-"+c.p.direction+"' style='width:"+m*18+"px;'>";m+="<div style='"+(c.p.direction=="rtl"?"right:":"left:")+n*18+"px;' class='ui-icon ";if(p[o]!==undefined)p[o]=p[o]=="true"||p[o]===true?true:false;if(p[h]=="true"||p[h]===true){m+=(p[d]!==undefined&&p[d]!==""?p[d]:c.p.treeIcons.leaf)+" tree-leaf treeclick";p[h]=true;n="leaf"}else{p[h]=false;n=""}p[g]=(p[g]=="true"||p[g]===true?true:false)&&
|
||
|
p[o];m+=p[g]===false?p[h]===true?"'":c.p.treeIcons.plus+" tree-plus treeclick'":p[h]===true?"'":c.p.treeIcons.minus+" tree-minus treeclick'";m+="></div></div>";a(c.rows[b].cells[f]).wrapInner("<span class='cell-wrapper"+n+"'></span>").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)<h&&parseInt(this[f],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)<j&&e.push(this)});break;case "adjacency":var o=this.p.treeReader.parent_id_field,l=this.p.localReader.id;a(this.p.data).each(function(){this[o]==b[l]&&e.push(this)})}});return e},getFullTreeNode:function(b){var e=[];this.each(function(){var c;if(this.grid&&this.p.treeGrid)switch(this.p.treeGridModel){case "nested":var f=
|
||
|
this.p.treeReader.left_field,g=this.p.treeReader.right_field,h=this.p.treeReader.level_field,j=parseInt(b[f],10),d=parseInt(b[g],10),o=parseInt(b[h],10);a(this.p.data).each(function(){parseInt(this[h],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;m<c;m++)if(e[m][n]==this[l]){e.push(this);break}})}}});return e},getNodeAncestors:function(b){var e=
|
||
|
[];this.each(function(){if(this.grid&&this.p.treeGrid)for(var c=a(this).jqGrid("getNodeParent",b);c;){e.push(c);c=a(this).jqGrid("getNodeParent",c)}});return e},isVisibleNode:function(b){var e=true;this.each(function(){if(this.grid&&this.p.treeGrid){var c=a(this).jqGrid("getNodeAncestors",b),f=this.p.treeReader.expanded_field;a(c).each(function(){e=e&&this[f];if(!e)return false})}});return e},isNodeLoaded:function(b){var e;this.each(function(){if(this.grid&&this.p.treeGrid){var c=this.p.treeReader.leaf_field;
|
||
|
e=b!==undefined?b.loaded!==undefined?b.loaded:b[c]||a(this).jqGrid("getNodeChildren",b).length>0?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;g<h;g++){j=l[g];d.push(j);a(this).jqGrid("collectChildrenSortTree",d,j,b,e,c,f)}a.each(d,function(n){var m=a.jgrid.getAccessor(this,o.p.localReader.id);a("#"+o.p.id+" tbody tr:eq("+
|
||
|
n+")").after(a("tr#"+m,o.grid.bDiv))});d=l=g=null}})},collectChildrenSortTree:function(b,e,c,f,g,h){return this.each(function(){if(this.grid&&this.p.treeGrid){var j,d,o,l;j=a(this).jqGrid("getNodeChildren",e);j=a.jgrid.from(j);j.orderBy(c,f,g,h);l=j.select();j=0;for(d=l.length;j<d;j++){o=l[j];b.push(o);a(this).jqGrid("collectChildrenSortTree",b,o,c,f,g,h)}}})},setTreeRow:function(b,e){var c=false;this.each(function(){if(this.grid&&this.p.treeGrid)c=a(this).jqGrid("setRowData",b,e)});return c},delTreeNode:function(b){return this.each(function(){var e=
|
||
|
this.p.localReader.id,c=this.p.treeReader.left_field,f=this.p.treeReader.right_field,g,h,j;if(this.grid&&this.p.treeGrid){var d=this.p._index[b];if(d!==undefined){g=parseInt(this.p.data[d][f],10);h=g-parseInt(this.p.data[d][c],10)+1;d=a(this).jqGrid("getFullTreeNode",this.p.data[d]);if(d.length>0)for(var o=0;o<d.length;o++)a(this).jqGrid("delRowData",d[o][e]);if(this.p.treeGridModel==="nested"){e=a.jgrid.from(this.p.data).greater(c,g,{stype:"integer"}).select();if(e.length)for(j in e)e[j][c]=parseInt(e[j][c],
|
||
|
10)-h;e=a.jgrid.from(this.p.data).greater(f,g,{stype:"integer"}).select();if(e.length)for(j in e)e[j][f]=parseInt(e[j][f],10)-h}}}})},addChildNode:function(b,e,c){var f=this[0];if(c){var g=f.p.treeReader.expanded_field,h=f.p.treeReader.leaf_field,j=f.p.treeReader.level_field,d=f.p.treeReader.parent_id_field,o=f.p.treeReader.left_field,l=f.p.treeReader.right_field,n=f.p.treeReader.loaded,m,p,k,v,s;m=0;var q=e,r;if(!b){s=f.p.data.length-1;if(s>=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<b.groupField.length;e++){b.groupOrder[e]||(b.groupOrder[e]="asc");b.groupText[e]||(b.groupText[e]="{0}");if(typeof b.groupColumnShow[e]!="boolean")b.groupColumnShow[e]=true;if(typeof b.groupSummary[e]!="boolean")b.groupSummary[e]=
|
||
|
false;if(b.groupColumnShow[e]===true){b.visibiltyOnNextGrouping[e]=true;a(this).jqGrid("showCol",b.groupField[e])}else{b.visibiltyOnNextGrouping[e]=a("#"+this.p.id+"_"+b.groupField[e]).is(":visible");a(this).jqGrid("hideCol",b.groupField[e])}b.sortitems[e]=[];b.sortnames[e]=[];b.summaryval[e]=[];if(b.groupSummary[e]){b.summary[e]=[];for(var c=this.p.colModel,f=0,g=c.length;f<g;f++)c[f].summaryType&&b.summary[e].push({nm:c[f].name,st:c[f].summaryType,v:""})}}this.p.scroll=false;this.p.rownumbers=false;
|
||
|
this.p.subGrid=false;this.p.treeGrid=false;this.p.gridview=true}else this.p.grouping=false;else this.p.grouping=false})},groupingPrepare:function(b,e,c,f){this.each(function(){e[0]+="";var g=e[0].toString().split(" ").join(""),h=this.p.groupingView,j=this;if(c.hasOwnProperty(g))c[g].push(b);else{c[g]=[];c[g].push(b);h.sortitems[0].push(g);h.sortnames[0].push(a.trim(e[0].toString()));h.summaryval[0][g]=a.extend(true,[],h.summary[0])}h.groupSummary[0]&&a.each(h.summaryval[0][g],function(){this.v=a.isFunction(this.st)?
|
||
|
this.st.call(j,this.v,this.nm,f):a(j).jqGrid("groupingCalculations."+this.st,this.v,this.nm,f)})});return c},groupingToggle:function(b){this.each(function(){var e=this.p.groupingView,c=b.lastIndexOf("_"),f=b.substring(0,c+1);c=parseInt(b.substring(c+1),10)+1;var g=e.minusicon,h=e.plusicon,j=a("#"+b);j=j.length?j[0].nextSibling:null;var d=a("#"+b+" span.tree-wrap-"+this.p.direction),o=false;if(d.hasClass(g)){if(e.showSummaryOnHide&&e.groupSummary[0]){if(j)for(;j;){if(a(j).hasClass("jqfoot"))break;
|
||
|
a(j).hide();j=j.nextSibling}}else if(j)for(;j;){if(a(j).attr("id")==f+String(c))break;a(j).hide();j=j.nextSibling}d.removeClass(g).addClass(h);o=true}else{if(j)for(;j;){if(a(j).attr("id")==f+String(c))break;a(j).show();j=j.nextSibling}d.removeClass(h).addClass(g)}a.isFunction(this.p.onClickGroup)&&this.p.onClickGroup.call(this,b,o)});return false},groupingRender:function(b,e){return this.each(function(){var c=this,f=c.p.groupingView,g="",h="",j,d=f.groupCollapse?f.plusicon:f.minusicon,o,l,n;if(!f.groupDataSorted){f.sortitems[0].sort();
|
||
|
f.sortnames[0].sort();if(f.groupOrder[0].toLowerCase()=="desc"){f.sortitems[0].reverse();f.sortnames[0].reverse()}}d+=" tree-wrap-"+c.p.direction;for(n=0;n<e;){if(c.p.colModel[n].name==f.groupField[0]){l=n;break}n++}a.each(f.sortitems[0],function(m,p){j=c.p.id+"ghead_"+m;h="<span style='cursor:pointer;' class='ui-icon "+d+"' onclick=\"jQuery('#"+c.p.id+"').jqGrid('groupingToggle','"+j+"');return false;\"></span>";try{o=c.formatter(j,f.sortnames[0][m],l,f.sortitems[0])}catch(k){o=f.sortnames[0][m]}g+=
|
||
|
'<tr id="'+j+'" role="row" class= "ui-widget-content jqgroup ui-row-'+c.p.direction+'"><td colspan="'+e+'">'+h+a.jgrid.format(f.groupText[0],o,b[p].length)+"</td></tr>";for(var v=0;v<b[p].length;v++)g+=b[p][v].join("");if(f.groupSummary[0]){v="";if(f.groupCollapse&&!f.showSummaryOnHide)v=' style="display:none;"';g+="<tr"+v+' role="row" class="ui-widget-content jqfoot ui-row-'+c.p.direction+'">';v=f.summaryval[0][p];for(var s=c.p.colModel,q,r=b[p].length,w=0;w<e;w++){var y="<td "+c.formatCol(w,1,"")+
|
||
|
"> </td>",z="{0}";a.each(v,function(){if(this.nm==s[w].name){if(s[w].summaryTpl)z=s[w].summaryTpl;if(this.st=="avg")if(this.v&&r>0)this.v/=r;try{q=c.formatter("",this.v,w,this)}catch(E){q=this.v}y="<td "+c.formatCol(w,1,"")+">"+a.jgrid.format(z,q)+"</td>";return false}});g+=y}g+="</tr>"}});a("#"+c.p.id+" tbody:first").append(g);g=null})},groupingGroupBy:function(b,e){return this.each(function(){if(typeof b=="string")b=[b];var c=this.p.groupingView;this.p.grouping=true;if(typeof c.visibiltyOnNextGrouping==
|
||
|
"undefined")c.visibiltyOnNextGrouping=[];var f;for(f=0;f<c.groupField.length;f++)!c.groupColumnShow[f]&&c.visibiltyOnNextGrouping[f]&&a(this).jqGrid("showCol",c.groupField[f]);for(f=0;f<b.length;f++)c.visibiltyOnNextGrouping[f]=a("#"+this.p.id+"_"+b[f]).is(":visible");this.p.groupingView=a.extend(this.p.groupingView,e||{});c.groupField=b;a(this).trigger("reloadGrid")})},groupingRemove:function(b){return this.each(function(){if(typeof b=="undefined")b=true;this.p.grouping=false;if(b===true){for(var e=
|
||
|
this.p.groupingView,c=0;c<e.groupField.length;c++)!e.groupColumnShow[c]&&e.visibiltyOnNextGrouping[c]&&a(this).jqGrid("showCol",e.groupField);a("tr.jqgroup, tr.jqfoot","#"+this.p.id+" tbody:first").remove();a("tr.jqgrow:hidden","#"+this.p.id+" tbody:first").show()}else a(this).trigger("reloadGrid")})},groupingCalculations:{sum:function(b,e,c){return parseFloat(b||0)+parseFloat(c[e]||0)},min:function(b,e,c){if(b==="")return parseFloat(c[e]||0);return Math.min(parseFloat(b),parseFloat(c[e]||0))},max:function(b,
|
||
|
e,c){if(b==="")return parseFloat(c[e]||0);return Math.max(parseFloat(b),parseFloat(c[e]||0))},count:function(b,e,c){if(b==="")b=0;return c.hasOwnProperty(e)?b+1:0},avg:function(b,e,c){return parseFloat(b||0)+parseFloat(c[e]||0)}}})})(jQuery);
|
||
|
(function(a){a.jgrid.extend({jqGridImport:function(b){b=a.extend({imptype:"xml",impstring:"",impurl:"",mtype:"GET",impData:{},xmlGrid:{config:"roots>grid",data:"roots>rows"},jsonGrid:{config:"grid",data:"data"},ajaxOptions:{}},b||{});return this.each(function(){var e=this,c=function(h,j){var d=a(j.xmlGrid.config,h)[0],o=a(j.xmlGrid.data,h)[0],l;if(xmlJsonClass.xml2json&&a.jgrid.parse){d=xmlJsonClass.xml2json(d," ");d=a.jgrid.parse(d);for(var n in d)if(d.hasOwnProperty(n))l=d[n];if(o){o=d.grid.datatype;
|
||
|
d.grid.datatype="xmlstring";d.grid.datastr=h;a(e).jqGrid(l).jqGrid("setGridParam",{datatype:o})}else a(e).jqGrid(l)}else alert("xml2json or parse are not present")},f=function(h,j){if(h&&typeof h=="string"){var d=a.jgrid.parse(h),o=d[j.jsonGrid.config];if(d=d[j.jsonGrid.data]){var l=o.datatype;o.datatype="jsonstring";o.datastr=d;a(e).jqGrid(o).jqGrid("setGridParam",{datatype:l})}else a(e).jqGrid(o)}};switch(b.imptype){case "xml":a.ajax(a.extend({url:b.impurl,type:b.mtype,data:b.impData,dataType:"xml",
|
||
|
complete:function(h,j){if(j=="success"){c(h.responseXML,b);a.isFunction(b.importComplete)&&b.importComplete(h)}}},b.ajaxOptions));break;case "xmlstring":if(b.impstring&&typeof b.impstring=="string"){var g=a.jgrid.stringToDoc(b.impstring);if(g){c(g,b);a.isFunction(b.importComplete)&&b.importComplete(g);b.impstring=null}g=null}break;case "json":a.ajax(a.extend({url:b.impurl,type:b.mtype,data:b.impData,dataType:"json",complete:function(h,j){if(j=="success"){f(h.responseText,b);a.isFunction(b.importComplete)&&
|
||
|
b.importComplete(h)}}},b.ajaxOptions));break;case "jsonstring":if(b.impstring&&typeof b.impstring=="string"){f(b.impstring,b);a.isFunction(b.importComplete)&&b.importComplete(b.impstring);b.impstring=null}}})},jqGridExport:function(b){b=a.extend({exptype:"xmlstring",root:"grid",ident:"\t"},b||{});var e=null;this.each(function(){if(this.grid){var c=a.extend({},a(this).jqGrid("getGridParam"));if(c.rownumbers){c.colNames.splice(0,1);c.colModel.splice(0,1)}if(c.multiselect){c.colNames.splice(0,1);c.colModel.splice(0,
|
||
|
1)}if(c.subGrid){c.colNames.splice(0,1);c.colModel.splice(0,1)}c.knv=null;if(c.treeGrid)for(var f in c.treeReader)if(c.treeReader.hasOwnProperty(f)){c.colNames.splice(c.colNames.length-1);c.colModel.splice(c.colModel.length-1)}switch(b.exptype){case "xmlstring":e="<"+b.root+">"+xmlJsonClass.json2xml(c,b.ident)+"</"+b.root+">";break;case "jsonstring":e="{"+xmlJsonClass.toJson(c,b.root,b.ident,false)+"}";if(c.postData.filters!==undefined){e=e.replace(/filters":"/,'filters":');e=e.replace(/}]}"/,"}]}")}}}});
|
||
|
return e},excelExport:function(b){b=a.extend({exptype:"remote",url:null,oper:"oper",tag:"excel",exportOptions:{}},b||{});return this.each(function(){if(this.grid){var e;if(b.exptype=="remote"){e=a.extend({},this.p.postData);e[b.oper]=b.tag;e=jQuery.param(e);e=b.url.indexOf("?")!=-1?b.url+"&"+e:b.url+"?"+e;window.location=e}}})}})})(jQuery);
|
||
|
(function(a){if(a.browser.msie&&a.browser.version==8)a.expr[":"].hidden=function(e){return e.offsetWidth===0||e.offsetHeight===0||e.style.display=="none"};a.jgrid._multiselect=false;if(a.ui)if(a.ui.multiselect){if(a.ui.multiselect.prototype._setSelected){var b=a.ui.multiselect.prototype._setSelected;a.ui.multiselect.prototype._setSelected=function(e,c){var f=b.call(this,e,c);if(c&&this.selectedList){var g=this.element;this.selectedList.find("li").each(function(){a(this).data("optionLink")&&a(this).data("optionLink").remove().appendTo(g)})}return f}}if(a.ui.multiselect.prototype.destroy)a.ui.multiselect.prototype.destroy=
|
||
|
function(){this.element.show();this.container.remove();a.Widget===undefined?a.widget.prototype.destroy.apply(this,arguments):a.Widget.prototype.destroy.apply(this,arguments)};a.jgrid._multiselect=true}a.jgrid.extend({sortableColumns:function(e){return this.each(function(){function c(){f.p.disableClick=true}var f=this,g=f.p.id;g={tolerance:"pointer",axis:"x",scrollSensitivity:"1",items:">th:not(:has(#jqgh_"+g+"_cb,#jqgh_"+g+"_rn,#jqgh_"+g+"_subgrid),:hidden)",placeholder:{element:function(j){return a(document.createElement(j[0].nodeName)).addClass(j[0].className+
|
||
|
" ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]},update:function(j,d){d.height(j.currentItem.innerHeight()-parseInt(j.currentItem.css("paddingTop")||0,10)-parseInt(j.currentItem.css("paddingBottom")||0,10));d.width(j.currentItem.innerWidth()-parseInt(j.currentItem.css("paddingLeft")||0,10)-parseInt(j.currentItem.css("paddingRight")||0,10))}},update:function(j,d){var o=a(d.item).parent();o=a(">th",o);var l={},n=f.p.id+"_";a.each(f.p.colModel,function(p){l[this.name]=
|
||
|
p});var m=[];o.each(function(){var p=a(">div",this).get(0).id.replace(/^jqgh_/,"").replace(n,"");p in l&&m.push(l[p])});a(f).jqGrid("remapColumns",m,true,true);a.isFunction(f.p.sortable.update)&&f.p.sortable.update(m);setTimeout(function(){f.p.disableClick=false},50)}};if(f.p.sortable.options)a.extend(g,f.p.sortable.options);else if(a.isFunction(f.p.sortable))f.p.sortable={update:f.p.sortable};if(g.start){var h=g.start;g.start=function(j,d){c();h.call(this,j,d)}}else g.start=c;if(f.p.sortable.exclude)g.items+=
|
||
|
":not("+f.p.sortable.exclude+")";e.sortable(g).data("sortable").floating=true})},columnChooser:function(e){function c(m,p){if(m)if(typeof m=="string")a.fn[m]&&a.fn[m].apply(p,a.makeArray(arguments).slice(2));else a.isFunction(m)&&m.apply(p,a.makeArray(arguments).slice(2))}var f=this;if(!a("#colchooser_"+f[0].p.id).length){var g=a('<div id="colchooser_'+f[0].p.id+'" style="position:relative;overflow:hidden"><div><select multiple="multiple"></select></div></div>'),h=a("select",g);e=a.extend({width:420,
|
||
|
height:240,classname:null,done:function(m){m&&f.jqGrid("remapColumns",m,true)},msel:"multiselect",dlog:"dialog",dlog_opts:function(m){var p={};p[m.bSubmit]=function(){m.apply_perm();m.cleanup(false)};p[m.bCancel]=function(){m.cleanup(true)};return{buttons:p,close:function(){m.cleanup(true)},modal:m.modal?m.modal:false,resizable:m.resizable?m.resizable:true,width:m.width+20}},apply_perm:function(){a("option",h).each(function(){this.selected?f.jqGrid("showCol",j[this.value].name):f.jqGrid("hideCol",
|
||
|
j[this.value].name)});var m=[];a("option:selected",h).each(function(){m.push(parseInt(this.value,10))});a.each(m,function(){delete o[j[parseInt(this,10)].name]});a.each(o,function(){var p=parseInt(this,10);var k=m,v=p;if(v>=0){var s=k.slice(),q=s.splice(v,Math.max(k.length-v,v));if(v>k.length)v=k.length;s[v]=p;m=s.concat(q)}else m=void 0});e.done&&e.done.call(f,m)},cleanup:function(m){c(e.dlog,g,"destroy");c(e.msel,h,"destroy");g.remove();m&&e.done&&e.done.call(f)},msel_opts:{}},a.jgrid.col,e||{});
|
||
|
if(a.ui)if(a.ui.multiselect)if(e.msel=="multiselect"){if(!a.jgrid._multiselect){alert("Multiselect plugin loaded after jqGrid. Please load the plugin before the jqGrid!");return}e.msel_opts=a.extend(a.ui.multiselect.defaults,e.msel_opts)}e.caption&&g.attr("title",e.caption);if(e.classname){g.addClass(e.classname);h.addClass(e.classname)}if(e.width){a(">div",g).css({width:e.width,margin:"0 auto"});h.css("width",e.width)}if(e.height){a(">div",g).css("height",e.height);h.css("height",e.height-10)}var j=
|
||
|
f.jqGrid("getGridParam","colModel"),d=f.jqGrid("getGridParam","colNames"),o={},l=[];h.empty();a.each(j,function(m){o[this.name]=m;if(this.hidedlg)this.hidden||l.push(m);else h.append("<option value='"+m+"' "+(this.hidden?"":"selected='selected'")+">"+d[m]+"</option>")});var n=a.isFunction(e.dlog_opts)?e.dlog_opts.call(f,e):e.dlog_opts;c(e.dlog,g,n);n=a.isFunction(e.msel_opts)?e.msel_opts.call(f,e):e.msel_opts;c(e.msel,h,n)}},sortableRows:function(e){return this.each(function(){var c=this;if(c.grid)if(!c.p.treeGrid)if(a.fn.sortable){e=
|
||
|
a.extend({cursor:"move",axis:"y",items:".jqgrow"},e||{});if(e.start&&a.isFunction(e.start)){e._start_=e.start;delete e.start}else e._start_=false;if(e.update&&a.isFunction(e.update)){e._update_=e.update;delete e.update}else e._update_=false;e.start=function(f,g){a(g.item).css("border-width","0px");a("td",g.item).each(function(d){this.style.width=c.grid.cols[d].style.width});if(c.p.subGrid){var h=a(g.item).attr("id");try{a(c).jqGrid("collapseSubGridRow",h)}catch(j){}}e._start_&&e._start_.apply(this,
|
||
|
[f,g])};e.update=function(f,g){a(g.item).css("border-width","");c.p.rownumbers===true&&a("td.jqgrid-rownum",c.rows).each(function(h){a(this).html(h+1+(parseInt(c.p.page,10)-1)*parseInt(c.p.rowNum,10))});e._update_&&e._update_.apply(this,[f,g])};a("tbody:first",c).sortable(e);a("tbody:first",c).disableSelection()}})},gridDnD:function(e){return this.each(function(){function c(){var h=a.data(f,"dnd");a("tr.jqgrow:not(.ui-draggable)",f).draggable(a.isFunction(h.drag)?h.drag.call(a(f),h):h.drag)}var f=
|
||
|
this;if(f.grid)if(!f.p.treeGrid)if(a.fn.draggable&&a.fn.droppable){a("#jqgrid_dnd").html()===null&&a("body").append("<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>");if(typeof e=="string"&&e=="updateDnD"&&f.p.jqgdnd===true)c();else{e=a.extend({drag:function(h){return a.extend({start:function(j,d){if(f.p.subGrid){var o=a(d.helper).attr("id");try{a(f).jqGrid("collapseSubGridRow",o)}catch(l){}}for(o=0;o<a.data(f,"dnd").connectWith.length;o++)a(a.data(f,"dnd").connectWith[o]).jqGrid("getGridParam",
|
||
|
"reccount")=="0"&&a(a.data(f,"dnd").connectWith[o]).jqGrid("addRowData","jqg_empty_row",{});d.helper.addClass("ui-state-highlight");a("td",d.helper).each(function(n){this.style.width=f.grid.headers[n].width+"px"});h.onstart&&a.isFunction(h.onstart)&&h.onstart.call(a(f),j,d)},stop:function(j,d){if(d.helper.dropped&&!h.dragcopy){var o=a(d.helper).attr("id");a(f).jqGrid("delRowData",o)}for(o=0;o<a.data(f,"dnd").connectWith.length;o++)a(a.data(f,"dnd").connectWith[o]).jqGrid("delRowData","jqg_empty_row");
|
||
|
h.onstop&&a.isFunction(h.onstop)&&h.onstop.call(a(f),j,d)}},h.drag_opts||{})},drop:function(h){return a.extend({accept:function(j){if(!a(j).hasClass("jqgrow"))return j;j=a(j).closest("table.ui-jqgrid-btable");if(j.length>0&&a.data(j[0],"dnd")!==undefined){j=a.data(j[0],"dnd").connectWith;return a.inArray("#"+this.id,j)!=-1?true:false}return false},drop:function(j,d){if(a(d.draggable).hasClass("jqgrow")){var o=a(d.draggable).attr("id");o=d.draggable.parent().parent().jqGrid("getRowData",o);if(!h.dropbyname){var l=
|
||
|
0,n={},m,p=a("#"+this.id).jqGrid("getGridParam","colModel");try{for(var k in o){if(o.hasOwnProperty(k)&&p[l]){m=p[l].name;n[m]=o[k]}l++}o=n}catch(v){}}d.helper.dropped=true;if(h.beforedrop&&a.isFunction(h.beforedrop)){m=h.beforedrop.call(this,j,d,o,a("#"+f.id),a(this));if(typeof m!="undefined"&&m!==null&&typeof m=="object")o=m}if(d.helper.dropped){var s;if(h.autoid)if(a.isFunction(h.autoid))s=h.autoid.call(this,o);else{s=Math.ceil(Math.random()*1E3);s=h.autoidprefix+s}a("#"+this.id).jqGrid("addRowData",
|
||
|
s,o,h.droppos)}h.ondrop&&a.isFunction(h.ondrop)&&h.ondrop.call(this,j,d,o)}}},h.drop_opts||{})},onstart:null,onstop:null,beforedrop:null,ondrop:null,drop_opts:{activeClass:"ui-state-active",hoverClass:"ui-state-hover"},drag_opts:{revert:"invalid",helper:"clone",cursor:"move",appendTo:"#jqgrid_dnd",zIndex:5E3},dragcopy:false,dropbyname:false,droppos:"first",autoid:true,autoidprefix:"dnd_"},e||{});if(e.connectWith){e.connectWith=e.connectWith.split(",");e.connectWith=a.map(e.connectWith,function(h){return a.trim(h)});
|
||
|
a.data(f,"dnd",e);f.p.reccount!="0"&&!f.p.jqgdnd&&c();f.p.jqgdnd=true;for(var g=0;g<e.connectWith.length;g++)a(e.connectWith[g]).droppable(a.isFunction(e.drop)?e.drop.call(a(f),e):e.drop)}}}})},gridResize:function(e){return this.each(function(){var c=this;if(c.grid&&a.fn.resizable){e=a.extend({},e||{});if(e.alsoResize){e._alsoResize_=e.alsoResize;delete e.alsoResize}else e._alsoResize_=false;if(e.stop&&a.isFunction(e.stop)){e._stop_=e.stop;delete e.stop}else e._stop_=false;e.stop=function(f,g){a(c).jqGrid("setGridParam",
|
||
|
{height:a("#gview_"+c.p.id+" .ui-jqgrid-bdiv").height()});a(c).jqGrid("setGridWidth",g.size.width,e.shrinkToFit);e._stop_&&e._stop_.call(c,f,g)};e.alsoResize=e._alsoResize_?eval("("+("{'#gview_"+c.p.id+" .ui-jqgrid-bdiv':true,'"+e._alsoResize_+"':true}")+")"):a(".ui-jqgrid-bdiv","#gview_"+c.p.id);delete e._alsoResize_;a("#gbox_"+c.p.id).resizable(e)}})}})})(jQuery);
|
||
|
function tableToGrid(a,b){jQuery(a).each(function(){if(!this.grid){jQuery(this).width("99%");var e=jQuery(this).width(),c=jQuery("tr td:first-child input[type=checkbox]:first",jQuery(this)),f=jQuery("tr td:first-child input[type=radio]:first",jQuery(this));c=c.length>0;f=!c&&f.length>0;var g=c||f,h=[],j=[];jQuery("th",jQuery(this)).each(function(){if(h.length===0&&g){h.push({name:"__selection__",index:"__selection__",width:0,hidden:true});j.push("__selection__")}else{h.push({name:jQuery(this).attr("id")||
|
||
|
jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),index:jQuery(this).attr("id")||jQuery.trim(jQuery.jgrid.stripHtml(jQuery(this).html())).split(" ").join("_"),width:jQuery(this).width()||150});j.push(jQuery(this).html())}});var d=[],o=[],l=[];jQuery("tbody > tr",jQuery(this)).each(function(){var n={},m=0;jQuery("td",jQuery(this)).each(function(){if(m===0&&g){var p=jQuery("input",jQuery(this)),k=p.attr("value");o.push(k||d.length);p.is(":checked")&&l.push(k);n[h[m].name]=
|
||
|
p.attr("value")}else n[h[m].name]=jQuery(this).html();m++});m>0&&d.push(n)});jQuery(this).empty();jQuery(this).addClass("scroll");jQuery(this).jqGrid(jQuery.extend({datatype:"local",width:e,colNames:j,colModel:h,multiselect:c},b||{}));for(e=0;e<d.length;e++){f=null;if(o.length>0)if((f=o[e])&&f.replace)f=encodeURIComponent(f).replace(/[.\-%]/g,"_");if(f===null)f=e+1;jQuery(this).jqGrid("addRowData",f,d[e])}for(e=0;e<l.length;e++)jQuery(this).jqGrid("setSelection",l[e])}})};
|