Ext.data.CFQueryReader=Ext.extend(Ext.data.ArrayReader,{read:function(response){var json=response.responseText;var o=eval("("+json+")");if(!o){throw{message:"CFQueryReader.read: Json object not found"}}return this.readRecords(o)},readRecords:function(o){this.jsonData=o;var s=this.meta,Record=this.recordType,f=Record.prototype.fields,fi=f.items,fl=f.length,reset=false;if(typeof this.getJsonAccessor!="function"){this.getJsonAccessor=this.createAccessor}if(!this.ef||!this.getQueryRoot){if(s.successProperty){this.getSuccess=this.getJsonAccessor(s.successProperty)}if(s.root){this.getRoot=this.getJsonAccessor(s.root+'.DATA');this.getQueryRoot=this.getJsonAccessor(s.root)}else{this.getRoot=(o.QUERY)?this.getJsonAccessor('QUERY.DATA'):this.getJsonAccessor('DATA');this.getQueryRoot=function(){return(o.QUERY)?o.QUERY:o}}if(s.totalProperty){this.getTotal=this.getJsonAccessor(s.totalProperty)}else if(o.TOTALROWCOUNT){this.getTotal=this.getJsonAccessor('TOTALROWCOUNT')}}var root=this.getRoot(o),c=root.length,totalRecords=c,success=true;var cols=this.getQueryRoot(o).COLUMNS;for(var i=0;i<cols.length;i++){cols[i]=cols[i].toUpperCase()}if(s.totalProperty||o.TOTALROWCOUNT){var v=parseInt(this.getTotal(o),10);if(!isNaN(v)){totalRecords=v}}if(s.successProperty){var v=this.getSuccess(o);if(v===false||v==='false'){success=false}}for(var b=0;b<fl;b++){var fMap=(fi[b].mapping!==undefined&&fi[b].mapping!==null)?fi[b].mapping:fi[b].name;fi[b].mapArrLoc=cols.indexOf(fMap.toUpperCase())}if(!this.ef||reset===true){if(s.id){this.getId=function(rec){var r=rec[s.id];return(r===undefined||r==="")?null:r}}else{this.getId=function(){return null}}this.ef=[];for(var i=0;i<fl;i++){f=fi[i];var map=(f.mapping!==undefined&&f.mapping!==null)?f.mapping:f.name;this.ef[i]=function(rec){var r=rec[map];return(r===undefined||r==="")?null:r}}}var records=[];for(var i=0;i<c;i++){var n=root[i];var values={};for(var j=0,jlen=fl;j<jlen;j++){f=fi[j];var k=f.mapArrLoc!==undefined&&f.mapArrLoc!==null?f.mapArrLoc:j;var v=n[k]!==undefined?n[k]:f.defaultValue;v=f.convert(v,n);values[f.name]=v}var rec=new this.recordType(values,this.getId(values));rec.json=values;records[i]=rec}return{success:success,records:records,totalRecords:totalRecords}}});
