Ext.ns("Ext.ux.grid");
Ext.ux.grid.BufferView=Ext.extend(Ext.grid.GridView,{rowHeight:19,borderHeight:2,scrollDelay:100,cacheSize:20,cleanDelay:500,initTemplates:function(){Ext.ux.grid.BufferView.superclass.initTemplates.call(this);var a=this.templates;a.rowHolder=new Ext.Template('<div class="x-grid3-row {alt}" style="{tstyle}"></div>');a.rowHolder.disableFormats=true;a.rowHolder.compile();a.rowBody=new Ext.Template('<table class="x-grid3-row-table" border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',"<tbody><tr>{cells}</tr>",
this.enableRowBody?'<tr class="x-grid3-row-body-tr" style="{bodyStyle}"><td colspan="{cols}" class="x-grid3-body-cell" tabIndex="0" hidefocus="on"><div class="x-grid3-row-body">{body}</div></td></tr>':"","</tbody></table>");a.rowBody.disableFormats=true;a.rowBody.compile()},getStyleRowHeight:function(){return Ext.isBorderBox?this.rowHeight+this.borderHeight:this.rowHeight},getCalculatedRowHeight:function(){return this.rowHeight+this.borderHeight},getVisibleRowCount:function(){var a=this.getCalculatedRowHeight(),
b=this.scroller.dom.clientHeight;return b<1?0:Math.ceil(b/a)},getVisibleRows:function(){var a=this.getVisibleRowCount(),b=this.scroller.dom.scrollTop;b=b===0?0:Math.floor(b/this.getCalculatedRowHeight())-1;return{first:Math.max(b,0),last:Math.min(b+a+2,this.ds.getCount()-1)}},doRender:function(a,b,c,d,e,f,g){for(var h=this.templates,j=h.cell,k=h.row,l=h.rowBody,m=e-1,n=this.getStyleRowHeight(),p=this.getVisibleRows(),r=[],o,q={},s={tstyle:"width:"+this.getTotalWidth()+";height:"+n+"px;"},t,u=0,y=
b.length;u<y;u++){t=b[u];n=[];var w=u+d,v=w>=p.first&&w<=p.last;if(v)for(var x=0;x<e;x++){o=a[x];q.id=o.id;q.css=x===0?"x-grid3-cell-first ":x==m?"x-grid3-cell-last ":"";q.attr=q.cellAttr="";q.value=o.renderer(t.data[o.name],q,t,w,x,c);q.style=o.style;if(q.value===undefined||q.value==="")q.value="&#160;";if(t.dirty&&typeof t.modified[o.name]!=="undefined")q.css+=" x-grid3-dirty-cell";n[n.length]=j.apply(q)}o=[];if(f&&(w+1)%2===0)o[0]="x-grid3-row-alt";if(t.dirty)o[1]=" x-grid3-dirty-row";s.cols=e;
if(this.getRowClass)o[2]=this.getRowClass(t,w,s,c);s.alt=o.join(" ");s.cells=n.join("");r[r.length]=!v?h.rowHolder.apply(s):g?l.apply(s):k.apply(s)}return r.join("")},isRowRendered:function(a){return(a=this.getRow(a))&&a.childNodes.length>0},syncScroll:function(){Ext.ux.grid.BufferView.superclass.syncScroll.apply(this,arguments);this.update()},update:function(){if(this.scrollDelay){if(!this.renderTask)this.renderTask=new Ext.util.DelayedTask(this.doUpdate,this);this.renderTask.delay(this.scrollDelay)}else this.doUpdate()},
onRemove:function(a,b,c,d){Ext.ux.grid.BufferView.superclass.onRemove.apply(this,arguments);d!==true&&this.update()},doUpdate:function(){if(this.getVisibleRowCount()>0){for(var a=this.grid,b=a.colModel,c=a.store,d=this.getColumnData(),e=this.getVisibleRows(),f,g=e.first;g<=e.last;g++)if(!this.isRowRendered(g)&&(f=this.getRow(g))){var h=this.doRender(d,[c.getAt(g)],c,g,b.getColumnCount(),a.stripeRows,true);f.innerHTML=h}this.clean()}},clean:function(){if(!this.cleanTask)this.cleanTask=new Ext.util.DelayedTask(this.doClean,
this);this.cleanTask.delay(this.cleanDelay)},doClean:function(){if(this.getVisibleRowCount()>0){var a=this.getVisibleRows();a.first-=this.cacheSize;a.last+=this.cacheSize;var b=0,c=this.getRows();if(a.first<=0)b=a.last+1;for(var d=this.ds.getCount();b<d;b++)if((b<a.first||b>a.last)&&c[b].innerHTML)c[b].innerHTML=""}},removeTask:function(a){var b=this[a];if(b&&b.cancel){b.cancel();this[a]=null}},destroy:function(){this.removeTask("cleanTask");this.removeTask("renderTask");Ext.ux.grid.BufferView.superclass.destroy.call(this)},
layout:function(){Ext.ux.grid.BufferView.superclass.layout.call(this);this.update()}});Ext.ns("Ext.ux.layout");Ext.ux.layout.CenterLayout=Ext.extend(Ext.layout.FitLayout,{setItemSize:function(a,b){this.container.addClass("ux-layout-center");a.addClass("ux-layout-center-item");if(a&&b.height>0){if(a.width)b.width=a.width;a.setSize(b)}}});Ext.Container.LAYOUTS["ux.center"]=Ext.ux.layout.CenterLayout;Ext.ns("Ext.ux.grid");
Ext.ux.grid.CheckColumn=Ext.extend(Ext.grid.Column,{processEvent:function(a,b,c,d){if(a=="mousedown"){var e=c.store.getAt(d);e.set(this.dataIndex,!e.data[this.dataIndex]);return false}else return Ext.grid.ActionColumn.superclass.processEvent.apply(this,arguments)},renderer:function(a,b){b.css+=" x-grid3-check-col-td";return String.format('<div class="x-grid3-check-col{0}">&#160;</div>',a?"-on":"")},init:Ext.emptyFn});Ext.preg("checkcolumn",Ext.ux.grid.CheckColumn);Ext.grid.CheckColumn=Ext.ux.grid.CheckColumn;
Ext.grid.Column.types.checkcolumn=Ext.ux.grid.CheckColumn;Ext.ns("Ext.ux.grid");
Ext.ux.grid.ColumnHeaderGroup=Ext.extend(Ext.util.Observable,{constructor:function(a){this.config=a},init:function(a){Ext.applyIf(a.colModel,this.config);Ext.apply(a.getView(),this.viewConfig)},viewConfig:{initTemplates:function(){this.constructor.prototype.initTemplates.apply(this,arguments);var a=this.templates||{};if(!a.gcell)a.gcell=new Ext.XTemplate('<td class="x-grid3-hd x-grid3-gcell x-grid3-td-{id} ux-grid-hd-group-row-{row} {cls}" style="{style}">','<div {tooltip} class="x-grid3-hd-inner x-grid3-hd-{id}" unselectable="on" style="{istyle}">',
this.grid.enableHdMenu?'<a class="x-grid3-hd-btn" href="#"></a>':"","{value}</div></td>");this.templates=a;this.hrowRe=/ux-grid-hd-group-row-(\d+)/},renderHeaders:function(){for(var a=this.templates,b=[],c=this.cm,d=c.rows,e="width:"+this.getTotalWidth()+";",f=0,g=d.length;f<g;f++){for(var h=d[f],j=[],k=0,l=0,m=h.length;k<m;k++){var n=h[k];n.colspan=n.colspan||1;var p=this.getColumnId(n.dataIndex?c.findColumnIndex(n.dataIndex):l),r=Ext.ux.grid.ColumnHeaderGroup.prototype.getGroupStyle.call(this,n,
l);j[k]=a.gcell.apply({cls:"ux-grid-hd-group-cell",id:p,row:f,style:"width:"+r.width+";"+(r.hidden?"display:none;":"")+(n.align?"text-align:"+n.align+";":""),tooltip:n.tooltip?(Ext.QuickTips.isEnabled()?"ext:qtip":"title")+'="'+n.tooltip+'"':"",istyle:n.align=="right"?"padding-right:16px":"",btn:this.grid.enableHdMenu&&n.header,value:n.header||"&nbsp;"});l+=n.colspan}b[f]=a.header.apply({tstyle:e,cells:j.join("")})}b.push(this.constructor.prototype.renderHeaders.apply(this,arguments));return b.join("")},
onColumnWidthUpdated:function(){this.constructor.prototype.onColumnWidthUpdated.apply(this,arguments);Ext.ux.grid.ColumnHeaderGroup.prototype.updateGroupStyles.call(this)},onAllColumnWidthsUpdated:function(){this.constructor.prototype.onAllColumnWidthsUpdated.apply(this,arguments);Ext.ux.grid.ColumnHeaderGroup.prototype.updateGroupStyles.call(this)},onColumnHiddenUpdated:function(){this.constructor.prototype.onColumnHiddenUpdated.apply(this,arguments);Ext.ux.grid.ColumnHeaderGroup.prototype.updateGroupStyles.call(this)},
getHeaderCell:function(a){return this.mainHd.query(this.cellSelector)[a]},findHeaderCell:function(a){return a?this.fly(a).findParent("td.x-grid3-hd",this.cellSelectorDepth):false},findHeaderIndex:function(a){return(a=this.findHeaderCell(a))?this.getCellIndex(a):false},updateSortIcon:function(a,b){var c=this.sortClasses;this.mainHd.select(this.cellSelector).removeClass(c).item(a).addClass(c[b=="DESC"?1:0])},handleHdDown:function(a,b){var c=Ext.get(b);if(c.hasClass("x-grid3-hd-btn")){a.stopEvent();
var d=this.findHeaderCell(b);Ext.fly(d).addClass("x-grid3-hd-menu-open");this.hdCtxIndex=c=this.getCellIndex(d);var e=this.hmenu.items,f=this.cm;e.get("asc").setDisabled(!f.isSortable(c));e.get("desc").setDisabled(!f.isSortable(c));this.hmenu.on("hide",function(){Ext.fly(d).removeClass("x-grid3-hd-menu-open")},this,{single:true});this.hmenu.show(b,"tl-bl?")}else if(c.hasClass("ux-grid-hd-group-cell")||Ext.fly(b).up(".ux-grid-hd-group-cell"))a.stopEvent()},handleHdMove:function(a){var b=this.findHeaderCell(this.activeHdRef);
if(b&&!this.headersDisabled&&!Ext.fly(b).hasClass("ux-grid-hd-group-cell")){var c=this.splitHandleWidth||5,d=this.activeHdRegion;a=a.getPageX();b=b.style;var e="";if(this.grid.enableColumnResize!==false)if(a-d.left<=c&&this.cm.isResizable(this.activeHdIndex-1))e=Ext.isAir?"move":Ext.isWebKit?"e-resize":"col-resize";else if(d.right-a<=(!this.activeHdBtn?c:2)&&this.cm.isResizable(this.activeHdIndex))e=Ext.isAir?"move":Ext.isWebKit?"w-resize":"col-resize";b.cursor=e}},handleHdOver:function(a,b){var c=
this.findHeaderCell(b);if(c&&!this.headersDisabled){this.activeHdRef=b;this.activeHdIndex=this.getCellIndex(c);var d=this.fly(c);this.activeHdRegion=d.getRegion();if(!(this.cm.isMenuDisabled(this.activeHdIndex)||d.hasClass("ux-grid-hd-group-cell"))){d.addClass("x-grid3-hd-over");if(this.activeHdBtn=d.child(".x-grid3-hd-btn"))this.activeHdBtn.dom.style.height=c.firstChild.offsetHeight-1+"px"}}},handleHdOut:function(a,b){var c=this.findHeaderCell(b);if(c&&(!Ext.isIE||!a.within(c,true))){this.activeHdRef=
null;this.fly(c).removeClass("x-grid3-hd-over");c.style.cursor=""}},handleHdMenuClick:function(a){var b=this.hdCtxIndex,c=this.cm,d=this.ds,e=a.getItemId();switch(e){case "asc":d.sort(c.getDataIndex(b),"ASC");break;case "desc":d.sort(c.getDataIndex(b),"DESC");break;default:if(e.substr(0,6)=="group-"){b=e.split("-");var f=parseInt(b[1],10);d=parseInt(b[2],10);var g=this.cm.rows[f],h;b=f=0;for(var j=g.length;b<j;b++){h=g[b];if(d>=f&&d<f+h.colspan)break;f+=h.colspan}if(a.checked){d=c.getColumnsBy(this.isHideableColumn,
this).length;b=f;for(j=f+h.colspan;b<j;b++)c.isHidden(b)||d--;if(d<1){this.onDenyColumnHide();return false}}b=f;for(j=f+h.colspan;b<j;b++)c.config[b].fixed!==true&&c.config[b].hideable!==false&&c.setHidden(b,a.checked)}else if(e.substr(0,4)=="col-"){b=c.getIndexById(e.substr(4));if(b!=-1){if(a.checked&&c.getColumnsBy(this.isHideableColumn,this).length<=1){this.onDenyColumnHide();return false}c.setHidden(b,a.checked)}}if(e.substr(0,6)=="group-"||e.substr(0,4)=="col-"){a.checked=!a.checked;if(a.menu){var k=
function(m){m.items.each(function(n){if(!n.disabled){n.setChecked(a.checked,false);n.menu&&k(n.menu)}})};k(a.menu)}c=a;for(var l;c=c.parentMenu;){if(!c.parentMenu||!(l=c.parentMenu.items.get(c.getItemId()))||!l.setChecked)break;e=c.items.findIndexBy(function(m){return m.checked})>=0;l.setChecked(e,true)}a.checked=!a.checked}}return true},beforeColMenuShow:function(){var a=this.cm,b=this.cm.rows;this.colMenu.removeAll();for(var c=0,d=a.getColumnCount();c<d;c++){var e=this.colMenu,f=a.getColumnHeader(c),
g=[];if(a.config[c].fixed!==true&&a.config[c].hideable!==false){for(var h=0,j=b.length;h<j;h++){for(var k=b[h],l,m=0,n=0,p=k.length;n<p;n++){l=k[n];if(c>=m&&c<m+l.colspan)break;m+=l.colspan}if(l&&l.header)if(a.hierarchicalColMenu){k="group-"+h+"-"+m;n=(n=e.items?e.getComponent(k):null)?n.menu:null;if(!n){n=new Ext.menu.Menu({itemId:k});n.on("itemclick",this.handleHdMenuClick,this);p=false;var r=true,o=m;for(m=m+l.colspan;o<m;o++){a.isHidden(o)||(p=true);if(a.config[o].hideable!==false)r=false}e.add({itemId:k,
text:l.header,menu:n,hideOnClick:false,checked:p,disabled:r})}e=n}else g.push(l.header)}g.push(f);e.add(new Ext.menu.CheckItem({itemId:"col-"+a.getColumnId(c),text:g.join(" "),checked:!a.isHidden(c),hideOnClick:false,disabled:a.config[c].hideable===false}))}}},afterRenderUI:function(){this.constructor.prototype.afterRenderUI.apply(this,arguments);Ext.apply(this.columnDrop,Ext.ux.grid.ColumnHeaderGroup.prototype.columnDropConfig);Ext.apply(this.splitZone,Ext.ux.grid.ColumnHeaderGroup.prototype.splitZoneConfig)}},
splitZoneConfig:{allowHeaderDrag:function(a){return!a.getTarget(null,null,true).hasClass("ux-grid-hd-group-cell")}},columnDropConfig:{getTargetFromEvent:function(a){return this.view.findHeaderCell(Ext.lib.Event.getTarget(a))},positionIndicator:function(a,b,c){a=Ext.ux.grid.ColumnHeaderGroup.prototype.getDragDropData.call(this,a,b,c);if(a===false)return false;b=a.px+this.proxyOffsets[0];this.proxyTop.setLeftTop(b,a.r.top+this.proxyOffsets[1]);this.proxyTop.show();this.proxyBottom.setLeftTop(b,a.r.bottom);
this.proxyBottom.show();return a.pt},onNodeDrop:function(a,b,c,d){b=d.header;if(b!=a){a=Ext.ux.grid.ColumnHeaderGroup.prototype.getDragDropData.call(this,b,a,c);if(a===false)return false;c=this.grid.colModel;b=a.oldIndex<a.newIndex;d=c.rows;for(var e=a.row,f=d.length;e<f;e++){for(var g=d[e],h=g.length,j=0,k=1,l=h,m=0,n=0;m<h;m++){var p=g[m];if(a.oldIndex>=n&&a.oldIndex<n+p.colspan)j=m;if(a.oldIndex+a.colspan-1>=n&&a.oldIndex+a.colspan-1<n+p.colspan)k=m-j+1;if(a.newIndex>=n&&a.newIndex<n+p.colspan)l=
m;n+=p.colspan}h=g.splice(j,k);d[e]=g.splice(0,l-(b?k:0)).concat(h).concat(g)}for(d=0;d<a.colspan;d++){e=a.oldIndex+(b?0:d);f=a.newIndex+(b?-1:d);c.moveColumn(e,f);this.grid.fireEvent("columnmove",e,f)}return true}return false}},getGroupStyle:function(a,b){for(var c=0,d=true,e=b,f=b+a.colspan;e<f;e++)if(!this.cm.isHidden(e)){d=this.cm.getColumnWidth(e);if(typeof d=="number")c+=d;d=false}return{width:(Ext.isBorderBox||Ext.isWebKit&&!Ext.isSafari2?c:Math.max(c-this.borderWidth,0))+"px",hidden:d}},updateGroupStyles:function(a){for(var b=
this.mainHd.query(".x-grid3-header-offset > table"),c=this.getTotalWidth(),d=this.cm.rows,e=0;e<b.length;e++){b[e].style.width=c;if(e<d.length)for(var f=b[e].firstChild.firstChild.childNodes,g=0,h=0;g<f.length;g++){var j=d[e][g];if(typeof a!="number"||a>=h&&a<h+j.colspan){var k=Ext.ux.grid.ColumnHeaderGroup.prototype.getGroupStyle.call(this,j,h);f[g].style.width=k.width;f[g].style.display=k.hidden?"none":""}h+=j.colspan}}},getGroupRowIndex:function(a){if(a)if((a=a.className.match(this.hrowRe))&&a[1])return parseInt(a[1],
10);return this.cm.rows.length},getGroupSpan:function(a,b){if(a<0)return{col:0,colspan:this.cm.getColumnCount()};var c=this.cm.rows[a];if(c){for(var d=0,e=0,f=c.length;d<f;d++){var g=c[d];if(b>=e&&b<e+g.colspan)return{col:e,colspan:g.colspan};e+=g.colspan}return{col:e,colspan:0}}return{col:b,colspan:1}},getDragDropData:function(a,b,c){if(a.parentNode!=b.parentNode)return false;var d=this.grid.colModel,e=Ext.lib.Event.getPageX(c);c=Ext.lib.Dom.getRegion(b.firstChild);var f;if(c.right-e<=(c.right-c.left)/
2){e=c.right+this.view.borderWidth;f="after"}else{e=c.left;f="before"}var g=this.view.getCellIndex(a);b=this.view.getCellIndex(b);if(d.isFixed(b))return false;a=Ext.ux.grid.ColumnHeaderGroup.prototype.getGroupRowIndex.call(this.view,a);d=Ext.ux.grid.ColumnHeaderGroup.prototype.getGroupSpan.call(this.view,a,g);b=Ext.ux.grid.ColumnHeaderGroup.prototype.getGroupSpan.call(this.view,a,b);g=d.col;b=b.col+(f=="after"?b.colspan:0);if(b>=d.col&&b<=d.col+d.colspan)return false;var h=Ext.ux.grid.ColumnHeaderGroup.prototype.getGroupSpan.call(this.view,
a-1,g);if(b<h.col||b>h.col+h.colspan)return false;return{r:c,px:e,pt:f,row:a,oldIndex:g,newIndex:b,colspan:d.colspan}}});Ext.ns("Ext.ux.tree");
Ext.ux.tree.ColumnTree=Ext.extend(Ext.tree.TreePanel,{lines:false,borderWidth:Ext.isBorderBox?0:2,cls:"x-column-tree",onRender:function(){Ext.tree.ColumnTree.superclass.onRender.apply(this,arguments);this.headers=this.header.createChild({cls:"x-tree-headers"});for(var a=this.columns,b,c=0,d=0,e=a.length;d<e;d++){b=a[d];c+=b.width;this.headers.createChild({cls:"x-tree-hd "+(b.cls?b.cls+"-hd":""),cn:{cls:"x-tree-hd-text",html:b.header},style:"width:"+(b.width-this.borderWidth)+"px;"})}this.headers.createChild({cls:"x-clear"});
this.headers.setWidth(c+19);this.innerCt.setWidth(c)}});Ext.reg("columntree",Ext.ux.tree.ColumnTree);Ext.tree.ColumnTree=Ext.ux.tree.ColumnTree;
Ext.ux.tree.ColumnNodeUI=Ext.extend(Ext.tree.TreeNodeUI,{focus:Ext.emptyFn,renderElements:function(a,b,c,d){this.indentMarkup=a.parentNode?a.parentNode.ui.getChildIndent():"";var e=a.getOwnerTree(),f=e.columns;e=e.borderWidth;for(var g=f[0],h=['<li class="x-tree-node"><div ext:tree-node-id="',a.id,'" class="x-tree-node-el x-tree-node-leaf ',b.cls,'">','<div class="x-tree-col" style="width:',g.width-e,'px;">','<span class="x-tree-node-indent">',this.indentMarkup,"</span>",'<img src="',this.emptyIcon,
'" class="x-tree-ec-icon x-tree-elbow">','<img src="',b.icon||this.emptyIcon,'" class="x-tree-node-icon',b.icon?" x-tree-node-inline-icon":"",b.iconCls?" "+b.iconCls:"",'" unselectable="on">','<a hidefocus="on" class="x-tree-node-anchor" href="',b.href?b.href:"#",'" tabIndex="1" ',b.hrefTarget?' target="'+b.hrefTarget+'"':"",">",'<span unselectable="on">',a.text||(g.renderer?g.renderer(b[g.dataIndex],a,b):b[g.dataIndex]),"</span></a>","</div>"],j=1,k=f.length;j<k;j++){g=f[j];h.push('<div class="x-tree-col ',
g.cls?g.cls:"",'" style="width:',g.width-e,'px;">','<div class="x-tree-col-text">',g.renderer?g.renderer(b[g.dataIndex],a,b):b[g.dataIndex],"</div>","</div>")}h.push('<div class="x-clear"></div></div>','<ul class="x-tree-node-ct" style="display:none;"></ul>',"</li>");this.wrap=d!==true&&a.nextSibling&&a.nextSibling.ui.getEl()?Ext.DomHelper.insertHtml("beforeBegin",a.nextSibling.ui.getEl(),h.join("")):Ext.DomHelper.insertHtml("beforeEnd",c,h.join(""));this.elNode=this.wrap.childNodes[0];this.ctNode=
this.wrap.childNodes[1];a=this.elNode.firstChild.childNodes;this.indentNode=a[0];this.ecNode=a[1];this.iconNode=a[2];this.anchor=a[3];this.textNode=a[3].firstChild}});Ext.tree.ColumnNodeUI=Ext.ux.tree.ColumnNodeUI;
Ext.DataView.LabelEditor=Ext.extend(Ext.Editor,{alignment:"tl-tl",hideEl:false,cls:"x-small-editor",shim:false,completeOnEnter:true,cancelOnEsc:true,labelSelector:"span.x-editable",constructor:function(a,b){Ext.DataView.LabelEditor.superclass.constructor.call(this,b||new Ext.form.TextField({allowBlank:false,growMin:90,growMax:240,grow:true,selectOnFocus:true}),a)},init:function(a){this.view=a;a.on("render",this.initEditor,this);this.on("complete",this.onSave,this)},initEditor:function(){this.view.on({scope:this,
containerclick:this.doBlur,click:this.doBlur});this.view.getEl().on("mousedown",this.onMouseDown,this,{delegate:this.labelSelector})},doBlur:function(){this.editing&&this.field.blur()},onMouseDown:function(a,b){if(!a.ctrlKey&&!a.shiftKey){var c=this.view.findItemFromChild(b);a.stopEvent();c=this.view.store.getAt(this.view.indexOf(c));this.startEdit(b,c.data[this.dataIndex]);this.activeRecord=c}else a.preventDefault()},onSave:function(a,b){this.activeRecord.set(this.dataIndex,b)}});
Ext.DataView.DragSelector=function(a){function b(){m=[];j.all.each(function(o){m[m.length]=o.getRegion()});n=j.el.getRegion()}function c(){return false}function d(o){return!r||o.target==j.el.dom}function e(){j.on("containerclick",c,j,{single:true});if(k){k.dom.parentNode!==j.el.dom&&j.el.dom.appendChild(k.dom);k.setDisplayed("block")}else k=j.el.createChild({cls:"x-view-selector"});b();j.clearSelections()}function f(){var o=l.startXY,q=l.getXY(),s=Math.min(o[0],q[0]),t=Math.min(o[1],q[1]),u=Math.abs(o[0]-
q[0]);o=Math.abs(o[1]-q[1]);p.left=s;p.top=t;p.right=s+u;p.bottom=t+o;p.constrainTo(n);k.setRegion(p);s=0;for(t=m.length;s<t;s++){u=m[s];if((o=p.intersect(u))&&!u.selected){u.selected=true;j.select(s,true)}else if(!o&&u.selected){u.selected=false;j.deselect(s)}}}function g(){Ext.isIE||j.un("containerclick",c,j);k&&k.setDisplayed(false)}function h(o){l=new Ext.dd.DragTracker({onBeforeStart:d,onStart:e,onDrag:f,onEnd:g});l.initEl(o.el)}a=a||{};var j,k,l,m,n,p=new Ext.lib.Region(0,0,0,0),r=a.dragSafe===
true;this.init=function(o){j=o;j.on("render",h)}};Ext.ns("Ext.ux.form");
Ext.ux.form.FileUploadField=Ext.extend(Ext.form.TextField,{buttonText:"Browse...",buttonOnly:false,buttonOffset:3,readOnly:true,autoSize:Ext.emptyFn,initComponent:function(){Ext.ux.form.FileUploadField.superclass.initComponent.call(this);this.addEvents("fileselected")},onRender:function(a,b){Ext.ux.form.FileUploadField.superclass.onRender.call(this,a,b);this.wrap=this.el.wrap({cls:"x-form-field-wrap x-form-file-wrap"});this.el.addClass("x-form-file-text");this.el.dom.removeAttribute("name");this.createFileInput();
var c=Ext.applyIf(this.buttonCfg||{},{text:this.buttonText});this.button=new Ext.Button(Ext.apply(c,{renderTo:this.wrap,cls:"x-form-file-btn"+(c.iconCls?" x-btn-icon":"")}));if(this.buttonOnly){this.el.hide();this.wrap.setWidth(this.button.getEl().getWidth())}this.bindListeners();this.resizeEl=this.positionEl=this.wrap},bindListeners:function(){this.fileInput.on({scope:this,mouseenter:function(){this.button.addClass(["x-btn-over","x-btn-focus"])},mouseleave:function(){this.button.removeClass(["x-btn-over",
"x-btn-focus","x-btn-click"])},mousedown:function(){this.button.addClass("x-btn-click")},mouseup:function(){this.button.removeClass(["x-btn-over","x-btn-focus","x-btn-click"])},change:function(){var a=this.fileInput.dom.value;this.setValue(a);this.fireEvent("fileselected",this,a)}})},createFileInput:function(){this.fileInput=this.wrap.createChild({id:this.getFileInputId(),name:this.name||this.getId(),cls:"x-form-file",tag:"input",type:"file",size:1})},reset:function(){if(this.rendered){this.fileInput.remove();
this.createFileInput();this.bindListeners()}Ext.ux.form.FileUploadField.superclass.reset.call(this)},getFileInputId:function(){return this.id+"-file"},onResize:function(a,b){Ext.ux.form.FileUploadField.superclass.onResize.call(this,a,b);this.wrap.setWidth(a);if(!this.buttonOnly){a=this.wrap.getWidth()-this.button.getEl().getWidth()-this.buttonOffset;this.el.setWidth(a)}},onDestroy:function(){Ext.ux.form.FileUploadField.superclass.onDestroy.call(this);Ext.destroy(this.fileInput,this.button,this.wrap)},
onDisable:function(){Ext.ux.form.FileUploadField.superclass.onDisable.call(this);this.doDisable(true)},onEnable:function(){Ext.ux.form.FileUploadField.superclass.onEnable.call(this);this.doDisable(false)},doDisable:function(a){this.fileInput.dom.disabled=a;this.button.setDisabled(a)},preFocus:Ext.emptyFn,alignErrorIcon:function(){this.errorIcon.alignTo(this.wrap,"tl-tr",[2,0])}});Ext.reg("fileuploadfield",Ext.ux.form.FileUploadField);Ext.form.FileUploadField=Ext.ux.form.FileUploadField;
Ext.ux.GMapPanel=Ext.extend(Ext.Panel,{initComponent:function(){Ext.applyIf(this,{plain:true,zoomLevel:3,yaw:180,pitch:0,zoom:0,gmapType:"map",border:false});Ext.ux.GMapPanel.superclass.initComponent.call(this)},afterRender:function(){var a=this.ownerCt.getSize();Ext.applyIf(this,a);Ext.ux.GMapPanel.superclass.afterRender.call(this);if(this.gmapType==="map")this.gmap=new GMap2(this.body.dom);if(this.gmapType==="panorama")this.gmap=new GStreetviewPanorama(this.body.dom);typeof this.addControl=="object"&&
this.gmapType==="map"&&this.gmap.addControl(this.addControl);if(typeof this.setCenter==="object"){if(typeof this.setCenter.geoCodeAddr==="string")this.geoCodeLookup(this.setCenter.geoCodeAddr);else{if(this.gmapType==="map"){var b=new GLatLng(this.setCenter.lat,this.setCenter.lng);this.gmap.setCenter(b,this.zoomLevel)}typeof this.setCenter.marker==="object"&&typeof b==="object"&&this.addMarker(b,this.setCenter.marker,this.setCenter.marker.clear)}this.gmapType==="panorama"&&this.gmap.setLocationAndPOV(new GLatLng(this.setCenter.lat,
this.setCenter.lng),{yaw:this.yaw,pitch:this.pitch,zoom:this.zoom})}GEvent.bind(this.gmap,"load",this,function(){this.onMapReady()})},onMapReady:function(){this.addMarkers(this.markers);this.addMapControls();this.addOptions()},onResize:function(a,b){typeof this.getMap()=="object"&&this.gmap.checkResize();Ext.ux.GMapPanel.superclass.onResize.call(this,a,b)},setSize:function(a,b,c){typeof this.getMap()=="object"&&this.gmap.checkResize();Ext.ux.GMapPanel.superclass.setSize.call(this,a,b,c)},getMap:function(){return this.gmap},
getCenter:function(){return this.getMap().getCenter()},getCenterLatLng:function(){var a=this.getCenter();return{lat:a.lat(),lng:a.lng()}},addMarkers:function(a){if(Ext.isArray(a))for(var b=0;b<a.length;b++)this.addMarker(new GLatLng(a[b].lat,a[b].lng),a[b].marker,false,a[b].setCenter,a[b].listeners)},addMarker:function(a,b,c,d,e){Ext.applyIf(b,G_DEFAULT_ICON);c===true&&this.getMap().clearOverlays();d===true&&this.getMap().setCenter(a,this.zoomLevel);a=new GMarker(a,b);if(typeof e==="object")for(evt in e)GEvent.bind(a,
evt,this,e[evt]);this.getMap().addOverlay(a)},addMapControls:function(){if(this.gmapType==="map")if(Ext.isArray(this.mapControls))for(i=0;i<this.mapControls.length;i++)this.addMapControl(this.mapControls[i]);else if(typeof this.mapControls==="string")this.addMapControl(this.mapControls);else typeof this.mapControls==="object"&&this.getMap().addControl(this.mapControls)},addMapControl:function(a){a=window[a];typeof a==="function"&&this.getMap().addControl(new a)},addOptions:function(){if(Ext.isArray(this.mapConfOpts))for(i=
0;i<this.mapConfOpts.length;i++)this.addOption(this.mapConfOpts[i]);else typeof this.mapConfOpts==="string"&&this.addOption(this.mapConfOpts)},addOption:function(a){typeof this.getMap()[a]==="function"&&this.getMap()[a]()},geoCodeLookup:function(a){this.geocoder=new GClientGeocoder;this.geocoder.getLocations(a,this.addAddressToMap.createDelegate(this))},addAddressToMap:function(a){if(!a||a.Status.code!=200)Ext.MessageBox.alert("Error","Code "+a.Status.code+" Error Returned");else{place=a.Placemark[0];
addressinfo=place.AddressDetails;accuracy=addressinfo.Accuracy;if(accuracy===0)Ext.MessageBox.alert("Unable to Locate Address","Unable to Locate the Address you provided");else if(accuracy<7)Ext.MessageBox.alert("Address Accuracy","The address provided has a low accuracy.<br><br>Level "+accuracy+" Accuracy (8 = Exact Match, 1 = Vague Match)");else{point=new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]);typeof this.setCenter.marker==="object"&&typeof point==="object"&&this.addMarker(point,
this.setCenter.marker,this.setCenter.marker.clear,true,this.setCenter.listeners)}}}});Ext.reg("gmappanel",Ext.ux.GMapPanel);Ext.namespace("Ext.ux.grid");
Ext.ux.grid.GridFilters=Ext.extend(Ext.util.Observable,{autoReload:true,filterCls:"ux-filtered-column",local:false,menuFilterText:"Filters",paramPrefix:"filter",showMenu:true,stateId:undefined,updateBuffer:500,constructor:function(a){a=a||{};this.deferredUpdate=new Ext.util.DelayedTask(this.reload,this);this.filters=new Ext.util.MixedCollection;this.filters.getKey=function(b){return b?b.dataIndex:null};this.addFilters(a.filters);delete a.filters;Ext.apply(this,a)},init:function(a){if(a instanceof
Ext.grid.GridPanel){this.grid=a;this.bindStore(this.grid.getStore(),true);this.filters.getCount()==0&&this.addFilters(this.grid.getColumnModel());this.grid.filters=this;this.grid.addEvents({filterupdate:true});a.on({scope:this,beforestaterestore:this.applyState,beforestatesave:this.saveState,beforedestroy:this.destroy,reconfigure:this.onReconfigure});a.rendered?this.onRender():a.on({scope:this,single:true,render:this.onRender})}else if(a instanceof Ext.PagingToolbar)this.toolbar=a},applyState:function(a,
b){var c,d;this.applyingState=true;this.clearFilters();if(b.filters)for(c in b.filters)if(d=this.filters.get(c)){d.setValue(b.filters[c]);d.setActive(true)}this.deferredUpdate.cancel();this.local&&this.reload();delete this.applyingState;delete b.filters},saveState:function(a,b){var c={};this.filters.each(function(d){if(d.active)c[d.dataIndex]=d.getValue()});return b.filters=c},onRender:function(){this.grid.getView().on("refresh",this.onRefresh,this);this.createMenu()},destroy:function(){this.removeAll();
this.purgeListeners();if(this.filterMenu){Ext.menu.MenuMgr.unregister(this.filterMenu);this.filterMenu.destroy();this.filterMenu=this.menu.menu=null}},removeAll:function(){if(this.filters){Ext.destroy.apply(Ext,this.filters.items);this.filters.clear()}},bindStore:function(a,b){if(!b&&this.store)this.local?a.un("load",this.onLoad,this):a.un("beforeload",this.onBeforeLoad,this);if(a)this.local?a.on("load",this.onLoad,this):a.on("beforeload",this.onBeforeLoad,this);this.store=a},onReconfigure:function(){this.bindStore(this.grid.getStore());
this.store.clearFilter();this.removeAll();this.addFilters(this.grid.getColumnModel());this.updateColumnHeadings()},createMenu:function(){var a=this.grid.getView().hmenu;if(this.showMenu&&a){this.sep=a.addSeparator();this.filterMenu=new Ext.menu.Menu({id:this.grid.id+"-filters-menu"});this.menu=a.add({checked:false,itemId:"filters",text:this.menuFilterText,menu:this.filterMenu});this.menu.on({scope:this,checkchange:this.onCheckChange,beforecheckchange:this.onBeforeCheck});a.on("beforeshow",this.onMenu,
this)}this.updateColumnHeadings()},getMenuFilter:function(){var a=this.grid.getView();if(!a||a.hdCtxIndex===undefined)return null;return this.filters.get(a.cm.config[a.hdCtxIndex].dataIndex)},onMenu:function(){var a=this.getMenuFilter();if(a){this.menu.menu=a.menu;this.menu.setChecked(a.active,false);this.menu.setDisabled(a.disabled===true)}this.menu.setVisible(a!==undefined);this.sep.setVisible(a!==undefined)},onCheckChange:function(a,b){this.getMenuFilter().setActive(b)},onBeforeCheck:function(a,
b){return!b||this.getMenuFilter().isActivatable()},onStateChange:function(a,b){if(a!=="serialize"){b==this.getMenuFilter()&&this.menu.setChecked(b.active,false);if((this.autoReload||this.local)&&!this.applyingState)this.deferredUpdate.delay(this.updateBuffer);this.updateColumnHeadings();this.applyingState||this.grid.saveState();this.grid.fireEvent("filterupdate",this,b)}},onBeforeLoad:function(a,b){b.params=b.params||{};this.cleanParams(b.params);var c=this.buildQuery(this.getFilterData());Ext.apply(b.params,
c)},onLoad:function(a){a.filterBy(this.getRecordFilter())},onRefresh:function(){this.updateColumnHeadings()},updateColumnHeadings:function(){var a=this.grid.getView(),b,c,d;if(a.mainHd){b=0;for(c=a.cm.config.length;b<c;b++){d=this.getFilter(a.cm.config[b].dataIndex);Ext.fly(a.getHeaderCell(b))[d&&d.active?"addClass":"removeClass"](this.filterCls)}}},reload:function(){if(this.local){this.grid.store.clearFilter(true);this.grid.store.filterBy(this.getRecordFilter())}else{var a,b=this.grid.store;this.deferredUpdate.cancel();
if(this.toolbar){a=b.paramNames.start;if(b.lastOptions&&b.lastOptions.params&&b.lastOptions.params[a])b.lastOptions.params[a]=0}b.reload()}},getRecordFilter:function(){var a=[],b,c;this.filters.each(function(d){d.active&&a.push(d)});b=a.length;return function(d){for(c=0;c<b;c++)if(!a[c].validateRecord(d))return false;return true}},addFilter:function(a){var b=this.getFilterClass(a.type);a=a.menu?a:new b(a);this.filters.add(a);Ext.util.Observable.capture(a,this.onStateChange,this);return a},addFilters:function(a){if(a){var b,
c,d,e=false,f;if(a instanceof Ext.grid.ColumnModel){a=a.config;e=true}b=0;for(c=a.length;b<c;b++){if(e){f=a[b].dataIndex;if(d=a[b].filter||a[b].filterable){d=d===true?{}:d;Ext.apply(d,{dataIndex:f});d.type=d.type||this.store.fields.get(f).type.type}}else d=a[b];d&&this.addFilter(d)}}},getFilter:function(a){return this.filters.get(a)},clearFilters:function(){this.filters.each(function(a){a.setActive(false)})},getFilterData:function(){var a=[],b,c;this.filters.each(function(d){if(d.active){var e=[].concat(d.serialize());
b=0;for(c=e.length;b<c;b++)a.push({field:d.dataIndex,data:e[b]})}});return a},buildQuery:function(a){var b={},c,d,e,f,g=a.length;if(this.encode){f=[];for(c=0;c<g;c++){d=a[c];f.push(Ext.apply({},{field:d.field},d.data))}if(f.length>0)b[this.paramPrefix]=Ext.util.JSON.encode(f)}else for(c=0;c<g;c++){d=a[c];e=[this.paramPrefix,"[",c,"]"].join("");b[e+"[field]"]=d.field;e=e+"[data]";for(f in d.data)b[[e,"[",f,"]"].join("")]=d.data[f]}return b},cleanParams:function(a){if(this.encode)delete a[this.paramPrefix];
else{var b,c;b=RegExp("^"+this.paramPrefix+"[[0-9]+]");for(c in a)b.test(c)&&delete a[c]}},getFilterClass:function(a){switch(a){case "auto":a="string";break;case "int":case "float":a="numeric";break;case "bool":a="boolean"}return Ext.ux.grid.filter[a.substr(0,1).toUpperCase()+a.substr(1)+"Filter"]}});Ext.preg("gridfilters",Ext.ux.grid.GridFilters);Ext.namespace("Ext.ux.grid.filter");
Ext.ux.grid.filter.Filter=Ext.extend(Ext.util.Observable,{active:false,dataIndex:null,menu:null,updateBuffer:500,constructor:function(a){Ext.apply(this,a);this.addEvents("activate","deactivate","serialize","update");Ext.ux.grid.filter.Filter.superclass.constructor.call(this);this.menu=new Ext.menu.Menu;this.init(a);if(a&&a.value){this.setValue(a.value);this.setActive(a.active!==false,true);delete a.value}},destroy:function(){this.menu&&this.menu.destroy();this.purgeListeners()},init:Ext.emptyFn,getValue:Ext.emptyFn,
setValue:Ext.emptyFn,isActivatable:function(){return true},getSerialArgs:Ext.emptyFn,validateRecord:function(){return true},serialize:function(){var a=this.getSerialArgs();this.fireEvent("serialize",a,this);return a},fireUpdate:function(){this.active&&this.fireEvent("update",this);this.setActive(this.isActivatable())},setActive:function(a,b){if(this.active!=a){this.active=a;if(b!==true)this.fireEvent(a?"activate":"deactivate",this)}}});
Ext.ux.grid.filter.BooleanFilter=Ext.extend(Ext.ux.grid.filter.Filter,{defaultValue:false,yesText:"Yes",noText:"No",init:function(){var a=Ext.id();this.options=[new Ext.menu.CheckItem({text:this.yesText,group:a,checked:this.defaultValue===true}),new Ext.menu.CheckItem({text:this.noText,group:a,checked:this.defaultValue===false})];this.menu.add(this.options[0],this.options[1]);for(a=0;a<this.options.length;a++){this.options[a].on("click",this.fireUpdate,this);this.options[a].on("checkchange",this.fireUpdate,
this)}},getValue:function(){return this.options[0].checked},setValue:function(a){this.options[a?0:1].setChecked(true)},getSerialArgs:function(){return{type:"boolean",value:this.getValue()}},validateRecord:function(a){return a.get(this.dataIndex)==this.getValue()}});
Ext.ux.grid.filter.DateFilter=Ext.extend(Ext.ux.grid.filter.Filter,{afterText:"After",beforeText:"Before",compareMap:{before:"lt",after:"gt",on:"eq"},dateFormat:"m/d/Y",menuItems:["before","after","-","on"],menuItemCfgs:{selectOnFocus:true,width:125},onText:"On",pickerOpts:{},init:function(){var a,b,c,d,e,f;a=Ext.apply(this.pickerOpts,{minDate:this.minDate,maxDate:this.maxDate,format:this.dateFormat,listeners:{scope:this,select:this.onMenuSelect}});this.fields={};b=0;for(c=this.menuItems.length;b<
c;b++){d=this.menuItems[b];if(d!=="-"){e={itemId:"range-"+d,text:this[d+"Text"],menu:new Ext.menu.DateMenu(Ext.apply(a,{itemId:d})),listeners:{scope:this,checkchange:this.onCheckChange}};f=Ext.menu.CheckItem;d=this.fields[d]=new f(e)}this.menu.add(d)}},onCheckChange:function(){this.setActive(this.isActivatable());this.fireEvent("update",this)},onInputKeyUp:function(a,b){if(b.getKey()==b.RETURN&&a.isValid()){b.stopEvent();this.menu.hide(true)}},onMenuSelect:function(a,b){var c=this.fields,d=this.fields[a.itemId];
d.setChecked(true);if(d==c.on){c.before.setChecked(false,true);c.after.setChecked(false,true)}else{c.on.setChecked(false,true);if(d==c.after&&c.before.menu.picker.value<b)c.before.setChecked(false,true);else d==c.before&&c.after.menu.picker.value>b&&c.after.setChecked(false,true)}this.fireEvent("update",this)},getValue:function(){var a,b={};for(a in this.fields)if(this.fields[a].checked)b[a]=this.fields[a].menu.picker.getValue();return b},setValue:function(a,b){for(var c in this.fields)if(a[c]){this.fields[c].menu.picker.setValue(a[c]);
this.fields[c].setChecked(true)}else b||this.fields[c].setChecked(false);this.fireEvent("update",this)},isActivatable:function(){for(var a in this.fields)if(this.fields[a].checked)return true;return false},getSerialArgs:function(){var a=[],b;for(b in this.fields)this.fields[b].checked&&a.push({type:"date",comparison:this.compareMap[b],value:this.getFieldValue(b).format(this.dateFormat)});return a},getFieldValue:function(a){return this.fields[a].menu.picker.getValue()},getPicker:function(a){return this.fields[a].menu.picker},
validateRecord:function(a){var b,c=a.get(this.dataIndex);if(!Ext.isDate(c))return false;c=c.clearTime(true).getTime();for(b in this.fields)if(this.fields[b].checked){a=this.getFieldValue(b).clearTime(true).getTime();if(b=="before"&&a<=c)return false;if(b=="after"&&a>=c)return false;if(b=="on"&&a!=c)return false}return true}});
Ext.ux.grid.filter.ListFilter=Ext.extend(Ext.ux.grid.filter.Filter,{phpMode:false,init:function(a){this.dt=new Ext.util.DelayedTask(this.fireUpdate,this);this.menu&&this.menu.destroy();this.menu=new Ext.ux.menu.ListMenu(a);this.menu.on("checkchange",this.onCheckChange,this)},getValue:function(){return this.menu.getSelected()},setValue:function(a){this.menu.setSelected(a);this.fireEvent("update",this)},isActivatable:function(){return this.getValue().length>0},getSerialArgs:function(){return{type:"list",
value:this.phpMode?this.getValue().join(","):this.getValue()}},onCheckChange:function(){this.dt.delay(this.updateBuffer)},validateRecord:function(a){return this.getValue().indexOf(a.get(this.dataIndex))>-1}});
Ext.ux.grid.filter.NumericFilter=Ext.extend(Ext.ux.grid.filter.Filter,{fieldCls:Ext.form.NumberField,iconCls:{gt:"ux-rangemenu-gt",lt:"ux-rangemenu-lt",eq:"ux-rangemenu-eq"},menuItemCfgs:{emptyText:"Enter Filter Text...",selectOnFocus:true,width:125},menuItems:["lt","gt","-","eq"],init:function(a){this.menu&&this.menu.destroy();this.menu=new Ext.ux.menu.RangeMenu(Ext.apply(a,{fieldCfg:this.fieldCfg||{},fieldCls:this.fieldCls,fields:this.fields||{},iconCls:this.iconCls,menuItemCfgs:this.menuItemCfgs,
menuItems:this.menuItems,updateBuffer:this.updateBuffer}));this.menu.on("update",this.fireUpdate,this)},getValue:function(){return this.menu.getValue()},setValue:function(a){this.menu.setValue(a)},isActivatable:function(){var a=this.getValue();for(key in a)if(a[key]!==undefined)return true;return false},getSerialArgs:function(){var a,b=[],c=this.menu.getValue();for(a in c)b.push({type:"numeric",comparison:a,value:c[a]});return b},validateRecord:function(a){a=a.get(this.dataIndex);var b=this.getValue();
if(b.eq!==undefined&&a!=b.eq)return false;if(b.lt!==undefined&&a>=b.lt)return false;if(b.gt!==undefined&&a<=b.gt)return false;return true}});
Ext.ux.grid.filter.StringFilter=Ext.extend(Ext.ux.grid.filter.Filter,{iconCls:"ux-gridfilter-text-icon",emptyText:"Enter Filter Text...",selectOnFocus:true,width:125,init:function(a){Ext.applyIf(a,{enableKeyEvents:true,iconCls:this.iconCls,listeners:{scope:this,keyup:this.onInputKeyUp}});this.inputItem=new Ext.form.TextField(a);this.menu.add(this.inputItem);this.updateTask=new Ext.util.DelayedTask(this.fireUpdate,this)},getValue:function(){return this.inputItem.getValue()},setValue:function(a){this.inputItem.setValue(a);
this.fireEvent("update",this)},isActivatable:function(){return this.inputItem.getValue().length>0},getSerialArgs:function(){return{type:"string",value:this.getValue()}},validateRecord:function(a){a=a.get(this.dataIndex);if(typeof a!="string")return this.getValue().length===0;return a.toLowerCase().indexOf(this.getValue().toLowerCase())>-1},onInputKeyUp:function(a,b){if(b.getKey()==b.RETURN&&a.isValid()){b.stopEvent();this.menu.hide(true)}else this.updateTask.delay(this.updateBuffer)}});Ext.namespace("Ext.ux.menu");
Ext.ux.menu.ListMenu=Ext.extend(Ext.menu.Menu,{labelField:"text",loadingText:"Loading...",loadOnShow:true,single:false,constructor:function(a){this.selected=[];this.addEvents("checkchange");Ext.ux.menu.ListMenu.superclass.constructor.call(this,a=a||{});if(!a.store&&a.options){for(var b=[],c=0,d=a.options.length;c<d;c++){var e=a.options[c];switch(Ext.type(e)){case "array":b.push(e);break;case "object":b.push([e.id,e[this.labelField]]);break;case "string":b.push([e,e])}}this.store=new Ext.data.Store({reader:new Ext.data.ArrayReader({id:0},
["id",this.labelField]),data:b,listeners:{load:this.onLoad,scope:this}});this.loaded=true}else{this.add({text:this.loadingText,iconCls:"loading-indicator"});this.store.on("load",this.onLoad,this)}},destroy:function(){this.store&&this.store.destroy();Ext.ux.menu.ListMenu.superclass.destroy.call(this)},show:function(){var a=null;return function(){if(arguments.length===0)Ext.ux.menu.ListMenu.superclass.show.apply(this,a);else{a=arguments;this.loadOnShow&&!this.loaded&&this.store.load();Ext.ux.menu.ListMenu.superclass.show.apply(this,
arguments)}}}(),onLoad:function(a,b){var c=this.isVisible();this.hide(false);this.removeAll(true);for(var d=this.single?Ext.id():null,e=0,f=b.length;e<f;e++){var g=new Ext.menu.CheckItem({text:b[e].get(this.labelField),group:d,checked:this.selected.indexOf(b[e].id)>-1,hideOnClick:false});g.itemId=b[e].id;g.on("checkchange",this.checkChange,this);this.add(g)}this.loaded=true;c&&this.show();this.fireEvent("load",this,b)},getSelected:function(){return this.selected},setSelected:function(a){a=this.selected=
[].concat(a);this.loaded&&this.items.each(function(b){b.setChecked(false,true);for(var c=0,d=a.length;c<d;c++)b.itemId==a[c]&&b.setChecked(true,true)},this)},checkChange:function(a,b){var c=[];this.items.each(function(d){d.checked&&c.push(d.itemId)},this);this.selected=c;this.fireEvent("checkchange",a,b)}});Ext.ns("Ext.ux.menu");
Ext.ux.menu.RangeMenu=Ext.extend(Ext.menu.Menu,{constructor:function(a){Ext.ux.menu.RangeMenu.superclass.constructor.call(this,a);this.addEvents("update");this.updateTask=new Ext.util.DelayedTask(this.fireUpdate,this);var b,c,d,e;a=0;for(b=this.menuItems.length;a<b;a++){c=this.menuItems[a];if(c!=="-"){d={itemId:"range-"+c,enableKeyEvents:true,iconCls:this.iconCls[c]||"no-icon",listeners:{scope:this,keyup:this.onInputKeyUp}};Ext.apply(d,Ext.applyIf(this.fields[c]||{},this.fieldCfg[c]),this.menuItemCfgs);
e=d.fieldCls||this.fieldCls;c=this.fields[c]=new e(d)}this.add(c)}},fireUpdate:function(){this.fireEvent("update",this)},getValue:function(){var a={},b,c;for(b in this.fields){c=this.fields[b];if(c.isValid()&&String(c.getValue()).length>0)a[b]=c.getValue()}return a},setValue:function(a){for(var b in this.fields)this.fields[b].setValue(a[b]!==undefined?a[b]:"");this.fireEvent("update",this)},onInputKeyUp:function(a,b){if(b.getKey()==b.RETURN&&a.isValid()){b.stopEvent();this.hide(true)}else{if(a==this.fields.eq){this.fields.gt&&
this.fields.gt.setValue(null);this.fields.lt&&this.fields.lt.setValue(null)}else this.fields.eq.setValue(null);this.updateTask.delay(this.updateBuffer)}}});Ext.ns("Ext.ux.grid");
Ext.ux.grid.GroupSummary=Ext.extend(Ext.util.Observable,{constructor:function(a){Ext.apply(this,a);Ext.ux.grid.GroupSummary.superclass.constructor.call(this)},init:function(a){this.grid=a;a=this.view=a.getView();a.doGroupEnd=this.doGroupEnd.createDelegate(this);a.afterMethod("onColumnWidthUpdated",this.doWidth,this);a.afterMethod("onAllColumnWidthsUpdated",this.doAllWidths,this);a.afterMethod("onColumnHiddenUpdated",this.doHidden,this);a.afterMethod("onUpdate",this.doUpdate,this);a.afterMethod("onRemove",
this.doRemove,this);if(!this.rowTpl){this.rowTpl=new Ext.Template('<div class="x-grid3-summary-row" style="{tstyle}">','<table class="x-grid3-summary-table" border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',"<tbody><tr>{cells}</tr></tbody>","</table></div>");this.rowTpl.disableFormats=true}this.rowTpl.compile();if(!this.cellTpl){this.cellTpl=new Ext.Template('<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} {css}" style="{style}">','<div class="x-grid3-cell-inner x-grid3-col-{id}" unselectable="on">{value}</div>',
"</td>");this.cellTpl.disableFormats=true}this.cellTpl.compile()},toggleSummaries:function(a){var b=this.grid.getGridEl();if(b){if(a===undefined)a=b.hasClass("x-grid-hide-summary");b[a?"removeClass":"addClass"]("x-grid-hide-summary")}},renderSummary:function(a,b){b=b||this.view.getColumnData();for(var c=this.grid.getColumnModel().config,d=[],e,f={},g,h=b.length-1,j=0,k=b.length;j<k;j++){e=b[j];g=c[j];f.id=e.id;f.style=e.style;f.css=j==0?"x-grid3-cell-first ":j==h?"x-grid3-cell-last ":"";f.value=g.summaryType||
g.summaryRenderer?(g.summaryRenderer||e.renderer)(a.data[e.name],f,a):"";if(f.value==undefined||f.value==="")f.value="&#160;";d[d.length]=this.cellTpl.apply(f)}return this.rowTpl.apply({tstyle:"width:"+this.view.getTotalWidth()+";",cells:d.join("")})},calculate:function(a,b){for(var c={},d,e,f=this.grid.getColumnModel().config,g,h=0,j=a.length;h<j;h++){d=a[h];for(var k=0,l=b.length;k<l;k++){e=b[k];g=f[k];if(g.summaryType)c[e.name]=Ext.ux.grid.GroupSummary.Calculations[g.summaryType](c[e.name]||0,
d,e.name,c)}}return c},doGroupEnd:function(a,b,c){b=this.calculate(b.rs,c);a.push("</div>",this.renderSummary({data:b},c),"</div>")},doWidth:function(a,b,c){if(this.isGrouped())for(var d=this.view.getGroups(),e=d.length,f=0,g;f<e;++f){g=d[f].childNodes[2];g.style.width=c;g.firstChild.style.width=c;g.firstChild.rows[0].childNodes[a].style.width=b}},doAllWidths:function(a,b){if(this.isGrouped())for(var c=this.view.getGroups(),d=c.length,e=0,f,g,h=a.length;e<d;e++){f=c[e].childNodes[2];f.style.width=
b;f.firstChild.style.width=b;g=f.firstChild.rows[0].childNodes;for(f=0;f<h;f++)g[f].style.width=a[f]}},doHidden:function(a,b,c){if(this.isGrouped())for(var d=this.view.getGroups(),e=d.length,f=0,g=b?"none":"";f<e;f++){b=d[f].childNodes[2];b.style.width=c;b.firstChild.style.width=c;b.firstChild.rows[0].childNodes[a].style.display=g}},isGrouped:function(){return!Ext.isEmpty(this.grid.getStore().groupField)},refreshSummary:function(a){return this.refreshSummaryById(this.view.getGroupId(a))},getSummaryNode:function(a){if(a=
Ext.fly(a,"_gsummary"))return a.down(".x-grid3-summary-row",true);return null},refreshSummaryById:function(a){var b=Ext.getDom(a);if(!b)return false;var c=[];this.grid.getStore().each(function(f){if(f._groupId==a)c[c.length]=f});var d=this.view.getColumnData();d=this.renderSummary({data:this.calculate(c,d)},d);var e=this.getSummaryNode(a);e&&b.removeChild(e);Ext.DomHelper.append(b,d);return true},doUpdate:function(a,b){this.refreshSummaryById(b._groupId)},doRemove:function(a,b,c,d){d||this.refreshSummaryById(b._groupId)},
showSummaryMsg:function(a,b){var c=this.getSummaryNode(this.view.getGroupId(a));if(c)c.innerHTML='<div class="x-grid3-summary-msg">'+b+"</div>"}});Ext.grid.GroupSummary=Ext.ux.grid.GroupSummary;
Ext.ux.grid.GroupSummary.Calculations={sum:function(a,b,c){return a+(b.data[c]||0)},count:function(a,b,c,d){return d[c+"count"]?++d[c+"count"]:d[c+"count"]=1},max:function(a,b,c,d){a=b.data[c];b=d[c+"max"]===undefined?d[c+"max"]=a:d[c+"max"];return a>b?d[c+"max"]=a:b},min:function(a,b,c,d){a=b.data[c];b=d[c+"min"]===undefined?d[c+"min"]=a:d[c+"min"];return a<b?d[c+"min"]=a:b},average:function(a,b,c,d){a=d[c+"count"]?++d[c+"count"]:d[c+"count"]=1;b=d[c+"total"]=(d[c+"total"]||0)+(b.data[c]||0);return b===
0?0:b/a}};Ext.grid.GroupSummary.Calculations=Ext.ux.grid.GroupSummary.Calculations;
Ext.ux.grid.HybridSummary=Ext.extend(Ext.ux.grid.GroupSummary,{calculate:function(a,b){var c=this.view.getGroupField();return this.getSummaryData(a[0].data[c])||Ext.ux.grid.HybridSummary.superclass.calculate.call(this,a,b)},updateSummaryData:function(a,b,c){var d=this.grid.getStore().reader.jsonData;if(!d.summaryData)d.summaryData={};d.summaryData[a]=b;c||this.refreshSummary(a)},getSummaryData:function(a){var b=this.grid.getStore().reader,c=b.jsonData,d=b.recordType.prototype.fields;if(c&&c.summaryData)if(a=
c.summaryData[a])return b.extractValues(a,d.items,d.length);return null}});Ext.grid.HybridSummary=Ext.ux.grid.HybridSummary;
Ext.ux.GroupTab=Ext.extend(Ext.Container,{mainItem:0,expanded:true,deferredRender:true,activeTab:null,idDelimiter:"__",headerAsText:false,frame:false,hideBorders:true,initComponent:function(a){Ext.apply(this,a);this.frame=false;Ext.ux.GroupTab.superclass.initComponent.call(this);this.addEvents("activate","deactivate","changemainitem","beforetabchange","tabchange");this.setLayout(new Ext.layout.CardLayout({deferredRender:this.deferredRender}));if(!this.stack)this.stack=Ext.TabPanel.AccessStack();this.initItems();
this.on("beforerender",function(){this.groupEl=this.ownerCt.getGroupEl(this)},this);this.on("add",this.onAdd,this,{target:this});this.on("remove",this.onRemove,this,{target:this});if(this.mainItem!==undefined){a=typeof this.mainItem=="object"?this.mainItem:this.items.get(this.mainItem);delete this.mainItem;this.setMainItem(a)}},setActiveTab:function(a){a=this.getComponent(a);if(!a)return false;if(!this.rendered){this.activeTab=a;return true}if(this.activeTab!=a&&this.fireEvent("beforetabchange",this,
a,this.activeTab)!==false){if(this.activeTab&&this.activeTab!=this.mainItem){var b=this.getTabEl(this.activeTab);b&&Ext.fly(b).removeClass("x-grouptabs-strip-active")}b=this.getTabEl(a);Ext.fly(b).addClass("x-grouptabs-strip-active");this.activeTab=a;this.stack.add(a);this.layout.setActiveItem(a);this.layoutOnTabChange&&a.doLayout&&a.doLayout();this.scrolling&&this.scrollToTab(a,this.animScroll);this.fireEvent("tabchange",this,a);return true}return false},getTabEl:function(a){if(a==this.mainItem)return this.groupEl;
return Ext.TabPanel.prototype.getTabEl.call(this,a)},onRender:function(a,b){Ext.ux.GroupTab.superclass.onRender.call(this,a,b);this.strip=Ext.fly(this.groupEl).createChild({tag:"ul",cls:"x-grouptabs-sub"});this.tooltip=new Ext.ToolTip({target:this.groupEl,delegate:"a.x-grouptabs-text",trackMouse:true,renderTo:document.body,listeners:{beforeshow:function(d){var e=d.triggerElement.parentNode===this.mainItem.tabEl?this.mainItem:this.findById(d.triggerElement.parentNode.id.split(this.idDelimiter)[1]);
if(!e.tabTip)return false;d.body.dom.innerHTML=e.tabTip},scope:this}});if(!this.itemTpl){var c=new Ext.Template('<li class="{cls}" id="{id}">','<a onclick="return false;" class="x-grouptabs-text {iconCls}">{text}</a>',"</li>");c.disableFormats=true;c.compile();Ext.ux.GroupTab.prototype.itemTpl=c}this.items.each(this.initTab,this)},afterRender:function(){Ext.ux.GroupTab.superclass.afterRender.call(this);if(this.activeTab!==undefined){var a=typeof this.activeTab=="object"?this.activeTab:this.items.get(this.activeTab);
delete this.activeTab;this.setActiveTab(a)}},initTab:function(a,b){var c=this.strip.dom.childNodes[b],d=Ext.TabPanel.prototype.getTemplateArgs.call(this,a);if(a===this.mainItem){a.tabEl=this.groupEl;d.cls+=" x-grouptabs-main-item"}c=c?this.itemTpl.insertBefore(c,d):this.itemTpl.append(this.strip,d);a.tabEl=a.tabEl||c;a.on("disable",this.onItemDisabled,this);a.on("enable",this.onItemEnabled,this);a.on("titlechange",this.onItemTitleChanged,this);a.on("iconchange",this.onItemIconChanged,this);a.on("beforeshow",
this.onBeforeShowItem,this)},setMainItem:function(a){a=this.getComponent(a);if(!(!a||this.fireEvent("changemainitem",this,a,this.mainItem)===false))this.mainItem=a},getMainItem:function(){return this.mainItem||null},onBeforeShowItem:function(a){if(a!=this.activeTab){this.setActiveTab(a);return false}},onAdd:function(a,b,c){this.rendered&&this.initTab.call(this,b,c)},onRemove:function(a,b){Ext.destroy(Ext.get(this.getTabEl(b)));this.stack.remove(b);b.un("disable",this.onItemDisabled,this);b.un("enable",
this.onItemEnabled,this);b.un("titlechange",this.onItemTitleChanged,this);b.un("iconchange",this.onItemIconChanged,this);b.un("beforeshow",this.onBeforeShowItem,this);if(b==this.activeTab){var c=this.stack.next();if(c)this.setActiveTab(c);else if(this.items.getCount()>0)this.setActiveTab(0);else this.activeTab=null}},onBeforeAdd:function(a){if(a.events?this.items.containsKey(a.getItemId())?a:null:this.items.get(a)){this.setActiveTab(a);return false}Ext.TabPanel.superclass.onBeforeAdd.apply(this,arguments);
var b=a.elements;a.elements=b?b.replace(",header",""):b;a.border=a.border===true},onItemDisabled:Ext.TabPanel.prototype.onItemDisabled,onItemEnabled:Ext.TabPanel.prototype.onItemEnabled,onItemTitleChanged:function(a){var b=this.getTabEl(a);if(b)Ext.fly(b).child("a.x-grouptabs-text",true).innerHTML=a.title},onItemIconChanged:function(a,b,c){(a=this.getTabEl(a))&&Ext.fly(a).child("a.x-grouptabs-text").replaceClass(c,b)},beforeDestroy:function(){Ext.TabPanel.prototype.beforeDestroy.call(this);this.tooltip.destroy()}});
Ext.reg("grouptab",Ext.ux.GroupTab);Ext.ns("Ext.ux");
Ext.ux.GroupTabPanel=Ext.extend(Ext.TabPanel,{tabPosition:"left",alternateColor:false,alternateCls:"x-grouptabs-panel-alt",defaultType:"grouptab",deferredRender:false,activeGroup:null,initComponent:function(){Ext.ux.GroupTabPanel.superclass.initComponent.call(this);this.addEvents("beforegroupchange","groupchange");this.elements="body,header";this.stripTarget="header";this.tabPosition=this.tabPosition=="right"?"right":"left";this.addClass("x-grouptabs-panel");this.tabStyle&&this.tabStyle!=""&&this.addClass("x-grouptabs-panel-"+
this.tabStyle);this.alternateColor&&this.addClass(this.alternateCls);this.on("beforeadd",function(a,b,c){this.initGroup(b,c)});this.items.each(function(a){a.on("tabchange",function(b){this.fireEvent("tabchange",this,b.activeTab)},this)},this)},initEvents:function(){this.mon(this.strip,"mousedown",this.onStripMouseDown,this)},onRender:function(a,b){Ext.TabPanel.superclass.onRender.call(this,a,b);if(this.plain){var c=this.tabPosition=="top"?"header":"footer";this[c].addClass("x-tab-panel-"+c+"-plain")}this.stripWrap=
this[this.stripTarget].createChild({cls:"x-tab-strip-wrap ",cn:{tag:"ul",cls:"x-grouptabs-strip x-grouptabs-tab-strip-"+this.tabPosition}});this.strip=new Ext.Element(this.stripWrap.dom.firstChild);this.header.addClass("x-grouptabs-panel-header");this.bwrap.addClass("x-grouptabs-bwrap");this.body.addClass("x-tab-panel-body-"+this.tabPosition+" x-grouptabs-panel-body");if(!this.groupTpl){c=new Ext.Template('<li class="{cls}" id="{id}">','<a class="x-grouptabs-expand" onclick="return false;"></a>',
'<a class="x-grouptabs-text {iconCls}" href="#" onclick="return false;">',"<span>{text}</span></a>","</li>");c.disableFormats=true;c.compile();Ext.ux.GroupTabPanel.prototype.groupTpl=c}this.items.each(this.initGroup,this)},afterRender:function(){Ext.ux.GroupTabPanel.superclass.afterRender.call(this);this.tabJoint=Ext.fly(this.body.dom.parentNode).createChild({cls:"x-tab-joint"});this.addClass("x-tab-panel-"+this.tabPosition);this.header.setWidth(this.tabWidth);if(this.activeGroup!==undefined){var a=
typeof this.activeGroup=="object"?this.activeGroup:this.items.get(this.activeGroup);delete this.activeGroup;this.setActiveGroup(a);a.setActiveTab(a.getMainItem())}},getGroupEl:Ext.TabPanel.prototype.getTabEl,findTargets:function(a){var b=null,c=a.getTarget("li",this.strip);if(c){b=this.findById(c.id.split(this.idDelimiter)[1]);if(b.disabled)return{expand:null,item:null,el:null}}return{expand:a.getTarget(".x-grouptabs-expand",this.strip),isGroup:!a.getTarget("ul.x-grouptabs-sub",this.strip),item:b,
el:c}},onStripMouseDown:function(a){if(a.button==0){a.preventDefault();a=this.findTargets(a);if(a.expand)this.toggleGroup(a.el);else if(a.item)a.isGroup?a.item.setActiveTab(a.item.getMainItem()):a.item.ownerCt.setActiveTab(a.item)}},expandGroup:function(a){if(a.isXType)a=this.getGroupEl(a);Ext.fly(a).addClass("x-grouptabs-expanded");this.syncTabJoint()},toggleGroup:function(a){if(a.isXType)a=this.getGroupEl(a);Ext.fly(a).toggleClass("x-grouptabs-expanded");this.syncTabJoint()},collapseGroup:function(a){if(a.isXType)a=
this.getGroupEl(a);Ext.fly(a).removeClass("x-grouptabs-expanded");this.syncTabJoint()},syncTabJoint:function(a){if(this.tabJoint)if(a=a||this.getGroupEl(this.activeGroup)){this.tabJoint.setHeight(Ext.fly(a).getHeight()-2);var b=Ext.isGecko2?0:1;this.tabPosition=="left"?this.tabJoint.alignTo(a,"tl-tr",[-2,b]):this.tabJoint.alignTo(a,"tr-tl",[1,b])}else this.tabJoint.hide()},getActiveTab:function(){if(!this.activeGroup)return null;return this.activeGroup.getTabEl(this.activeGroup.activeTab)||null},
onResize:function(){Ext.ux.GroupTabPanel.superclass.onResize.apply(this,arguments);this.syncTabJoint()},createCorner:function(a,b){return Ext.fly(a).createChild({cls:"x-grouptabs-corner x-grouptabs-corner-"+b})},initGroup:function(a,b){var c=this.strip.dom.childNodes[b],d=this.getTemplateArgs(a);if(b===0)d.cls+=" x-tab-first";d.cls+=" x-grouptabs-main";d.text=a.getMainItem().title;c=c?this.groupTpl.insertBefore(c,d):this.groupTpl.append(this.strip,d);d=this.createCorner(c,"top-"+this.tabPosition);
var e=this.createCorner(c,"bottom-"+this.tabPosition);a.tabEl=c;a.expanded&&this.expandGroup(c);if(Ext.isIE6||Ext.isIE&&!Ext.isStrict){e.setLeft("-10px");e.setBottom("-5px");d.setLeft("-10px");d.setTop("-5px")}this.mon(a,{scope:this,changemainitem:this.onGroupChangeMainItem,beforetabchange:this.onGroupBeforeTabChange})},setActiveGroup:function(a){a=this.getComponent(a);if(!a)return false;if(!this.rendered){this.activeGroup=a;return true}if(this.activeGroup!=a&&this.fireEvent("beforegroupchange",this,
a,this.activeGroup)!==false){if(this.activeGroup){this.activeGroup.activeTab=null;var b=this.getGroupEl(this.activeGroup);b&&Ext.fly(b).removeClass("x-grouptabs-strip-active")}b=this.getGroupEl(a);Ext.fly(b).addClass("x-grouptabs-strip-active");this.activeGroup=a;this.stack.add(a);this.layout.setActiveItem(a);this.syncTabJoint(b);this.fireEvent("groupchange",this,a);return true}return false},onGroupBeforeTabChange:function(a,b,c){if(a!==this.activeGroup||b!==c)this.strip.select(".x-grouptabs-sub > li.x-grouptabs-strip-active",
true).removeClass("x-grouptabs-strip-active");this.expandGroup(this.getGroupEl(a));if(a!==this.activeGroup)return this.setActiveGroup(a)},getFrameHeight:function(){var a=this.el.getFrameWidth("tb");a+=(this.tbar?this.tbar.getHeight():0)+(this.bbar?this.bbar.getHeight():0);return a},adjustBodyWidth:function(a){return a-this.tabWidth}});Ext.reg("grouptabpanel",Ext.ux.GroupTabPanel);
Ext.ux.form.ItemSelector=Ext.extend(Ext.form.Field,{hideNavIcons:false,imagePath:"",iconUp:"up2.gif",iconDown:"down2.gif",iconLeft:"left2.gif",iconRight:"right2.gif",iconTop:"top2.gif",iconBottom:"bottom2.gif",drawUpIcon:true,drawDownIcon:true,drawLeftIcon:true,drawRightIcon:true,drawTopIcon:true,drawBotIcon:true,delimiter:",",bodyStyle:null,border:false,defaultAutoCreate:{tag:"div"},multiselects:null,initComponent:function(){Ext.ux.form.ItemSelector.superclass.initComponent.call(this);this.addEvents({rowdblclick:true,
change:true})},onRender:function(a,b){Ext.ux.form.ItemSelector.superclass.onRender.call(this,a,b);var c=[{legend:"Available",draggable:true,droppable:true,width:100,height:100},{legend:"Selected",droppable:true,draggable:true,width:100,height:100}];this.fromMultiselect=new Ext.ux.form.MultiSelect(Ext.applyIf(this.multiselects[0],c[0]));this.fromMultiselect.on("dblclick",this.onRowDblClick,this);this.toMultiselect=new Ext.ux.form.MultiSelect(Ext.applyIf(this.multiselects[1],c[1]));this.toMultiselect.on("dblclick",
this.onRowDblClick,this);c=new Ext.Panel({bodyStyle:this.bodyStyle,border:this.border,layout:"table",layoutConfig:{columns:3}});c.add(this.fromMultiselect);var d=new Ext.Panel({header:false});c.add(d);c.add(this.toMultiselect);c.render(this.el);d.el.down("."+d.bwrapCls).remove();if(this.imagePath!=""&&this.imagePath.charAt(this.imagePath.length-1)!="/")this.imagePath+="/";this.iconUp=this.imagePath+(this.iconUp||"up2.gif");this.iconDown=this.imagePath+(this.iconDown||"down2.gif");this.iconLeft=this.imagePath+
(this.iconLeft||"left2.gif");this.iconRight=this.imagePath+(this.iconRight||"right2.gif");this.iconTop=this.imagePath+(this.iconTop||"top2.gif");this.iconBottom=this.imagePath+(this.iconBottom||"bottom2.gif");d=d.getEl();this.toTopIcon=d.createChild({tag:"img",src:this.iconTop,style:{cursor:"pointer",margin:"2px"}});d.createChild({tag:"br"});this.upIcon=d.createChild({tag:"img",src:this.iconUp,style:{cursor:"pointer",margin:"2px"}});d.createChild({tag:"br"});this.addIcon=d.createChild({tag:"img",
src:this.iconRight,style:{cursor:"pointer",margin:"2px"}});d.createChild({tag:"br"});this.removeIcon=d.createChild({tag:"img",src:this.iconLeft,style:{cursor:"pointer",margin:"2px"}});d.createChild({tag:"br"});this.downIcon=d.createChild({tag:"img",src:this.iconDown,style:{cursor:"pointer",margin:"2px"}});d.createChild({tag:"br"});this.toBottomIcon=d.createChild({tag:"img",src:this.iconBottom,style:{cursor:"pointer",margin:"2px"}});this.toTopIcon.on("click",this.toTop,this);this.upIcon.on("click",
this.up,this);this.downIcon.on("click",this.down,this);this.toBottomIcon.on("click",this.toBottom,this);this.addIcon.on("click",this.fromTo,this);this.removeIcon.on("click",this.toFrom,this);if(!this.drawUpIcon||this.hideNavIcons)this.upIcon.dom.style.display="none";if(!this.drawDownIcon||this.hideNavIcons)this.downIcon.dom.style.display="none";if(!this.drawLeftIcon||this.hideNavIcons)this.addIcon.dom.style.display="none";if(!this.drawRightIcon||this.hideNavIcons)this.removeIcon.dom.style.display=
"none";if(!this.drawTopIcon||this.hideNavIcons)this.toTopIcon.dom.style.display="none";if(!this.drawBotIcon||this.hideNavIcons)this.toBottomIcon.dom.style.display="none";c.body.first();this.el.setWidth(c.body.first().getWidth());c.body.removeClass();this.hiddenName=this.name;this.hiddenField=this.el.createChild({tag:"input",type:"hidden",value:"",name:this.name})},doLayout:function(){if(this.rendered){this.fromMultiselect.fs.doLayout();this.toMultiselect.fs.doLayout()}},afterRender:function(){Ext.ux.form.ItemSelector.superclass.afterRender.call(this);
this.toStore=this.toMultiselect.store;this.toStore.on("add",this.valueChanged,this);this.toStore.on("remove",this.valueChanged,this);this.toStore.on("load",this.valueChanged,this);this.valueChanged(this.toStore)},toTop:function(){var a=this.toMultiselect.view.getSelectedIndexes(),b=[];if(a.length>0){a.sort();for(var c=0;c<a.length;c++){record=this.toMultiselect.view.store.getAt(a[c]);b.push(record)}a=[];for(c=b.length-1;c>-1;c--){record=b[c];this.toMultiselect.view.store.remove(record);this.toMultiselect.view.store.insert(0,
record);a.push(b.length-1-c)}}this.toMultiselect.view.refresh();this.toMultiselect.view.select(a)},toBottom:function(){var a=this.toMultiselect.view.getSelectedIndexes(),b=[];if(a.length>0){a.sort();for(var c=0;c<a.length;c++){record=this.toMultiselect.view.store.getAt(a[c]);b.push(record)}a=[];for(c=0;c<b.length;c++){record=b[c];this.toMultiselect.view.store.remove(record);this.toMultiselect.view.store.add(record);a.push(this.toMultiselect.view.store.getCount()-(b.length-c))}}this.toMultiselect.view.refresh();
this.toMultiselect.view.select(a)},up:function(){var a=null,b=this.toMultiselect.view.getSelectedIndexes();b.sort();var c=[];if(b.length>0){for(var d=0;d<b.length;d++){a=this.toMultiselect.view.store.getAt(b[d]);if(b[d]-1>=0){this.toMultiselect.view.store.remove(a);this.toMultiselect.view.store.insert(b[d]-1,a);c.push(b[d]-1)}}this.toMultiselect.view.refresh();this.toMultiselect.view.select(c)}},down:function(){var a=null,b=this.toMultiselect.view.getSelectedIndexes();b.sort();b.reverse();var c=[];
if(b.length>0){for(var d=0;d<b.length;d++){a=this.toMultiselect.view.store.getAt(b[d]);if(b[d]+1<this.toMultiselect.view.store.getCount()){this.toMultiselect.view.store.remove(a);this.toMultiselect.view.store.insert(b[d]+1,a);c.push(b[d]+1)}}this.toMultiselect.view.refresh();this.toMultiselect.view.select(c)}},fromTo:function(){var a=this.fromMultiselect.view.getSelectedIndexes(),b=[];if(a.length>0){for(var c=0;c<a.length;c++){record=this.fromMultiselect.view.store.getAt(a[c]);b.push(record)}this.allowDup||
(a=[]);for(c=0;c<b.length;c++){record=b[c];if(this.allowDup){var d=new Ext.data.Record;record.id=d.id;delete d;this.toMultiselect.view.store.add(record)}else{this.fromMultiselect.view.store.remove(record);this.toMultiselect.view.store.add(record);a.push(this.toMultiselect.view.store.getCount()-1)}}}this.toMultiselect.view.refresh();this.fromMultiselect.view.refresh();(b=this.toMultiselect.store.sortInfo)&&this.toMultiselect.store.sort(b.field,b.direction);this.toMultiselect.view.select(a)},toFrom:function(){var a=
this.toMultiselect.view.getSelectedIndexes(),b=[];if(a.length>0){for(var c=0;c<a.length;c++){record=this.toMultiselect.view.store.getAt(a[c]);b.push(record)}a=[];for(c=0;c<b.length;c++){record=b[c];this.toMultiselect.view.store.remove(record);if(!this.allowDup){this.fromMultiselect.view.store.add(record);a.push(this.fromMultiselect.view.store.getCount()-1)}}}this.fromMultiselect.view.refresh();this.toMultiselect.view.refresh();(b=this.fromMultiselect.store.sortInfo)&&this.fromMultiselect.store.sort(b.field,
b.direction);this.fromMultiselect.view.select(a)},valueChanged:function(a){for(var b=null,c=[],d=0;d<a.getCount();d++){b=a.getAt(d);c.push(b.get(this.toMultiselect.valueField))}this.hiddenField.dom.value=c.join(this.delimiter);this.fireEvent("change",this,this.getValue(),this.hiddenField.dom.value)},getValue:function(){return this.hiddenField.dom.value},onRowDblClick:function(a,b,c,d){if(a==this.toMultiselect.view)this.toFrom();else a==this.fromMultiselect.view&&this.fromTo();return this.fireEvent("rowdblclick",
a,b,c,d)},reset:function(){range=this.toMultiselect.store.getRange();this.toMultiselect.store.removeAll();this.fromMultiselect.store.add(range);var a=this.fromMultiselect.store.sortInfo;a&&this.fromMultiselect.store.sort(a.field,a.direction);this.valueChanged(this.toMultiselect.store)}});Ext.reg("itemselector",Ext.ux.form.ItemSelector);Ext.ux.ItemSelector=Ext.ux.form.ItemSelector;Ext.ns("Ext.ux.grid");
Ext.ux.grid.LockingGridView=Ext.extend(Ext.grid.GridView,{lockText:"Lock",unlockText:"Unlock",rowBorderWidth:1,lockedBorderWidth:1,syncHeights:false,initTemplates:function(){var a=this.templates||{};if(!a.masterTpl)a.masterTpl=new Ext.Template('<div class="x-grid3" hidefocus="true">','<div class="x-grid3-locked">','<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset" style="{lstyle}">{lockedHeader}</div></div><div class="x-clear"></div></div>','<div class="x-grid3-scroller"><div class="x-grid3-body" style="{lstyle}">{lockedBody}</div><div class="x-grid3-scroll-spacer"></div></div>',
"</div>",'<div class="x-grid3-viewport x-grid3-unlocked">','<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset" style="{ostyle}">{header}</div></div><div class="x-clear"></div></div>','<div class="x-grid3-scroller"><div class="x-grid3-body" style="{bstyle}">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',"</div>",'<div class="x-grid3-resize-marker">&#160;</div>','<div class="x-grid3-resize-proxy">&#160;</div>',"</div>");this.templates=
a;Ext.ux.grid.LockingGridView.superclass.initTemplates.call(this)},getEditorParent:function(){return this.el.dom},initElements:function(){var a=Ext.get(this.grid.getGridEl().dom.firstChild),b=a.child("div.x-grid3-locked"),c=b.child("div.x-grid3-header"),d=b.child("div.x-grid3-scroller"),e=a.child("div.x-grid3-viewport"),f=e.child("div.x-grid3-header"),g=e.child("div.x-grid3-scroller");if(this.grid.hideHeaders){c.setDisplayed(false);f.setDisplayed(false)}this.forceFit&&g.setStyle("overflow-x","hidden");
Ext.apply(this,{el:a,mainWrap:e,mainHd:f,innerHd:f.dom.firstChild,scroller:g,mainBody:g.child("div.x-grid3-body"),focusEl:g.child("a"),resizeMarker:a.child("div.x-grid3-resize-marker"),resizeProxy:a.child("div.x-grid3-resize-proxy"),lockedWrap:b,lockedHd:c,lockedScroller:d,lockedBody:d.child("div.x-grid3-body"),lockedInnerHd:c.child("div.x-grid3-header-inner",true)});this.focusEl.swallowEvent("click",true)},getLockedRows:function(){return this.hasRows()?this.lockedBody.dom.childNodes:[]},getLockedRow:function(a){return this.getLockedRows()[a]},
getCell:function(a,b){var c=this.cm.getLockedCount();if(b<c)return this.getLockedRow(a).getElementsByTagName("td")[b];return Ext.ux.grid.LockingGridView.superclass.getCell.call(this,a,b-c)},getHeaderCell:function(a){var b=this.cm.getLockedCount();if(a<b)return this.lockedHd.dom.getElementsByTagName("td")[a];return Ext.ux.grid.LockingGridView.superclass.getHeaderCell.call(this,a-b)},addRowClass:function(a,b){var c=this.getLockedRow(a);c&&this.fly(c).addClass(b);Ext.ux.grid.LockingGridView.superclass.addRowClass.call(this,
a,b)},removeRowClass:function(a,b){var c=this.getLockedRow(a);c&&this.fly(c).removeClass(b);Ext.ux.grid.LockingGridView.superclass.removeRowClass.call(this,a,b)},removeRow:function(a){Ext.removeNode(this.getLockedRow(a));Ext.ux.grid.LockingGridView.superclass.removeRow.call(this,a)},removeRows:function(a,b){for(var c=this.lockedBody.dom,d=a;d<=b;d++)Ext.removeNode(c.childNodes[a]);Ext.ux.grid.LockingGridView.superclass.removeRows.call(this,a,b)},syncScroll:function(a){this.lockedScroller.dom.scrollTop=
this.scroller.dom.scrollTop;Ext.ux.grid.LockingGridView.superclass.syncScroll.call(this,a)},updateSortIcon:function(a,b){var c=this.sortClasses,d=this.lockedHd.select("td").removeClass(c),e=this.mainHd.select("td").removeClass(c),f=this.cm.getLockedCount();c=c[b=="DESC"?1:0];a<f?d.item(a).addClass(c):e.item(a-f).addClass(c)},updateAllColumnWidths:function(){var a=this.getTotalWidth(),b=this.cm.getColumnCount(),c=this.getLockedWidth(),d=this.cm.getLockedCount(),e=[],f,g;this.updateLockedWidth();for(g=
0;g<b;g++){e[g]=this.getColumnWidth(g);this.getHeaderCell(g).style.width=e[g]}var h=this.getLockedRows(),j=this.getRows(),k,l;g=0;for(f=j.length;g<f;g++){k=h[g];k.style.width=c;if(k.firstChild){k.firstChild.style.width=c;k=k.firstChild.rows[0];for(l=0;l<d;l++)k.childNodes[l].style.width=e[l]}k=j[g];k.style.width=a;if(k.firstChild){k.firstChild.style.width=a;k=k.firstChild.rows[0];for(l=d;l<b;l++)k.childNodes[l-d].style.width=e[l]}}this.onAllColumnWidthsUpdated(e,a);this.syncHeaderHeight()},updateColumnWidth:function(a){var b=
this.getColumnWidth(a),c=this.cm.getLockedCount(),d,e,f;this.updateLockedWidth();if(a<c){d=this.getLockedRows();e=this.getLockedWidth();c=a}else{d=this.getRows();e=this.getTotalWidth();c=a-c}this.getHeaderCell(a).style.width=b;for(var g=0,h=d.length;g<h;g++){f=d[g];f.style.width=e;if(f.firstChild){f.firstChild.style.width=e;f.firstChild.rows[0].childNodes[c].style.width=b}}this.onColumnWidthUpdated(a,b,this.getTotalWidth());this.syncHeaderHeight()},updateColumnHidden:function(a,b){var c=this.cm.getLockedCount(),
d,e,f,g=b?"none":"";this.updateLockedWidth();if(a<c){d=this.getLockedRows();e=this.getLockedWidth();c=a}else{d=this.getRows();e=this.getTotalWidth();c=a-c}this.getHeaderCell(a).style.display=g;for(var h=0,j=d.length;h<j;h++){f=d[h];f.style.width=e;if(f.firstChild){f.firstChild.style.width=e;f.firstChild.rows[0].childNodes[c].style.display=g}}this.onColumnHiddenUpdated(a,b,this.getTotalWidth());delete this.lastViewWidth;this.layout()},doRender:function(a,b,c,d,e,f){var g=this.templates,h=g.cell;g=
g.row;for(var j=e-1,k="width:"+this.getTotalWidth()+";",l="width:"+this.getLockedWidth()+";",m=[],n=[],p,r,o,q={},s={},t,u=0,y=b.length;u<y;u++){t=b[u];p=[];r=[];for(var w=u+d,v=0;v<e;v++){o=a[v];q.id=o.id;q.css=(v===0?"x-grid3-cell-first ":v==j?"x-grid3-cell-last ":"")+(this.cm.config[v].cellCls?" "+this.cm.config[v].cellCls:"");q.attr=q.cellAttr="";q.value=o.renderer(t.data[o.name],q,t,w,v,c);q.style=o.style;if(Ext.isEmpty(q.value))q.value="&#160;";if(this.markDirty&&t.dirty&&Ext.isDefined(t.modified[o.name]))q.css+=
" x-grid3-dirty-cell";if(o.locked)r[r.length]=h.apply(q);else p[p.length]=h.apply(q)}o=[];if(f&&(w+1)%2===0)o[0]="x-grid3-row-alt";if(t.dirty)o[1]=" x-grid3-dirty-row";s.cols=e;if(this.getRowClass)o[2]=this.getRowClass(t,w,s,c);s.alt=o.join(" ");s.cells=p.join("");s.tstyle=k;m[m.length]=g.apply(s);s.cells=r.join("");s.tstyle=l;n[n.length]=g.apply(s)}return[m.join(""),n.join("")]},processRows:function(a,b){if(!(!this.ds||this.ds.getCount()<1)){var c=this.getRows(),d=this.getLockedRows(),e,f;b=b||!this.grid.stripeRows;
a=a||0;for(var g=0,h=c.length;g<h;++g){e=c[g];f=d[g];e.rowIndex=g;f.rowIndex=g;if(!b){e.className=e.className.replace(this.rowClsRe," ");f.className=f.className.replace(this.rowClsRe," ");if((g+1)%2===0){e.className+=" x-grid3-row-alt";f.className+=" x-grid3-row-alt"}}this.syncRowHeights(e,f)}if(a===0){Ext.fly(c[0]).addClass(this.firstRowCls);Ext.fly(d[0]).addClass(this.firstRowCls)}Ext.fly(c[c.length-1]).addClass(this.lastRowCls);Ext.fly(d[d.length-1]).addClass(this.lastRowCls)}},syncRowHeights:function(a,
b){if(this.syncHeights){var c=Ext.get(a),d=Ext.get(b),e=c.getHeight(),f=d.getHeight();if(e>f)d.setHeight(e);else f>e&&c.setHeight(f)}},afterRender:function(){if(this.ds&&this.cm){var a=this.renderRows()||["&#160;","&#160;"];this.mainBody.dom.innerHTML=a[0];this.lockedBody.dom.innerHTML=a[1];this.processRows(0,true);this.deferEmptyText!==true&&this.applyEmptyText();this.grid.fireEvent("viewready",this.grid)}},renderUI:function(){var a=this.templates,b=this.renderHeaders(),c=a.body.apply({rows:"&#160;"});
return a.masterTpl.apply({body:c,header:b[0],ostyle:"width:"+this.getOffsetWidth()+";",bstyle:"width:"+this.getTotalWidth()+";",lockedBody:c,lockedHeader:b[1],lstyle:"width:"+this.getLockedWidth()+";"})},afterRenderUI:function(){var a=this.grid;this.initElements();Ext.fly(this.innerHd).on("click",this.handleHdDown,this);Ext.fly(this.lockedInnerHd).on("click",this.handleHdDown,this);this.mainHd.on({scope:this,mouseover:this.handleHdOver,mouseout:this.handleHdOut,mousemove:this.handleHdMove});this.lockedHd.on({scope:this,
mouseover:this.handleHdOver,mouseout:this.handleHdOut,mousemove:this.handleHdMove});this.scroller.on("scroll",this.syncScroll,this);if(a.enableColumnResize!==false){this.splitZone=new Ext.grid.GridView.SplitDragZone(a,this.mainHd.dom);this.splitZone.setOuterHandleElId(Ext.id(this.lockedHd.dom));this.splitZone.setOuterHandleElId(Ext.id(this.mainHd.dom))}if(a.enableColumnMove){this.columnDrag=new Ext.grid.GridView.ColumnDragZone(a,this.innerHd);this.columnDrag.setOuterHandleElId(Ext.id(this.lockedInnerHd));
this.columnDrag.setOuterHandleElId(Ext.id(this.innerHd));this.columnDrop=new Ext.grid.HeaderDropZone(a,this.mainHd.dom)}if(a.enableHdMenu!==false){this.hmenu=new Ext.menu.Menu({id:a.id+"-hctx"});this.hmenu.add({itemId:"asc",text:this.sortAscText,cls:"xg-hmenu-sort-asc"},{itemId:"desc",text:this.sortDescText,cls:"xg-hmenu-sort-desc"});this.grid.enableColLock!==false&&this.hmenu.add("-",{itemId:"lock",text:this.lockText,cls:"xg-hmenu-lock"},{itemId:"unlock",text:this.unlockText,cls:"xg-hmenu-unlock"});
if(a.enableColumnHide!==false){this.colMenu=new Ext.menu.Menu({id:a.id+"-hcols-menu"});this.colMenu.on({scope:this,beforeshow:this.beforeColMenuShow,itemclick:this.handleHdMenuClick});this.hmenu.add("-",{itemId:"columns",hideOnClick:false,text:this.columnsText,menu:this.colMenu,iconCls:"x-cols-icon"})}this.hmenu.on("itemclick",this.handleHdMenuClick,this)}if(a.trackMouseOver){this.mainBody.on({scope:this,mouseover:this.onRowOver,mouseout:this.onRowOut});this.lockedBody.on({scope:this,mouseover:this.onRowOver,
mouseout:this.onRowOut})}if(a.enableDragDrop||a.enableDrag)this.dragZone=new Ext.grid.GridDragZone(a,{ddGroup:a.ddGroup||"GridDD"});this.updateHeaderSortState()},layout:function(){if(this.mainBody){var a=this.grid,b=a.getGridEl().getSize(true),c=b.width;if(!(!a.hideHeaders&&(c<20||b.height<20))){this.syncHeaderHeight();if(a.autoHeight){this.scroller.dom.style.overflow="visible";this.lockedScroller.dom.style.overflow="visible";if(Ext.isWebKit){this.scroller.dom.style.position="static";this.lockedScroller.dom.style.position=
"static"}}else{this.el.setSize(b.width,b.height);a=this.mainHd.getHeight();var d=b.height-a}this.updateLockedWidth();if(this.forceFit){if(this.lastViewWidth!=c){this.fitColumns(false,false);this.lastViewWidth=c}}else{this.autoExpand();this.syncHeaderScroll()}this.onLayout(c,d)}}},getOffsetWidth:function(){return this.cm.getTotalWidth()-this.cm.getTotalLockedWidth()+this.getScrollOffset()+"px"},renderHeaders:function(){for(var a=this.cm,b=this.templates,c=b.hcell,d=[],e=[],f={},g=a.getColumnCount(),
h=g-1,j=0;j<g;j++){f.id=a.getColumnId(j);f.value=a.getColumnHeader(j)||"";f.style=this.getColumnStyle(j,true);f.tooltip=this.getColumnTooltip(j);f.css=(j===0?"x-grid3-cell-first ":j==h?"x-grid3-cell-last ":"")+(a.config[j].headerCls?" "+a.config[j].headerCls:"");if(a.config[j].align=="right")f.istyle="padding-right:16px";else delete f.istyle;if(a.isLocked(j))e[e.length]=c.apply(f);else d[d.length]=c.apply(f)}return[b.header.apply({cells:d.join(""),tstyle:"width:"+this.getTotalWidth()+";"}),b.header.apply({cells:e.join(""),
tstyle:"width:"+this.getLockedWidth()+";"})]},updateHeaders:function(){var a=this.renderHeaders();this.innerHd.firstChild.innerHTML=a[0];this.innerHd.firstChild.style.width=this.getOffsetWidth();this.innerHd.firstChild.firstChild.style.width=this.getTotalWidth();this.lockedInnerHd.firstChild.innerHTML=a[1];a=this.getLockedWidth();this.lockedInnerHd.firstChild.style.width=a;this.lockedInnerHd.firstChild.firstChild.style.width=a},getResolvedXY:function(a){if(!a)return null;var b=a.cell;a=a.row;return b?
Ext.fly(b).getXY():[this.scroller.getX(),Ext.fly(a).getY()]},syncFocusEl:function(a,b,c){Ext.ux.grid.LockingGridView.superclass.syncFocusEl.call(this,a,b,b<this.cm.getLockedCount()?false:c)},ensureVisible:function(a,b,c){return Ext.ux.grid.LockingGridView.superclass.ensureVisible.call(this,a,b,b<this.cm.getLockedCount()?false:c)},insertRows:function(a,b,c,d){a=a.getCount()-1;if(!d&&b===0&&c>=a)this.refresh();else{d||this.fireEvent("beforerowsinserted",this,b,c);var e=this.renderRows(b,c),f=this.getRow(b);
if(f){b===0&&this.removeRowClass(0,this.firstRowCls);Ext.DomHelper.insertHtml("beforeBegin",f,e[0]);f=this.getLockedRow(b);Ext.DomHelper.insertHtml("beforeBegin",f,e[1])}else{this.removeRowClass(a-1,this.lastRowCls);Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,e[0]);Ext.DomHelper.insertHtml("beforeEnd",this.lockedBody.dom,e[1])}if(d){if(b===0||b>=a)this.addRowClass(b,b===0?this.firstRowCls:this.lastRowCls)}else{this.fireEvent("rowsinserted",this,b,c);this.processRows(b)}}this.syncFocusEl(b)},
getColumnStyle:function(a,b){var c=!b?this.cm.config[a].cellStyle||this.cm.config[a].css||"":this.cm.config[a].headerStyle||"";c+="width:"+this.getColumnWidth(a)+";";if(this.cm.isHidden(a))c+="display:none;";var d=this.cm.config[a].align;if(d)c+="text-align:"+d+";";return c},getLockedWidth:function(){return this.cm.getTotalLockedWidth()+"px"},getTotalWidth:function(){return this.cm.getTotalWidth()-this.cm.getTotalLockedWidth()+"px"},getColumnData:function(){for(var a=[],b=this.cm,c=b.getColumnCount(),
d=0;d<c;d++){var e=b.getDataIndex(d);a[d]={name:!Ext.isDefined(e)?this.ds.fields.get(d).name:e,renderer:b.getRenderer(d),scope:b.getRendererScope(d),id:b.getColumnId(d),style:this.getColumnStyle(d),locked:b.isLocked(d)}}return a},renderBody:function(){var a=this.renderRows()||["&#160;","&#160;"];return[this.templates.body.apply({rows:a[0]}),this.templates.body.apply({rows:a[1]})]},refreshRow:function(a){var b=this.ds,c=this.cm.getColumnCount(),d=this.getColumnData(),e=c-1,f=["x-grid3-row"],g={tstyle:String.format("width: {0};",
this.getTotalWidth())},h={tstyle:String.format("width: {0};",this.getLockedWidth())},j=[],k=[],l=this.templates.cell,m,n,p,r;if(Ext.isNumber(a)){m=a;a=b.getAt(m)}else m=b.indexOf(a);if(!(!a||m<0)){for(r=0;r<c;r++){n=d[r];p=r==0?"x-grid3-cell-first":r==e?"x-grid3-cell-last ":"";p={id:n.id,style:n.style,css:p,attr:"",cellAttr:""};p.value=n.renderer.call(n.scope,a.data[n.name],p,a,m,r,b);if(Ext.isEmpty(p.value))p.value=" ";if(this.markDirty&&a.dirty&&typeof a.modified[n.name]!="undefined")p.css+=" x-grid3-dirty-cell";
if(n.locked)k[r]=l.apply(p);else j[r]=l.apply(p)}d=this.getRow(m);d.className="";e=this.getLockedRow(m);e.className="";this.grid.stripeRows&&(m+1)%2===0&&f.push("x-grid3-row-alt");if(this.getRowClass){g.cols=c;f.push(this.getRowClass(a,m,g,b))}this.fly(d).addClass(f).setStyle(g.tstyle);g.cells=j.join("");d.innerHTML=this.templates.rowInner.apply(g);this.fly(e).addClass(f).setStyle(h.tstyle);h.cells=k.join("");e.innerHTML=this.templates.rowInner.apply(h);e.rowIndex=m;this.syncRowHeights(d,e);this.fireEvent("rowupdated",
this,m,a)}},refresh:function(a){this.fireEvent("beforerefresh",this);this.grid.stopEditing(true);var b=this.renderBody();this.mainBody.update(b[0]).setWidth(this.getTotalWidth());this.lockedBody.update(b[1]).setWidth(this.getLockedWidth());if(a===true){this.updateHeaders();this.updateHeaderSortState()}this.processRows(0,true);this.layout();this.applyEmptyText();this.fireEvent("refresh",this)},onDenyColumnLock:function(){},initData:function(a,b){this.cm&&this.cm.un("columnlockchange",this.onColumnLock,
this);Ext.ux.grid.LockingGridView.superclass.initData.call(this,a,b);this.cm&&this.cm.on("columnlockchange",this.onColumnLock,this)},onColumnLock:function(){this.refresh(true)},handleHdMenuClick:function(a){var b=this.hdCtxIndex,c=this.cm,d=a.getItemId(),e=c.getLockedCount();switch(d){case "lock":if(c.getColumnCount(true)<=e+1){this.onDenyColumnLock();return}c.setLocked(b,true,e!=b);if(e!=b){c.moveColumn(b,e);this.grid.fireEvent("columnmove",b,e)}break;case "unlock":if(e-1!=b){c.setLocked(b,false,
true);c.moveColumn(b,e-1);this.grid.fireEvent("columnmove",b,e-1)}else c.setLocked(b,false);break;default:return Ext.ux.grid.LockingGridView.superclass.handleHdMenuClick.call(this,a)}return true},handleHdDown:function(a,b){Ext.ux.grid.LockingGridView.superclass.handleHdDown.call(this,a,b);if(this.grid.enableColLock!==false)if(Ext.fly(b).hasClass("x-grid3-hd-btn")){var c=this.getCellIndex(this.findHeaderCell(b)),d=this.hmenu.items,e=this.cm;d.get("lock").setDisabled(e.isLocked(c));d.get("unlock").setDisabled(!e.isLocked(c))}},
syncHeaderHeight:function(){var a=Ext.fly(this.innerHd).child("tr",true),b=Ext.fly(this.lockedInnerHd).child("tr",true);a.style.height="auto";b.style.height="auto";var c=Math.max(b.offsetHeight,a.offsetHeight)+"px";a.style.height=c;b.style.height=c},updateLockedWidth:function(){var a=this.cm.getTotalLockedWidth(),b=this.cm.getTotalWidth()-a,c=this.grid.getGridEl().getSize(true),d=Ext.isBorderBox?0:this.lockedBorderWidth,e=Ext.isBorderBox?0:this.rowBorderWidth,f=Math.max(c.width-a-d-e,0)+"px",g=this.getScrollOffset();
if(!this.grid.autoHeight){c=Math.max(c.height-this.mainHd.getHeight(),0)+"px";this.lockedScroller.dom.style.height=c;this.scroller.dom.style.height=c}this.lockedWrap.dom.style.width=a+e+"px";this.scroller.dom.style.width=f;this.mainWrap.dom.style.left=a+d+e+"px";if(this.innerHd){this.lockedInnerHd.firstChild.style.width=a+"px";this.lockedInnerHd.firstChild.firstChild.style.width=a+"px";this.innerHd.style.width=f;this.innerHd.firstChild.style.width=b+e+g+"px";this.innerHd.firstChild.firstChild.style.width=
b+"px"}if(this.mainBody){this.lockedBody.dom.style.width=a+e+"px";this.mainBody.dom.style.width=b+e+"px"}}});
Ext.ux.grid.LockingColumnModel=Ext.extend(Ext.grid.ColumnModel,{isLocked:function(a){return this.config[a].locked===true},setLocked:function(a,b,c){if(this.isLocked(a)!=b){this.config[a].locked=b;c||this.fireEvent("columnlockchange",this,a,b)}},getTotalLockedWidth:function(){for(var a=0,b=0,c=this.config.length;b<c;b++)if(this.isLocked(b)&&!this.isHidden(b))a+=this.getColumnWidth(b);return a},getLockedCount:function(){for(var a=this.config.length,b=0;b<a;b++)if(!this.isLocked(b))return b;return a},
moveColumn:function(a,b){var c=this.isLocked(a),d=this.isLocked(b);if(a<b&&c&&!d)this.setLocked(a,false,true);else a>b&&!c&&d&&this.setLocked(a,true,true);Ext.ux.grid.LockingColumnModel.superclass.moveColumn.apply(this,arguments)}});Ext.ns("Ext.ux.form");
Ext.ux.form.MultiSelect=Ext.extend(Ext.form.Field,{ddReorder:false,appendOnly:false,width:100,height:100,displayField:0,valueField:1,allowBlank:true,minSelections:0,maxSelections:Number.MAX_VALUE,blankText:Ext.form.TextField.prototype.blankText,minSelectionsText:"Minimum {0} item(s) required",maxSelectionsText:"Maximum {0} item(s) allowed",delimiter:",",cls:"ux-form-multiselect",defaultAutoCreate:{tag:"div"},initComponent:function(){Ext.ux.form.MultiSelect.superclass.initComponent.call(this);if(Ext.isArray(this.store)){if(Ext.isArray(this.store[0])){this.store=
new Ext.data.ArrayStore({fields:["value","text"],data:this.store});this.valueField="value"}else{this.store=new Ext.data.ArrayStore({fields:["text"],data:this.store,expandData:true});this.valueField="text"}this.displayField="text"}else this.store=Ext.StoreMgr.lookup(this.store);this.addEvents({dblclick:true,click:true,change:true,drop:true})},onRender:function(a,b){Ext.ux.form.MultiSelect.superclass.onRender.call(this,a,b);var c=this.fs=new Ext.form.FieldSet({renderTo:this.el,title:this.legend,height:this.height,
width:this.width,style:"padding:0;",tbar:this.tbar});c.body.addClass("ux-mselect");this.view=new Ext.ListView({selectedClass:"ux-mselect-selected",multiSelect:true,store:this.store,columns:[{header:"Value",width:1,dataIndex:this.displayField}],hideHeaders:true});c.add(this.view);this.view.on("click",this.onViewClick,this);this.view.on("beforeclick",this.onViewBeforeClick,this);this.view.on("dblclick",this.onViewDblClick,this);this.hiddenName=this.name||Ext.id();this.hiddenField=this.el.createChild({tag:"input",
type:"hidden",value:"",name:this.hiddenName});this.hiddenField.dom.disabled=this.hiddenName!=this.name;c.doLayout()},afterRender:function(){Ext.ux.form.MultiSelect.superclass.afterRender.call(this);if(this.ddReorder&&!this.dragGroup&&!this.dropGroup)this.dragGroup=this.dropGroup="MultiselectDD-"+Ext.id();if(this.draggable||this.dragGroup)this.dragZone=new Ext.ux.form.MultiSelect.DragZone(this,{ddGroup:this.dragGroup});if(this.droppable||this.dropGroup)this.dropZone=new Ext.ux.form.MultiSelect.DropZone(this,
{ddGroup:this.dropGroup})},onViewClick:function(a,b,c,d){this.fireEvent("change",this,this.getValue(),this.hiddenField.dom.value);this.hiddenField.dom.value=this.getValue();this.fireEvent("click",this,d);this.validate()},onViewBeforeClick:function(){if(this.disabled||this.readOnly)return false},onViewDblClick:function(a,b,c,d){return this.fireEvent("dblclick",a,b,c,d)},getValue:function(a){var b=[],c=this.view.getSelectedIndexes();if(c.length==0)return"";for(var d=0;d<c.length;d++)b.push(this.store.getAt(c[d]).get(a!=
null?a:this.valueField));return b.join(this.delimiter)},setValue:function(a){var b,c=[];this.view.clearSelections();this.hiddenField.dom.value="";if(!(!a||a=="")){Ext.isArray(a)||(a=a.split(this.delimiter));for(var d=0;d<a.length;d++){b=this.view.store.indexOf(this.view.store.query(this.valueField,RegExp("^"+a[d]+"$","i")).itemAt(0));c.push(b)}this.view.select(c);this.hiddenField.dom.value=this.getValue();this.validate()}},reset:function(){this.setValue("")},getRawValue:function(a){a=this.getValue(a);
return a=a.length?a.split(this.delimiter):[]},setRawValue:function(a){setValue(a)},validateValue:function(a){if(a.length<1)if(this.allowBlank){this.clearInvalid();return true}else{this.markInvalid(this.blankText);return false}if(a.length<this.minSelections){this.markInvalid(String.format(this.minSelectionsText,this.minSelections));return false}if(a.length>this.maxSelections){this.markInvalid(String.format(this.maxSelectionsText,this.maxSelections));return false}return true},disable:function(){this.disabled=
true;this.hiddenField.dom.disabled=true;this.fs.disable()},enable:function(){this.disabled=false;this.hiddenField.dom.disabled=false;this.fs.enable()},destroy:function(){Ext.destroy(this.fs,this.dragZone,this.dropZone);Ext.ux.form.MultiSelect.superclass.destroy.call(this)}});Ext.reg("multiselect",Ext.ux.form.MultiSelect);Ext.ux.Multiselect=Ext.ux.form.MultiSelect;
Ext.ux.form.MultiSelect.DragZone=function(a,b){this.ms=a;this.view=a.view;var c=b.ddGroup||"MultiselectDD",d;if(Ext.isArray(c))d=c.shift();else{d=c;c=null}Ext.ux.form.MultiSelect.DragZone.superclass.constructor.call(this,this.ms.fs.body,{containerScroll:true,ddGroup:d});this.setDraggable(c)};
Ext.extend(Ext.ux.form.MultiSelect.DragZone,Ext.dd.DragZone,{onInitDrag:function(a,b){var c=Ext.get(this.dragData.ddel.cloneNode(true));this.proxy.update(c.dom);c.setWidth(c.child("em").getWidth());this.onStartDrag(a,b);return true},collectSelection:function(a){a.repairXY=Ext.fly(this.view.getSelectedNodes()[0]).getXY();var b=0;this.view.store.each(function(){if(this.view.isSelected(b)){var c=this.view.getNode(b),d=c.cloneNode(true);d.id=Ext.id();a.ddel.appendChild(d);a.records.push(this.view.store.getAt(b));
a.viewNodes.push(c)}b++},this)},onEndDrag:function(){var a=Ext.get(this.dragData.ddel);a&&a.hasClass("multi-proxy")&&a.remove()},getDragData:function(a){var b=this.view.findItemFromChild(a.getTarget());if(b){if(!this.view.isSelected(b)&&!a.ctrlKey&&!a.shiftKey){this.view.select(b);this.ms.setValue(this.ms.getValue())}if(this.view.getSelectionCount()==0||a.ctrlKey||a.shiftKey)return false;a={sourceView:this.view,viewNodes:[],records:[]};if(this.view.getSelectionCount()==1){b=this.view.getSelectedIndexes()[0];
var c=this.view.getNode(b);a.viewNodes.push(a.ddel=c);a.records.push(this.view.store.getAt(b));a.repairXY=Ext.fly(c).getXY()}else{a.ddel=document.createElement("div");a.ddel.className="multi-proxy";this.collectSelection(a)}return a}return false},getRepairXY:function(){return this.dragData.repairXY},setDraggable:function(a){if(a)Ext.isArray(a)?Ext.each(a,this.setDraggable,this):this.addToGroup(a)}});
Ext.ux.form.MultiSelect.DropZone=function(a,b){this.ms=a;this.view=a.view;var c=b.ddGroup||"MultiselectDD",d;if(Ext.isArray(c))d=c.shift();else{d=c;c=null}Ext.ux.form.MultiSelect.DropZone.superclass.constructor.call(this,this.ms.fs.body,{containerScroll:true,ddGroup:d});this.setDroppable(c)};
Ext.extend(Ext.ux.form.MultiSelect.DropZone,Ext.dd.DropZone,{getTargetFromEvent:function(a){return a.getTarget()},getDropPoint:function(a,b){if(b==this.ms.fs.body.dom)return"below";var c=Ext.lib.Dom.getY(b);c=c+(c+b.offsetHeight-c)/2;return Ext.lib.Event.getPageY(a)<=c?"above":"below"},isValidDropPoint:function(a,b,c){if(!c.viewNodes||c.viewNodes.length!=1)return true;c=c.viewNodes[0];if(c==b)return false;if(a=="below"&&b.nextSibling==c)return false;if(a=="above"&&b.previousSibling==c)return false;
return true},onNodeEnter:function(){return false},onNodeOver:function(a,b,c,d){var e=this.dropNotAllowed;b=this.getDropPoint(c,a,b);if(this.isValidDropPoint(b,a,d)){if(this.ms.appendOnly)return"x-tree-drop-ok-below";if(b){if(b=="above"){e=a.previousSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-above";d="x-view-drag-insert-above"}else{e=a.nextSibling?"x-tree-drop-ok-between":"x-tree-drop-ok-below";d="x-view-drag-insert-below"}if(this.lastInsertClass!=d){Ext.fly(a).replaceClass(this.lastInsertClass,
d);this.lastInsertClass=d}}}return e},onNodeOut:function(a){this.removeDropIndicators(a)},onNodeDrop:function(a,b,c,d){if(this.ms.fireEvent("drop",this,a,b,c,d)===false)return false;c=this.getDropPoint(c,a,b);if(a!=this.ms.fs.body.dom)a=this.view.findItemFromChild(a);if(this.ms.appendOnly)insertAt=this.view.store.getCount();else{insertAt=a==this.ms.fs.body.dom?this.view.store.getCount()-1:this.view.indexOf(a);c=="below"&&insertAt++}b=false;if(d.sourceView==this.view){if(c=="below")d.viewNodes[0]==
a&&d.viewNodes.shift();else d.viewNodes[d.viewNodes.length-1]==a&&d.viewNodes.pop();if(!d.viewNodes.length)return false;if(insertAt>this.view.store.indexOf(d.records[0])){b="down";insertAt--}}for(a=0;a<d.records.length;a++){c=d.records[a];d.sourceView&&d.sourceView.store.remove(c);this.view.store.insert(b=="down"?insertAt:insertAt++,c);(c=this.view.store.sortInfo)&&this.view.store.sort(c.field,c.direction)}return true},removeDropIndicators:function(a){if(a){Ext.fly(a).removeClass(["x-view-drag-insert-above",
"x-view-drag-insert-left","x-view-drag-insert-right","x-view-drag-insert-below"]);this.lastInsertClass="_noclass"}},setDroppable:function(a){if(a)Ext.isArray(a)?Ext.each(a,this.setDroppable,this):this.addToGroup(a)}});if(!Array.prototype.map)Array.prototype.map=function(a,b){var c=this.length;if(typeof a!="function")throw new TypeError;for(var d=Array(c),e=0;e<c;e++)if(e in this)d[e]=a.call(b,this[e],e,this);return d};Ext.ns("Ext.ux.data");
Ext.ux.data.PagingMemoryProxy=Ext.extend(Ext.data.MemoryProxy,{constructor:function(a){Ext.ux.data.PagingMemoryProxy.superclass.constructor.call(this);this.data=a},doRequest:function(a,b,c,d,e,f,g){c=c||{};var h;try{h=d.readRecords(this.data)}catch(j){this.fireEvent("loadexception",this,g,null,j);e.call(f,null,g,false);return}if(c.filter!==undefined){h.records=h.records.filter(function(l){return typeof l=="object"?String(l.data[c.filterCol||0]).match(c.filter)?true:false:String(l).match(c.filter)?
true:false});h.totalRecords=h.records.length}if(c.sort!==undefined){var k=String(c.dir).toUpperCase()=="DESC"?-1:1;h.records.sort(function(l,m){var n=0;n=typeof l=="object"?(l.data[c.sort]>m.data[c.sort]?1:l.data[c.sort]<m.data[c.sort]?-1:0)*k:(l>m?1:l<m?-1:0)*k;if(n==0)n=l.index<m.index?-1:1;return n})}if(c.start!==undefined&&c.limit!==undefined)h.records=h.records.slice(c.start,c.start+c.limit);e.call(f,h,g,true)}});Ext.data.PagingMemoryProxy=Ext.ux.data.PagingMemoryProxy;
Ext.ux.PanelResizer=Ext.extend(Ext.util.Observable,{minHeight:0,maxHeight:1E7,constructor:function(a){Ext.apply(this,a);this.events={};Ext.ux.PanelResizer.superclass.constructor.call(this,a)},init:function(a){this.panel=a;if(this.panel.elements.indexOf("footer")==-1)a.elements+=",footer";a.on("render",this.onRender,this)},onRender:function(a){this.handle=a.footer.createChild({cls:"x-panel-resize"});this.tracker=new Ext.dd.DragTracker({onStart:this.onDragStart.createDelegate(this),onDrag:this.onDrag.createDelegate(this),
onEnd:this.onDragEnd.createDelegate(this),tolerance:3,autoStart:300});this.tracker.initEl(this.handle);a.on("beforedestroy",this.tracker.destroy,this.tracker)},onDragStart:function(a){this.dragging=true;this.startHeight=this.panel.el.getHeight();this.fireEvent("dragstart",this,a)},onDrag:function(a){this.panel.setHeight((this.startHeight-this.tracker.getOffset()[1]).constrain(this.minHeight,this.maxHeight));this.fireEvent("drag",this,a)},onDragEnd:function(a){this.dragging=false;this.fireEvent("dragend",
this,a)}});Ext.preg("panelresizer",Ext.ux.PanelResizer);
Ext.ux.Portal=Ext.extend(Ext.Panel,{layout:"column",autoScroll:true,cls:"x-portal",defaultType:"portalcolumn",initComponent:function(){Ext.ux.Portal.superclass.initComponent.call(this);this.addEvents({validatedrop:true,beforedragover:true,dragover:true,beforedrop:true,drop:true})},initEvents:function(){Ext.ux.Portal.superclass.initEvents.call(this);this.dd=new Ext.ux.Portal.DropZone(this,this.dropConfig)},beforeDestroy:function(){this.dd&&this.dd.unreg();Ext.ux.Portal.superclass.beforeDestroy.call(this)}});
Ext.reg("portal",Ext.ux.Portal);
Ext.ux.Portal.DropZone=Ext.extend(Ext.dd.DropTarget,{constructor:function(a,b){this.portal=a;Ext.dd.ScrollManager.register(a.body);Ext.ux.Portal.DropZone.superclass.constructor.call(this,a.bwrap.dom,b);a.body.ddScrollConfig=this.ddScrollConfig},ddScrollConfig:{vthresh:50,hthresh:-1,animate:true,increment:200},createEvent:function(a,b,c,d,e,f){return{portal:this.portal,panel:c.panel,columnIndex:d,column:e,position:f,data:c,source:a,rawEvent:b,status:this.dropAllowed}},notifyOver:function(a,b,c){var d=
b.getXY(),e=this.portal,f=a.proxy;if(!this.grid)this.grid=this.getGrid();var g=e.body.dom.clientWidth;if(this.lastCW){if(this.lastCW!=g){this.lastCW=g;e.doLayout();this.grid=this.getGrid()}}else this.lastCW=g;g=0;for(var h=this.grid.columnX,j=false,k=h.length;g<k;g++)if(d[0]<h[g].x+h[g].w){j=true;break}j||g--;var l;h=false;j=0;var m=e.items.itemAt(g),n=m.items.items,p=false;for(k=n.length;j<k;j++){l=n[j];var r=l.el.getHeight();if(r===0)p=true;else if(l.el.getY()+r/2>d[1]){h=true;break}}j=(h&&l?j:
m.items.getCount())+(p?-1:0);a=this.createEvent(a,b,c,g,m,j);if(e.fireEvent("validatedrop",a)!==false&&e.fireEvent("beforedragover",a)!==false){f.getProxy().setWidth("auto");l?f.moveProxy(l.el.dom.parentNode,h?l.el.dom:null):f.moveProxy(m.el.dom,null);this.lastPos={c:m,col:g,p:p||h&&l?j:false};this.scrollPos=e.body.getScroll();e.fireEvent("dragover",a)}return a.status},notifyOut:function(){delete this.grid},notifyDrop:function(a,b,c){delete this.grid;if(this.lastPos){var d=this.lastPos.c,e=this.lastPos.p,
f=a.panel;b=this.createEvent(a,b,c,this.lastPos.col,d,e!==false?e:d.items.getCount());if(this.portal.fireEvent("validatedrop",b)!==false&&this.portal.fireEvent("beforedrop",b)!==false){a.proxy.getProxy().remove();f.el.dom.parentNode.removeChild(a.panel.el.dom);e!==false?d.insert(e,f):d.add(f);d.doLayout();this.portal.fireEvent("drop",b);var g=this.scrollPos.top;if(g){var h=this.portal.body.dom;setTimeout(function(){h.scrollTop=g},10)}}delete this.lastPos}},getGrid:function(){var a=this.portal.bwrap.getBox();
a.columnX=[];this.portal.items.each(function(b){a.columnX.push({x:b.el.getX(),w:b.el.getWidth()})});return a},unreg:function(){Ext.dd.ScrollManager.unregister(this.portal.body);Ext.ux.Portal.DropZone.superclass.unreg.call(this)}});Ext.ux.PortalColumn=Ext.extend(Ext.Container,{layout:"anchor",defaultType:"portlet",cls:"x-portal-column"});Ext.reg("portalcolumn",Ext.ux.PortalColumn);Ext.ux.Portlet=Ext.extend(Ext.Panel,{anchor:"100%",frame:true,collapsible:true,draggable:true,cls:"x-portlet"});
Ext.reg("portlet",Ext.ux.Portlet);
Ext.ux.ProgressBarPager=Ext.extend(Object,{progBarWidth:225,defaultText:"Loading...",defaultAnimCfg:{duration:1,easing:"bounceOut"},constructor:function(a){a&&Ext.apply(this,a)},init:function(a){if(a.displayInfo){this.parent=a;a.items.indexOf(a.displayItem);a.remove(a.displayItem,true);this.progressBar=new Ext.ProgressBar({text:this.defaultText,width:this.progBarWidth,animate:this.defaultAnimCfg});a.displayItem=this.progressBar;a.add(a.displayItem);a.doLayout();Ext.apply(a,this.parentOverrides);this.progressBar.on("render",
function(b){b.mon(b.getEl().applyStyles("cursor:pointer"),"click",this.handleProgressBarClick,this)},this,{single:true})}},handleProgressBarClick:function(a){var b=this.parent,c=b.displayItem,d=this.progressBar.getBox();a=a.getXY()[0]-d.x;d=Math.ceil(b.store.getTotalCount()/b.pageSize);b.changePage(Math.ceil(a/(c.width/d)))},parentOverrides:{updateInfo:function(){if(this.displayItem){var a=this.store.getCount(),b=this.getPageData(),c=this.readPage(b);a=a==0?this.emptyMsg:String.format(this.displayMsg,
this.cursor+1,this.cursor+a,this.store.getTotalCount());c=b.activePage;this.displayItem.updateProgress(c/b.pages,a,this.animate||this.defaultAnimConfig)}}}});Ext.preg("progressbarpager",Ext.ux.ProgressBarPager);Ext.ns("Ext.ux.grid");
Ext.ux.grid.RowEditor=Ext.extend(Ext.Panel,{floating:true,shadow:false,layout:"hbox",cls:"x-small-editor",buttonAlign:"center",baseCls:"x-row-editor",elements:"header,footer,body",frameWidth:5,buttonPad:3,clicksToEdit:"auto",monitorValid:true,focusDelay:250,errorSummary:true,saveText:"Save",cancelText:"Cancel",commitChangesText:"You need to commit or cancel your changes",errorText:"Errors",defaults:{normalWidth:true},initComponent:function(){Ext.ux.grid.RowEditor.superclass.initComponent.call(this);
this.addEvents("beforeedit","canceledit","validateedit","afteredit")},init:function(a){this.ownerCt=this.grid=a;if(this.clicksToEdit===2)a.on("rowdblclick",this.onRowDblClick,this);else{a.on("rowclick",this.onRowClick,this);Ext.isIE&&a.on("rowdblclick",this.onRowDblClick,this)}a.getStore().on("remove",function(){this.stopEditing(false)},this);a.on({scope:this,keydown:this.onGridKey,columnresize:this.verifyLayout,columnmove:this.refreshFields,reconfigure:this.refreshFields,beforedestroy:this.beforedestroy,
destroy:this.destroy,bodyscroll:{buffer:250,fn:this.positionButtons}});a.getColumnModel().on("hiddenchange",this.verifyLayout,this,{delay:1});a.getView().on("refresh",this.stopEditing.createDelegate(this,[]))},beforedestroy:function(){this.stopMonitoring();this.grid.getStore().un("remove",this.onStoreRemove,this);this.stopEditing(false);Ext.destroy(this.btns,this.tooltip)},refreshFields:function(){this.initFields();this.verifyLayout()},isDirty:function(){var a;this.items.each(function(b){if(String(this.values[b.id])!==
String(b.getValue())){a=true;return false}},this);return a},startEditing:function(a,b){if(this.editing&&this.isDirty())this.showTooltip(this.commitChangesText);else{if(Ext.isObject(a))a=this.grid.getStore().indexOf(a);if(this.fireEvent("beforeedit",this,a)!==false){this.editing=true;var c=this.grid,d=c.getView(),e=d.getRow(a),f=c.store.getAt(a);this.record=f;this.rowIndex=a;this.values={};this.rendered||this.render(d.getEditorParent());this.setSize(Ext.fly(e).getWidth());this.initialized||this.initFields();
c=c.getColumnModel();d=this.items.items;for(var g,h,j=0,k=c.getColumnCount();j<k;j++){h=this.preEditValue(f,c.getDataIndex(j));g=d[j];g.setValue(h);this.values[g.id]=Ext.isEmpty(h)?"":h}this.verifyLayout(true);this.isVisible()?this.el.setXY(Ext.fly(e).getXY(),{duration:0.15}):this.setPagePosition(Ext.fly(e).getXY());this.isVisible()||this.show().doLayout();b!==false&&this.doFocus.defer(this.focusDelay,this)}}},stopEditing:function(a){this.editing=false;if(this.isVisible())if(a===false||!this.isValid()){this.hide();
this.fireEvent("canceledit",this,a===false)}else{a={};for(var b=this.record,c=false,d=this.grid.colModel,e=this.items.items,f=0,g=d.getColumnCount();f<g;f++)if(!d.isHidden(f)){var h=d.getDataIndex(f);if(!Ext.isEmpty(h)){var j=b.data[h],k=this.postEditValue(e[f].getValue(),j,b,h);if(String(j)!==String(k)){a[h]=k;c=true}}}if(c&&this.fireEvent("validateedit",this,a,b,this.rowIndex)!==false){b.beginEdit();Ext.iterate(a,function(l,m){b.set(l,m)});b.endEdit();this.fireEvent("afteredit",this,a,b,this.rowIndex)}else this.fireEvent("canceledit",
this,false);this.hide()}},verifyLayout:function(a){if(this.el&&(this.isVisible()||a===true)){a=this.grid.getView().getRow(this.rowIndex);this.setSize(Ext.fly(a).getWidth(),Ext.isIE?Ext.fly(a).getHeight()+9:undefined);a=this.grid.colModel;for(var b=this.items.items,c=0,d=a.getColumnCount();c<d;c++)if(a.isHidden(c))b[c].hide();else{var e=0;e+=c===d-1?3:1;b[c].show();b[c].setWidth(a.getColumnWidth(c)-e)}this.doLayout();this.positionButtons()}},slideHide:function(){this.hide()},initFields:function(){var a=
this.grid.getColumnModel(),b=Ext.layout.ContainerLayout.prototype.parseMargins;this.removeAll(false);for(var c=0,d=a.getColumnCount();c<d;c++){var e=a.getColumnAt(c),f=e.getEditor();f||(f=e.displayEditor||new Ext.form.DisplayField);f.margins=c==0?b("0 1 2 1"):c==d-1?b("0 0 2 1"):Ext.isIE?b("0 0 2 0"):b("0 1 2 0");f.setWidth(a.getColumnWidth(c));f.column=e;if(f.ownerCt!==this){f.on("focus",this.ensureVisible,this);f.on("specialkey",this.onKey,this)}this.insert(c,f)}this.initialized=true},onKey:function(a,
b){if(b.getKey()===b.ENTER){this.stopEditing(true);b.stopPropagation()}},onGridKey:function(a){if(a.getKey()===a.ENTER&&!this.isVisible()){var b=this.grid.getSelectionModel().getSelected();if(b){this.startEditing(this.grid.store.indexOf(b));a.stopPropagation()}}},ensureVisible:function(a){this.isVisible()&&this.grid.getView().ensureVisible(this.rowIndex,this.grid.colModel.getIndexById(a.column.id),true)},onRowClick:function(a,b,c){if(this.clicksToEdit=="auto"){a=this.lastClickIndex;this.lastClickIndex=
b;if(a!=b&&!this.isVisible())return}this.startEditing(b,false);this.doFocus.defer(this.focusDelay,this,[c.getPoint()])},onRowDblClick:function(a,b,c){this.startEditing(b,false);this.doFocus.defer(this.focusDelay,this,[c.getPoint()])},onRender:function(){Ext.ux.grid.RowEditor.superclass.onRender.apply(this,arguments);this.el.swallowEvent(["keydown","keyup","keypress"]);this.btns=new Ext.Panel({baseCls:"x-plain",cls:"x-btns",elements:"body",layout:"table",width:this.minButtonWidth*2+this.frameWidth*
2+this.buttonPad*4,items:[{ref:"saveBtn",itemId:"saveBtn",xtype:"button",text:this.saveText,width:this.minButtonWidth,handler:this.stopEditing.createDelegate(this,[true])},{xtype:"button",text:this.cancelText,width:this.minButtonWidth,handler:this.stopEditing.createDelegate(this,[false])}]});this.btns.render(this.bwrap)},afterRender:function(){Ext.ux.grid.RowEditor.superclass.afterRender.apply(this,arguments);this.positionButtons();this.monitorValid&&this.startMonitoring()},onShow:function(){this.monitorValid&&
this.startMonitoring();Ext.ux.grid.RowEditor.superclass.onShow.apply(this,arguments)},onHide:function(){Ext.ux.grid.RowEditor.superclass.onHide.apply(this,arguments);this.stopMonitoring();this.grid.getView().focusRow(this.rowIndex)},positionButtons:function(){if(this.btns){var a=this.grid,b=this.el.dom.clientHeight,c=a.getView().scroller.dom.scrollLeft,d=this.btns.getWidth();this.btns.el.shift({left:Math.min(a.getWidth(),a.getColumnModel().getTotalWidth())/2-d/2+c,top:b-2,stopFx:true,duration:0.2})}},
preEditValue:function(a,b){var c=a.data[b];return this.autoEncode&&typeof c==="string"?Ext.util.Format.htmlDecode(c):c},postEditValue:function(a){return this.autoEncode&&typeof a=="string"?Ext.util.Format.htmlEncode(a):a},doFocus:function(a){if(this.isVisible()){var b=0,c=this.grid.getColumnModel();if(a)b=this.getTargetColumnIndex(a);b=b||0;for(var d=c.getColumnCount();b<d;b++){a=c.getColumnAt(b);if(!a.hidden&&a.getEditor()){a.getEditor().focus();break}}}},getTargetColumnIndex:function(a){var b=this.grid,
c=b.view;a=a.left;b=b.colModel.config;for(var d=0,e=false,f;f=b[d];d++)if(!f.hidden)if(Ext.fly(c.getHeaderCell(d)).getRegion().right>=a){e=d;break}return e},startMonitoring:function(){if(!this.bound&&this.monitorValid){this.bound=true;Ext.TaskMgr.start({run:this.bindHandler,interval:this.monitorPoll||200,scope:this})}},stopMonitoring:function(){this.bound=false;this.tooltip&&this.tooltip.hide()},isValid:function(){var a=true;this.items.each(function(b){if(!b.isValid(true))return a=false});return a},
bindHandler:function(){if(!this.bound)return false;var a=this.isValid();!a&&this.errorSummary&&this.showTooltip(this.getErrorText().join(""));this.btns.saveBtn.setDisabled(!a);this.fireEvent("validation",this,a)},lastVisibleColumn:function(){for(var a=this.items.getCount()-1,b;a>=0;a--){b=this.items.items[a];if(!b.hidden)return b}},showTooltip:function(a){var b=this.tooltip;if(!b)b=this.tooltip=new Ext.ToolTip({maxWidth:600,cls:"errorTip",width:300,title:this.errorText,autoHide:false,anchor:"left",
anchorToTarget:true,mouseOffset:[40,0]});var c=this.grid.getView(),d=parseInt(this.el.dom.style.top,10);c=c.scroller.dom.scrollTop;var e=this.el.getHeight();if(d+e>=c){b.initTarget(this.lastVisibleColumn().getEl());if(!b.rendered){b.show();b.hide()}b.body.update(a);b.doAutoWidth(20);b.show()}else b.rendered&&b.hide()},getErrorText:function(){var a=["<ul>"];this.items.each(function(b){b.isValid(true)||a.push("<li>",b.getActiveError(),"</li>")});a.push("</ul>");return a}});Ext.preg("roweditor",Ext.ux.grid.RowEditor);
Ext.ns("Ext.ux.grid");
Ext.ux.grid.RowExpander=Ext.extend(Ext.util.Observable,{expandOnEnter:true,expandOnDblClick:true,header:"",width:20,sortable:false,fixed:true,hideable:false,menuDisabled:true,dataIndex:"",id:"expander",lazyRender:true,enableCaching:true,constructor:function(a){Ext.apply(this,a);this.addEvents({beforeexpand:true,expand:true,beforecollapse:true,collapse:true});Ext.ux.grid.RowExpander.superclass.constructor.call(this);if(this.tpl){if(typeof this.tpl=="string")this.tpl=new Ext.Template(this.tpl);this.tpl.compile()}this.state=
{};this.bodyContent={}},getRowClass:function(a,b,c){c.cols-=1;var d=this.bodyContent[a.id];if(!d&&!this.lazyRender)d=this.getBodyContent(a,b);if(d)c.body=d;return this.state[a.id]?"x-grid3-row-expanded":"x-grid3-row-collapsed"},init:function(a){this.grid=a;var b=a.getView();b.getRowClass=this.getRowClass.createDelegate(this);b.enableRowBody=true;a.on("render",this.onRender,this);a.on("destroy",this.onDestroy,this)},onRender:function(){var a=this.grid;a.getView().mainBody.on("mousedown",this.onMouseDown,
this,{delegate:".x-grid3-row-expander"});if(this.expandOnEnter)this.keyNav=new Ext.KeyNav(this.grid.getGridEl(),{enter:this.onEnter,scope:this});this.expandOnDblClick&&a.on("rowdblclick",this.onRowDblClick,this)},onDestroy:function(){if(this.keyNav){this.keyNav.disable();delete this.keyNav}var a=this.grid.getView().mainBody;a&&a.un("mousedown",this.onMouseDown,this)},onRowDblClick:function(a,b){this.toggleRow(b)},onEnter:function(){for(var a=this.grid,b=a.getSelectionModel().getSelections(),c=0,d=
b.length;c<d;c++)this.toggleRow(a.getStore().indexOf(b[c]))},getBodyContent:function(a){if(!this.enableCaching)return this.tpl.apply(a.data);var b=this.bodyContent[a.id];if(!b){b=this.tpl.apply(a.data);this.bodyContent[a.id]=b}return b},onMouseDown:function(a){a.stopEvent();this.toggleRow(a.getTarget(".x-grid3-row"))},renderer:function(a,b){b.cellAttr='rowspan="2"';return'<div class="x-grid3-row-expander">&#160;</div>'},beforeExpand:function(a,b,c){if(this.fireEvent("beforeexpand",this,a,b,c)!==false){if(this.tpl&&
this.lazyRender)b.innerHTML=this.getBodyContent(a,c);return true}else return false},toggleRow:function(a){if(typeof a=="number")a=this.grid.view.getRow(a);this[Ext.fly(a).hasClass("x-grid3-row-collapsed")?"expandRow":"collapseRow"](a)},expandRow:function(a){if(typeof a=="number")a=this.grid.view.getRow(a);var b=this.grid.store.getAt(a.rowIndex),c=Ext.DomQuery.selectNode("tr:nth(2) div.x-grid3-row-body",a);if(this.beforeExpand(b,c,a.rowIndex)){this.state[b.id]=true;Ext.fly(a).replaceClass("x-grid3-row-collapsed",
"x-grid3-row-expanded");this.fireEvent("expand",this,b,c,a.rowIndex)}},collapseRow:function(a){if(typeof a=="number")a=this.grid.view.getRow(a);var b=this.grid.store.getAt(a.rowIndex),c=Ext.fly(a).child("tr:nth(1) div.x-grid3-row-body",true);if(this.fireEvent("beforecollapse",this,b,c,a.rowIndex)!==false){this.state[b.id]=false;Ext.fly(a).replaceClass("x-grid3-row-expanded","x-grid3-row-collapsed");this.fireEvent("collapse",this,b,c,a.rowIndex)}}});Ext.preg("rowexpander",Ext.ux.grid.RowExpander);
Ext.grid.RowExpander=Ext.ux.grid.RowExpander;Ext.ns("Ext.ux.layout");
Ext.ux.layout.RowLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:true,type:"row",allowContainerRemove:false,isValidParent:function(a){return this.innerCt&&a.getPositionEl().dom.parentNode==this.innerCt.dom},getLayoutTargetSize:function(){var a=this.container.getLayoutTarget(),b;if(a){b=a.getViewSize();if(Ext.isIE&&Ext.isStrict&&b.height==0)b=a.getStyleSize();b.width-=a.getPadding("lr");b.height-=a.getPadding("tb")}return b},renderAll:function(a,b){if(!this.innerCt){this.innerCt=b.createChild({cls:"x-column-inner"});
this.innerCt.createChild({cls:"x-clear"})}Ext.layout.ColumnLayout.superclass.renderAll.call(this,a,this.innerCt)},onLayout:function(a,b){var c=a.items.items,d=c.length,e,f,g,h=[];this.renderAll(a,b);var j=this.getLayoutTargetSize();if(!(j.width<1&&j.height<1)){var k=e=j.height;this.innerCt.setSize({height:e});for(g=0;g<d;g++){e=c[g];f=e.getPositionEl().getMargins("tb");h[g]=f;e.rowHeight||(k-=e.getHeight()+f)}k=k<0?0:k;for(g=0;g<d;g++){e=c[g];f=h[g];e.rowHeight&&e.setSize({height:Math.floor(e.rowHeight*
k)-f})}if(Ext.isIE)if(b.getStyle("overflow")&&g!="hidden"&&!this.adjustmentPass)if(this.getLayoutTargetSize().width!=j.width){this.adjustmentPass=true;this.onLayout(a,b)}delete this.adjustmentPass}}});Ext.Container.LAYOUTS["ux.row"]=Ext.ux.layout.RowLayout;Ext.ns("Ext.ux.form");
Ext.ux.form.SearchField=Ext.extend(Ext.form.TwinTriggerField,{initComponent:function(){Ext.ux.form.SearchField.superclass.initComponent.call(this);this.on("specialkey",function(a,b){b.getKey()==b.ENTER&&this.onTrigger2Click()},this)},validationEvent:false,validateOnBlur:false,trigger1Class:"x-form-clear-trigger",trigger2Class:"x-form-search-trigger",hideTrigger1:true,width:180,hasSearch:false,paramName:"query",onTrigger1Click:function(){if(this.hasSearch){this.el.dom.value="";this.store.baseParams=
this.store.baseParams||{};this.store.baseParams[this.paramName]="";this.store.reload({params:{start:0}});this.triggers[0].hide();this.hasSearch=false}},onTrigger2Click:function(){var a=this.getRawValue();if(a.length<1)this.onTrigger1Click();else{this.store.baseParams=this.store.baseParams||{};this.store.baseParams[this.paramName]=a;this.store.reload({params:{start:0}});this.hasSearch=true;this.triggers[0].show()}}});Ext.ns("Ext.ux.form");
Ext.ux.form.SelectBox=Ext.extend(Ext.form.ComboBox,{constructor:function(a){this.searchResetDelay=1E3;a=a||{};a=Ext.apply(a||{},{editable:false,forceSelection:true,rowHeight:false,lastSearchTerm:false,triggerAction:"all",mode:"local"});Ext.ux.form.SelectBox.superclass.constructor.apply(this,arguments);this.lastSelectedIndex=this.selectedIndex||0},initEvents:function(){Ext.ux.form.SelectBox.superclass.initEvents.apply(this,arguments);this.el.on("keydown",this.keySearch,this,true);this.cshTask=new Ext.util.DelayedTask(this.clearSearchHistory,
this)},keySearch:function(a){var b=a.getKey(),c=String.fromCharCode(b),d=0;if(this.store.getCount()){switch(b){case Ext.EventObject.HOME:a.stopEvent();this.selectFirst();return;case Ext.EventObject.END:a.stopEvent();this.selectLast();return;case Ext.EventObject.PAGEDOWN:this.selectNextPage();a.stopEvent();return;case Ext.EventObject.PAGEUP:this.selectPrevPage();a.stopEvent();return}if(!(a.hasModifier()&&!a.shiftKey||a.isNavKeyPress()||a.isSpecialKey())){if(this.lastSearchTerm==c)d=this.lastSelectedIndex;
this.search(this.displayField,c,d);this.cshTask.delay(this.searchResetDelay)}}},onRender:function(){this.store.on("load",this.calcRowsPerPage,this);Ext.ux.form.SelectBox.superclass.onRender.apply(this,arguments);if(this.mode=="local"){this.initList();this.calcRowsPerPage()}},onSelect:function(a,b,c){if(this.fireEvent("beforeselect",this,a,b)!==false){this.setValue(a.data[this.valueField||this.displayField]);c||this.collapse();this.lastSelectedIndex=b+1;this.fireEvent("select",this,a,b)}},afterRender:function(){Ext.ux.form.SelectBox.superclass.afterRender.apply(this,
arguments);Ext.isWebKit&&this.el.swallowEvent("mousedown",true);this.el.unselectable();this.innerList.unselectable();this.trigger.unselectable();this.innerList.on("mouseup",function(a,b){b.id&&b.id==this.innerList.id||this.onViewClick()},this);this.mun(this.view,"containerclick",this.onViewClick,this);this.mun(this.view,"click",this.onViewClick,this);this.innerList.on("mouseover",function(a,b){if(!(b.id&&b.id==this.innerList.id)){this.lastSelectedIndex=this.view.getSelectedIndexes()[0]+1;this.cshTask.delay(this.searchResetDelay)}},
this);this.trigger.un("click",this.onTriggerClick,this);this.trigger.on("mousedown",function(a){a.preventDefault();this.onTriggerClick()},this);this.on("collapse",function(){Ext.getDoc().un("mouseup",this.collapseIf,this)},this,true);this.on("expand",function(){Ext.getDoc().on("mouseup",this.collapseIf,this)},this,true)},clearSearchHistory:function(){this.lastSelectedIndex=0;this.lastSearchTerm=false},selectFirst:function(){this.focusAndSelect(this.store.data.first())},selectLast:function(){this.focusAndSelect(this.store.data.last())},
selectPrevPage:function(){this.rowHeight&&this.focusAndSelect(this.store.getAt(Math.max(this.selectedIndex-this.rowsPerPage,0)))},selectNextPage:function(){this.rowHeight&&this.focusAndSelect(this.store.getAt(Math.min(this.selectedIndex+this.rowsPerPage,this.store.getCount()-1)))},search:function(a,b){this.lastSearchTerm=b;var c=this.store.find.apply(this.store,arguments);c!==-1&&this.focusAndSelect(c)},focusAndSelect:function(a){a=Ext.isNumber(a)?a:this.store.indexOf(a);this.select(a,this.isExpanded());
this.onSelect(this.store.getAt(a),a,this.isExpanded())},calcRowsPerPage:function(){if(this.store.getCount()){this.rowHeight=Ext.fly(this.view.getNode(0)).getHeight();this.rowsPerPage=this.maxHeight/this.rowHeight}else this.rowHeight=false}});Ext.reg("selectbox",Ext.ux.form.SelectBox);Ext.ux.SelectBox=Ext.ux.form.SelectBox;
Ext.ux.SlidingPager=Ext.extend(Object,{init:function(a){var b=a.items.indexOf(a.inputItem);Ext.each(a.items.getRange(b-2,b+2),function(d){d.hide()});var c=new Ext.Slider({width:114,minValue:1,maxValue:1,plugins:new Ext.slider.Tip({getText:function(d){return String.format("Page <b>{0}</b> of <b>{1}</b>",d.value,d.slider.maxValue)}}),listeners:{changecomplete:function(d,e){a.changePage(e)}}});a.insert(b+1,c);a.on({change:function(d,e){c.setMaxValue(e.pages);c.setValue(e.activePage)}})}});Ext.ns("Ext.ux.form");
Ext.ux.form.SpinnerField=Ext.extend(Ext.form.NumberField,{actionMode:"wrap",deferHeight:true,autoSize:Ext.emptyFn,onBlur:Ext.emptyFn,adjustSize:Ext.BoxComponent.prototype.adjustSize,constructor:function(a){var b=Ext.copyTo({},a,"incrementValue,alternateIncrementValue,accelerate,defaultValue,triggerClass,splitterClass");b=this.spinner=new Ext.ux.Spinner(b);b=a.plugins?Ext.isArray(a.plugins)?a.plugins.push(b):[a.plugins,b]:b;Ext.ux.form.SpinnerField.superclass.constructor.call(this,Ext.apply(a,{plugins:b}))},
getResizeEl:function(){return this.wrap},getPositionEl:function(){return this.wrap},alignErrorIcon:function(){this.wrap&&this.errorIcon.alignTo(this.wrap,"tl-tr",[2,0])},validateBlur:function(){return true}});Ext.reg("spinnerfield",Ext.ux.form.SpinnerField);Ext.form.SpinnerField=Ext.ux.form.SpinnerField;
Ext.ux.Spinner=Ext.extend(Ext.util.Observable,{incrementValue:1,alternateIncrementValue:5,triggerClass:"x-form-spinner-trigger",splitterClass:"x-form-spinner-splitter",alternateKey:Ext.EventObject.shiftKey,defaultValue:0,accelerate:false,constructor:function(a){Ext.ux.Spinner.superclass.constructor.call(this,a);Ext.apply(this,a);this.mimicing=false},init:function(a){this.field=a;a.afterMethod("onRender",this.doRender,this);a.afterMethod("onEnable",this.doEnable,this);a.afterMethod("onDisable",this.doDisable,
this);a.afterMethod("afterRender",this.doAfterRender,this);a.afterMethod("onResize",this.doResize,this);a.afterMethod("onFocus",this.doFocus,this);a.beforeMethod("onDestroy",this.doDestroy,this)},doRender:function(){var a=this.el=this.field.getEl(),b=this.field;if(b.wrap)this.wrap=b.wrap.addClass("x-form-field-wrap");else b.wrap=this.wrap=a.wrap({cls:"x-form-field-wrap"});this.trigger=this.wrap.createChild({tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.triggerClass});b.width||this.wrap.setWidth(a.getWidth()+
this.trigger.getWidth());this.splitter=this.wrap.createChild({tag:"div",cls:this.splitterClass,style:"width:13px; height:2px;"});this.splitter.setRight(Ext.isIE?1:2).setTop(10).show();this.proxy=this.trigger.createProxy("",this.splitter,true);this.proxy.addClass("x-form-spinner-proxy");this.proxy.setStyle("left","0px");this.proxy.setSize(14,1);this.proxy.hide();this.dd=new Ext.dd.DDProxy(this.splitter.dom.id,"SpinnerDrag",{dragElId:this.proxy.id});this.initTrigger();this.initSpinner()},doAfterRender:function(){var a;
if(Ext.isIE&&this.el.getY()!=(a=this.trigger.getY())){this.el.position();this.el.setY(a)}},doEnable:function(){if(this.wrap){this.disabled=false;this.wrap.removeClass(this.field.disabledClass)}},doDisable:function(){if(this.wrap){this.disabled=true;this.wrap.addClass(this.field.disabledClass);this.el.removeClass(this.field.disabledClass)}},doResize:function(a){typeof a=="number"&&this.el.setWidth(a-this.trigger.getWidth());this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth())},doFocus:function(){if(!this.mimicing){this.wrap.addClass("x-trigger-wrap-focus");
this.mimicing=true;Ext.get(Ext.isIE?document.body:document).on("mousedown",this.mimicBlur,this,{delay:10});this.el.on("keydown",this.checkTab,this)}},checkTab:function(a){a.getKey()==a.TAB&&this.triggerBlur()},mimicBlur:function(a){!this.wrap.contains(a.target)&&this.field.validateBlur(a)&&this.triggerBlur()},triggerBlur:function(){this.mimicing=false;Ext.get(Ext.isIE?document.body:document).un("mousedown",this.mimicBlur,this);this.el.un("keydown",this.checkTab,this);this.field.beforeBlur();this.wrap.removeClass("x-trigger-wrap-focus");
this.field.onBlur.call(this.field)},initTrigger:function(){this.trigger.addClassOnOver("x-form-trigger-over");this.trigger.addClassOnClick("x-form-trigger-click")},initSpinner:function(){this.field.addEvents({spin:true,spinup:true,spindown:true});this.keyNav=new Ext.KeyNav(this.el,{up:function(a){a.preventDefault();this.onSpinUp()},down:function(a){a.preventDefault();this.onSpinDown()},pageUp:function(a){a.preventDefault();this.onSpinUpAlternate()},pageDown:function(a){a.preventDefault();this.onSpinDownAlternate()},
scope:this});this.repeater=new Ext.util.ClickRepeater(this.trigger,{accelerate:this.accelerate});this.field.mon(this.repeater,"click",this.onTriggerClick,this,{preventDefault:true});this.field.mon(this.trigger,{mouseover:this.onMouseOver,mouseout:this.onMouseOut,mousemove:this.onMouseMove,mousedown:this.onMouseDown,mouseup:this.onMouseUp,scope:this,preventDefault:true});this.field.mon(this.wrap,"mousewheel",this.handleMouseWheel,this);this.dd.setXConstraint(0,0,10);this.dd.setYConstraint(1500,1500,
10);this.dd.endDrag=this.endDrag.createDelegate(this);this.dd.startDrag=this.startDrag.createDelegate(this);this.dd.onDrag=this.onDrag.createDelegate(this)},onMouseOver:function(){if(!this.disabled){var a=this.getMiddle();this.tmpHoverClass=Ext.EventObject.getPageY()<a?"x-form-spinner-overup":"x-form-spinner-overdown";this.trigger.addClass(this.tmpHoverClass)}},onMouseOut:function(){this.trigger.removeClass(this.tmpHoverClass)},onMouseMove:function(){if(!this.disabled){var a=this.getMiddle();Ext.EventObject.getPageY()>
a&&this.tmpHoverClass=="x-form-spinner-overup"||Ext.EventObject.getPageY()}},onMouseDown:function(){if(!this.disabled){var a=this.getMiddle();this.tmpClickClass=Ext.EventObject.getPageY()<a?"x-form-spinner-clickup":"x-form-spinner-clickdown";this.trigger.addClass(this.tmpClickClass)}},onMouseUp:function(){this.trigger.removeClass(this.tmpClickClass)},onTriggerClick:function(){if(!(this.disabled||this.el.dom.readOnly)){var a=this.getMiddle();this["onSpin"+(Ext.EventObject.getPageY()<a?"Up":"Down")]()}},
getMiddle:function(){var a=this.trigger.getTop(),b=this.trigger.getHeight();return a+b/2},isSpinnable:function(){if(this.disabled||this.el.dom.readOnly){Ext.EventObject.preventDefault();return false}return true},handleMouseWheel:function(a){if(this.wrap.hasClass("x-trigger-wrap-focus")!=false){var b=a.getWheelDelta();if(b>0){this.onSpinUp();a.stopEvent()}else if(b<0){this.onSpinDown();a.stopEvent()}}},startDrag:function(){this.proxy.show();this._previousY=Ext.fly(this.dd.getDragEl()).getTop()},endDrag:function(){this.proxy.hide()},
onDrag:function(){if(!this.disabled){var a=Ext.fly(this.dd.getDragEl()).getTop(),b="";if(this._previousY>a)b="Up";if(this._previousY<a)b="Down";b!=""&&this["onSpin"+b]();this._previousY=a}},onSpinUp:function(){if(this.isSpinnable()!=false)if(Ext.EventObject.shiftKey==true)this.onSpinUpAlternate();else{this.spin(false,false);this.field.fireEvent("spin",this);this.field.fireEvent("spinup",this)}},onSpinDown:function(){if(this.isSpinnable()!=false)if(Ext.EventObject.shiftKey==true)this.onSpinDownAlternate();
else{this.spin(true,false);this.field.fireEvent("spin",this);this.field.fireEvent("spindown",this)}},onSpinUpAlternate:function(){if(this.isSpinnable()!=false){this.spin(false,true);this.field.fireEvent("spin",this);this.field.fireEvent("spinup",this)}},onSpinDownAlternate:function(){if(this.isSpinnable()!=false){this.spin(true,true);this.field.fireEvent("spin",this);this.field.fireEvent("spindown",this)}},spin:function(a,b){var c=parseFloat(this.field.getValue()),d=b==true?this.alternateIncrementValue:
this.incrementValue;a==true?c-=d:c+=d;c=isNaN(c)?this.defaultValue:c;c=this.fixBoundries(c);this.field.setRawValue(c)},fixBoundries:function(a){a=a;if(this.field.minValue!=undefined&&a<this.field.minValue)a=this.field.minValue;if(this.field.maxValue!=undefined&&a>this.field.maxValue)a=this.field.maxValue;return this.fixPrecision(a)},fixPrecision:function(a){var b=isNaN(a);if(!this.field.allowDecimals||this.field.decimalPrecision==-1||b||!a)return b?"":a;return parseFloat(parseFloat(a).toFixed(this.field.decimalPrecision))},
doDestroy:function(){this.trigger&&this.trigger.remove();if(this.wrap){this.wrap.remove();delete this.field.wrap}this.splitter&&this.splitter.remove();if(this.dd){this.dd.unreg();this.dd=null}this.proxy&&this.proxy.remove();this.repeater&&this.repeater.purgeListeners();if(this.mimicing)Ext.get(Ext.isIE?document.body:document).un("mousedown",this.mimicBlur,this)}});Ext.form.Spinner=Ext.ux.Spinner;Ext.ux.Spotlight=function(a){Ext.apply(this,a)};
Ext.ux.Spotlight.prototype={active:false,animate:true,duration:0.25,easing:"easeNone",animated:false,createElements:function(){var a=Ext.getBody();this.right=a.createChild({cls:"x-spotlight"});this.left=a.createChild({cls:"x-spotlight"});this.top=a.createChild({cls:"x-spotlight"});this.bottom=a.createChild({cls:"x-spotlight"});this.all=new Ext.CompositeElement([this.right,this.left,this.top,this.bottom])},show:function(a,b,c){if(this.animated)this.show.defer(50,this,[a,b,c]);else{this.el=Ext.get(a);
this.right||this.createElements();if(this.active)this.applyBounds(false,false,false,b,c);else{this.all.setDisplayed("");this.applyBounds(true,false);this.active=true;Ext.EventManager.onWindowResize(this.syncSize,this);this.applyBounds(false,this.animate,false,b,c)}}},hide:function(a,b){if(this.animated)this.hide.defer(50,this,[a,b]);else{Ext.EventManager.removeResizeListener(this.syncSize,this);this.applyBounds(true,this.animate,true,a,b)}},doHide:function(){this.active=false;this.all.setDisplayed(false)},
syncSize:function(){this.applyBounds(false,false)},applyBounds:function(a,b,c,d,e){var f=this.el.getRegion(),g=Ext.lib.Dom.getViewWidth(true),h=Ext.lib.Dom.getViewHeight(true),j=0,k=false;if(b){k={callback:function(){j++;if(j==4){this.animated=false;c&&this.doHide();Ext.callback(d,e,[this])}},scope:this,duration:this.duration,easing:this.easing};this.animated=true}this.right.setBounds(f.right,a?h:f.top,g-f.right,a?0:h-f.top,k);this.left.setBounds(0,0,f.left,a?0:f.bottom,k);this.top.setBounds(a?g:
f.left,0,a?0:g-f.left,f.top,k);this.bottom.setBounds(0,f.bottom,a?0:f.right,h-f.bottom,k);if(!b){c&&this.doHide();d&&Ext.callback(d,e,[this])}},destroy:function(){this.doHide();Ext.destroy(this.right,this.left,this.top,this.bottom);delete this.el;delete this.all}};Ext.Spotlight=Ext.ux.Spotlight;
Ext.ux.StatusBar=Ext.extend(Ext.Toolbar,{cls:"x-statusbar",busyIconCls:"x-status-busy",busyText:"Loading...",autoClear:5E3,emptyText:"&nbsp;",activeThreadId:0,initComponent:function(){if(this.statusAlign=="right")this.cls+=" x-status-right";Ext.ux.StatusBar.superclass.initComponent.call(this)},afterRender:function(){Ext.ux.StatusBar.superclass.afterRender.call(this);var a=this.statusAlign=="right";this.currIconCls=this.iconCls||this.defaultIconCls;this.statusEl=new Ext.Toolbar.TextItem({cls:"x-status-text "+
(this.currIconCls||""),text:this.text||this.defaultText||""});if(a){this.add("->");this.add(this.statusEl)}else{this.insert(0,this.statusEl);this.insert(1,"->")}this.doLayout()},setStatus:function(a){a=a||{};if(typeof a=="string")a={text:a};a.text!==undefined&&this.setText(a.text);a.iconCls!==undefined&&this.setIcon(a.iconCls);if(a.clear){a=a.clear;var b=this.autoClear,c={useDefaults:true,anim:true};if(typeof a=="object"){a=Ext.applyIf(a,c);if(a.wait)b=a.wait}else if(typeof a=="number"){b=a;a=c}else if(typeof a==
"boolean")a=c;a.threadId=this.activeThreadId;this.clearStatus.defer(b,this,[a])}return this},clearStatus:function(a){a=a||{};if(a.threadId&&a.threadId!==this.activeThreadId)return this;var b=a.useDefaults?this.defaultText:this.emptyText,c=a.useDefaults?this.defaultIconCls?this.defaultIconCls:"":"";if(a.anim)this.statusEl.el.fadeOut({remove:false,useDisplay:true,scope:this,callback:function(){this.setStatus({text:b,iconCls:c});this.statusEl.el.show()}});else{this.statusEl.hide();this.setStatus({text:b,
iconCls:c});this.statusEl.show()}return this},setText:function(a){this.activeThreadId++;this.text=a||"";this.rendered&&this.statusEl.setText(this.text);return this},getText:function(){return this.text},setIcon:function(a){this.activeThreadId++;a=a||"";if(this.rendered){if(this.currIconCls){this.statusEl.removeClass(this.currIconCls);this.currIconCls=null}if(a.length>0){this.statusEl.addClass(a);this.currIconCls=a}}else this.currIconCls=a;return this},showBusy:function(a){if(typeof a=="string")a={text:a};
a=Ext.applyIf(a||{},{text:this.busyText,iconCls:this.busyIconCls});return this.setStatus(a)}});Ext.reg("statusbar",Ext.ux.StatusBar);
Ext.ux.TabCloseMenu=Ext.extend(Object,{closeTabText:"Close Tab",closeOtherTabsText:"Close Other Tabs",showCloseAll:true,closeAllTabsText:"Close All Tabs",constructor:function(a){Ext.apply(this,a||{})},init:function(a){this.tabs=a;a.on({scope:this,contextmenu:this.onContextMenu,destroy:this.destroy})},destroy:function(){Ext.destroy(this.menu);delete this.menu;delete this.tabs;delete this.active},onContextMenu:function(a,b,c){this.active=b;var d=this.createMenu(),e=true,f=true,g=d.getComponent("closeall");
d.getComponent("close").setDisabled(!b.closable);a.items.each(function(){if(this.closable){e=false;if(this!=b)return f=false}});d.getComponent("closeothers").setDisabled(f);g&&g.setDisabled(e);c.stopEvent();d.showAt(c.getPoint())},createMenu:function(){if(!this.menu){var a=[{itemId:"close",text:this.closeTabText,scope:this,handler:this.onClose}];this.showCloseAll&&a.push("-");a.push({itemId:"closeothers",text:this.closeOtherTabsText,scope:this,handler:this.onCloseOthers});this.showCloseAll&&a.push({itemId:"closeall",
text:this.closeAllTabsText,scope:this,handler:this.onCloseAll});this.menu=new Ext.menu.Menu({items:a})}return this.menu},onClose:function(){this.tabs.remove(this.active)},onCloseOthers:function(){this.doClose(true)},onCloseAll:function(){this.doClose(false)},doClose:function(a){var b=[];this.tabs.items.each(function(c){if(c.closable)if(!a||c!=this.active)b.push(c)},this);Ext.each(b,function(c){this.tabs.remove(c)},this)}});Ext.preg("tabclosemenu",Ext.ux.TabCloseMenu);Ext.ns("Ext.ux.grid");
Ext.ux.grid.TableGrid=function(a,b){b=b||{};Ext.apply(this,b);var c=b.fields||[],d=b.columns||[];a=Ext.get(a);for(var e=a.insertSibling(),f=[],g=[],h=a.query("thead th"),j=0,k;k=h[j];j++){var l=k.innerHTML,m="tcol-"+j;f.push(Ext.applyIf(c[j]||{},{name:m,mapping:"td:nth("+(j+1)+")/@innerHTML"}));g.push(Ext.applyIf(d[j]||{},{header:l,dataIndex:m,width:k.offsetWidth,tooltip:k.title,sortable:true}))}c=new Ext.data.Store({reader:new Ext.data.XmlReader({record:"tbody tr"},f)});c.loadData(a.dom);g=new Ext.grid.ColumnModel(g);
b.width||b.height?e.setSize(b.width||"auto",b.height||"auto"):e.setWidth(a.getWidth());b.remove!==false&&a.remove();Ext.applyIf(this,{ds:c,cm:g,sm:new Ext.grid.RowSelectionModel,autoHeight:true,autoWidth:false});Ext.ux.grid.TableGrid.superclass.constructor.call(this,e,{})};Ext.extend(Ext.ux.grid.TableGrid,Ext.grid.GridPanel);Ext.grid.TableGrid=Ext.ux.grid.TableGrid;Ext.ns("Ext.ux");
Ext.ux.TabScrollerMenu=Ext.extend(Object,{pageSize:10,maxText:15,menuPrefixText:"Items",constructor:function(a){a=a||{};Ext.apply(this,a)},init:function(a){Ext.apply(a,this.parentOverrides);a.tabScrollerMenu=this;var b=this;a.on({render:{scope:a,single:true,fn:function(){var c=a.createScrollers.createSequence(b.createPanelsMenu,this);a.createScrollers=c}}})},createPanelsMenu:function(){var a=this.stripWrap.dom.offsetHeight;Ext.fly(this.header.dom.firstChild).applyStyles({right:"18px"});Ext.get(this.strip.dom.parentNode).applyStyles({"margin-right":"36px"});
var b=this.header.insertFirst({cls:"x-tab-tabmenu-right"});b.setHeight(a);b.addClassOnOver("x-tab-tabmenu-over");b.on("click",this.showTabsMenu,this);this.scrollLeft.show=this.scrollLeft.show.createSequence(function(){b.show()});this.scrollLeft.hide=this.scrollLeft.hide.createSequence(function(){b.hide()})},getPageSize:function(){return this.pageSize},setPageSize:function(a){this.pageSize=a},getMaxText:function(){return this.maxText},setMaxText:function(a){this.maxText=a},getMenuPrefixText:function(){return this.menuPrefixText},
setMenuPrefixText:function(a){this.menuPrefixText=a},parentOverrides:{showTabsMenu:function(a){if(this.tabsMenu){this.tabsMenu.destroy();this.un("destroy",this.tabsMenu.destroy,this.tabsMenu);this.tabsMenu=null}this.tabsMenu=new Ext.menu.Menu;this.on("destroy",this.tabsMenu.destroy,this.tabsMenu);this.generateTabMenuItems();a=Ext.get(a.getTarget()).getXY();a[1]+=24;this.tabsMenu.showAt(a)},generateTabMenuItems:function(){var a=this.getActiveTab(),b=this.items.getCount(),c=this.tabScrollerMenu.getPageSize();
if(b>c){for(var d=Math.floor(b/c),e=b%c,f=0;f<d;f++){for(var g=(f+1)*c,h=[],j=0;j<c;j++){index=j+g-c;var k=this.items.get(index);h.push(this.autoGenMenuItem(k))}this.tabsMenu.add({text:this.tabScrollerMenu.getMenuPrefixText()+" "+(g-c+1)+" - "+g,menu:h})}if(e>0){c=d*c;h=[];for(f=c;f<b;f++){k=this.items.get(f);h.push(this.autoGenMenuItem(k))}this.tabsMenu.add({text:this.tabScrollerMenu.menuPrefixText+" "+(c+1)+" - "+(c+h.length),menu:h})}}else this.items.each(function(l){l.id!=a.id&&!l.hidden&&this.tabsMenu.add(this.autoGenMenuItem(l))},
this)},autoGenMenuItem:function(a){var b=this.tabScrollerMenu.getMaxText();return{text:Ext.util.Format.ellipsis(a.title,b),handler:this.showTabFromMenu,scope:this,disabled:a.disabled,tabToShow:a,iconCls:a.iconCls}},showTabFromMenu:function(a){this.setActiveTab(a.tabToShow)}}});Ext.reg("tabscrollermenu",Ext.ux.TabScrollerMenu);Ext.ns("Ext.ux.tree");
Ext.ux.tree.XmlTreeLoader=Ext.extend(Ext.tree.TreeLoader,{XML_NODE_ELEMENT:1,XML_NODE_TEXT:3,processResponse:function(a,b,c){var d=a.responseXML;d=d.documentElement||d;try{b.beginUpdate();b.appendChild(this.parseXml(d));b.endUpdate();this.runCallback(c,scope||b,[b])}catch(e){this.handleFailure(a)}},parseXml:function(a){var b=[];Ext.each(a.childNodes,function(c){if(c.nodeType==this.XML_NODE_ELEMENT){var d=this.createNode(c);if(c.childNodes.length>0){c=this.parseXml(c);if(typeof c=="string")d.attributes.innerText=
c;else d.appendChild(c)}b.push(d)}else if(c.nodeType==this.XML_NODE_TEXT){d=c.nodeValue.trim();if(d.length>0)return b=d}},this);return b},createNode:function(a){var b={tagName:a.tagName};Ext.each(a.attributes,function(c){b[c.nodeName]=c.nodeValue});this.processAttributes(b);return Ext.ux.tree.XmlTreeLoader.superclass.createNode.call(this,b)},processAttributes:Ext.emptyFn});Ext.ux.XmlTreeLoader=Ext.ux.tree.XmlTreeLoader;
Ext.ux.ValidationStatus=Ext.extend(Ext.Component,{errorIconCls:"x-status-error",errorListCls:"x-status-error-list",validIconCls:"x-status-valid",showText:"The form has errors (click for details...)",hideText:"Click again to hide the error list",submitText:"Saving...",init:function(a){a.on("render",function(){this.statusBar=a;this.monitor=true;this.errors=new Ext.util.MixedCollection;this.listAlign=a.statusAlign=="right"?"br-tr?":"bl-tl?";if(this.form){this.form=Ext.getCmp(this.form).getForm();this.startMonitoring();
this.form.on("beforeaction",function(c,d){if(d.type=="submit")this.monitor=false},this);var b=function(){this.monitor=true};this.form.on("actioncomplete",b,this);this.form.on("actionfailed",b,this)}},this,{single:true});a.on({scope:this,afterlayout:{single:true,fn:function(){a.statusEl.getEl().on("click",this.onStatusClick,this,{buffer:200})}},beforedestroy:{single:true,fn:this.onDestroy}})},startMonitoring:function(){this.form.items.each(function(a){a.on("invalid",this.onFieldValidation,this);a.on("valid",
this.onFieldValidation,this)},this)},stopMonitoring:function(){this.form.items.each(function(a){a.un("invalid",this.onFieldValidation,this);a.un("valid",this.onFieldValidation,this)},this)},onDestroy:function(){this.stopMonitoring();this.statusBar.statusEl.un("click",this.onStatusClick,this);Ext.ux.ValidationStatus.superclass.onDestroy.call(this)},onFieldValidation:function(a,b){if(!this.monitor)return false;b?this.errors.add(a.id,{field:a,msg:b}):this.errors.removeKey(a.id);this.updateErrorList();
if(this.errors.getCount()>0)this.statusBar.getText()!=this.showText&&this.statusBar.setStatus({text:this.showText,iconCls:this.errorIconCls});else this.statusBar.clearStatus().setIcon(this.validIconCls)},updateErrorList:function(){if(this.errors.getCount()>0){var a="<ul>";this.errors.each(function(b){a+='<li id="x-err-'+b.field.id+'"><a href="#">'+b.msg+"</a></li>"},this);this.getMsgEl().update(a+"</ul>")}else this.getMsgEl().update("")},getMsgEl:function(){if(!this.msgEl){this.msgEl=Ext.DomHelper.append(Ext.getBody(),
{cls:this.errorListCls+" x-hide-offsets"},true);this.msgEl.on("click",function(a){if(a=a.getTarget("li",10,true)){Ext.getCmp(a.id.split("x-err-")[1]).focus();this.hideErrors()}},this,{stopEvent:true})}return this.msgEl},showErrors:function(){this.updateErrorList();this.getMsgEl().alignTo(this.statusBar.getEl(),this.listAlign).slideIn("b",{duration:0.3,easing:"easeOut"});this.statusBar.setText(this.hideText);this.form.getEl().on("click",this.hideErrors,this,{single:true})},hideErrors:function(){var a=
this.getMsgEl();if(a.isVisible()){a.slideOut("b",{duration:0.2,easing:"easeIn"});this.statusBar.setText(this.showText)}this.form.getEl().un("click",this.hideErrors,this)},onStatusClick:function(){if(this.getMsgEl().isVisible())this.hideErrors();else this.errors.getCount()>0&&this.showErrors()}});
(function(){Ext.override(Ext.list.Column,{init:function(){var a=Ext.data.Types,b=this.sortType;if(this.type){if(Ext.isString(this.type))this.type=Ext.data.Types[this.type.toUpperCase()]||a.AUTO}else this.type=a.AUTO;if(Ext.isString(b))this.sortType=Ext.data.SortTypes[b];else if(Ext.isEmpty(b))this.sortType=this.type.sortType}});Ext.tree.Column=Ext.extend(Ext.list.Column,{});Ext.tree.NumberColumn=Ext.extend(Ext.list.NumberColumn,{});Ext.tree.DateColumn=Ext.extend(Ext.list.DateColumn,{});Ext.tree.BooleanColumn=
Ext.extend(Ext.list.BooleanColumn,{});Ext.reg("tgcolumn",Ext.tree.Column);Ext.reg("tgnumbercolumn",Ext.tree.NumberColumn);Ext.reg("tgdatecolumn",Ext.tree.DateColumn);Ext.reg("tgbooleancolumn",Ext.tree.BooleanColumn)})();
Ext.ux.tree.TreeGridNodeUI=Ext.extend(Ext.tree.TreeNodeUI,{isTreeGridNodeUI:true,renderElements:function(a,b,c,d){var e=a.getOwnerTree(),f=e.columns,g=f[0],h,j,k;this.indentMarkup=a.parentNode?a.parentNode.ui.getChildIndent():"";j=['<tbody class="x-tree-node">','<tr ext:tree-node-id="',a.id,'" class="x-tree-node-el x-tree-node-leaf ',b.cls,'">','<td class="x-treegrid-col">','<span class="x-tree-node-indent">',this.indentMarkup,"</span>",'<img src="',this.emptyIcon,'" class="x-tree-ec-icon x-tree-elbow" />',
'<img src="',b.icon||this.emptyIcon,'" class="x-tree-node-icon',b.icon?" x-tree-node-inline-icon":"",b.iconCls?" "+b.iconCls:"",'" unselectable="on" />','<a hidefocus="on" class="x-tree-node-anchor" href="',b.href?b.href:"#",'" tabIndex="1" ',b.hrefTarget?' target="'+b.hrefTarget+'"':"",">",'<span unselectable="on">',g.tpl?g.tpl.apply(b):b[g.dataIndex]||g.text,"</span></a>","</td>"];h=1;for(k=f.length;h<k;h++){g=f[h];j.push('<td class="x-treegrid-col ',g.cls?g.cls:"",'">','<div unselectable="on" class="x-treegrid-text"',
g.align?' style="text-align: '+g.align+';"':"",">",g.tpl?g.tpl.apply(b):b[g.dataIndex],"</div>","</td>")}j.push('</tr><tr class="x-tree-node-ct"><td colspan="',f.length,'">','<table class="x-treegrid-node-ct-table" cellpadding="0" cellspacing="0" style="table-layout: fixed; display: none; width: ',e.innerCt.getWidth(),'px;"><colgroup>');h=0;for(k=f.length;h<k;h++)j.push('<col style="width: ',f[h].hidden?0:f[h].width,'px;" />');j.push("</colgroup></table></td></tr></tbody>");this.wrap=d!==true&&a.nextSibling&&
a.nextSibling.ui.getEl()?Ext.DomHelper.insertHtml("beforeBegin",a.nextSibling.ui.getEl(),j.join("")):Ext.DomHelper.insertHtml("beforeEnd",c,j.join(""));this.elNode=this.wrap.childNodes[0];this.ctNode=this.wrap.childNodes[1].firstChild.firstChild;a=this.elNode.firstChild.childNodes;this.indentNode=a[0];this.ecNode=a[1];this.iconNode=a[2];this.anchor=a[3];this.textNode=a[3].firstChild},animExpand:function(a){this.ctNode.style.display="";Ext.ux.tree.TreeGridNodeUI.superclass.animExpand.call(this,a)}});
Ext.ux.tree.TreeGridRootNodeUI=Ext.extend(Ext.tree.TreeNodeUI,{isTreeGridNodeUI:true,render:function(){if(!this.rendered){this.wrap=this.ctNode=this.node.ownerTree.innerCt.dom;this.node.expanded=true}if(Ext.isWebKit){var a=this.ctNode;a.style.tableLayout=null;(function(){a.style.tableLayout="fixed"}).defer(1)}},destroy:function(){this.elNode&&Ext.dd.Registry.unregister(this.elNode.id);delete this.node},collapse:Ext.emptyFn,expand:Ext.emptyFn});
Ext.tree.ColumnResizer=Ext.extend(Ext.util.Observable,{minWidth:14,constructor:function(a){Ext.apply(this,a);Ext.tree.ColumnResizer.superclass.constructor.call(this)},init:function(a){this.tree=a;a.on("render",this.initEvents,this)},initEvents:function(a){a.mon(a.innerHd,"mousemove",this.handleHdMove,this);this.tracker=new Ext.dd.DragTracker({onBeforeStart:this.onBeforeStart.createDelegate(this),onStart:this.onStart.createDelegate(this),onDrag:this.onDrag.createDelegate(this),onEnd:this.onEnd.createDelegate(this),
tolerance:3,autoStart:300});this.tracker.initEl(a.innerHd);a.on("beforedestroy",this.tracker.destroy,this.tracker)},handleHdMove:function(a){var b=a.getPageX(),c=a.getTarget(".x-treegrid-hd",3,true);if(c){var d=c.getRegion();a=c.dom.style;var e=c.dom.parentNode;if(b-d.left<=5&&c.dom!==e.firstChild){for(b=c.dom.previousSibling;b&&Ext.fly(b).hasClass("x-treegrid-hd-hidden");)b=b.previousSibling;if(b){this.activeHd=Ext.get(b);a.cursor=Ext.isWebKit?"e-resize":"col-resize"}}else if(d.right-b<=5){for(b=
c.dom;b&&Ext.fly(b).hasClass("x-treegrid-hd-hidden");)b=b.previousSibling;if(b){this.activeHd=Ext.get(b);a.cursor=Ext.isWebKit?"w-resize":"col-resize"}}else{delete this.activeHd;a.cursor=""}}},onBeforeStart:function(){this.dragHd=this.activeHd;return!!this.dragHd},onStart:function(){this.dragHeadersDisabled=this.tree.headersDisabled;this.tree.headersDisabled=true;this.proxy=this.tree.body.createChild({cls:"x-treegrid-resizer"});this.proxy.setHeight(this.tree.body.getHeight());var a=this.tracker.getXY()[0];
this.hdX=this.dragHd.getX();this.hdIndex=this.tree.findHeaderIndex(this.dragHd);this.proxy.setX(this.hdX);this.proxy.setWidth(a-this.hdX);this.maxWidth=this.tree.outerCt.getWidth()-this.tree.innerBody.translatePoints(this.hdX).left},onDrag:function(){this.proxy.setWidth((this.tracker.getXY()[0]-this.hdX).constrain(this.minWidth,this.maxWidth))},onEnd:function(){var a=this.proxy.getWidth(),b=this.tree,c=this.dragHeadersDisabled;this.proxy.remove();delete this.dragHd;b.columns[this.hdIndex].width=a;
b.updateColumnWidths();setTimeout(function(){b.headersDisabled=c},100)}});Ext.ns("Ext.ux.tree");
Ext.ux.tree.TreeGridSorter=Ext.extend(Ext.tree.TreeSorter,{sortClasses:["sort-asc","sort-desc"],sortAscText:"Sort Ascending",sortDescText:"Sort Descending",constructor:function(a,b){Ext.isObject(b)||(b={property:a.columns[0].dataIndex||"text",folderSort:true});Ext.ux.tree.TreeGridSorter.superclass.constructor.apply(this,arguments);this.tree=a;a.on("headerclick",this.onHeaderClick,this);a.ddAppendOnly=true;var c=this;this.defaultSortFn=function(d,e){var f=c.dir&&c.dir.toLowerCase()=="desc",g=c.property||
"text",h=c.sortType,j=c.caseSensitive===true,k=c.leafAttr||"leaf",l=d.attributes,m=e.attributes;if(c.folderSort){if(l[k]&&!m[k])return 1;if(!l[k]&&m[k])return-1}k=l[g];g=m[g];m=h?h(k):j?k:k.toUpperCase();v2=h?h(g):j?g:g.toUpperCase();return m<v2?f?+1:-1:m>v2?f?-1:+1:0};a.on("afterrender",this.onAfterTreeRender,this,{single:true});a.on("headermenuclick",this.onHeaderMenuClick,this)},onAfterTreeRender:function(){this.tree.hmenu&&this.tree.hmenu.insert(0,{itemId:"asc",text:this.sortAscText,cls:"xg-hmenu-sort-asc"},
{itemId:"desc",text:this.sortDescText,cls:"xg-hmenu-sort-desc"});this.updateSortIcon(0,"asc")},onHeaderMenuClick:function(a,b,c){if(b==="asc"||b==="desc"){this.onHeaderClick(a,null,c);return false}},onHeaderClick:function(a,b,c){if(a&&!this.tree.headersDisabled){var d=this;d.property=a.dataIndex;d.dir=a.dir=a.dir==="desc"?"asc":"desc";d.sortType=a.sortType;Ext.isBoolean(a.caseSensitive);d.sortFn=a.sortFn||this.defaultSortFn;this.tree.root.cascade(function(e){e.isLeaf()||d.updateSort(d.tree,e)});this.updateSortIcon(c,
a.dir)}},updateSortIcon:function(a,b){var c=this.sortClasses;this.tree.innerHd.select("td").removeClass(c).item(a).addClass(c[b=="desc"?1:0])}});Ext.ux.tree.TreeGridLoader=Ext.extend(Ext.tree.TreeLoader,{createNode:function(a){if(!a.uiProvider)a.uiProvider=Ext.ux.tree.TreeGridNodeUI;return Ext.tree.TreeLoader.prototype.createNode.call(this,a)}});
Ext.ux.tree.TreeGrid=Ext.extend(Ext.tree.TreePanel,{rootVisible:false,useArrows:true,lines:false,borderWidth:Ext.isBorderBox?0:2,cls:"x-treegrid",columnResize:true,enableSort:true,reserveScrollOffset:true,enableHdMenu:true,columnsText:"Columns",initComponent:function(){if(!this.root)this.root=new Ext.tree.AsyncTreeNode({text:"Root"});var a=this.loader;if(a){if(Ext.isObject(a)&&!a.load)a=new Ext.ux.tree.TreeGridLoader(a)}else a=new Ext.ux.tree.TreeGridLoader({dataUrl:this.dataUrl,requestMethod:this.requestMethod,
store:this.store});this.loader=a;Ext.ux.tree.TreeGrid.superclass.initComponent.call(this);this.initColumns();if(this.enableSort)this.treeGridSorter=new Ext.ux.tree.TreeGridSorter(this,this.enableSort);if(this.columnResize){this.colResizer=new Ext.tree.ColumnResizer(this.columnResize);this.colResizer.init(this)}if(!this.internalTpl)this.internalTpl=new Ext.XTemplate('<div class="x-grid3-header">','<div class="x-treegrid-header-inner">','<div class="x-grid3-header-offset">','<table style="table-layout: fixed;" cellspacing="0" cellpadding="0" border="0"><colgroup><tpl for="columns"><col /></tpl></colgroup>',
'<thead><tr class="x-grid3-hd-row">','<tpl for="columns">','<td class="x-grid3-hd x-grid3-cell x-treegrid-hd" style="text-align: {align};" id="',this.id,'-xlhd-{#}">','<div class="x-grid3-hd-inner x-treegrid-hd-inner" unselectable="on">',this.enableHdMenu?'<a class="x-grid3-hd-btn" href="#"></a>':"",'{header}<img class="x-grid3-sort-icon" src="',Ext.BLANK_IMAGE_URL,'" />',"</div>","</td></tpl>","</tr></thead>","</table>","</div></div>","</div>",'<div class="x-treegrid-root-node">','<table class="x-treegrid-root-table" cellpadding="0" cellspacing="0" style="table-layout: fixed;"></table>',
"</div>");if(!this.colgroupTpl)this.colgroupTpl=new Ext.XTemplate('<colgroup><tpl for="columns"><col style="width: {width}px"/></tpl></colgroup>')},initColumns:function(){var a=this.columns,b=a.length,c=[],d,e;for(d=0;d<b;d++){e=a[d];if(!e.isColumn){e.xtype=e.xtype?/^tg/.test(e.xtype)?e.xtype:"tg"+e.xtype:"tgcolumn";e=Ext.create(e)}e.init(this);c.push(e);if(this.enableSort!==false&&e.sortable!==false)this.enableSort=e.sortable=true}this.columns=c},onRender:function(){Ext.tree.TreePanel.superclass.onRender.apply(this,
arguments);this.el.addClass("x-treegrid");this.outerCt=this.body.createChild({cls:"x-tree-root-ct x-treegrid-ct "+(this.useArrows?"x-tree-arrows":this.lines?"x-tree-lines":"x-tree-no-lines")});this.internalTpl.overwrite(this.outerCt,{columns:this.columns});this.mainHd=Ext.get(this.outerCt.dom.firstChild);this.innerHd=Ext.get(this.mainHd.dom.firstChild);this.innerBody=Ext.get(this.outerCt.dom.lastChild);this.innerCt=Ext.get(this.innerBody.dom.firstChild);this.colgroupTpl.insertFirst(this.innerCt,{columns:this.columns});
if(this.hideHeaders)this.el.child(".x-grid3-header").setDisplayed("none");else if(this.enableHdMenu!==false){this.hmenu=new Ext.menu.Menu({id:this.id+"-hctx"});if(this.enableColumnHide!==false){this.colMenu=new Ext.menu.Menu({id:this.id+"-hcols-menu"});this.colMenu.on({scope:this,beforeshow:this.beforeColMenuShow,itemclick:this.handleHdMenuClick});this.hmenu.add({itemId:"columns",hideOnClick:false,text:this.columnsText,menu:this.colMenu,iconCls:"x-cols-icon"})}this.hmenu.on("itemclick",this.handleHdMenuClick,
this)}},setRootNode:function(a){a.attributes.uiProvider=Ext.ux.tree.TreeGridRootNodeUI;a=Ext.ux.tree.TreeGrid.superclass.setRootNode.call(this,a);this.innerCt&&this.colgroupTpl.insertFirst(this.innerCt,{columns:this.columns});return a},clearInnerCt:function(){if(Ext.isIE)for(var a=this.innerCt.dom;a.firstChild;)a.removeChild(a.firstChild);else Ext.ux.tree.TreeGrid.superclass.clearInnerCt.call(this)},initEvents:function(){Ext.ux.tree.TreeGrid.superclass.initEvents.apply(this,arguments);this.mon(this.innerBody,
"scroll",this.syncScroll,this);this.mon(this.innerHd,"click",this.handleHdDown,this);this.mon(this.mainHd,{scope:this,mouseover:this.handleHdOver,mouseout:this.handleHdOut})},onResize:function(a,b){Ext.ux.tree.TreeGrid.superclass.onResize.apply(this,arguments);var c=this.innerBody.dom,d=this.innerHd.dom;if(c){if(Ext.isNumber(b))c.style.height=this.body.getHeight(true)-d.offsetHeight+"px";if(Ext.isNumber(a)){var e=Ext.num(this.scrollOffset,Ext.getScrollBarWidth());if(this.reserveScrollOffset||c.offsetWidth-
c.clientWidth>10)this.setScrollOffset(e);else{var f=this;setTimeout(function(){f.setScrollOffset(c.offsetWidth-c.clientWidth>10?e:0)},10)}}}},updateColumnWidths:function(){var a=this.columns,b=a.length,c=this.outerCt.query("colgroup"),d=c.length,e,f,g,h;for(g=0;g<b;g++){e=a[g];for(h=0;h<d;h++){f=c[h];f.childNodes[g].style.width=(e.hidden?0:e.width)+"px"}}g=0;c=this.innerHd.query("td");for(len=c.length;g<len;g++){e=Ext.fly(c[g]);a[g]&&a[g].hidden?e.addClass("x-treegrid-hd-hidden"):e.removeClass("x-treegrid-hd-hidden")}a=
this.getTotalColumnWidth();Ext.fly(this.innerHd.dom.firstChild).setWidth(a+(this.scrollOffset||0));this.outerCt.select("table").setWidth(a);this.syncHeaderScroll()},getVisibleColumns:function(){var a=[],b=this.columns,c=b.length,d;for(d=0;d<c;d++)b[d].hidden||a.push(b[d]);return a},getTotalColumnWidth:function(){for(var a=0,b=0,c=this.getVisibleColumns(),d=c.length;b<d;b++)a+=c[b].width;return a},setScrollOffset:function(a){this.scrollOffset=a;this.updateColumnWidths()},handleHdDown:function(a,b){var c=
a.getTarget(".x-treegrid-hd");if(c&&Ext.fly(b).hasClass("x-grid3-hd-btn")){var d=this.hmenu.items,e=this.columns,f=this.findHeaderIndex(c);e=e[f];a.stopEvent();Ext.fly(c).addClass("x-grid3-hd-menu-open");this.hdCtxIndex=f;this.fireEvent("headerbuttonclick",d,e,c,f);this.hmenu.on("hide",function(){Ext.fly(c).removeClass("x-grid3-hd-menu-open")},this,{single:true});this.hmenu.show(b,"tl-bl?")}else if(c){f=this.findHeaderIndex(c);this.fireEvent("headerclick",this.columns[f],c,f)}},handleHdOver:function(a,
b){var c=a.getTarget(".x-treegrid-hd");if(c&&!this.headersDisabled){index=this.findHeaderIndex(c);this.activeHdRef=b;this.activeHdIndex=index;var d=Ext.get(c);this.activeHdRegion=d.getRegion();d.addClass("x-grid3-hd-over");if(this.activeHdBtn=d.child(".x-grid3-hd-btn"))this.activeHdBtn.dom.style.height=c.firstChild.offsetHeight-1+"px"}},handleHdOut:function(a){var b=a.getTarget(".x-treegrid-hd");if(b&&(!Ext.isIE||!a.within(b,true))){this.activeHdRef=null;Ext.fly(b).removeClass("x-grid3-hd-over");
b.style.cursor=""}},findHeaderIndex:function(a){a=a.dom||a;for(var b=a.parentNode.childNodes,c=0,d;d=b[c];c++)if(d==a)return c;return-1},beforeColMenuShow:function(){var a=this.columns,b=a.length,c,d;this.colMenu.removeAll();for(c=1;c<b;c++){d=a[c];d.hideable!==false&&this.colMenu.add(new Ext.menu.CheckItem({itemId:"col-"+c,text:d.header,checked:!d.hidden,hideOnClick:false,disabled:d.hideable===false}))}},handleHdMenuClick:function(a){var b=this.hdCtxIndex,c=a.getItemId();if(this.fireEvent("headermenuclick",
this.columns[b],c,b)!==false){b=c.substr(4);b>0&&this.columns[b]&&this.setColumnVisible(b,!a.checked)}return true},setColumnVisible:function(a,b){this.columns[a].hidden=!b;this.updateColumnWidths()},scrollToTop:function(){this.innerBody.dom.scrollTop=0;this.innerBody.dom.scrollLeft=0},syncScroll:function(){this.syncHeaderScroll();var a=this.innerBody.dom;this.fireEvent("bodyscroll",a.scrollLeft,a.scrollTop)},syncHeaderScroll:function(){var a=this.innerBody.dom;this.innerHd.dom.scrollLeft=a.scrollLeft;
this.innerHd.dom.scrollLeft=a.scrollLeft},registerNode:function(a){Ext.ux.tree.TreeGrid.superclass.registerNode.call(this,a);if(!a.uiProvider&&!a.isRoot&&!a.ui.isTreeGridNodeUI)a.ui=new Ext.ux.tree.TreeGridNodeUI(a)}});Ext.reg("treegrid",Ext.ux.tree.TreeGrid);
