Ext.ux.Reorderer=Ext.extend(Object,{defaults:{animate:!0,animationDuration:0.2,defaultReorderable:!1},constructor:function(a){Ext.apply(this,a||{},this.defaults)},init:function(a){this.target=a;this.initEvents();a=this.getItems();var b=a.length,d;for(d=0;d<b;d++)this.createIfReorderable(a[d])},reorder:function(a){var b=this.target;!1!==b.fireEvent("before-reorder",a,b,this)&&(this.doReorder(a),b.fireEvent("reorder",a,b,this))},doReorder:function(a){throw Error("doReorder must be implemented in the Ext.ux.Reorderer subclass");
},createItemDD:function(a){throw Error("createItemDD must be implemented in the Ext.ux.Reorderer subclass");},createItemDD:function(a){var b=a.getEl(),d=this.target,e=this;a.dd=new Ext.dd.DD(b,void 0,{isTarget:!1});a.dd.constrainTo(d.getEl());a.dd.setYConstraint(0,0,0);Ext.apply(a.dd,{b4StartDrag:function(){this.startPosition=b.getXY();this.startZIndex=b.getStyle("zIndex");b.setStyle("zIndex",1E4);a.suspendEvents()},onDrag:function(f){f=b.getXY()[0];for(var g=f-this.startPosition[0],h=d.items.items,
k=h.indexOf(a),l=0;l<h.length;l++){var m=h[l];if(m.reorderable&&m.id!=a.id){var n=m.getEl().getBox(),n=(e.buttonXCache[m.id]||n.x)+n.width/2,m=k>l&&0>g&&f<n,n=k<l&&0<g&&f+b.getWidth()>n;if(m||n){e[m?"onMovedLeft":"onMovedRight"](a,l,k);break}}}},endDrag:function(){e.updateButtonXCache();b.moveTo(e.buttonXCache[a.id],void 0,{duration:e.animationDuration,scope:this,callback:function(){a.resumeEvents();d.fireEvent("reordered",a,d)}});b.setStyle("zIndex",this.startZIndex)}})},createIfReorderable:function(a){this.defaultReorderable&&
void 0==a.reorderable&&(a.reorderable=!0);if(a.reorderable&&!a.dd)if(a.rendered)this.createItemDD(a);else a.on("render",this.createItemDD.createDelegate(this,[a]),this,{single:!0})},getItems:function(){return this.target.items.items},initEvents:function(){this.target.addEvents("before-reorder","reorder")}});
Ext.ux.HBoxReorderer=Ext.extend(Ext.ux.Reorderer,{init:function(a){this.buttonXCache={};a.on({scope:this,add:function(a,d){this.createIfReorderable(d)}});Ext.ux.HBoxReorderer.superclass.init.apply(this,arguments)},createItemDD:function(a){if(void 0==a.dd){var b=a.getEl(),d=this,e=d.target;a.dd=new Ext.dd.DD(b,void 0,{isTarget:!1});b.applyStyles({position:"absolute"});var f=function(){return!1};Ext.apply(a.dd,{b4StartDrag:function(){this.startPosition=b.getXY();this.startZIndex=b.getStyle("zIndex");
b.setStyle("zIndex",1E4);a.suspendEvents();if(a.menu)a.menu.on("beforeshow",f,d)},startDrag:function(){this.constrainTo(e.getEl());this.setYConstraint(0,0,0)},onDrag:function(f){f=b.getXY()[0];var h=f-this.startPosition[0],k=e.items.items,l=k.length,m=k.indexOf(a),n,p;for(n=0;n<l;n++)if(p=k[n],p.reorderable&&p.id!=a.id){var q=p.getEl().getBox(),q=(d.buttonXCache[p.id]||q.x)+q.width/2;p=m>n&&0>h&&f<q;q=m<n&&0<h&&f+b.getWidth()>q;if(p||q){d[p?"onMovedLeft":"onMovedRight"](a,n,m);break}}},endDrag:function(){d.updateButtonXCache();
b.moveTo(d.buttonXCache[a.id],b.getY(),{duration:d.animationDuration,scope:this,callback:function(){a.resumeEvents();a.menu&&a.menu.un("beforeshow",f,d);e.fireEvent("reordered",a,e)}});b.setStyle("zIndex",this.startZIndex)}})}},onMovedLeft:function(a,b,d){var e=this.target,f=e.items.items,g=f.length;if(void 0!=b&&b!=d)for(e.remove(a,!1),e.insert(b,a),this.updateButtonXCache(),b=0;b<g;b++)e=f[b],d=this.buttonXCache[e.id],a==e?a.dd.startPosition[0]=d:(e=e.getEl(),e.moveTo(d,e.getY(),{duration:this.animationDuration}))},
onMovedRight:function(a,b,d){this.onMovedLeft.apply(this,arguments)},updateButtonXCache:function(){var a=this.target,b=a.items,d=a.getEl().getBox(!0).x;b.each(function(a){this.buttonXCache[a.id]=d;d+=a.getEl().getWidth()},this)}});Ext.ns("Ext.ux.plugins.grid");Ext.ux.plugins.grid.CellToolTips=function(a){var b;Ext.isArray(a)?(b=a,a={}):b=a.ajaxTips;Ext.ux.plugins.grid.CellToolTips.superclass.constructor.call(this,a);a.tipConfig&&(this.tipConfig=a.tipConfig);this.ajaxTips=b};
Ext.extend(Ext.ux.plugins.grid.CellToolTips,Ext.util.Observable,{version:1.3,ajaxTips:!1,tipTpls:!1,tipFns:!1,tipUrls:"",tipConfig:{},request:!1,init:function(a){this.ajaxTips&&(this.tipTpls={},this.tipFns={},this.tipAfterFns={},this.tipUrls={},Ext.each(this.ajaxTips,function(a){this.tipTpls[a.field]=new Ext.XTemplate(a.tpl);a.url&&(this.tipUrls[a.field]=a.url);a.fn&&(this.tipFns[a.field]=a.fn);a.afterFn&&(this.tipAfterFns[a.field]=a.afterFn);a.tipConfig&&(this.tipConfig=a.tipConfig)},this),delete this.ajaxTips,
a.on("render",this.onGridRender.createDelegate(this)))},setFieldTpl:function(a,b){this.tipTpls[a]=Ext.isObject(b)?b:new Ext.XTemplate(b)},onGridRender:function(a){this.tipTpls&&(Ext.apply(this.tipConfig,{target:a.getView().mainBody,delegate:".x-grid3-cell-inner",renderTo:document.body,finished:!1}),Ext.applyIf(this.tipConfig,{trackMouse:!0}),this.tip=new Ext.ToolTip(this.tipConfig),this.tip.ctt=this,this.tip.on("beforeshow",this.beforeTipShow.createDelegate(this.tip,[this,a],!0)),this.tip.on("hide",
this.hideTip))},beforeTipShow:function(a,b,d){var e=d.getView().findCellIndex(a.triggerElement),e=d.getColumnModel().getDataIndex(e);if(!b.tipTpls[e])return!1;if(a.finished)a.body.dom.innerHTML=a.ctt.tipTpls[e].apply(a.tipdata);else{var f="string"==typeof b.tipUrls[e],g=d.getView().findRowIndex(a.triggerElement),h=d.getStore().getAt(g);if(d.CellToolTipCondition&&!1===d.CellToolTipCondition(g,h))return!1;g=h.copy().data;f?(b.loadDetails(b.tipFns[e]?b.tipFns[e](g):g,a,d,b,e),a.body.dom.innerHTML="Loading..."):
a.body.dom.innerHTML=b.tipTpls[e].apply(b.tipFns[e]?b.tipFns[e](h.data):h.data)}},hideTip:function(a){a.finished=!1},loadDetails:function(a,b,d,e,f){Ext.Ajax.request({url:e.tipUrls[f],params:a,method:"POST",success:function(a,d){b.finished=!0;b.tipdata=Ext.decode(a.responseText);e.tipAfterFns[f]&&(b.tipdata=e.tipAfterFns[f](b.tipdata));b.show()}})}});Ext.namespace("Ext.ux.grid");Ext.ux.grid.GridHeaderFilters=function(a){a&&Ext.apply(this,a)};
Ext.extend(Ext.ux.grid.GridHeaderFilters,Ext.util.Observable,{fieldHeight:22,fieldPadding:1,highlightOnFilter:!0,highlightColor:"yellow",highlightCls:null,stateful:!0,applyMode:"auto",filters:null,filtersInitMode:"replace",ensureFilteredVisible:!0,cfgFilterInit:!1,containerConfig:null,labelWidth:50,fcc:null,filterFields:null,filterContainers:null,filterContainerCls:"x-ghf-filter-container",inResizeProcess:!1,init:function(a){this.grid=a;a=this.grid.getView();a.updateHeaders=a.updateHeaders.createSequence(function(){this.renderFilters.call(this)},
this).createInterceptor(function(){return!0},this);this.grid.on({scope:this,render:this.onRender,resize:this.onResize,columnresize:this.onColResize,reconfigure:this.onReconfigure,beforedestroy:this.destroyFilters});this.stateful&&(this.grid.on("beforestatesave",this.saveFilters,this),this.grid.on("beforestaterestore",this.loadFilters,this));this.grid.getColumnModel().on("hiddenchange",this.onColHidden,this);this.grid.addEvents("filterupdate");this.addEvents({render:!0});this.cfgFilterInit=Ext.isDefined(this.filters)&&
null!==this.filters;this.filters||(this.filters={});this.configure(this.grid.getColumnModel());Ext.ux.grid.GridHeaderFilters.superclass.constructor.call(this);this.stateful&&(Ext.isArray(this.grid.stateEvents)||(this.grid.stateEvents=[]),this.grid.stateEvents.push("filterupdate"));Ext.apply(this.grid,{headerFilters:this,getHeaderFilter:function(a){return this.headerFilters?this.headerFilters.filters[a]:null},setHeaderFilter:function(a,d){if(this.headerFilters){var e={};e[a]=d;this.setHeaderFilters(e)}},
setHeaderFilters:function(a,d,e){if(this.headerFilters){d&&this.resetHeaderFilters(!1);3>arguments.length&&(e=!0);var f=!1,g;for(g in a)this.headerFilters.filterFields[g]&&(f=this.headerFilters.filterFields[g],this.headerFilters.setFieldValue(f,a[g]),this.headerFilters.applyFilter(f,!1),f=!0);f&&e&&this.headerFilters.storeReload()}},getHeaderFilterField:function(a){if(this.headerFilters)return this.headerFilters.filterFields[a]?this.headerFilters.filterFields[a]:null},resetHeaderFilters:function(a){if(this.headerFilters){0==
arguments.length&&(a=!0);for(var d in this.headerFilters.filterFields){var e=this.headerFilters.filterFields[d];Ext.isFunction(e.clearValue)?e.clearValue():this.headerFilters.setFieldValue(e,"");this.headerFilters.applyFilter(e,!1)}a&&this.headerFilters.storeReload()}},applyHeaderFilters:function(a){0==arguments.length&&(a=!0);this.headerFilters.applyFilters(a)}})},configure:function(a){a=a.getColumnsBy(function(a){return Ext.isObject(a.filter)||Ext.isArray(a.filter)?!0:!1});this.fcc={};for(var b=
0;b<a.length;b++){var d=a[b],e=d.filter;Ext.isArray(e)||(e=[e]);for(var f=0;f<e.length;f++){var g=Ext.apply({filterName:0<f?d.dataIndex+f:d.dataIndex},e[f]);Ext.apply(g,{columnId:d.id,dataIndex:d.dataIndex,hideLabel:!0,anchor:"100%"});this.cfgFilterInit||Ext.isEmpty(g.value)||(this.filters[g.filterName]=Ext.isFunction(g.filterEncoder)?g.filterEncoder.call(this,g.value):g.value);delete g.value;if(g.applyFilterEvent)g.listeners={scope:this},g.listeners[g.applyFilterEvent]=function(a){this.applyFilter(a)},
delete g.applyFilterEvent;else if("auto"===this.applyMode||"change"===this.applyMode||Ext.isEmpty(this.applyMode))if(void 0!=g.hasListener){if(!g.hasListener("change"))g.on("change",function(a){var b=a.getValue();String(a.startValue)!==String(b)&&(b=a.getXType(),"combo"!=b&&"datefield"!=b&&this.applyFilter(a))},this);if(!g.hasListener("specialkey"))g.on("specialkey",function(a,b){b.stopPropagation();b.getKey()==b.ENTER&&(this.focusedFilterName=a.filterName,a.el.dom.blur())},this);if(!g.hasListener("select"))g.on("select",
function(a){this.focusedFilterName=a.filterName;this.applyFilter(a)},this)}else g.listeners={change:function(a){var b=a.getValue();String(a.startValue)!==String(b)&&(b=a.getXType(),"combo"!=b&&"datefield"!=b&&this.applyFilter(a))},specialkey:function(a,b){b.stopPropagation();b.getKey()==b.TAB&&(this.focusedFilterName=void 0);b.getKey()==b.ENTER&&(this.focusedFilterName=a.filterName)},select:function(a){this.focusedFilterName=a.filterName;this.applyFilter(a)},scope:this};else"enter"===this.applyMode&&
(g.listeners={specialkey:function(a,b){b.stopPropagation();b.getKey()==b.ENTER&&(this.focusedFilterName=a.filterName,this.applyFilters());b.getKey()==b.TAB&&(this.focusedFilterName=void 0)},scope:this});var h=this.fcc[g.columnId];h||(h={cls:this.filterContainerCls,border:!1,bodyBorder:!1,bodyStyle:"background-color: transparent",labelSeparator:"",labelWidth:this.labelWidth,layout:"hbox",style:{},items:[]},this.containerConfig&&Ext.apply(h,this.containerConfig),this.fcc[g.columnId]=h);h.items.push({bodyStyle:"background-color: transparent",
border:!1,bodyBorder:!1,layout:"form",padding:2,margins:"0 0 -4 0",flex:1,items:[g]})}}},renderFilterContainer:function(a,b){this.filterContainers||(this.filterContainers={});var d=this.grid.getColumnModel().getIndexById(a),e=this.grid.getView().getHeaderCell(d),e=Ext.get(e);Ext.isGecko&&(e.dom.style.MozUserSelect="text");e.dom.style.verticalAlign="top";b.width=e.getWidth()-3;d=new Ext.Container(b);d.render(e);this.filterContainers[a]=d;e=0;this.filterFields||(this.filterFields={});var f=d.findBy(function(a){return!Ext.isEmpty(a.filterName)});
if(!Ext.isEmpty(f))for(var g=0;g<f.length;g++)this.filterFields[f[g].filterName]=f[g],e+=f[g].getHeight();return d},renderFilters:function(){if(this.fcc){for(var a in this.fcc)this.renderFilterContainer(a,this.fcc[a]);this.setFilters(this.filters);this.highlightFilters(this.isFiltered());this.focusedFilterName&&this.getFilterField(this.focusedFilterName).focus()}},onRender:function(){this.isFiltered()&&this.applyFilters(!1);this.fireEvent("render",this)},getFilterField:function(a){return this.filterFields?
this.filterFields[a]:null},setFilters:function(a,b){if((this.filters=a)&&this.filterFields){for(var d in this.filters)this.filterFields[d]||delete this.filters[d];for(d in this.filterFields){var e=this.filterFields[d],f=this.filters[e.filterName];Ext.isEmpty(f)?b&&this.setFieldValue(e,""):this.setFieldValue(e,f)}}},onColResize:function(a,b){if(this.filterContainers)if(!this.inResizeProcess&&this.grid.viewConfig&&this.grid.viewConfig.forceFit)this.onResize();else{var d=this.grid.getColumnModel().getColumnId(a);
if(d=this.filterContainers[d])isNaN(b)&&(b=0),d.setWidth(3>b?0:b-3),d.doLayout(!1,!0)}},onResize:function(){this.inResizeProcess=!0;for(var a=this.grid.getColumnModel().getColumnCount(),b=0;b<a;b++){var d=this.grid.getView().getHeaderCell(b),d=Ext.get(d);this.onColResize(b,d.getWidth())}this.inResizeProcess=!1},onColHidden:function(a,b,d){d||(a=this.grid.getColumnModel().getColumnWidth(b),this.onColResize(b,a))},onReconfigure:function(a,b,d){this.destroyFilters();this.configure(d);this.renderFilters()},
saveFilters:function(a,b){var d={},e;for(e in this.filters)d[e]=this.filters[e];b.gridHeaderFilters=d;return!0},loadFilters:function(a,b){var d=b.gridHeaderFilters;d&&(this.cfgFilterInit?"merge"===this.filtersInitMode&&Ext.apply(d,this.filters):this.filters=d)},isFiltered:function(){for(var a in this.filters)if(!Ext.isEmpty(this.filters[a]))return!0;return!1},highlightFilters:function(a){if(this.highlightOnFilter&&this.filterContainers&&this.grid.getView().mainHd){var b=a?this.highlightColor:"transparent",
d;for(d in this.filterContainers){var e=this.filterContainers[d];e.rendered&&(Ext.isEmpty(this.highlightCls)?e.getEl().setStyle("backgroundColor",b):a?e.getEl().addClass(this.highlightCls):e.getEl().removeClass(this.highlightCls))}}},getFieldValue:function(a){return Ext.isFunction(a.filterEncoder)?a.filterEncoder.call(a,a.getValue()):a.getValue()},setFieldValue:function(a,b){Ext.isFunction(a.filterDecoder)&&(b=a.filterDecoder.call(a,b));a.setValue(b)},applyFilter:function(a,b){2>arguments.length&&
(b=!0);if(a&&a.isValid()&&(!a.disabled||Ext.isDefined(this.grid.store.baseParams[a.filterName]))){var d=this.getFieldValue(a);if(a.disabled||Ext.isEmpty(d))delete this.grid.store.baseParams[a.filterName],delete this.filters[a.filterName];else if(this.grid.store.baseParams[a.filterName]=d,this.filters[a.filterName]=d,this.ensureFilteredVisible){var e=this.grid.getColumnModel().getIndexById(a.columnId);0<=e&&this.grid.getColumnModel().isHidden(e)&&this.grid.getColumnModel().setHidden(e,!1)}this.highlightFilters(this.isFiltered());
this.grid.fireEvent("filterupdate",a.filterName,d,a);a.startValue=d;b&&this.storeReload()}},applyFilters:function(a){1>arguments.length&&(a=!0);for(var b in this.filterFields)this.applyFilter(this.filterFields[b],!1);a&&this.storeReload()},storeReload:function(){if(this.grid.store.lastOptions){var a={start:0};this.grid.store.lastOptions.params&&this.grid.store.lastOptions.params.limit&&(a.limit=this.grid.store.lastOptions.params.limit);this.grid.store.load({params:a})}},getFilterContainer:function(a){return this.filterContainers?
this.filterContainers[a]:null},destroyFilters:function(){if(this.filterFields)for(var a in this.filterFields)Ext.destroy(this.filterFields[a]),delete this.filterFields[a];if(this.filterContainers)for(a in this.filterContainers)Ext.destroy(this.filterContainers[a]),delete this.filterContainers[a]}});Ext.preg("ux-grid-header-filter",Ext.ux.grid.GridHeaderFilters);Ext.ns("Ext.ux.grid");
Ext.ux.grid.LockingHeaderGroupGridView=Ext.extend(Ext.grid.GridView,{lockText:"Lock",unlockText:"Unlock",rowBorderWidth:1,lockedBorderWidth:1,syncHeights:!1,initTemplates:function(){var a=this.templates||{};a.master||(a.master=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>"));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+)/;Ext.ux.grid.LockingHeaderGroupGridView.superclass.initTemplates.call(this)},getEditorParent:function(a){return this.el.dom},initElements:function(){var a=
Ext.Element,b=this.grid.getGridEl().dom.firstChild,d=b.childNodes;this.el=new a(b);this.lockedWrap=new a(d[0]);this.lockedHd=new a(this.lockedWrap.dom.firstChild);this.lockedInnerHd=this.lockedHd.dom.firstChild;this.lockedScroller=new a(this.lockedWrap.dom.childNodes[1]);this.lockedBody=new a(this.lockedScroller.dom.firstChild);this.mainWrap=new a(d[1]);this.mainHd=new a(this.mainWrap.dom.firstChild);this.grid.hideHeaders&&(this.lockedHd.setDisplayed(!1),this.mainHd.setDisplayed(!1));this.innerHd=
this.mainHd.dom.firstChild;this.scroller=new a(this.mainWrap.dom.childNodes[1]);this.forceFit&&this.scroller.setStyle("overflow-x","hidden");this.mainBody=new a(this.scroller.dom.firstChild);this.focusEl=new a(this.scroller.dom.childNodes[1]);this.resizeMarker=new a(d[2]);this.resizeProxy=new a(d[3]);this.focusEl.swallowEvent("click",!0)},getLockedRows:function(){return this.hasRows()?this.lockedBody.dom.childNodes:[]},getLockedRow:function(a){return this.getLockedRows()[a]},getCell:function(a,b){var d=
this.cm.getLockedCount();return b<d?this.getLockedRow(a).getElementsByTagName("td")[b]:Ext.ux.grid.LockingHeaderGroupGridView.superclass.getCell.call(this,a,b-d)},getHeaderCell:function(a){var b=this.cm.getLockedCount();return a<b?this.lockedHd.dom.getElementsByTagName("td")[a]:this.mainHd.query(this.cellSelector)[a-b]},addRowClass:function(a,b){var d=this.getLockedRow(a);d&&this.fly(d).addClass(b);Ext.ux.grid.LockingHeaderGroupGridView.superclass.addRowClass.call(this,a,b)},removeRowClass:function(a,
b){var d=this.getLockedRow(a);d&&this.fly(d).removeClass(b);Ext.ux.grid.LockingHeaderGroupGridView.superclass.removeRowClass.call(this,a,b)},removeRow:function(a){Ext.removeNode(this.getLockedRow(a));Ext.ux.grid.LockingHeaderGroupGridView.superclass.removeRow.call(this,a)},removeRows:function(a,b){for(var d=this.lockedBody.dom,e=a;e<=b;e++)Ext.removeNode(d.childNodes[a]);Ext.ux.grid.LockingHeaderGroupGridView.superclass.removeRows.call(this,a,b)},syncScroll:function(a){this.lockedScroller.dom.scrollTop=
this.scroller.dom.scrollTop;Ext.ux.grid.LockingHeaderGroupGridView.superclass.syncScroll.call(this,a)},updateSortIcon:function(a,b){var d=this.sortClasses,e=this.lockedHd.select("td").removeClass(d),f=this.mainHd.select("td").removeClass(d),g=this.cm.getLockedCount(),d=d["DESC"==b?1:0];a<g?e.item(a).addClass(d):f.item(a-g).addClass(d)},updateAllColumnWidths:function(){var a=this.getTotalWidth(),b=this.cm.getColumnCount(),d=this.getLockedWidth(),e=this.cm.getLockedCount(),f=[],g,h;this.updateLockedWidth();
for(h=0;h<b;h++)f[h]=this.getColumnWidth(h),this.getHeaderCell(h).style.width=f[h];var k=this.getLockedRows(),l=this.getRows(),m,n;h=0;for(g=l.length;h<g;h++){m=k[h];m.style.width=d;if(m.firstChild)for(m.firstChild.style.width=d,m=m.firstChild.rows[0],n=0;n<e;n++)m.childNodes[n].style.width=f[n];m=l[h];m.style.width=a;if(m.firstChild)for(m.firstChild.style.width=a,m=m.firstChild.rows[0],n=e;n<b;n++)m.childNodes[n-e].style.width=f[n]}this.updateGroupStyles();this.onAllColumnWidthsUpdated(f,a);this.syncHeaderHeight()},
onColumnWidthUpdated:function(){Ext.ux.grid.LockingHeaderGroupGridView.superclass.onColumnWidthUpdated.call(this,arguments);this.updateGroupStyles.call(this)},onAllColumnWidthsUpdated:function(){Ext.ux.grid.LockingHeaderGroupGridView.superclass.onAllColumnWidthsUpdated.call(this,arguments);this.updateGroupStyles.call(this)},updateColumnWidth:function(a,b){var d=this.getColumnWidth(a),e=this.cm.getLockedCount(),f,g,h;this.updateLockedWidth();a<e?(f=this.getLockedRows(),g=this.getLockedWidth(),e=a):
(f=this.getRows(),g=this.getTotalWidth(),e=a-e);this.getHeaderCell(a).style.width=d;for(var k=0,l=f.length;k<l;k++)h=f[k],h.style.width=g,h.firstChild&&(h.firstChild.style.width=g,h.firstChild.rows[0].childNodes[e].style.width=d);this.onColumnWidthUpdated(a,d,this.getTotalWidth());this.syncHeaderHeight()},updateColumnHidden:function(a,b){var d=this.cm.getLockedCount(),e,f,g,h=b?"none":"";this.updateLockedWidth();a<d?(e=this.getLockedRows(),f=this.getLockedWidth(),d=a):(e=this.getRows(),f=this.getTotalWidth(),
d=a-d);this.getHeaderCell(a).style.display=h;for(var k=0,l=e.length;k<l;k++)g=e[k],g.style.width=f,g.firstChild&&(g.firstChild.style.width=f,g.firstChild.rows[0].childNodes[d].style.display=h);this.onColumnHiddenUpdated(a,b,this.getTotalWidth());delete this.lastViewWidth;this.layout()},doRender:function(a,b,d,e,f,g){for(var h=this.templates,k=h.cell,h=h.row,l=f-1,m="width:"+this.getTotalWidth()+";",n="width:"+this.getLockedWidth()+";",p=[],q=[],t,u,v,s={},w={},x,z=0,A=b.length;z<A;z++){x=b[z];t=[];
u=[];for(var B=z+e,y=0;y<f;y++)v=a[y],s.id=v.id,s.css=(0===y?"x-grid3-cell-first ":y==l?"x-grid3-cell-last ":"")+(this.cm.config[y].cellCls?" "+this.cm.config[y].cellCls:""),s.attr=s.cellAttr="",s.value=v.renderer(x.data[v.name],s,x,B,y,d),s.style=v.style,Ext.isEmpty(s.value)&&(s.value="&#160;"),this.markDirty&&x.dirty&&Ext.isDefined(x.modified[v.name])&&(s.css+=" x-grid3-dirty-cell"),v.locked?u[u.length]=k.apply(s):t[t.length]=k.apply(s);v=[];g&&0===(B+1)%2&&(v[0]="x-grid3-row-alt");x.dirty&&(v[1]=
" x-grid3-dirty-row");w.cols=f;this.getRowClass&&(v[2]=this.getRowClass(x,B,w,d));w.alt=v.join(" ");w.cells=t.join("");w.tstyle=m;p[p.length]=h.apply(w);w.cells=u.join("");w.tstyle=n;q[q.length]=h.apply(w)}return[p.join(""),q.join("")]},processRows:function(a,b){if(this.ds&&!(1>this.ds.getCount())){var d=this.getRows(),e=this.getLockedRows(),f,g;b=b||!this.grid.stripeRows;a=a||0;for(var h=0,k=d.length;h<k;++h)if(f=d[h],g=e[h],f.rowIndex=h,g.rowIndex=h,b||(f.className=f.className.replace(this.rowClsRe,
" "),g.className=g.className.replace(this.rowClsRe," "),0===(h+1)%2&&(f.className+=" x-grid3-row-alt",g.className+=" x-grid3-row-alt")),this.syncHeights){f=Ext.get(f);g=Ext.get(g);var l=f.getHeight(),m=g.getHeight();l>m?g.setHeight(l):m>l&&f.setHeight(m)}0===a&&(Ext.fly(d[0]).addClass(this.firstRowCls),Ext.fly(e[0]).addClass(this.firstRowCls));Ext.fly(d[d.length-1]).addClass(this.lastRowCls);Ext.fly(e[e.length-1]).addClass(this.lastRowCls)}},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,!0);!0!==this.deferEmptyText&&this.applyEmptyText()}},renderUI:function(){var a=this.renderHeaders(),b=this.templates.body.apply({rows:"&#160;"}),a=this.templates.master.apply({body:b,header:a[0],ostyle:"width:"+this.getOffsetWidth()+";",bstyle:"width:"+this.getTotalWidth()+";",lockedBody:b,lockedHeader:a[1],lstyle:"width:"+this.getLockedWidth()+";"}),b=this.grid;b.getGridEl().dom.innerHTML=
a;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);!1!==b.enableColumnResize&&(this.splitZone=new Ext.grid.GridView.SplitDragZone(b,this.mainHd.dom),
this.splitZone.setOuterHandleElId(Ext.id(this.lockedHd.dom)),this.splitZone.setOuterHandleElId(Ext.id(this.mainHd.dom)));b.enableColumnMove&&(this.columnDrag=new Ext.grid.GridView.ColumnDragZone(b,this.innerHd),this.columnDrag.setOuterHandleElId(Ext.id(this.lockedInnerHd)),this.columnDrag.setOuterHandleElId(Ext.id(this.innerHd)),this.columnDrop=new Ext.grid.HeaderDropZone(b,this.mainHd.dom));!1!==b.enableHdMenu&&(this.hmenu=new Ext.menu.Menu({id:b.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"}),!1!==this.grid.enableColLock&&this.hmenu.add("-",{itemId:"lock",text:this.lockText,cls:"xg-hmenu-lock"},{itemId:"unlock",text:this.unlockText,cls:"xg-hmenu-unlock"}),!1!==b.enableColumnHide&&(this.colMenu=new Ext.menu.Menu({id:b.id+"-hcols-menu"}),this.colMenu.on({scope:this,beforeshow:this.beforeColMenuShow,itemclick:this.handleHdMenuClick}),this.hmenu.add("-",{itemId:"columns",hideOnClick:!1,text:this.columnsText,
menu:this.colMenu,iconCls:"x-cols-icon"})),this.hmenu.on("itemclick",this.handleHdMenuClick,this));b.trackMouseOver&&(this.mainBody.on({scope:this,mouseover:this.onRowOver,mouseout:this.onRowOut}),this.lockedBody.on({scope:this,mouseover:this.onRowOver,mouseout:this.onRowOut}));if(b.enableDragDrop||b.enableDrag)this.dragZone=new Ext.grid.GridDragZone(b,{ddGroup:b.ddGroup||"GridDD"});this.updateHeaderSortState()},splitZoneConfig:{allowHeaderDrag:function(a){return!a.getTarget(null,null,!0).hasClass("ux-grid-hd-group-cell")}},
columnDropConfig:{getTargetFromEvent:function(a){a=Ext.lib.Event.getTarget(a);return this.view.findHeaderCell(a)},positionIndicator:function(a,b,d){a=this.getDragDropData.call(this,a,b,d);if(!1===a)return!1;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,d,e){b=e.header;if(b!=a){a=this.getDragDropData.call(this,b,a,d);if(!1===a)return!1;d=
this.grid.colModel;b=a.oldIndex<a.newIndex;e=d.rows;for(var f=a.row,g=e.length;f<g;f++){for(var h=e[f],k=h.length,l=0,m=1,n=k,p=0,q=0;p<k;p++){var t=h[p];a.oldIndex>=q&&a.oldIndex<q+t.colspan&&(l=p);a.oldIndex+a.colspan-1>=q&&a.oldIndex+a.colspan-1<q+t.colspan&&(m=p-l+1);a.newIndex>=q&&a.newIndex<q+t.colspan&&(n=p);q+=t.colspan}k=h.splice(l,m);e[f]=h.splice(0,n-(b?m:0)).concat(k).concat(h)}for(e=0;e<a.colspan;e++)f=a.oldIndex+(b?0:e),g=a.newIndex+(b?-1:e),d.moveColumn(f,g),this.grid.fireEvent("columnmove",
f,g);return!0}return!1}},updateGroupStyles:function(a){for(var b=this.lockedHd.query(".x-grid3-header-offset > table"),d=this.getLockedWidth(),e=this.rows,f=[],g=0;g<b.length;g++)if(b[g].style.width=d,g<e.length)for(var h=b[g].firstChild.firstChild.childNodes,k=f[g]=0,l=0;k<h.length;k++){var m=e[g][k];f[g]+=1;if("number"!=typeof a||a>=l&&a<l+m.colspan){var n=this.getGroupStyle.call(this,m,l);h[k].style.width=n.width;h[k].style.display=n.hidden?"none":""}l+=m.colspan}b=this.mainHd.query(".x-grid3-header-offset > table");
d=this.getTotalWidth();e=this.rows;for(g=0;g<b.length;g++)if(b[g].style.width=d,g<e.length)for(h=b[g].firstChild.firstChild.childNodes,k=0,l=this.cm.getLockedCount();k<h.length;k++){m=e[g][f[g]+k];if("number"!=typeof a||a>=l&&a<l+m.colspan)n=this.getGroupStyle.call(this,m,l),h[k].style.width=n.width,h[k].style.display=n.hidden?"none":"";l+=m.colspan}},getGroupRowIndex:function(a){return a&&(a=a.className.match(this.hrowRe))&&a[1]?parseInt(a[1],10):this.cm.rows.length},layout:function(){if(this.mainBody){var a=
this.grid,b=a.getGridEl().getSize(!0),d=b.width;if(a.hideHeaders||!(20>d||20>b.height)){this.syncHeaderHeight();if(a.autoHeight)this.scroller.dom.style.overflow="visible",this.lockedScroller.dom.style.overflow="visible",Ext.isWebKit&&(this.scroller.dom.style.position="static",this.lockedScroller.dom.style.position="static");else{this.el.setSize(b.width,b.height);var a=this.mainHd.getHeight(),e=b.height-a}this.updateLockedWidth();this.forceFit?this.lastViewWidth!=d&&(this.fitColumns(!1,!1),this.lastViewWidth=
d):(this.autoExpand(),this.syncHeaderScroll());this.onLayout(d,e)}}},getGroupSpan:function(a,b){if(0>a)return{col:0,colspan:this.cm.getColumnCount()};var d=this.cm.rows[a];if(d){for(var e=0,f=0,g=d.length;e<g;e++){var h=d[e];if(b>=f&&b<f+h.colspan)return{col:f,colspan:h.colspan};f+=h.colspan}return{col:f,colspan:0}}return{col:b,colspan:1}},getOffsetWidth:function(){return this.cm.getTotalWidth()-this.cm.getTotalLockedWidth()+this.getScrollOffset()+"px"},renderHeaders:function(){for(var a=this.cm,
b=this.templates,b=b.hcell,d=[],e=[],f={},g=a.getColumnCount(),h=g-1,k=0;k<g;k++)f.id=a.getColumnId(k),f.value=a.getColumnHeader(k)||"",f.style=this.getColumnStyle(k,!0),f.tooltip=this.getColumnTooltip(k),f.css=(0===k?"x-grid3-cell-first ":k==h?"x-grid3-cell-last ":"")+(a.config[k].headerCls?" "+a.config[k].headerCls:""),"right"==a.config[k].align?f.istyle="padding-right:16px":delete f.istyle,a.isLocked(k)?e[e.length]=b.apply(f):d[d.length]=b.apply(f);for(var b=this.templates,f=[],h=[],a=this.cm,
l=this.rows,m="width:"+this.getTotalWidth()+";",n=0,p=l.length;n<p;n++){for(var q=l[n],t=[],u=[],v=k=0,g=q.length;k<g;k++){var s=q[k];s.colspan=s.colspan||1;var w=this.getColumnId(s.dataIndex?a.findColumnIndex(s.dataIndex):v),x=this.getGroupStyle.call(this,s,v),w=b.gcell.apply({cls:"ux-grid-hd-group-cell",id:w,row:n,style:"width:"+x.width+";"+(x.hidden?"display:none;":"")+(s.align?"text-align:"+s.align+";":""),tooltip:s.tooltip?(Ext.QuickTips.isEnabled()?"ext:qtip":"title")+'="'+s.tooltip+'"':"",
istyle:"right"==s.align?"padding-right:16px":"",btn:this.grid.enableHdMenu&&s.header,value:s.header||"&nbsp;"});a.isLocked(s.dataIndex?a.findColumnIndex(s.dataIndex):v)?u[k]=w:t[k]=w;v+=s.colspan}f[n]=b.header.apply({tstyle:m,cells:t.join("")});h[n]=b.header.apply({tstyle:m,cells:u.join("")})}f.push(b.header.apply({cells:d.join(""),tstyle:"width:"+this.getTotalWidth()+";"}));h.push(b.header.apply({cells:e.join(""),tstyle:"width:"+this.getLockedWidth()+";"}));return[f.join(""),h.join("")]},getGroupStyle:function(a,
b){for(var d=0,e=!0,f=b,g=b+a.colspan;f<g;f++)this.cm.isHidden(f)||(e=this.cm.getColumnWidth(f),"number"==typeof e&&(d+=e),e=!1);return{width:(Ext.isBorderBox||Ext.isWebKit&&!Ext.isSafari2?d:Math.max(d-this.borderWidth,0))+"px",hidden:e}},findHeaderCell:function(a){return a?this.fly(a).findParent("td.x-grid3-hd",this.cellSelectorDepth):!1},findHeaderIndex:function(a){return(a=this.findHeaderCell(a))?this.getCellIndex(a):!1},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,d){Ext.ux.grid.LockingHeaderGroupGridView.superclass.syncFocusEl.call(this,
a,b,b<this.cm.getLockedCount()?!1:d)},ensureVisible:function(a,b,d){return Ext.ux.grid.LockingHeaderGroupGridView.superclass.ensureVisible.call(this,a,b,b<this.cm.getLockedCount()?!1:d)},insertRows:function(a,b,d,e){a=a.getCount()-1;if(!e&&0===b&&d>=a)this.refresh();else{e||this.fireEvent("beforerowsinserted",this,b,d);var f=this.renderRows(b,d),g=this.getRow(b);g?(0===b&&this.removeRowClass(0,this.firstRowCls),Ext.DomHelper.insertHtml("beforeBegin",g,f[0]),g=this.getLockedRow(b),Ext.DomHelper.insertHtml("beforeBegin",
g,f[1])):(this.removeRowClass(a-1,this.lastRowCls),Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,f[0]),Ext.DomHelper.insertHtml("beforeEnd",this.lockedBody.dom,f[1]));e?(0===b||b>=a)&&this.addRowClass(b,0===b?this.firstRowCls:this.lastRowCls):(this.fireEvent("rowsinserted",this,b,d),this.processRows(b))}this.syncFocusEl(b)},getColumnStyle:function(a,b){var d=b?this.cm.config[a].headerStyle||"":this.cm.config[a].cellStyle||this.cm.config[a].css||"",d=d+("width:"+this.getColumnWidth(a)+";");
this.cm.isHidden(a)&&(d+="display:none;");var e=this.cm.config[a].align;e&&(d+="text-align:"+e+";");return d},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,d=b.getColumnCount(),e=0;e<d;e++){var f=b.getDataIndex(e);a[e]={name:Ext.isDefined(f)?f:this.ds.fields.get(e).name,renderer:b.getRenderer(e),id:b.getColumnId(e),style:this.getColumnStyle(e),
locked:b.isLocked(e)}}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){Ext.ux.grid.LockingHeaderGroupGridView.superclass.refreshRow.call(this,a);a=Ext.isNumber(a)?a:this.ds.indexOf(a);this.getLockedRow(a).rowIndex=a},refresh:function(a){this.fireEvent("beforerefresh",this);this.grid.stopEditing(!0);var b=this.renderBody();this.mainBody.update(b[0]).setWidth(this.getTotalWidth());
this.lockedBody.update(b[1]).setWidth(this.getLockedWidth());!0===a&&(this.updateHeaders(),this.updateHeaderSortState());this.processRows(0,!0);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.LockingHeaderGroupGridView.superclass.initData.call(this,a,b);if(this.cm)this.cm.on("columnlockchange",this.onColumnLock,this)},onColumnLock:function(){this.refresh(!0)},
handleHdMenuClick:function(a){var b=this.hdCtxIndex,d=this.cm,e=a.getItemId(),f=d.getLockedCount();switch(e){case "lock":if(d.getColumnCount(!0)<=f+1){this.onDenyColumnLock();return}d.setLocked(b,!0);f!=b&&(d.moveColumn(b,f),this.grid.fireEvent("columnmove",b,f));break;case "unlock":f-1!=b?(d.setLocked(b,!1,!0),d.moveColumn(b,f-1),this.grid.fireEvent("columnmove",b,f-1)):d.setLocked(b,!1);break;default:return Ext.ux.grid.LockingHeaderGroupGridView.superclass.handleHdMenuClick.call(this,a)}return!0},
handleHdDown:function(a,b){var d=Ext.get(b);if(d.hasClass("x-grid3-hd-btn")){a.stopEvent();var e=this.findHeaderCell(b);Ext.fly(e).addClass("x-grid3-hd-menu-open");this.hdCtxIndex=d=this.getCellIndex(e);var f=this.hmenu.items,g=this.cm;f.get("asc").setDisabled(!g.isSortable(d));f.get("desc").setDisabled(!g.isSortable(d));this.hmenu.on("hide",function(){Ext.fly(e).removeClass("x-grid3-hd-menu-open")},this,{single:!0});this.hmenu.show(b,"tl-bl?")}else(d.hasClass("ux-grid-hd-group-cell")||Ext.fly(b).up(".ux-grid-hd-group-cell"))&&
a.stopEvent();!1!==this.grid.enableColLock&&Ext.fly(b).hasClass("x-grid3-hd-btn")&&(e=this.findHeaderCell(b),d=this.getCellIndex(e),f=this.hmenu.items,g=this.cm,f.get("lock").setDisabled(g.isLocked(d)),f.get("unlock").setDisabled(!g.isLocked(d)))},handleHdOver:function(a,b){var d=this.findHeaderCell(b);if(d&&!this.headersDisabled){this.activeHdRef=b;this.activeHdIndex=this.getCellIndex(d);var e=this.fly(d);this.activeHdRegion=e.getRegion();!this.cm.isMenuDisabled(this.activeHdIndex)&&!e.hasClass("ux-grid-hd-group-cell")&&
(e.addClass("x-grid3-hd-over"),this.activeHdBtn=e.child(".x-grid3-hd-btn"))&&(this.activeHdBtn.dom.style.height=d.firstChild.offsetHeight-1+"px")}},handleHdOut:function(a,b){var d=this.findHeaderCell(b);!d||Ext.isIE&&a.within(d,!0)||(this.activeHdRef=null,this.fly(d).removeClass("x-grid3-hd-over"),d.style.cursor="")},syncHeaderHeight:function(){this.innerHd.firstChild.firstChild.style.height="auto";this.lockedInnerHd.firstChild.firstChild.style.height="auto";var a=this.innerHd.firstChild.firstChild.offsetHeight,
b=this.lockedInnerHd.firstChild.firstChild.offsetHeight,a=(b>a?b:a)+"px";this.innerHd.firstChild.firstChild.style.height=a;this.lockedInnerHd.firstChild.firstChild.style.height=a},updateLockedWidth:function(){var a=this.cm.getTotalLockedWidth(),b=this.cm.getTotalWidth()-a,d=this.grid.getGridEl().getSize(!0),e=Ext.isBorderBox?0:this.lockedBorderWidth,f=Ext.isBorderBox?0:this.rowBorderWidth,g=d.width-a-e-f+"px",h=this.getScrollOffset();this.grid.autoHeight||(d=d.height-this.mainHd.getHeight()+"px",
this.lockedScroller.dom.style.height=d,this.scroller.dom.style.height=d);this.lockedWrap.dom.style.width=a+f+"px";this.scroller.dom.style.width=g;this.mainWrap.dom.style.left=a+e+f+"px";this.innerHd&&(this.lockedInnerHd.firstChild.style.width=a+"px",this.lockedInnerHd.firstChild.firstChild.style.width=a+"px",this.innerHd.style.width=g,this.innerHd.firstChild.style.width=b+f+h+"px",this.innerHd.firstChild.firstChild.style.width=b+"px");this.mainBody&&(this.lockedBody.dom.style.width=a+f+"px",this.mainBody.dom.style.width=
b+f+"px")}});
Ext.ux.grid.LockingGroupColumnModel=Ext.extend(Ext.grid.ColumnModel,{isLocked:function(a){return!0===this.config[a].locked},setLocked:function(a,b,d){this.isLocked(a)!=b&&(this.config[a].locked=b,d||this.fireEvent("columnlockchange",this,a,b))},getTotalLockedWidth:function(){for(var a=0,b=0,d=this.config.length;b<d;b++)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 d=this.isLocked(a),e=this.isLocked(b);a<b&&d&&!e?this.setLocked(a,!1,!0):a>b&&!d&&e&&this.setLocked(a,!0,!0);Ext.ux.grid.LockingGroupColumnModel.superclass.moveColumn.apply(this,arguments)}});Ext.namespace("Ext.ux.Ribbon");
Ext.ux.Ribbon=Ext.extend(Ext.TabPanel,{titleId:null,constructor:function(a){this.titleId=[];Ext.apply(a,{baseCls:"x-plain ui-ribbon",margins:"0 0 0 0",plain:!0,border:!1,deferredRender:!1,layoutOnTabChange:!0,title:"",activeTab:0,listeners:{beforetabchange:function(a,b,f){a.expand()},afterrender:{scope:this,fn:function(){if(0<this.titleId.length)for(var a=0;a<this.titleId.length;a++)if(r=Ext.get(this.titleId[a].id))r.on("click",this.titleId[a].fn)}}}});Ext.apply(this,Ext.apply(this.initialConfig,
a));if(a.items)for(var b=0;b<a.items.length;b++)this.initRibbon(a.items[b],b);Ext.ux.Ribbon.superclass.constructor.apply(this,arguments)},initRibbon:function(a,b){for(var d=[],e=0;e<a.ribbon.length;e++){c={xtype:"buttongroup",cls:"x-btn-group-ribbonstyle",defaults:{scale:"small",iconAlign:"left",minWidth:40},items:a.ribbon[e].items};title=a.ribbon[e].title||"";topTitle=a.ribbon[e].topTitle||!1;if(onTitleClick=a.ribbon[e].onTitleClick||!1)titleId="ux-ribbon-"+Ext.id(),title='<span id="'+titleId+'" style="cursor:pointer;">'+
title+"</span>",this.titleId.push({id:titleId,fn:onTitleClick});""!==title&&(topTitle?Ext.apply(c,{title:title}):Ext.apply(c,{footerCfg:{cls:"x-btn-group-header x-unselectable",tag:"span",html:title}}));if(cfg=a.ribbon[e].cfg||null)Ext.applyIf(c,a.ribbon[e].cfg),cfg.defaults&&Ext.apply(c.defaults,cfg.defaults);d.push(c)}Ext.apply(a,{baseCls:"x-plain",tbar:d})}});
Ext.ux.ToolbarDroppable=Ext.extend(Object,{constructor:function(a){Ext.apply(this,a,{})},init:function(a){this.toolbar=a;this.toolbar.on({scope:this,render:this.createDropTarget})},createDropTarget:function(){this.dropTarget=new Ext.dd.DropTarget(this.toolbar.getEl(),{notifyOver:this.notifyOver.createDelegate(this),notifyDrop:this.notifyDrop.createDelegate(this)})},addDDGroup:function(a){void 0!=this.dropTarget&&this.dropTarget.addToGroup(a)},calculateEntryIndex:function(a){var b=0,d=this.toolbar,
e=d.items.items,f=e.length,d=d.getEl().getXY()[0];a=a.getXY()[0]-d;for(var g=0;g<f;g++){var b=e[g].getEl().getWidth(),h=d+b/2,d=d+b;if(a<h){b=g;break}else b=g+1}return b},canDrop:function(a){return!0},notifyOver:function(a,b,d){return this.canDrop.apply(this,arguments)?this.dropTarget.dropAllowed:this.dropTarget.dropNotAllowed},notifyDrop:function(a,b,d){a=this.canDrop(a,b,d);var e=this.toolbar;a&&(b=this.calculateEntryIndex(b),e.insert(b,this.createItem(d)),e.doLayout(),this.afterLayout());return a},
createItem:function(a){throw Error("The createItem method must be implemented in the ToolbarDroppable plugin");},afterLayout:Ext.emptyFn});
Ext.ux.ToolbarReorderer=Ext.extend(Ext.ux.Reorderer,{init:function(a){this.buttonXCache={};a.on({scope:this,add:function(a,d){this.createIfReorderable(d)}});Ext.ux.ToolbarReorderer.superclass.init.apply(this,arguments)},createItemDD:function(a){if(void 0==a.dd){var b=a.getEl(),d=this.target,e=this;a.dd=new Ext.dd.DD(b,void 0,{isTarget:!1});var f=function(){return!1};Ext.apply(a.dd,{b4StartDrag:function(){this.startPosition=b.getXY();this.startZIndex=b.getStyle("zIndex");b.setStyle("zIndex",1E4);a.suspendEvents();
if(a.menu)a.menu.on("beforeshow",f,e)},startDrag:function(){this.constrainTo(d.getEl());this.setYConstraint(0,0,0)},onDrag:function(f){f=b.getXY()[0];for(var h=f-this.startPosition[0],k=d.items.items,l=k.indexOf(a),m=0;m<k.length;m++){var n=k[m];if(n.reorderable&&n.id!=a.id){var p=n.getEl().getBox(),p=(e.buttonXCache[n.id]||p.x)+p.width/2,n=l>m&&0>h&&f<p,p=l<m&&0<h&&f+b.getWidth()>p;if(n||p){e[n?"onMovedLeft":"onMovedRight"](a,m,l);break}}}},endDrag:function(){e.updateButtonXCache();b.moveTo(e.buttonXCache[a.id],
b.getY(),{duration:e.animationDuration,scope:this,callback:function(){a.resumeEvents();a.menu&&a.menu.un("beforeshow",f,e);d.fireEvent("reordered",a,d)}});b.setStyle("zIndex",this.startZIndex)}})}},onMovedLeft:function(a,b,d){var e=this.target,f=e.items.items;if(void 0!=b&&b!=d)for(e.remove(a,!1),e.insert(b,a),this.updateButtonXCache(),b=0;b<f.length;b++)e=f[b],d=this.buttonXCache[e.id],a==e?a.dd.startPosition[0]=d:(e=e.getEl(),e.moveTo(d,e.getY(),{duration:this.animationDuration}))},onMovedRight:function(a,
b,d){this.onMovedLeft.apply(this,arguments)},updateButtonXCache:function(){var a=this.target,b=a.items,d=a.getEl().getBox(!0).x;b.each(function(a){this.buttonXCache[a.id]=d;d+=a.getEl().getWidth()},this)}});Ext.ux.Mask=function(a){Ext.apply(this,{mask:a})};
Ext.extend(Ext.ux.Mask,Object,{init:function(a){this.LetrasL="abcdefghijklmnopqrstuvwxyz";this.LetrasU=Ext.util.Format.uppercase(this.LetrasL);this.Letras=this.LetrasL+this.LetrasU;this.Numeros="0123456789";this.Fixos="().-:/ ";this.Charset=" !\"#$%&'()*+,-./0123456789:;<=>?@"+this.LetrasU+"[]^_/`"+this.LetrasL+"{|}~";a.enableKeyEvents=!0;a.on("keypress",function(a,d){return this.press(a,d)},this)},press:function(a,b){var d=a.getValue(),e=b.getKey(),f=this.mask,g=a.el.dom;if(b){if(0<g.selectionEnd-
g.selectionStart||0<g.selectionStart&&g.selectionStart<g.textLength)return!0;var h=this.Charset.substr(e-32,1);if(32>e||b.isNavKeyPress()||e==b.BACKSPACE)return!0;if(Ext.isGecko||Ext.isGecko2||Ext.isGecko3)if(0==b.charCode&&46==b.keyCode||b.isSpecialKey())return!0;e=d.length;if(e>=f.length)return a.setValue(d),b.stopEvent(),!1;for(e=f.substr(e,1);-1!=this.Fixos.indexOf(e);){d+=e;e=d.length;if(e>=f.length)return b.stopEvent(),!1;e=f.substr(e,1)}switch(e){case "#":if(-1==this.Numeros.indexOf(h))return b.stopEvent(),
!1;break;case "A":h=h.toUpperCase();if(-1==this.LetrasU.indexOf(h))return b.stopEvent(),!1;break;case "a":h=h.toLowerCase();if(-1==this.LetrasL.indexOf(h))return b.stopEvent(),!1;break;case "Z":if(-1==this.Letras.indexOf(h))return b.stopEvent(),!1;break;case "*":a.setValue(d+h);break;default:a.setValue(d)}}a.setValue(d+h);g.selectionEnd=g.selectionStart;b.stopEvent();return!1}});Ext.ns("Ext.ux");
Ext.ux.Lightbox=function(){var a={},b=[],d,e=!1,f=[];return{overlayOpacity:0.85,animate:!0,resizeSpeed:8,borderSize:10,labelImage:"Image",labelOf:"of",init:function(){this.resizeDuration=this.animate?0.15*(11-this.resizeSpeed):0;this.overlayDuration=this.animate?0.2:0;e||(Ext.apply(this,Ext.util.Observable.prototype),Ext.util.Observable.constructor.call(this),this.addEvents("open","close"),this.initMarkup(),this.initEvents(),e=!0)},initMarkup:function(){a.shim=Ext.DomHelper.append(document.body,{tag:"iframe",
id:"ux-lightbox-shim"},!0);a.overlay=Ext.DomHelper.append(document.body,{id:"ux-lightbox-overlay"},!0);var b=new Ext.Template(this.getTemplate());a.lightbox=b.append(document.body,{},!0);Ext.each("outerImageContainer imageContainer image hoverNav navPrev navNext loading loadingLink outerDataContainer dataContainer data details caption imageNumber bottomNav navClose".split(" "),function(b){a[b]=Ext.get("ux-lightbox-"+b)});Ext.each([a.overlay,a.lightbox,a.shim],function(a){a.setVisibilityMode(Ext.Element.DISPLAY);
a.hide()});b=(this.animate?250:1)+"px";a.outerImageContainer.setStyle({width:b,height:b})},getTemplate:function(){return'<div id="ux-lightbox">;<div id="ux-lightbox-outerImageContainer">;<div id="ux-lightbox-imageContainer">;<img id="ux-lightbox-image">;<div id="ux-lightbox-hoverNav">;<a href="#" id="ux-lightbox-navPrev"></a>;<a href="#" id="ux-lightbox-navNext"></a>;</div>;<div id="ux-lightbox-loading">;<a id="ux-lightbox-loadingLink"></a>;</div>;</div>;</div>;<div id="ux-lightbox-outerDataContainer">;<div id="ux-lightbox-dataContainer">;<div id="ux-lightbox-data">;<div id="ux-lightbox-details">;<span id="ux-lightbox-caption"></span>;<span id="ux-lightbox-imageNumber"></span>;</div>;<div id="ux-lightbox-bottomNav">;<a href="#" id="ux-lightbox-navClose"></a>;</div>;</div>;</div>;</div>;</div>'.split(";")},
initEvents:function(){var b=function(a){a.preventDefault();this.close()};a.overlay.on("click",b,this);a.loadingLink.on("click",b,this);a.navClose.on("click",b,this);a.lightbox.on("click",function(a){"ux-lightbox"==a.getTarget().id&&this.close()},this);a.navPrev.on("click",function(a){a.preventDefault();this.setImage(d-1)},this);a.navNext.on("click",function(a){a.preventDefault();this.setImage(d+1)},this)},register:function(a,b){-1===f.indexOf(a)&&(f.push(a),Ext.fly(document).on("click",function(d){var e=
d.getTarget(a);e&&(d.preventDefault(),this.open(e,a,b))},this))},open:function(d,e,f){f=f||!1;this.setViewSize();a.overlay.fadeIn({duration:this.overlayDuration,endOpacity:this.overlayOpacity,callback:function(){b=[];var l=0;if(f){var m=Ext.query(e);for(Ext.each(m,function(a){a.href&&b.push([a.href,a.title])});b[l][0]!=d.href;)l++}else b.push([d.href,d.title]);var m=Ext.fly(document).getScroll(),n=m.top+Ext.lib.Dom.getViewportHeight()/10;a.lightbox.setStyle({top:n+"px",left:m.left+"px"}).show();this.setImage(l);
this.fireEvent("open",b[l])},scope:this})},setViewSize:function(){var b=this.getViewSize();a.overlay.setStyle({width:b[0]+"px",height:b[1]+"px"});a.shim.setStyle({width:b[0]+"px",height:b[1]+"px"}).show()},setImage:function(e){d=e;this.disableKeyNav();this.animate&&a.loading.show();a.image.hide();a.hoverNav.hide();a.navPrev.hide();a.navNext.hide();a.dataContainer.setOpacity(1E-4);a.imageNumber.hide();var f=new Image;f.onload=function(){a.image.dom.src=b[d][0];this.resizeImage(f.width,f.height)}.createDelegate(this);
f.src=b[d][0]},resizeImage:function(b,d){var e=a.outerImageContainer.getWidth(),f=a.outerImageContainer.getHeight(),m=b+2*this.borderSize,n=d+2*this.borderSize,p=function(){a.hoverNav.setWidth(a.imageContainer.getWidth()+"px");a.navPrev.setHeight(d+"px");a.navNext.setHeight(d+"px");a.outerDataContainer.setWidth(m+"px");this.showImage()};0!=f-n||0!=e-m?a.outerImageContainer.shift({height:n,width:m,duration:this.resizeDuration,scope:this,callback:p,delay:50}):p.call(this)},showImage:function(){a.loading.hide();
a.image.fadeIn({duration:this.resizeDuration,scope:this,callback:function(){this.updateDetails()}});this.preloadImages()},updateDetails:function(){var e=a.data.getWidth(!0)-a.navClose.getWidth()-10;a.details.setWidth((0<e?e:0)+"px");a.caption.update(b[d][1]);a.caption.show();1<b.length&&(a.imageNumber.update(this.labelImage+" "+(d+1)+" "+this.labelOf+"  "+b.length),a.imageNumber.show());a.dataContainer.fadeIn({duration:this.resizeDuration/2,scope:this,callback:function(){var b=this.getViewSize();
a.overlay.setHeight(b[1]+"px");this.updateNav()}})},updateNav:function(){this.enableKeyNav();a.hoverNav.show();0<d&&a.navPrev.show();d<b.length-1&&a.navNext.show()},enableKeyNav:function(){Ext.fly(document).on("keydown",this.keyNavAction,this)},disableKeyNav:function(){Ext.fly(document).un("keydown",this.keyNavAction,this)},keyNavAction:function(a){a=a.getKey();88==a||67==a||27==a?this.close():80==a||37==a?0!=d&&this.setImage(d-1):78!=a&&39!=a||d==b.length-1||this.setImage(d+1)},preloadImages:function(){var a;
b.length>d+1&&(a=new Image,a.src=b[d+1][0]);0<d&&(a=new Image,a.src=b[d-1][0])},close:function(){this.disableKeyNav();a.lightbox.hide();a.overlay.fadeOut({duration:this.overlayDuration});a.shim.hide();this.fireEvent("close",d)},getViewSize:function(){return[Ext.lib.Dom.getViewWidth(),Ext.lib.Dom.getViewHeight()]}}}();Ext.onReady(Ext.ux.Lightbox.init,Ext.ux.Lightbox);Ext.QuickTips.init();if("undefined"==typeof console)var console={log:function(){}};Ext.namespace("Ext.m3");
function assert(a,b){if(!a)throw console.error(b),Error(b);}
Ext.override(Ext.form.Field,{isEdit:!0,isModified:!1,updateLabel:function(){this.setFieldLabel(this.fieldLabel)},setFieldLabel:function(a){if(void 0!=a){if(this.rendered){var b=a+":";this.isModified&&(b='<span style="color:darkmagenta;">'+b+"</span>");var d=this.el.up(".x-form-item",10,!0);d&&d.child(".x-form-item-label").update(b)}this.fieldLabel=a}},fireKey:function(a){a.isSpecialKey()&&(a.getKey()==a.ENTER&&(this.onBlur(),this.startValue=this.getValue()),this.fireEvent("specialkey",this,a))}});
Ext.define("Ext.m3.TitlePanel",{extend:"Ext.Panel",xtype:"m3-title-panel",titleItems:null,addTitleItem:function(a){a=Ext.ComponentMgr.create(a);var b=Ext.DomHelper.append(this.header,{tag:"div",style:"float:right;margin-top:-4px;margin-left:3px;"},!0);a.render(b)},onRender:function(a,b){Ext.m3.TitlePanel.superclass.onRender.apply(this,arguments);if(null!=this.titleItems){if(Ext.isArray(this.titleItems))for(var d=this.titleItems.length-1;0<=d;d--)this.addTitleItem(this.titleItems[d]);else this.addTitleItems(this.titleItems);
this.header&&this.header.removeClass("x-unselectable")}},getChildByName:function(a){if(this.items)for(var b=0;b<this.items.length;b++)if(this.items.items[b].name==a)return this.items.items[b];if(this.titleItems)for(b=0;b<this.titleItems.length;b++)if(this.titleItems[b].name==a)return this.titleItems[b];return null}});
function uiFailureResponseOnFormSubmit(a){"server"==a.action.failureType?(obj=Ext.util.JSON.decode(a.action.response.responseText),Ext.Msg.show({title:a.title,msg:obj.error_msg,buttons:Ext.Msg.OK,icon:Ext.Msg.WARNING})):Ext.Msg.alert(a.title,a.message)}
function uiAjaxFailMessage(a,b){if(a&&(0===a.status&&Ext.Msg.alert("","\u0418\u0437\u0432\u0438\u043d\u0438\u0442\u0435, \u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d."),!(200===a.status||b&&"server"===b.failureType))){Ext.getBody().getViewSize();!a.responseText&&b&&b.response&&(a=b.response);var d=a.responseText;d||(a.statusText=a.message,d=a.stack.replace(RegExp("\n","g"),"<br />"));(new Ext.Window({title:"Request Failure",
layout:"fit",maximizable:!0,maximized:!0,listeners:{resize:{fn:function(a){var b=Ext.getCmp("__ErrorMessageEditor");a=a.body.getViewSize();b.setSize(a.width,a.height-42)}}},items:new Ext.form.FormPanel({baseCls:"x-plain",layout:"absolute",defaultType:"label",items:[{x:5,y:5,html:'<div class="x-window-dlg"><div class="ext-mb-error" style="width:32px;height:32px"></div></div>'},{x:42,y:6,html:"<b>Status Code: </b>"},{x:125,y:6,text:a.status},{x:42,y:25,html:"<b>Status Text: </b>"},{x:125,y:25,text:a.statusText},
{x:0,y:42,id:"__ErrorMessageEditor",xtype:"htmleditor",value:d,readOnly:!0,enableAlignments:!1,enableColors:!1,enableFont:!1,enableFontSize:!1,enableFormat:!1,enableLinks:!1,enableLists:!1,enableSourceEdit:!1,listeners:{push:{fn:function(a,b){(function(a){try{for(var b=a.getElementsByTagName("script"),d=0;d<b.length;d++)b[d].innerText?this.eval(b[d].innerText):this.eval(b[d].textContent);this.hideAll(this.getElementsByClassName(a,"table","vars"));this.hideAll(this.getElementsByClassName(a,"ol","pre-context"));
this.hideAll(this.getElementsByClassName(a,"ol","post-context"));this.hideAll(this.getElementsByClassName(a,"div","pastebin"))}catch(e){}}).call(this.iframe.contentWindow,this.iframe.contentDocument)}}}}]})})).show()}}function uiShowErrorMessage(a){a=Ext.decode(a.responseText);a.error_msg&&Ext.Msg.alert(SOFTWARE_NAME,a.error_msg);return a.success}
function thousandCurrencyRenderer(a){if("number"!=typeof a){var b=a;try{b=parseFloat(a.replace(/,+/,".").replace(/\s+/g,""))}catch(d){b=NaN}if(isNaN(b))return a;a=b}var b="",e=a.toFixed(2).split(".");a=e[0];var e=e[1],f=0,g=0,h=a.length%3;if(0!=h){for(;g<h;g++)b+=a.charAt(g);b+=" "}for(;g<a.length;g++)0==f%3&&0!=f&&(b+=" "),b+=a.charAt(g),f++;e&&(b+=","+e);return b=b.replace(/\s,/,",")}function includeInArr(a,b){return-1!=a.indexOf(b)}
function showMessage(a,b,d){d=d||Ext.MessageBox.INFO;Ext.Msg.show({title:b||"\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435",msg:a||"",buttons:Ext.Msg.OK,icon:d})}function showWarning(a,b){showMessage(a,b,Ext.MessageBox.WARNING)}Ext.define("Ext.m3.ComboBox",{extend:"Ext.form.ComboBox",xtype:"m3-combobox",getText:function(){return this.lastSelectionText||""},setValue:function(a){Ext.isObject(a)?(this.getStore().add(new Ext.data.Record(a)),this.setValue(a[this.valueField])):this.callParent(arguments)}});
(function(){function a(a,b,d,h,k,l){"remote"==b&&d!=Ext.data.Api.actions.read?k.raw.message&&Ext.Msg.show({title:"\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435!",msg:k.raw.message,buttons:Ext.Msg.CANCEL,icon:Ext.Msg.WARNING}):uiAjaxFailMessage(k,h)}var b;Ext.m3.configureGrid=b=function(){this.bubbleEvents.push("gethandler");this.enableBubble(this.bubbleEvents);var b=this.params||{};!this.cm||this.cm instanceof Ext.grid.ColumnModel||(this.cm=Ext.create(this.cm));!this.sm||this.sm instanceof Ext.grid.AbstractSelectionModel||
(this.sm=Ext.create(this.sm));(this.sm instanceof Ext.grid.CheckboxSelectionModel||this.sm instanceof Ext.ux.grid.livegrid.CheckboxSelectionModel)&&this.columns&&this.columns.unshift(this.sm);!this.view||this.view instanceof Ext.grid.GridView||(this.view=Ext.create(this.view));var d;b.contextMenu?(b.contextMenu instanceof Ext.menu.Menu||(b.contextMenu=Ext.create(b.contextMenu)),d=function(a){a.stopEvent();b.contextMenu.showAt(a.getXY())}):d=Ext.emptyFn;var g;b.rowContextMenu?(b.rowContextMenu instanceof
Ext.menu.Menu||(b.rowContextMenu=Ext.create(b.rowContextMenu)),g=function(a,d,f){f.stopEvent();this.getSelectionModel().isSelected&&!this.getSelectionModel().isSelected(d)&&this.getSelectionModel().selectRow(d);b.rowContextMenu.showAt(f.getXY())}):g=Ext.emptyFn;var h=b.bandedColumns;h&&h instanceof Array&&0<h.length&&(this.plugins||(this.plugins=[]),this.plugins.push(new Ext.ux.grid.ColumnHeaderGroup({rows:h})));if(h=this.colModel?this.colModel.columns:this.columns){var k=!1;Ext.each(h,function(a){a.filter&&
(k=!0);"string"===typeof a.renderer&&(this.fireEvent("gethandler",a,a.renderer),a.handler&&(a.renderer=a.handler))},this);k&&this.plugins.push({ptype:"gridfilters",menuFilterText:"\u0424\u0438\u043b\u044c\u0442\u0440"})}this.on("contextmenu",d);this.on("rowcontextmenu",g);this.on("beforerender",function(b){this.getStore().on("exception",a,this);if((b=this.getBottomToolbar())&&b instanceof Ext.PagingToolbar){var d=this.getStore();d.setBaseParam("start",0);d.setBaseParam("limit",b.pageSize);b.bind(d)}})};
var d={setBlocked:function(a,b){if(!includeInArr(b,this.itemId)){var d=[this.getTopToolbar(),this.params.contextMenu,this.params.rowContextMenu];Ext.each(d,function(d){d&&d.cascade(function(d){d.setBlocked(a,b)})})}}};Ext.define("Ext.m3.GridPanel",Ext.apply(d,{extend:"Ext.grid.GridPanel",xtype:"m3-grid",initComponent:function(){b.apply(this);this.callParent()}}));Ext.define("Ext.m3.EditorGridPanel",Ext.apply(d,{extend:"Ext.grid.EditorGridPanel",xtype:"m3-edit-grid",initComponent:function(){b.apply(this);
this.callParent()}}))})();Ext.reg("sm-cell",Ext.grid.CellSelectionModel);Ext.reg("sm-checkbox",Ext.grid.CheckboxSelectionModel);Ext.reg("sm-row",Ext.grid.RowSelectionModel);Ext.reg("view-grouping",Ext.grid.GroupingView);
"3.0"==Ext.version&&Ext.override(Ext.grid.GridView,{ensureVisible:function(a,b,d){if((a=this.resolveCell(a,b,d))&&a.row){var e=a.row,f=a.cell;b=this.scroller.dom;for(var g=0,h=e,k=this.el.dom,h=e,k=this.el.dom;h&&h!=k;)g+=h.offsetTop,h=h.offsetParent;var g=g-this.mainHd.dom.offsetHeight,e=g+e.offsetHeight,h=b.clientHeight,k=parseInt(b.scrollTop,10),l=k+h;g<k?b.scrollTop=g:e>l&&(b.scrollTop=e-h);!1!==d&&(d=parseInt(f.offsetLeft,10),f=d+f.offsetWidth,g=parseInt(b.scrollLeft,10),k=g+b.clientWidth,d<
g?b.scrollLeft=d:f>k&&(b.scrollLeft=f-b.clientWidth));return this.getResolvedXY(a)}}});Ext.namespace("Ext.ux.maximgb.tg");
Ext.ux.maximgb.tg.AbstractTreeStore=Ext.extend(Ext.data.Store,{leaf_field_name:"_is_leaf",page_offset:0,active_node:null,constructor:function(a){Ext.ux.maximgb.tg.AbstractTreeStore.superclass.constructor.call(this,a);this.paramNames.active_node||(this.paramNames.active_node="anode");this.addEvents("beforeexpandnode","expandnode","expandnodefailed","beforecollapsenode","collapsenode","beforeactivenodechange","activenodechange")},remove:function(a){a===this.active_node&&this.setActiveNode(null);this.removeNodeDescendants(a);
Ext.ux.maximgb.tg.AbstractTreeStore.superclass.remove.call(this,a)},removeNodeDescendants:function(a){var b,d=this.getNodeChildren(a);a=0;for(b=d.length;a<b;a++)this.remove(d[a])},load:function(a){a?a.params?void 0===a.params[this.paramNames.active_node]&&(a.params[this.paramNames.active_node]=this.active_node?this.active_node.id:null):(a.params={},a.params[this.paramNames.active_node]=this.active_node?this.active_node.id:null):(a={params:{}},a.params[this.paramNames.active_node]=this.active_node?
this.active_node.id:null);null!==a.params[this.paramNames.active_node]&&(a.add=!0);return Ext.ux.maximgb.tg.AbstractTreeStore.superclass.load.call(this,a)},loadRecords:function(a,b,d){if(a&&!1!==d){d=a.records;var e=a.totalRecords||d.length,f=this.getPageOffsetFromOptions(b);a=this.getLoadedNodeIdFromOptions(b);var g,h,k=this;if(b&&!0===b.add){a&&(g=this.getById(a));g&&(this.setNodeLoaded(g,!0),this.setNodeChildrenOffset(g,f),this.setNodeChildrenTotalCount(g,Math.max(e,d.length)),this.removeNodeDescendants(g));
this.suspendEvents();f={};g=0;for(a=d.length;g<a;g++)e=d[g],h=this.indexOfId(e.id),-1==h?(f[e.id]=!1,this.add(e)):(f[e.id]=!0,h=this.getAt(h),h.reject(),h.data=e.data,d[g]=h);this.applySort();this.resumeEvents();d.sort(function(a,b){var d=k.data.indexOf(a),e=k.data.indexOf(b);return d>e?1:-1});g=0;for(a=d.length;g<a;g++)e=d[g],!0==f[e.id]?this.fireEvent("update",this,e,Ext.data.Record.COMMIT):this.fireEvent("add",this,[e],this.data.indexOf(e))}else{this.pruneModifiedRecords&&(this.modified=[]);g=
0;for(a=d.length;g<a;g++)d[g].join(this);this.snapshot&&(this.data=this.snapshot,delete this.snapshot);this.data.clear();this.data.addAll(d);this.page_offset=f;this.totalLength=e;this.applySort();this.fireEvent("datachanged",this)}this.fireEvent("load",this,d,b);b.callback&&b.callback.call(b.scope||this,d,b,!0)}else!1!==d&&this.fireEvent("load",this,[],b),b.callback&&b.callback.call(b.scope||this,[],b,!1)},sort:function(a,b){this.remoteSort&&(this.setActiveNode(null),this.lastOptions&&(this.lastOptions.add=
!1,this.lastOptions.params&&(this.lastOptions.params[this.paramNames.active_node]=null)));return Ext.ux.maximgb.tg.AbstractTreeStore.superclass.sort.call(this,a,b)},applySort:function(){if(this.sortInfo&&!this.remoteSort){var a=this.sortInfo;this.sortData(a.field,a.direction)}else this.applyTreeSort()},sortData:function(a,b){b=b||"ASC";var d=this.fields.get(a).sortType,e=function(b,e){var h=d(b.data[a]),k=d(e.data[a]);return h>k?1:h<k?-1:0};this.data.sort(b,e);this.snapshot&&this.snapshot!=this.data&&
this.snapshot.sort(b,e);this.applyTreeSort()},applyTreeSort:function(){var a,b,d,e=[],f=this.getRootNodes();a=0;for(b=f.length;a<b;a++)d=f[a],e.push(d),this.collectNodeChildrenTreeSorted(e,d);0<e.length&&(this.data.clear(),this.data.addAll(e));this.snapshot&&this.snapshot!==this.data&&(a=this.data,this.data=this.snapshot,this.snapshot=null,this.applyTreeSort(),this.snapshot=this.data,this.data=a)},collectNodeChildrenTreeSorted:function(a,b){var d,e,f,g=this.getNodeChildren(b);d=0;for(e=g.length;d<
e;d++)f=g[d],a.push(f),this.collectNodeChildrenTreeSorted(a,f)},getActiveNode:function(){return this.active_node},setActiveNode:function(a){if(this.active_node!==a)if(a)if(-1!=this.data.indexOf(a))!1!==this.fireEvent("beforeactivenodechange",this,this.active_node,a)&&(this.active_node=a,this.fireEvent("activenodechange",this,this.active_node,a));else throw"Given record is not from the store.";else!1!==this.fireEvent("beforeactivenodechange",this,this.active_node,a)&&(this.active_node=a,this.fireEvent("activenodechange",
this,this.active_node,a))},isExpandedNode:function(a){return!0===a.ux_maximgb_tg_expanded},setNodeExpanded:function(a,b){a.ux_maximgb_tg_expanded=b},isVisibleNode:function(a){var b,d=this.getNodeAncestors(a),e=!0;a=0;for(b=d.length;a<b&&(e=e&&this.isExpandedNode(d[a]),e);a++);return e},isLeafNode:function(a){return!0==a.get(this.leaf_field_name)},isLoadedNode:function(a){return void 0!==a.ux_maximgb_tg_loaded?a.ux_maximgb_tg_loaded:this.isLeafNode(a)||this.hasChildNodes(a)?!0:!1},setNodeLoaded:function(a,
b){a.ux_maximgb_tg_loaded=b},getNodeChildrenOffset:function(a){return a.ux_maximgb_tg_offset||0},setNodeChildrenOffset:function(a,b){a.ux_maximgb_tg_offset=b},getNodeChildrenTotalCount:function(a){return a.ux_maximgb_tg_total||0},setNodeChildrenTotalCount:function(a,b){a.ux_maximgb_tg_total=b},collapseNode:function(a){this.isExpandedNode(a)&&!1!==this.fireEvent("beforecollapsenode",this,a)&&(this.setNodeExpanded(a,!1),this.fireEvent("collapsenode",this,a))},expandNode:function(a){var b;this.isExpandedNode(a)||
!1===this.fireEvent("beforeexpandnode",this,a)||(this.isLoadedNode(a)?(this.setNodeExpanded(a,!0),this.fireEvent("expandnode",this,a)):(b={},b[this.paramNames.active_node]=a.id,this.load({add:!0,params:b,callback:this.expandNodeCallback,scope:this})))},expandNodeCallback:function(a,b,d){a=this.getById(b.params[this.paramNames.active_node]);d&&a?(this.setNodeExpanded(a,!0),this.fireEvent("expandnode",this,a)):this.fireEvent("expandnodefailed",this,b.params[this.paramNames.active_node],a)},expandAll:function(){var a,
b,d,e=this.data.getRange();this.suspendEvents();b=0;for(d=e.length;b<d;b++)a=e[b],this.isExpandedNode(a)||this.expandNode(a);this.resumeEvents();this.fireEvent("datachanged",this)},collapseAll:function(){var a,b,d,e=this.data.getRange();this.suspendEvents();b=0;for(d=e.length;b<d;b++)a=e[b],this.isExpandedNode(a)&&this.collapseNode(a);this.resumeEvents();this.fireEvent("datachanged",this)},getLoadedNodeIdFromOptions:function(a){var b=null;a&&a.params&&a.params[this.paramNames.active_node]&&(b=a.params[this.paramNames.active_node]);
return b},getPageOffsetFromOptions:function(a){var b=0;a&&a.params&&a.params[this.paramNames.start]&&(b=parseInt(a.params[this.paramNames.start],10),isNaN(b)&&(b=0));return b},hasNextSiblingNode:function(a){return null!==this.getNodeNextSibling(a)},hasPrevSiblingNode:function(a){return null!==this.getNodePrevSibling(a)},hasChildNodes:function(a){return 0<this.getNodeChildrenCount(a)},getNodeAncestors:function(a){var b=[];for(a=this.getNodeParent(a);a;)b.push(a),a=this.getNodeParent(a);return b},getNodeChildrenCount:function(a){return this.getNodeChildren(a).length},
getNodeNextSibling:function(a){var b,d=null;b=(b=this.getNodeParent(a))?this.getNodeChildren(b):this.getRootNodes();a=b.indexOf(a);a<b.length-1&&(d=b[a+1]);return d},getNodePrevSibling:function(a){var b,d=null;b=(b=this.getNodeParent(a))?this.getNodeChildren(b):this.getRootNodes();a=b.indexOf(a);0<a&&(d=b[a-1]);return d},getRootNodes:function(){throw"Abstract method call";},getNodeDepth:function(a){throw"Abstract method call";},getNodeParent:function(a){throw"Abstract method call";},getNodeChildren:function(a){throw"Abstract method call";
},addToNode:function(a,b){throw"Abstract method call";},removeFromNode:function(a,b){throw"Abstract method call";},getPageOffset:function(){return this.page_offset},getActiveNodePageOffset:function(){return this.active_node?this.getNodeChildrenOffset(this.active_node):this.getPageOffset()},getActiveNodeCount:function(){return this.active_node?this.getNodeChildrenCount(this.active_node):this.getRootNodes().length},getActiveNodeTotalCount:function(){return this.active_node?this.getNodeChildrenTotalCount(this.active_node):
this.getTotalCount()}});
Ext.ux.maximgb.tg.AdjacencyListStore=Ext.extend(Ext.ux.maximgb.tg.AbstractTreeStore,{parent_id_field_name:"_parent",getRootNodes:function(){var a,b,d=[],e=this.data.getRange();a=0;for(b=e.length;a<b;a++)null==e[a].get(this.parent_id_field_name)&&d.push(e[a]);return d},getNodeDepth:function(a){return this.getNodeAncestors(a).length},getNodeParent:function(a){return this.getById(a.get(this.parent_id_field_name))},getNodeChildren:function(a){var b,d,e=[],f=this.data.getRange();b=0;for(d=f.length;b<d;b++)f[b].get(this.parent_id_field_name)==
a.id&&e.push(f[b]);return e},addToNode:function(a,b){b.set(this.parent_id_field_name,a.id);this.addSorted(b)},removeFromNode:function(a,b){this.remove(b)}});Ext.reg("Ext.ux.maximgb.tg.AdjacencyListStore",Ext.ux.maximgb.tg.AdjacencyListStore);
Ext.ux.maximgb.tg.NestedSetStore=Ext.extend(Ext.ux.maximgb.tg.AbstractTreeStore,{left_field_name:"_lft",right_field_name:"_rgt",level_field_name:"_level",root_node_level:1,getRootNodes:function(){var a,b,d=[],e=this.data.getRange();a=0;for(b=e.length;a<b;a++)e[a].get(this.level_field_name)==this.root_node_level&&d.push(e[a]);return d},getNodeDepth:function(a){return a.get(this.level_field_name)-this.root_node_level},getNodeParent:function(a){var b=null,d=this.data.getRange(),e,f,g,h,k,l,m,n;g=a.get(this.left_field_name);
k=a.get(this.right_field_name);m=a.get(this.level_field_name);e=0;for(f=d.length;e<f;e++)if(a=d[e],h=a.get(this.left_field_name),l=a.get(this.right_field_name),n=a.get(this.level_field_name),n==m-1&&h<g&&l>k){b=a;break}return b},getNodeChildren:function(a){var b,d,e,f,g,h,k,l=[];h=this.data.getRange();b=a.get(this.left_field_name);d=a.get(this.right_field_name);f=a.get(this.level_field_name);i=0;for(len=h.length;i<len;i++)k=h[i],a=k.get(this.left_field_name),e=k.get(this.right_field_name),g=k.get(this.level_field_name),
g==f+1&&a>b&&e<d&&l.push(k);return l}});
Ext.ux.maximgb.tg.GridView=Ext.extend(Ext.grid.GridView,{expanded_icon_class:"ux-maximgb-tg-elbow-minus",last_expanded_icon_class:"ux-maximgb-tg-elbow-end-minus",collapsed_icon_class:"ux-maximgb-tg-elbow-plus",last_collapsed_icon_class:"ux-maximgb-tg-elbow-end-plus",skip_width_update_class:"ux-maximgb-tg-skip-width-update",initTemplates:function(){var a=this.templates||{};a.row||(a.row=new Ext.Template('<div class="x-grid3-row ux-maximgb-tg-level-{level} {alt}" style="{tstyle} {display_style}">','<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>","</div>"));a.mastercell||(a.mastercell=new Ext.Template('<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} {css}" style="{style}" tabIndex="0" {cellAttr}>','<div class="ux-maximgb-tg-mastercell-wrap">',"{treeui}",'<div class="x-grid3-cell-inner x-grid3-col-{id}" unselectable="on" {attr}>{value}</div>',
"</div>","</td>"));a.treeui||(a.treeui=new Ext.Template('<div class="ux-maximgb-tg-uiwrap" style="width: {wrap_width}px">',"{elbow_line}",'<div style="left: {left}px" class="{cls}">&#160;</div>',"</div>"));a.elbow_line||(a.elbow_line=new Ext.Template('<div style="left: {left}px" class="{cls}">&#160;</div>'));this.templates=a;Ext.ux.maximgb.tg.GridView.superclass.initTemplates.call(this)},doRender:function(a,b,d,e,f,g){for(var h=this.templates,k=h.cell,l=h.row,m=f-1,n=[],p,q={},t={tstyle:"width:"+
this.getTotalWidth()+";"},u,v=0,s=b.length;v<s;v++){u=b[v];p=[];var w=v+e,x=this.renderRow(u,w,f,d,this.cm.getTotalWidth());if(!1===x)for(x=0;x<f;x++)k=a[x],q.id=k.id,q.css=0==x?"x-grid3-cell-first ":x==m?"x-grid3-cell-last ":"",q.attr=q.cellAttr="",q.value=k.renderer.call(k.scope,u.data[k.name],q,u,w,x,d),q.style=k.style,Ext.isEmpty(q.value)&&(q.value="&#160;"),this.markDirty&&u.dirty&&"undefined"!==typeof u.modified[k.name]&&(q.css+=" x-grid3-dirty-cell"),k.id==this.grid.master_column_id?(q.treeui=
this.renderCellTreeUI(u,d),k=h.mastercell):k=h.cell,p[p.length]=k.apply(q);else p.push(x);x=[];g&&0==(w+1)%2&&(x[0]="x-grid3-row-alt");u.dirty&&(x[1]=" x-grid3-dirty-row");t.cols=f;this.getRowClass&&(x[2]=this.getRowClass(u,w,t,d));t.alt=x.join(" ");t.cells=p.join("");d.isVisibleNode(u)?t.display_style="":t.display_style="display: none;";t.level=d.getNodeDepth(u);n[n.length]=l.apply(t)}return n.join("")},renderCellTreeUI:function(a,b){var d=this.templates.treeui,e=this.templates.elbow_line,f={},g,
h,k=level=b.getNodeDepth(a);f.wrap_width=16*(k+1);if(0<level)for(f.elbow_line="",g=a,left=0;level--;){if(h=b.getNodeParent(g))b.hasNextSiblingNode(h)?f.elbow_line=e.apply({left:16*level,cls:"ux-maximgb-tg-elbow-line"})+f.elbow_line:f.elbow_line=e.apply({left:16*level,cls:"ux-maximgb-tg-elbow-empty"})+f.elbow_line;else throw["Tree inconsistency can't get level ",level+1," node(id=",g.id,") parent."].join("");g=h}b.isLeafNode(a)?b.hasNextSiblingNode(a)?f.cls="ux-maximgb-tg-elbow":f.cls="ux-maximgb-tg-elbow-end":
(f.cls="ux-maximgb-tg-elbow-active ",b.isExpandedNode(a)?b.hasNextSiblingNode(a)?f.cls+=this.expanded_icon_class:f.cls+=this.last_expanded_icon_class:b.hasNextSiblingNode(a)?f.cls+=this.collapsed_icon_class:f.cls+=this.last_collapsed_icon_class);f.left=1+16*k;return d.apply(f)},renderRow:function(a,b,d,e,f){return!1},afterRender:function(){Ext.ux.maximgb.tg.GridView.superclass.afterRender.call(this);this.updateAllColumnWidths()},updateAllColumnWidths:function(){var a=this.getTotalWidth(),b=this.cm.getColumnCount(),
d=[],e,f;for(f=0;f<b;f++)d[f]=this.getColumnWidth(f);this.innerHd.firstChild.style.width=this.getOffsetWidth();this.innerHd.firstChild.firstChild.style.width=a;this.mainBody.dom.style.width=a;for(f=0;f<b;f++)this.getHeaderCell(f).style.width=d[f];var g=this.getRows(),h;f=0;for(e=g.length;f<e;f++)if(h=g[f],h.style.width=a,h.firstChild){h.firstChild.style.width=a;h=h.firstChild.rows[0];for(var k=0;k<b&&k<h.childNodes.length;k++)Ext.fly(h.childNodes[k]).hasClass(this.skip_width_update_class)||(h.childNodes[k].style.width=
d[k])}this.onAllColumnWidthsUpdated(d,a)},updateColumnWidth:function(a,b){var d=this.getColumnWidth(a),e=this.getTotalWidth();this.innerHd.firstChild.style.width=this.getOffsetWidth();this.innerHd.firstChild.firstChild.style.width=e;this.mainBody.dom.style.width=e;this.getHeaderCell(a).style.width=d;for(var f=this.getRows(),g,h=0,k=f.length;h<k;h++)g=f[h],g.style.width=e,g.firstChild&&(g.firstChild.style.width=e,a<g.firstChild.rows[0].childNodes.length&&!Ext.fly(g.firstChild.rows[0].childNodes[a]).hasClass(this.skip_width_update_class)&&
(g.firstChild.rows[0].childNodes[a].style.width=d));this.onColumnWidthUpdated(a,d,e)},updateColumnHidden:function(a,b){var d=this.getTotalWidth();this.innerHd.firstChild.style.width=this.getOffsetWidth();this.innerHd.firstChild.firstChild.style.width=d;this.mainBody.dom.style.width=d;var e=b?"none":"";this.getHeaderCell(a).style.display=e;for(var f=this.getRows(),g,h=0,k=f.length;h<k;h++)g=f[h],g.style.width=d,g.firstChild&&(g.firstChild.style.width=d,a<g.firstChild.rows[0].childNodes.length&&!Ext.fly(g.firstChild.rows[0].childNodes[a]).hasClass(this.skip_width_update_class)&&
(g.firstChild.rows[0].childNodes[a].style.display=e));this.onColumnHiddenUpdated(a,b,d);delete this.lastViewWidth;this.layout()},processRows:function(a,b){var d=0;if(!(1>this.ds.getCount())){b=!this.grid.stripeRows;var e=this.getRows(),d=0;Ext.each(e,function(a,e){a.rowIndex=e;a.className=a.className.replace(this.rowClsRe," ");"none"!=a.style.display&&(b||0!==(d+1)%2||(a.className+=" x-grid3-row-alt"),d++)},this);Ext.fly(e[0]).addClass(this.firstRowCls);Ext.fly(e[e.length-1]).addClass(this.lastRowCls)}},
ensureVisible:function(a,b,d){var e,f=this.ds.getAt(a);if(!this.ds.isVisibleNode(f))for(e=this.ds.getNodeAncestors(f);0<e.length;)f=e.shift(),this.ds.isExpandedNode(f)||this.ds.expandNode(f);return Ext.ux.maximgb.tg.GridView.superclass.ensureVisible.call(this,a,b,d)},expandRow:function(a,b){var d=this.ds,e,f,g,h,k;"number"==typeof a?(e=a,a=d.getAt(e)):e=d.indexOf(a);b=b||!1;g=this.getRow(e);if(e=Ext.fly(g).child(".ux-maximgb-tg-elbow-active"))d.hasNextSiblingNode(a)?(e.removeClass(this.collapsed_icon_class),
e.removeClass(this.last_collapsed_icon_class),e.addClass(this.expanded_icon_class)):(e.removeClass(this.collapsed_icon_class),e.removeClass(this.last_collapsed_icon_class),e.addClass(this.last_expanded_icon_class));if(d.isVisibleNode(a))for(h=d.getNodeChildren(a),e=0,f=h.length;e<f;e++)k=d.indexOf(h[e]),g=this.getRow(k),g.style.display="block",d.isExpandedNode(h[e])&&this.expandRow(k,!0);b||this.processRows(0)},collapseRow:function(a,b){var d=this.ds,e,f,g,h,k;"number"==typeof a?(e=a,a=d.getAt(e)):
e=d.indexOf(a);b=b||!1;h=this.getRow(e);if(pmel=Ext.fly(h).child(".ux-maximgb-tg-elbow-active"))d.hasNextSiblingNode(a)?(pmel.removeClass(this.expanded_icon_class),pmel.removeClass(this.last_expanded_icon_class),pmel.addClass(this.collapsed_icon_class)):(pmel.removeClass(this.expanded_icon_class),pmel.removeClass(this.last_expanded_icon_class),pmel.addClass(this.last_collapsed_icon_class));g=d.getNodeChildren(a);e=0;for(f=g.length;e<f;e++)k=d.indexOf(g[e]),h=this.getRow(k),"none"!=h.style.display&&
(h.style.display="none",this.collapseRow(k,!0));b||this.processRows(0)},initData:function(a,b){Ext.ux.maximgb.tg.GridView.superclass.initData.call(this,a,b);this.ds&&(this.ds.un("expandnode",this.onStoreExpandNode,this),this.ds.un("collapsenode",this.onStoreCollapseNode,this));a&&(a.on("expandnode",this.onStoreExpandNode,this),a.on("collapsenode",this.onStoreCollapseNode,this))},onLoad:function(a,b,d){d&&d.params&&(null===d.params[a.paramNames.active_node]||-1==a.indexOfId(d.params[a.paramNames.active_node]))&&
Ext.ux.maximgb.tg.GridView.superclass.onLoad.call(this,a,b,d)},onAdd:function(a,b,d){Ext.ux.maximgb.tg.GridView.superclass.onAdd.call(this,a,b,d);this.mainWrap&&this.processRows(0)},onRemove:function(a,b,d,e){Ext.ux.maximgb.tg.GridView.superclass.onRemove.call(this,a,b,d,e);!0!==e&&this.mainWrap&&this.processRows(0)},onUpdate:function(a,b){Ext.ux.maximgb.tg.GridView.superclass.onUpdate.call(this,a,b);this.mainWrap&&this.processRows(0)},onStoreExpandNode:function(a,b){this.expandRow(b)},onStoreCollapseNode:function(a,
b){this.collapseRow(b)}});
Ext.ux.maximgb.tg.GridPanel=Ext.extend(Ext.m3.GridPanel,{master_column_id:0,tg_cls:"ux-maximgb-tg-panel",initComponent:function(){this.initComponentPreOverride();Ext.ux.maximgb.tg.GridPanel.superclass.initComponent.call(this);this.getSelectionModel().on("selectionchange",this.onTreeGridSelectionChange,this);this.initComponentPostOverride()},initComponentPreOverride:Ext.emptyFn,initComponentPostOverride:Ext.emptyFn,onRender:function(a,b){Ext.ux.maximgb.tg.GridPanel.superclass.onRender.call(this,a,
b);this.el.addClass(this.tg_cls)},getView:function(){this.view||(this.view=new Ext.ux.maximgb.tg.GridView(this.viewConfig));return this.view},onClick:function(a){var b=a.getTarget(),d=this.getView().findRowIndex(b),e=this.getStore();this.getSelectionModel();var f=!0;!1!==d&&Ext.fly(b).hasClass("ux-maximgb-tg-elbow-active")&&(b=e.getAt(d),e.isExpandedNode(b)?e.collapseNode(b):e.expandNode(b),f=!1);f&&Ext.ux.maximgb.tg.GridPanel.superclass.onClick.call(this,a)},onMouseDown:function(a){var b=a.getTarget();
Ext.fly(b).hasClass("ux-maximgb-tg-elbow-active")||Ext.ux.maximgb.tg.GridPanel.superclass.onMouseDown.call(this,a)},onTreeGridSelectionChange:function(a,b){var d,e=this.getStore();a.getSelected?(d=a.getSelected(),e.setActiveNode(d)):a.getSelectedCell&&b&&(d=b.record,e.setActiveNode(d));if(d&&!e.isVisibleNode(d))for(d=e.getNodeAncestors(d);0<d.length;)e.expandNode(d.pop())}});
Ext.ux.maximgb.tg.EditorGridPanel=Ext.extend(Ext.grid.EditorGridPanel,{master_column_id:0,initComponent:function(){this.initComponentPreOverride();Ext.ux.maximgb.tg.EditorGridPanel.superclass.initComponent.call(this);this.getSelectionModel().on("selectionchange",this.onTreeGridSelectionChange,this);this.initComponentPostOverride()},initComponentPreOverride:Ext.emptyFn,initComponentPostOverride:Ext.emptyFn,onRender:function(a,b){Ext.ux.maximgb.tg.EditorGridPanel.superclass.onRender.call(this,a,b);
this.el.addClass("ux-maximgb-tg-panel")},getView:function(){this.view||(this.view=new Ext.ux.maximgb.tg.GridView(this.viewConfig));return this.view},onClick:function(a){var b=a.getTarget(),d=this.getView().findRowIndex(b),e=this.getStore();this.getSelectionModel();var f=!0;!1!==d&&Ext.fly(b).hasClass("ux-maximgb-tg-elbow-active")&&(b=e.getAt(d),e.isExpandedNode(b)?e.collapseNode(b):e.expandNode(b),f=!1);f&&Ext.ux.maximgb.tg.EditorGridPanel.superclass.onClick.call(this,a)},onMouseDown:function(a){var b=
a.getTarget();Ext.fly(b).hasClass("ux-maximgb-tg-elbow-active")||Ext.ux.maximgb.tg.EditorGridPanel.superclass.onMouseDown.call(this,a)},onTreeGridSelectionChange:function(a,b){var d,e=this.getStore();a.getSelected?(d=a.getSelected(),e.setActiveNode(d)):a.getSelectedCell&&b&&(d=b.record,e.setActiveNode(d));if(d&&!e.isVisibleNode(d))for(d=e.getNodeAncestors(d);0<d.length;)e.expandNode(d.pop())}});
Ext.ux.maximgb.tg.PagingToolbar=Ext.extend(Ext.PagingToolbar,{onRender:function(a,b){Ext.ux.maximgb.tg.PagingToolbar.superclass.onRender.call(this,a,b);this.updateUI()},getPageData:function(){var a=0,b=0;this.store&&(b=this.store.getActiveNodePageOffset(),a=this.store.getActiveNodeTotalCount());return{total:a,activePage:Math.ceil((b+this.pageSize)/this.pageSize),pages:a<this.pageSize?1:Math.ceil(a/this.pageSize)}},updateInfo:function(){var a=0,b=0,d=0;this.displayItem&&(this.store&&(b=this.store.getActiveNodePageOffset(),
a=this.store.getActiveNodeCount(),d=this.store.getActiveNodeTotalCount()),a=0==a?this.emptyMsg:String.format(this.displayMsg,b+1,b+a,d),this.displayItem.setText(a))},updateUI:function(){var a=this.getPageData(),b=a.activePage,d=a.pages;this.afterTextItem.setText(String.format(this.afterPageText,a.pages));this.inputItem.setValue(b);this.first.setDisabled(1==b);this.prev.setDisabled(1==b);this.next.setDisabled(b==d);this.last.setDisabled(b==d);this.refresh.enable();this.updateInfo()},bindStore:function(a,
b){!b&&this.store&&this.store.un("activenodechange",this.onStoreActiveNodeChange,this);if(a)a.on("activenodechange",this.onStoreActiveNodeChange,this);Ext.ux.maximgb.tg.PagingToolbar.superclass.bindStore.call(this,a,b)},beforeLoad:function(a,b){var d=this.getParams();Ext.ux.maximgb.tg.PagingToolbar.superclass.beforeLoad.call(this,a,b);b&&b.params&&(void 0===b.params[d.start]&&(b.params[d.start]=0),void 0===b.params[d.limit]&&(b.params[d.limit]=this.pageSize))},moveFirst:function(){this.doLoad(0)},
movePrevious:function(){var a=this.store,a=a?a.getActiveNodePageOffset():0;this.doLoad(Math.max(0,a-this.pageSize))},moveNext:function(){var a=this.store,a=a?a.getActiveNodePageOffset():0;this.doLoad(a+this.pageSize)},moveLast:function(){var a=this.store;a&&a.getActiveNodePageOffset();var a=a?a.getActiveNodeTotalCount():0,b=a%this.pageSize;this.doLoad(b?a-b:a-this.pageSize)},onStoreActiveNodeChange:function(a,b,d){this.rendered&&this.updateUI()}});Ext.reg("Ext.ux.maximgb.tg.GridPanel",Ext.ux.maximgb.tg.GridPanel);
Ext.reg("Ext.ux.maximgb.tg.EditorGridPanel",Ext.ux.maximgb.tg.EditorGridPanel);Ext.reg("Ext.ux.maximgb.tg.PagingToolbar",Ext.ux.maximgb.tg.PagingToolbar);
Ext.define("Ext.m3.Tree",{extend:"Ext.ux.tree.TreeGrid",xtype:"m3-tree",useArrows:!0,autoScroll:!1,animate:!0,containerScroll:!0,border:!1,split:!0,customLoad:!1,initComponent:function(){this.readOnly&&(this.enableDrop=this.enableDrag=this.enableDD=!1);this.root=new Ext.tree.AsyncTreeNode(this.root);this.contextMenu&&(this.contextMenu=Ext.create(this.contextMenu),this.addListener("contextmenu",function(a,b){a.select();this.contextMenu.contextNode=a;this.contextMenu.showAt(b.getXY())},this));this.containerContextMenu&&
(this.containerContextMenu=Ext.create(this.containerContextMenu),this.addListener("containercontextmenu",function(a,b){b.stopEvent();this.containerContextMenu.showAt(b.getXY())},this));Ext.m3.Tree.superclass.initComponent.call(this)}});Ext.reg("tggridcolumn",Ext.tree.Column);
Ext.define("Ext.m3.Window",{extend:"Ext.Window",xtype:"m3-window",helpTopic:null,constructor:function(a){this.listeners.gethandler=function(a,b){Ext.isFunction(this[b])&&(a.handler=this[b].createDelegate(this))}.bind(this);this.callParent(arguments);this.addEvents("mask","unmask","gethandler");var b=new Ext.LoadMask(this.getEl(),{msg:"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430..."}),d=0;this.on("mask",function(a,f,g){b.msgOrig=b.msg;b.msgClsOrig=b.msgCls;f&&(b.msg=f,b.msgCls="x-mask");b.show();
d++;if(g instanceof Ext.m3.Window)this.on("activate",g.activate,g)},this);this.on("unmask",function(a,f){d--;0>=d&&(b.hide(),f instanceof Ext.m3.Window&&this.un("activate",f.activate,f));b.msg=b.msgOrig;b.msgCls=b.msgClsOrig},this)},activate:function(){this.toFront()},initTools:function(){if(this.helpTopic){assert(this.helpTopic instanceof Array);assert(0<this.helpTopic.length);var a=this.helpTopic[0]+".html";2==this.helpTopic.length&&(a+="#"+this.helpTopic[1]);this.addTool({id:"help",handler:function(){showHelpWindow(a)}.bind(this)})}this.callParent()},
findByItemId:function(a){var b=[this,this.getTopToolbar(),this.getBottomToolbar(),this.getFooterToolbar()],d;Ext.each(b,function(b){if(b&&(b=b.find("itemId",a)[0]))return d=b,!1},this);return d},bind:Ext.emptyFn,setBlocked:function(a,b){var d=this,e=[this,this.getTopToolbar(),this.getBottomToolbar(),this.getFooterToolbar()];Ext.each(e,function(e){e&&e.cascade(function(e){d!=e&&e.setBlocked(a,b||[])})})}});
Ext.define("Ext.m3.AddrField",{extend:"Ext.Container",xtype:"m3-kladr",constructor:function(a,b){b=a.params||b;var d=b.items||[],e=new Ext.data.JsonStore({url:b.kladr_url,idProperty:"code",root:"rows",totalProperty:"total",fields:[{name:"code"},{name:"display_name"},{name:"socr"},{name:"zipcode"},{name:"gni"},{name:"uno"},{name:"okato"},{name:"addr_name"}]});if(""!=b.place_record&&void 0!=b.place_record){var f=Ext.util.JSON.decode(b.place_record);e.loadData({total:1,rows:[f]})}var g=b.read_only?"m3-grey-field":
"";this.place=new Ext.m3.ComboBox({name:b.place_field_name,fieldLabel:b.place_label,allowBlank:b.place_allow_blank,readOnly:b.read_only,cls:g,hideTrigger:!0,minChars:2,emptyText:"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u0443\u043d\u043a\u0442...",queryParam:"filter",store:e,resizable:!0,displayField:"display_name",valueField:"code",mode:"remote",hiddenName:b.place_field_name,valueNotFoundText:"",invalidClass:b.invalid_class});
this.place.setValue(b.place_value);this.zipcode=new Ext.form.TextField({name:b.zipcode_field_name,value:b.zipcode_value,emptyText:"\u0438\u043d\u0434\u0435\u043a\u0441",readOnly:b.read_only,cls:g,width:55,maskRe:/[0-9]/});1<b.level&&(e=new Ext.data.JsonStore({url:b.street_url,idProperty:"code",root:"rows",totalProperty:"total",fields:[{name:"code"},{name:"display_name"},{name:"socr"},{name:"zipcode"},{name:"gni"},{name:"uno"},{name:"okato"},{name:"name"}]}),""!=b.street_record&&void 0!=b.street_record&&
(f=Ext.util.JSON.decode(b.street_record),e.loadData({total:1,rows:[f]})),this.street=new Ext.m3.ComboBox({name:b.street_field_name,fieldLabel:b.street_label,allowBlank:b.street_allow_blank,readOnly:b.read_only,cls:g,hideTrigger:!0,minChars:2,emptyText:"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0443\u043b\u0438\u0446\u0443...",queryParam:"filter",store:e,resizable:!0,displayField:"display_name",valueField:"code",mode:"remote",hiddenName:b.street_field_name,valueNotFoundText:"",invalidClass:b.invalid_class}),
this.street.setValue(b.street_value),2<b.level&&(this.house=new Ext.form.TextField({name:b.house_field_name,allowBlank:b.house_allow_blank,readOnly:b.read_only,cls:g,fieldLabel:b.house_label,value:b.house_value,emptyText:"",width:40,invalidClass:b.invalid_class}),b.use_corps&&(this.corps=new Ext.form.TextField({name:b.corps_field_name,allowBlank:b.corps_allow_blank,readOnly:b.read_only,cls:g,fieldLabel:b.corps_label,value:b.corps_value,emptyText:"",width:40,invalidClass:b.invalid_class})),3<b.level&&
(this.flat=new Ext.form.TextField({name:b.flat_field_name,fieldLabel:b.flat_label,value:b.flat_value,allowBlank:b.flat_allow_blank,readOnly:b.read_only,cls:g,emptyText:"",width:40,invalidClass:b.invalid_class}))));b.addr_visible&&(this.addr=new Ext.form.TextArea({name:b.addr_field_name,anchor:"100%",fieldLabel:b.addr_label,value:b.addr_value,readOnly:!0,cls:g,height:36}));1==b.view_mode&&(this.place.flex=1,f=2<b.level?[this.place,this.zipcode]:[this.place],1<b.level&&(this.street.flex=1,this.street.fieldLabel=
b.street_label,f.push({xtype:"label",style:{padding:"3px"},text:b.street_label+":"},this.street),2<b.level&&(this.house.fieldLabel=b.house_label,f.push({xtype:"label",style:{padding:"3px"},text:b.house_label+":"},this.house),b.use_corps&&(this.corps.fieldLabel=b.corps_label,f.push({xtype:"label",style:{padding:"3px"},text:b.corps_label+":"},this.corps)),3<b.level&&(this.flat.fieldLabel=b.flat_label,f.push({xtype:"label",style:{padding:"3px"},text:b.flat_label+":"},this.flat)))),f={xtype:"compositefield",
anchor:"100%",fieldLabel:b.place_label,items:f,invalidClass:b.invalid_composite_field_class},d.push(f),b.addr_visible&&d.push(this.addr));2==b.view_mode&&(2<b.level?(this.place.flex=1,f={xtype:"compositefield",anchor:"100%",fieldLabel:b.place_label,items:[this.place,this.zipcode],invalidClass:b.invalid_composite_field_class},d.push(f)):(this.place.anchor="100%",d.push(this.place)),1<b.level&&(this.street.flex=1,f=[this.street],2<b.level&&(this.house.fieldLabel=b.house_label,f.push({xtype:"label",
style:{padding:"3px"},text:b.house_label+":"},this.house),b.use_corps&&(this.corps.fieldLabel=b.corps_label,f.push({xtype:"label",style:{padding:"3px"},text:b.corps_label+":"},this.corps)),3<b.level&&(this.flat.fieldLabel=b.flat_label,f.push({xtype:"label",style:{padding:"3px"},text:b.flat_label+":"},this.flat))),f={xtype:"compositefield",anchor:"100%",fieldLabel:b.street_label,items:f,invalidClass:b.invalid_composite_field_class},d.push(f)),b.addr_visible&&d.push(this.addr));3==b.view_mode&&(2<b.level?
(this.place.flex=1,f={xtype:"compositefield",anchor:"100%",fieldLabel:b.place_label,items:[this.place,this.zipcode],invalidClass:b.invalid_composite_field_class},d.push(f)):(this.place.anchor="100%",d.push(this.place)),1<b.level&&(this.street.anchor="100%",d.push(this.street),2<b.level&&(f=[{xtype:"container",layout:"form",items:this.house,style:{overflow:"hidden"}}],b.use_corps&&f.push({xtype:"container",layout:"form",items:this.corps,style:{overflow:"hidden"}}),3<b.level&&f.push({xtype:"container",
layout:"form",style:{padding:"0px 0px 0px 5px",overflow:"hidden"},items:this.flat}),f=new Ext.Container({anchor:"100%",layout:"column",items:f,style:{overflow:"hidden"}}),d.push(f))),b.addr_visible&&d.push(this.addr));d=Ext.applyIf({items:d,get_addr_url:b.get_addr_url,level:b.level,use_corps:b.use_corps,addr_visible:b.addr_visible,style:{overflow:"hidden"}},a);Ext.Container.superclass.constructor.call(this,d)},beforeStreetQuery:function(a){this.street.getStore().baseParams.place_code=this.place.value},
clearStreet:function(){void 0!=this.street&&this.street.setValue("")},afterRenderAddr:function(){if(this.addr_visible)this.addr.getEl().on("dblclick",this.onDblClickAddr,this)},initComponent:function(){Ext.m3.AddrField.superclass.initComponent.call(this);this.mon(this.place,"change",this.onChangePlace,this);1<this.level&&(this.mon(this.street,"change",this.onChangeStreet,this),2<this.level&&(this.mon(this.house,"change",this.onChangeHouse,this),this.use_corps&&this.mon(this.corps,"change",this.onChangeCorps,
this),this.mon(this.zipcode,"change",this.onChangeZipcode,this),3<this.level&&this.mon(this.flat,"change",this.onChangeFlat,this)));this.mon(this.place,"beforequery",this.beforePlaceQuery,this);1<this.level&&this.mon(this.street,"beforequery",this.beforeStreetQuery,this);if(this.addr_visible)this.addr.on("afterrender",this.afterRenderAddr,this);this.addEvents("change","change_place","change_street","change_house","change_corps","change_flat","change_zipcode","before_query_place")},getNewAddr:function(){var a;
void 0!=this.place&&(a=this.place.getValue());var b;void 0!=this.street&&(b=this.street.getValue());var d;void 0!=this.house&&(d=this.house.getValue());var e;void 0!=this.corps&&(e=this.corps.getValue());var f;void 0!=this.flat&&(f=this.flat.getValue());var g;void 0!=this.zipcode&&(g=this.zipcode.getValue());var h=null;a=this.place.getStore().data.get(a);void 0!=a&&(h=a.data);a=null;if(void 0!=this.street)var k=this.street.getStore().data.get(b);void 0!=k&&(a=k.data);b=this.generateTextAddr(h,a,d,
e,f,g);void 0!=this.addr&&this.addr.setValue(b);return b},generateTextAddr:function(a,b,d,e,f,g){var h="",h=void 0!=b?a.addr_name+", "+b.socr+" "+b.name:a.addr_name;""!=g&&(h=g+", "+h);""!=d&&void 0!=d&&(h=h+", \u0434. "+d);""!=e&&void 0!=e&&(h=h+", \u043a\u043e\u0440\u043f. "+e);""!=f&&void 0!=f&&(h=h+", \u043a\u0432. "+f);return h},setNewAddr:function(a){void 0!=this.addr&&(this.addr.value=a)},onChangePlace:function(){var a=this.place.getValue(),b=this.place.getStore().data.get(a);void 0!=b?(b=
b.data,b.zipcode&&this.zipcode.setValue(b.zipcode)):this.place.setValue("");this.clearStreet();this.fireEvent("change_place",this,a,b);this.addr_visible&&this.getNewAddr()},onChangeStreet:function(){var a=this.street.getValue(),b=this.street.getStore().data.get(a);void 0!=b?(b=b.data,b.zipcode&&this.zipcode.setValue(b.zipcode)):this.clearStreet();this.fireEvent("change_street",this,a,b);this.addr_visible&&this.getNewAddr()},onChangeHouse:function(){this.fireEvent("change_house",this,this.house.getValue());
this.addr_visible&&this.getNewAddr()},onChangeCorps:function(){this.fireEvent("change_corps",this,this.corps.getValue());this.addr_visible&&this.getNewAddr()},onChangeFlat:function(){this.fireEvent("change_flat",this,this.flat.getValue());this.addr_visible&&this.getNewAddr()},onChangeZipcode:function(){this.fireEvent("change_zipcode",this,this.zipcode.getValue());this.addr_visible&&this.getNewAddr()},beforePlaceQuery:function(a){this.fireEvent("before_query_place",this,a)},onDblClickAddr:function(a){this.addr_visible&&
this.addr.setReadOnly(!1)}});"use strict";
Ext.define("Ext.m3.AdvancedComboBox",{extend:"Ext.m3.ComboBox",xtype:"m3-select",bubbleEvents:["mask","unmask","getcontext"],askBeforeDeleting:!0,actionSelectUrl:null,actionEditUrl:null,autocompleteUrl:null,hideBaseTrigger:!1,defaultValue:null,defaultText:null,defaultRecord:null,hideTriggerClear:!1,hideTriggerDropDown:!1,hideTriggerDictSelect:!1,hideTriggerDictEdit:!0,defaultLimit:"50",triggerClearClass:"x-form-clear-trigger",triggerSelectClass:"x-form-select-trigger",triggerEditClass:"x-form-edit-trigger",
initComponent:function(){!this.store.url&&this.autocompleteUrl&&(this.store.url=this.autocompleteUrl);this.allTriggers=[{iconCls:"x-form-clear-trigger",handler:null,hide:null},{iconCls:"",handler:null,hide:null},{iconCls:"x-form-select-trigger",handler:null,hide:null},{iconCls:"x-form-edit-trigger",handler:null,hide:!0}];Ext.m3.AdvancedComboBox.superclass.initComponent.call(this);this.hideTrigger&&(delete this.hideTrigger,this.hideBaseTrigger=!0);this.triggerConfig={tag:"span",cls:"x-form-twin-triggers",
cn:[]};Ext.each(this.allTriggers,function(a,d,e){this.triggerConfig.cn.push({tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger "+a.iconCls})},this);this.actionSelectUrl||(this.hideTriggerDictSelect=!0);this.actionEditUrl||(this.hideTriggerDictEdit=!0);this.hideBaseTrigger&&(this.hideTriggerDropDown=!0);if(this.defaultRecord&&0!==Object.getOwnPropertyNames(this.defaultRecord).length){var a=new Ext.data.Record(this.defaultRecord);this.setRecord(a)}else this.defaultValue&&this.defaultText&&this.addRecordToStore(this.defaultValue,
this.defaultText);this.validator=this.validateField;this.initBaseTrigger();this.addEvents("beforerequest","afterselect","changed");this.getStore().baseParams=Ext.applyIf({start:0,limit:this.defaultLimit},this.getStore().baseParams);this.triggerAction="all"},getTrigger:function(a){return this.triggers[a]},initTrigger:function(){var a=this.trigger.select(".x-form-trigger",!0),b=this;a.each(function(a,e,f){var g="Trigger"+(f+1);a.hide=function(){var a=b.wrap.getWidth();this.dom.style.display="none";
b.el.setWidth(a-b.trigger.getWidth());this["hidden"+g]=!0};a.show=function(){var a=b.wrap.getWidth();this.dom.style.display="";b.el.setWidth(a-b.trigger.getWidth());this["hidden"+g]=!1};this.allTriggers[f].hide&&(a.dom.style.display="none",this["hidden"+g]=!0)},this);this.disableTriggers(this.disabled);this.triggers=a.elements},getWidth:function(){return this.el.getWidth()+this.getTriggerWidth()},disableTriggers:function(a){this.trigger?this.trigger.select(".x-form-trigger",!0).each(function(b,d,
e){d=this.allTriggers[e].handler;e=Ext.elCache[b.id].events;a?b.un("click",d,this,{preventDefault:!0}):e.click&&0!==e.click.length||(b.on("click",d,this,{preventDefault:!0}),b.addClassOnOver("x-form-trigger-over"),b.addClassOnClick("x-form-trigger-click"))},this):(this.allTriggers[0].hide=a,this.allTriggers[1].hide=a,this.allTriggers[2].hide=a,this.allTriggers[3].hide=a)},initBaseTrigger:function(){this.allTriggers[0].handler=this.onTriggerClearClick;this.allTriggers[1].handler=this.onTriggerDropDownClick;
this.allTriggers[2].handler=this.onTriggerDictSelectClick;this.allTriggers[3].handler=this.onTriggerDictEditClick;this.allTriggers[0].hide=this.hideTriggerClear||this.readOnly||this.disabled;this.allTriggers[1].hide=this.hideTriggerDropDown||this.readOnly||this.disabled;this.allTriggers[2].hide=this.hideTriggerDictSelect||this.readOnly||this.disabled;this.allTriggers[3].hide=this.hideTriggerDictEdit||this.readOnly||this.disabled;this.getValue()||(this.allTriggers[0].hide=!0,this.allTriggers[3].hide=
!0)},getTriggerWidth:function(){var a=0;Ext.each(this.triggers,function(b,d){var e="Trigger"+(d+1),f=b.getWidth();a=0!==f||this["hidden"+e]?a+f:a+this.defaultTriggerWidth},this);return a},onDestroy:function(){Ext.destroy(this.triggers);Ext.destroy(this.allTriggers);Ext.m3.AdvancedComboBox.superclass.onDestroy.call(this)},onTriggerDropDownClick:function(){this.fireEvent("beforerequest",this)&&(this.isExpanded()?this.collapse():(this.onFocus({}),this.doQuery(null,!0)),this.el.focus())},getParams:function(a){a=
Ext.m3.AdvancedComboBox.superclass.getParams.call(this,a);return Ext.applyIf(a,this.getContext())},onTriggerDictSelectClick:function(){this.onSelectInDictionary()},onTriggerClearClick:function(){this.askBeforeDeleting?Ext.Msg.show({title:"\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435",msg:"\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435?",
icon:Ext.Msg.QUESTION,buttons:Ext.Msg.YESNO,fn:function(a,b,d){"yes"===a&&this.clearValue()},scope:this}):this.clearValue()},onTriggerDictEditClick:function(){this.onEditBtn()},onSelect:function(a,b){this.fireEvent("afterselect",this,a.data[this.valueField],a.data[this.displayField])&&(Ext.m3.AdvancedComboBox.superclass.onSelect.call(this,a,b),this.showClearBtn(),this.showEditBtn(),this.fireEvent("change",this,a.data[this.valueField||this.displayField]),this.fireEvent("changed",this))},showClearBtn:function(){this.hideTriggerClear||
!this.rendered||this.readOnly||this.disabled?this.hiddenTrigger1=this.hideTriggerClear||this.readOnly||this.disabled:this.getTrigger(0).show()},hideClearBtn:function(){this.rendered?this.getTrigger(0).hide():this.hiddenTrigger1=!0},showEditBtn:function(){this.actionEditUrl&&this.rendered&&!this.hideTriggerDictEdit&&this.getValue()?this.getTrigger(3).show():this.hiddenTrigger4=this.actionEditUrl||this.hideTriggerDictEdit||this.readOnly||this.disabled},hideEditBtn:function(){this.actionEditUrl&&this.rendered?
this.getTrigger(3).hide():this.hiddenTrigger4=!0},clearValue:function(){var a=this.getValue();Ext.m3.AdvancedComboBox.superclass.clearValue.call(this);this.hideClearBtn();this.hideEditBtn();this.fireEvent("change",this,"",a);this.fireEvent("changed",this)},setValue:function(a){Ext.isObject(a)&&(this.getStore().add(new Ext.data.Record(a)),a=a.id);Ext.m3.AdvancedComboBox.superclass.setValue.call(this,a);a&&(this.showClearBtn(),this.showEditBtn())},onSelectInDictionary:function(){assert(this.actionSelectUrl,
"actionSelectUrl is undefined");var a={mode:"\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442...",url:this.actionSelectUrl,params:Ext.apply({},this.getContext()),failure:uiAjaxFailMessage,success:function(a){a.on("select",function(a,b,f){this.fireEvent("afterselect",this,b,f)&&this.addRecordToStore(b,f)},this);return a}.bind(this)};this.fireEvent("beforerequest",this,a)&&UI.callAction.call(this,
a)},addRecordToStore:function(a,b){var d=new Ext.data.Record,e=this.getValue();d.id=a;d[this.displayField]=b;this.getStore().loadData({total:1,rows:[d]},!0);this.setValue(a);this.collapse();this.fireEvent("change",this,a,e);this.fireEvent("changed",this)},setRecord:function(a){if(a){var b=this.getStore(),d=b.find(this.valueField,a.data[this.valueField]);0<=d&&b.removeAt(d);b.add(a);this.onSelect(a,d)}else this.clearValue()},getRecord:function(){var a=this.getStore(),b=this.getValue(),b=a.find(this.valueField,
b);return 0<=b?a.getAt(b):null},onEditBtn:function(){assert(this.actionEditUrl,"actionEditUrl is undefined");var a=this.getValue();assert(a,"Value not selected but edit window called");Ext.Ajax.request({url:this.actionEditUrl,method:"POST",params:Ext.applyIf({id:a},this.getContext()),success:function(a,d){smart_eval(a.responseText)},failure:function(a,d){uiAjaxFailMessage()}})},triggerBlur:function(){this.focusClass&&this.el.removeClass(this.focusClass);this.wrap&&this.wrap.removeClass(this.wrapFocusClass);
!this.getRawValue()&&this.getValue()&&this.clearValue();this.validate()},validateField:function(a){return this.getRawValue()===this.getText()},showTriggers:function(a){a?(this.getValue()&&(this.showClearBtn(),this.showEditBtn()),this.hideTriggerDictSelect||this.getTrigger(2).show(),this.hideTriggerDropDown||this.getTrigger(1).show()):(this.hideClearBtn(),this.hideEditBtn(),this.getTrigger(2).hide(),this.getTrigger(1).hide())},setDisabled:function(a){this.disableTriggers(a);Ext.m3.AdvancedComboBox.superclass.setDisabled.call(this,
a);this.showTriggers(!a)},setReadOnly:function(a){var b=this.getWidth();this.disableTriggers(a);Ext.m3.AdvancedComboBox.superclass.setReadOnly.call(this,a);a?(this.el.setWidth(b),this.wrap&&this.wrap.setWidth(b)):(this.showTriggers(!a),this.onResize(b))}});
Ext.define("Ext.m3.AdvancedDataField",{extend:"Ext.form.DateField",xtype:"m3-date",baseTriggers:[{iconCls:"x-form-date-trigger",handler:null,hide:null},{iconCls:"x-form-current-date-trigger",handler:null,hide:null}],initComponent:function(){this.callParent();this.triggerConfig={tag:"span",cls:"x-form-twin-triggers",cn:[]};Ext.each(this.baseTriggers,function(a,b,d){this.triggerConfig.cn.push({tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger "+a.iconCls})},this);this.initBaseTrigger()},initTrigger:function(){var a=
this.trigger.select(".x-form-trigger",!0),b=this;a.each(function(a,e,f){var g="Trigger"+(f+1);a.hide=function(){var a=b.wrap.getWidth();this.dom.style.display="none";b.el.setWidth(a-b.trigger.getWidth());this["hidden"+g]=!0};a.show=function(){var a=b.wrap.getWidth();this.dom.style.display="";b.el.setWidth(a-b.trigger.getWidth());this["hidden"+g]=!1};this.baseTriggers[f].hide&&(a.dom.style.display="none",this["hidden"+g]=!0);this.mon(a,"click",this.baseTriggers[f].handler,this,{preventDefault:!0});
a.addClassOnOver("x-form-trigger-over");a.addClassOnClick("x-form-trigger-click")},this);this.triggers=a.elements},initBaseTrigger:function(){this.baseTriggers[0].handler=this.onTriggerClick;this.baseTriggers[1].handler=function(){if(!this.readOnly&&!this.disabled){var a=new Date;this.setValue(a);this.fireEvent("select",this,a)}};this.baseTriggers[1].hide=this.hideTriggerToday},onBlur:function(){this.beforeBlur();this.focusClass&&this.el.removeClass(this.focusClass);this.hasFocus=!1;!1===this.validationEvent||
!this.validateOnBlur&&"blur"!=this.validationEvent||this.validate();var a=this.getValue();String(a)!==String(this.startValue)&&this.fireEvent("change",this,a,this.startValue);this.fireEvent("blur",this);this.postBlur()}});Ext.define("Ext.m3.Button",{extend:"Ext.Button",xtype:"m3-button",bubbleEvents:["gethandler"],initComponent:function(){this.callParent();"string"===typeof this.handler&&this.fireEvent("gethandler",this,this.handler)},setBlocked:function(a,b){includeInArr(b,this.itemId)||this.setDisabled(a)}});
Ext.define("Ext.m3.EditWindow",{extend:"Ext.m3.Window",xtype:"m3-edit-window",form:null,dataUrl:null,changesCount:0,originalTitle:null,constructor:function(a){a.form instanceof Ext.Component||(a.items=a.items||[],a.items.unshift(a.form));Ext.m3.EditWindow.superclass.constructor.call(this,a)},initComponent:function(){this.callParent();this.form=this.items.first();this.items.each(function(a){this.setFieldOnChange(a,this)},this);this.addEvents("beforesubmit","aftersubmit","submitfailed","closing_canceled",
"beforeloaddata","dataloaded")},getInvalidNames:function(a){var b=[];a.items.each(function(a){Ext.isFunction(a.validate)&&!a.validate()&&b.push("<br>- "+a.fieldLabel)});return b},showInvalidFields:function(a){Ext.Msg.show({title:"\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0444\u043e\u0440\u043c\u044b",msg:"\u041d\u0430 \u0444\u043e\u0440\u043c\u0435 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044f:"+
a.toString()+".",buttons:Ext.Msg.OK,icon:Ext.Msg.WARNING})},submitForm:function(a,b,d){assert(this.form.url,"\u041d\u0435 \u0437\u0430\u0434\u0430\u043d url \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u044b");var e=this.form;if(e&&(a=this.getInvalidNames(e),a.length)){this.showInvalidFields(a);return}var f=Ext.applyIf(d||{},this.getContext()),g=function(a){for(var b=[],d=0;d<a.getCount();d++){var e=a.get(d);e.name&&e.localEdit?b.push(e):e instanceof Ext.Container&&void 0!=e.items&&(e=g(e.items),b=
b.concat(e))}return b};d=g(this.items);for(a=0;a<d.length;a++){b=d[a];for(var h=b.getStore(),k=[],l=0;l<h.data.items.length;l++)k.push(h.data.items[l].data);f[b.name]=Ext.encode(k)}d=e.el.dom.elements||(document.forms[e.el.dom]||Ext.getDom(e.el.dom)).elements;var m;Ext.each(d,function(a){m=a.name;!a.disabled&&m&&delete f[m]});var n={url:this.form.url,submitEmptyText:!1,params:f};this.fireEvent("beforesubmit",n)&&(new Q).then(this.fireEvent.createDelegate(this,["mask",this,"\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435..."])).then(function(){var a=
Q.defer();e.getForm().submit(Ext.applyIf({success:function(b,d){this.fireEvent("aftersubmit",this,b,d)&&a.resolve(d.response)}.bind(this),failure:function(b,d){this.fireEvent("submitfailed",this,b,d)&&a.reject(d)}.bind(this)},n));return a.promise}.bind(this)).then(UI.evalResult).then(function(a){this.fireEvent("closed_ok",a);this.close(!0)}.bind(this))["catch"](function(a){a instanceof TypeError&&uiAjaxFailMessage(a);var b;switch(a.failureType){case Ext.form.Action.CLIENT_INVALID:b=UI.showMsg({success:!1,
message:"\u041d\u0430 \u0444\u043e\u0440\u043c\u0435 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044f"});break;case Ext.form.Action.CONNECT_FAILURE:uiAjaxFailMessage(a.response);break;case Ext.form.Action.SERVER_INVALID:a.result?b=UI.showMsg(a.result):uiAjaxFailMessage(a.response)}return b})["finally"](this.fireEvent.createDelegate(this,["unmask",
this]))},onChangeFieldValue:function(a,b,d,e){a.originalValue!==b?(a.isModified||e.changesCount++,a.isModified=!0):(a.isModified&&e.changesCount--,a.isModified=!1);e.updateTitle();a.updateLabel()},clearModificationFlag:function(a){a=a||this;assert(a instanceof Ext.Container,"\u0414\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440");this.changesCount=0;this.updateTitle();a.items.each(function(a){a instanceof Ext.form.Field&&a.isEdit?(a.originalValue=
a.getValue(),a.startValue=a.getValue(),a.isModified=!1,a.updateLabel()):a instanceof Ext.Container&&this.clearModificationFlag(a)},this)},setFieldOnChange:function(a,b){if(a){if(a instanceof Ext.form.Field&&a.isEdit)if(a instanceof Ext.form.Checkbox)a.on("check",function(a,d){b.onChangeFieldValue(a,d,!d,b)});else a.on("change",function(a,d,g){b.onChangeFieldValue(a,d,g,b)});if(a.items)if(a.items instanceof Array)for(var d=0;d<a.items.length;d++)b.setFieldOnChange(a.items[d],b);else a.items.each(function(a){b.setFieldOnChange(a,
b)});if(a.titleItems)for(d=0;d<a.titleItems.length;d++)b.setFieldOnChange(a.titleItems[d],b)}},updateTitle:function(){this.title!==this.originalTitle&&null===this.originalTitle&&(this.originalTitle=this.title);0!==this.changesCount?this.setTitle("*"+this.originalTitle):this.setTitle(this.originalTitle)},close:function(a){0===this.changesCount||a?Ext.m3.EditWindow.superclass.close.call(this):!1!==this.fireEvent("beforeclose",this)&&Ext.Msg.show({title:"\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435",
msg:"\u0414\u0430\u043d\u043d\u044b\u0435 \u0431\u044b\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b! C\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f?",buttons:Ext.Msg.YESNOCANCEL,fn:function(a,d,e){"yes"===a?this.submitForm():"no"===a?this.hidden?this.doClose():this.hide(null,this.doClose,this):this.fireEvent("closing_canceled")},animEl:"elId",icon:Ext.MessageBox.QUESTION,scope:this})},disableToolbars:function(a){for(var b=[this.getTopToolbar(),
this.getFooterToolbar(),this.getBottomToolbar()],d=0;d<b.length;d++)b[d]&&b[d].setDisabled(a)},loadForm:function(){this.disableToolbars(!0);var a=new Ext.LoadMask(this.body,{msg:"\u0427\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445..."});a.show();this.fireEvent("beforeloaddata",this)&&(assert(this.dataUrl,"\u041d\u0435 \u0437\u0430\u0434\u0430\u043d dataUrl \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u044b"),this.form.doAction("load",{url:this.dataUrl,params:Ext.applyIf({isGetData:!0},
this.getContext()),success:this.onSuccessLoadForm.createDelegate(this,[a],!0),failure:this.onFailureLoadForm.createDelegate(this,[a],!0),scope:this}))},onSuccessLoadForm:function(a,b,d){var e,f,g,h=b.result.complex_data,k;for(k in h)e=a.findField(k),assert(e instanceof Ext.form.TriggerField,String.format("\u041f\u043e\u043b\u0435 {0} \u043d\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043e \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445",
k)),(f=h[k].id)?(g=new Ext.data.Record,g.set("id",f),g.set(e.displayField,h[k].value),e.getStore().add([g]),e.setValue(f),e.collapse()):e.clearValue();d.hide();this.disableToolbars(!1);this.fireEvent("dataloaded",b)},onFailureLoadForm:function(a,b,d){uiAjaxFailMessage.apply(this,arguments);d.hide();this.disableToolbars(!1)},plainValues:function(a){function b(a,g){var h,k;""!=g&&(g+=".");for(h in a)Ext.isFunction(a[h])||(k=a[h],Ext.isObject(k)?e.findField(g+h)?d[g+h]=k:b(k,g+h):d[g+h]=k)}var d={},
e=this.form.getForm();b(a,"");return d},bind:function(a){this.form.getForm().setValues(this.plainValues(a.model))}});Ext.ns("Ext.ux.grid");
Ext.ux.grid.Exporter=Ext.extend(Ext.util.Observable,{title:"",sendDatFromStore:!0,constructor:function(a){Ext.ux.grid.Exporter.superclass.constructor.call(this)},init:function(a){a instanceof Ext.grid.GridPanel&&(this.grid=a,this.grid.on("afterrender",this.onRender,this));this.dataUrl=this.grid.dataUrl},onRender:function(){this.grid.tbar||(this.grid.elements+=",tbar",tbar=new Ext.Toolbar,this.grid.tbar=tbar,this.grid.add(tbar),this.grid.doLayout());this.grid.tbar.insert(0,new Ext.Button({text:"\u042d\u043a\u0441\u043f\u043e\u0440\u0442",
iconCls:"icon-application-go",listeners:{scope:this,click:this.exportData}}))},exportData:function(){var a=[];Ext.each(this.grid.colModel.config,function(b,d){a.push({data_index:b.dataIndex,header:b.header,id:b.id,is_column:b.isCoumn,sortable:b.sortable,width:b.width})});var b=[];this.sendDatFromStore&&Ext.each(this.grid.store.data.items,function(a,d){b.push(a.data)});var d={columns:Ext.encode(a),title:this.title||this.grid.title||this.grid.id,data:Ext.encode(b)};Ext.Ajax.request({url:"/ui/exportgrid-export",
success:function(a,b){location.href=a.responseText},failure:function(){},params:d})}});
Ext.ux.tree.TreeHeaderFilters=Ext.extend(Ext.util.Observable,{fieldHeight:22,fieldPadding:1,highlightOnFilter:!0,highlightColor:"yellow",highlightCls:null,stateful:!0,applyMode:"auto",filters:null,filtersInitMode:"replace",ensureFilteredVisible:!0,cfgFilterInit:!1,containerConfig:null,labelWidth:50,fcc:null,filterFields:null,filterContainers:null,filterContainerCls:"x-ghf-filter-container",inResizeProcess:!1,constructor:function(a){a=a||{};Ext.apply(this,a)},init:function(a){this.tree=a;this.tree.on({scope:this,
render:this.onRender,resize:this.onResize,reconfigure:this.onReconfigure,beforedestroy:this.destroyFilters});this.stateful&&(this.tree.on("beforestatesave",this.saveFilters,this),this.tree.on("beforestaterestore",this.loadFilters,this));this.tree.on("hiddenchange",this.onColHidden,this);this.tree.addEvents("filterupdate");this.addEvents({render:!0});this.cfgFilterInit=Ext.isDefined(this.filters)&&null!==this.filters;this.filters||(this.filters={});this.configure(this.tree.columns);Ext.ux.tree.TreeHeaderFilters.superclass.constructor.call(this);
this.stateful&&(Ext.isArray(this.tree.stateEvents)||(this.tree.stateEvents=[]),this.tree.stateEvents.push("filterupdate"));Ext.apply(this.tree,{oldupdateColumnWidths:this.tree.updateColumnWidths,updateColumnWidths:this.updateColumnWidths.createDelegate(this),oldhandleHdDown:this.tree.handleHdDown,handleHdDown:this.handleHdDown.createDelegate(this),headerFilters:this,getHeaderFilter:function(a){return this.headerFilters?this.headerFilters.filters[a]:null},setHeaderFilter:function(a,d){if(this.headerFilters){var e=
{};e[a]=d;this.setHeaderFilters(e)}},setHeaderFilters:function(a,d,e){if(this.headerFilters){d&&this.resetHeaderFilters(!1);3>arguments.length&&(e=!0);var f=!1,g;for(g in a)this.headerFilters.filterFields[g]&&(f=this.headerFilters.filterFields[g],this.headerFilters.setFieldValue(f,a[g]),this.headerFilters.applyFilter(f,!1),f=!0);f&&e&&this.headerFilters.storeReload()}},getHeaderFilterField:function(a){if(this.headerFilters)return this.headerFilters.filterFields[a]?this.headerFilters.filterFields[a]:
null},resetHeaderFilters:function(a){if(this.headerFilters){0==arguments.length&&(a=!0);for(var d in this.headerFilters.filterFields){var e=this.headerFilters.filterFields[d];Ext.isFunction(e.clearValue)?e.clearValue():this.headerFilters.setFieldValue(e,"");this.headerFilters.applyFilter(e,!1)}a&&this.headerFilters.storeReload()}},applyHeaderFilters:function(a){0==arguments.length&&(a=!0);this.headerFilters.applyFilters(a)}})},handleHdDown:function(a,b){a.getTarget(".x-tree-filter-container")?a.target.focus():
this.tree.oldhandleHdDown(a,b)},updateColumnWidths:function(){for(var a=this.tree.columns.length,b=0;b<a;b++){var d=this.getHeaderCell(this.tree.columns[b].dataIndex);Ext.get(d);this.onColResize(b,0)}this.tree.oldupdateColumnWidths();this.onResize()},configure:function(a){for(var b=[],d=0,e=a.length;d<e;d++)if(Ext.isObject(a[d].filter)||Ext.isArray(a[d].filter))a[d].id=a[d].dataIndex,b.push(a[d]);this.fcc={};for(d=0;d<b.length;d++){a=b[d];e=a.filter;Ext.isArray(e)||(e=[e]);for(var f=0;f<e.length;f++){var g=
Ext.apply({filterName:0<f?a.dataIndex+f:a.dataIndex},e[f]);Ext.apply(g,{columnId:a.id,dataIndex:a.dataIndex,hideLabel:!0,anchor:"100%"});this.cfgFilterInit||Ext.isEmpty(g.value)||(this.filters[g.filterName]=Ext.isFunction(g.filterEncoder)?g.filterEncoder.call(this,g.value):g.value);delete g.value;if(g.applyFilterEvent)g.listeners={scope:this},g.listeners[g.applyFilterEvent]=function(a){this.applyFilter(a)},delete g.applyFilterEvent;else if("auto"===this.applyMode||"change"===this.applyMode||Ext.isEmpty(this.applyMode))if(void 0!=
g.hasListener){if(!g.hasListener("change"))g.on("change",function(a){var b=a.getXType();"combo"!=b&&"datefield"!=b&&this.applyFilter(a)},this);if(!g.hasListener("specialkey"))g.on("specialkey",function(a,b){b.stopPropagation();b.getKey()==b.ENTER&&(this.focusedFilterName=a.filterName)},this);if(!g.hasListener("select"))g.on("select",function(a){this.focusedFilterName=a.filterName;this.applyFilter(a)},this)}else g.listeners={change:function(a){var b=a.getXType();"combo"!=b&&"datefield"!=b&&(a.startValue=
a.getValue(),this.applyFilter(a))},specialkey:function(a,b){b.stopPropagation();b.getKey()==b.TAB&&(this.focusedFilterName=void 0);b.getKey()==b.ENTER&&(this.focusedFilterName=a.filterName)},select:function(a){this.focusedFilterName=a.filterName;this.applyFilter(a)},scope:this};else"enter"===this.applyMode&&(g.listeners={specialkey:function(a,b){b.stopPropagation();b.getKey()==b.ENTER&&(this.focusedFilterName=a.filterName,this.applyFilters());b.getKey()==b.TAB&&(this.focusedFilterName=void 0)},scope:this});
var h=this.fcc[g.columnId];h||(h={cls:this.filterContainerCls,border:!1,bodyBorder:!1,bodyStyle:"background-color: transparent",labelSeparator:"",labelWidth:this.labelWidth,layout:"hbox",style:{},items:[]},this.containerConfig&&Ext.apply(h,this.containerConfig),this.fcc[g.columnId]=h);h.items.push({cls:"x-tree-filter-container",bodyStyle:"background-color: transparent",border:!1,bodyBorder:!1,layout:"form",padding:2,margins:"0 0 -4 0",flex:1,items:[g]})}}},getHeaderCell:function(a){var b=this.tree.columns,
d=this.tree.outerCt.query("colgroup"),e,f;f=0;d=this.tree.innerHd.query("td");for(len=d.length;f<len;f++)if(e=Ext.fly(d[f]),b[f].dataIndex==a)return e;return null},renderFilterContainer:function(a,b){this.filterContainers||(this.filterContainers={});for(var d=0,e=this.tree.columns.length;d<e;d++);d=this.getHeaderCell(a);d=Ext.get(d);Ext.isGecko&&(d.dom.style.MozUserSelect="text");d.dom.style.verticalAlign="top";b.width=d.getWidth()-3;e=new Ext.Container(b);e.render(d);this.filterContainers[a]=e;var f=
0;this.filterFields||(this.filterFields={});var g=e.findBy(function(a){return!Ext.isEmpty(a.filterName)});if(!Ext.isEmpty(g))for(d=0;d<g.length;d++)this.filterFields[g[d].filterName]=g[d],f+=g[d].getHeight();return e},renderFilters:function(){if(this.fcc){for(var a in this.fcc)this.renderFilterContainer(a,this.fcc[a]);this.setFilters(this.filters);this.highlightFilters(this.isFiltered())}},onRender:function(){this.isFiltered()&&this.applyFilters(!1);this.renderFilters();this.fireEvent("render",this)},
getFilterField:function(a){return this.filterFields?this.filterFields[a]:null},setFilters:function(a,b){if((this.filters=a)&&this.filterFields){for(var d in this.filters)this.filterFields[d]||delete this.filters[d];for(d in this.filterFields){var e=this.filterFields[d],f=this.filters[e.filterName];Ext.isEmpty(f)?b&&this.setFieldValue(e,""):this.setFieldValue(e,f)}}},onColResize:function(a,b){if(this.filterContainers){var d=this.filterContainers[this.tree.columns[a].dataIndex];d&&(isNaN(b)&&(b=0),
d.setWidth(3>b?0:b-3),d.doLayout(!1,!0))}},onResize:function(){this.inResizeProcess=!0;for(var a=this.tree.columns.length,b=0;b<a;b++){var d=this.getHeaderCell(this.tree.columns[b].dataIndex),d=Ext.get(d);this.onColResize(b,d.getWidth())}this.inResizeProcess=!1},onColHidden:function(a,b,d){d||(a=this.getHeaderCell(this.tree.columns[b].dataIndex).getWidth(),this.onColResize(b,a),this.tree.updateColumnWidths())},onReconfigure:function(a,b,d){this.destroyFilters();this.configure(d);this.renderFilters()},
saveFilters:function(a,b){var d={},e;for(e in this.filters)d[e]=this.filters[e];b.gridHeaderFilters=d;return!0},loadFilters:function(a,b){var d=b.gridHeaderFilters;d&&(this.cfgFilterInit?"merge"===this.filtersInitMode&&Ext.apply(d,this.filters):this.filters=d)},isFiltered:function(){for(var a in this.filters)if(!Ext.isEmpty(this.filters[a]))return!0;return!1},highlightFilters:function(a){if(this.highlightOnFilter&&this.filterContainers&&this.tree.mainHd){var b=a?this.highlightColor:"transparent",
d;for(d in this.filterContainers){var e=this.filterContainers[d];e.rendered&&(Ext.isEmpty(this.highlightCls)?e.getEl().setStyle("backgroundColor",b):a?e.getEl().addClass(this.highlightCls):e.getEl().removeClass(this.highlightCls))}}},getFieldValue:function(a){return Ext.isFunction(a.filterEncoder)?a.filterEncoder.call(a,a.getValue()):a.getValue()},setFieldValue:function(a,b){Ext.isFunction(a.filterDecoder)&&(b=a.filterDecoder.call(a,b));a.setValue(b)},applyFilter:function(a,b){2>arguments.length&&
(b=!0);if(a&&a.isValid()){var d=this.getFieldValue(a);a.disabled||Ext.isEmpty(d)?delete this.filters[a.filterName]:this.filters[a.filterName]=d;this.highlightFilters(this.isFiltered());this.tree.fireEvent("filterupdate",a.filterName,d,a);b&&this.storeReload()}},applyFilters:function(a){1>arguments.length&&(a=!0);for(var b in this.filterFields)this.applyFilter(this.filterFields[b],!1);a&&this.storeReload()},storeReload:function(){for(var a in this.filterFields)this.getContext()&&delete this.getContext()[a];
this.tree.actionContextJson=Ext.applyIf(this.tree.actionContextJson||{},this.filters);this.tree.refreshStore();this.focusedFilterName&&this.getFilterField(this.focusedFilterName).focus()},getFilterContainer:function(a){return this.filterContainers?this.filterContainers[a]:null},destroyFilters:function(){if(this.filterFields)for(var a in this.filterFields)Ext.destroy(this.filterFields[a]),delete this.filterFields[a];if(this.filterContainers)for(a in this.filterContainers)Ext.destroy(this.filterContainers[a]),
delete this.filterContainers[a]}});Ext.preg("treeheaderfilters",Ext.ux.tree.TreeHeaderFilters);Ext.ns("Ext.ux.grid");
Ext.ux.grid.MultiSorting=Ext.extend(Ext.util.Observable,{constructor:function(a){a&&Ext.apply(this,a);Ext.ux.grid.MultiSorting.superclass.constructor.call(this)},init:function(a){a instanceof Ext.grid.GridPanel&&(this.grid=a,this.grid.on("headerclick",this.onHeaderClick,this),this.grid.on("afterrender",this.onAfterRender,this),this.grid.getStore().multiSort=Ext.createDelegate(this.realMultiSort,this.grid.getStore(),this,!0),this.grid.getStore().on("beforeload",this.beforeLoad,this))},onAfterRender:function(a){this.grid.un("headerclick",
this.grid.getView().onHeaderClick,this.grid.getView());this.grid.getView().updateHeaderSortState=Ext.createDelegate(this.realUpdateHeaderSortState,this.grid.getView());this.grid.getView().updateSortIcon=Ext.createDelegate(this.realUpdateSortIcon,this.grid.getView());this.grid.getView().on("beforebuffer",this.beforeBuffer,this)},onHeaderClick:function(a,b,d){var e=a.getColumnModel();if(!a.getView().headersDisabled&&e.isSortable(b))if(a.stopEditing(!0),a=a.getStore(),d.ctrlKey)if(d=e.getDataIndex(b),
a.hasMultiSort){b=a.multiSortInfo;for(var e=!1,f=0,g=b.sorters.length;f<g;f++)if(b.sorters[f].field==d){b.sorters[f].direction=b.sorters[f].direction.toggle("ASC","DESC");e=!0;break}e||b.sorters.push({direction:"ASC",field:d});a.multiSort(b.sorters)}else a.sortInfo&&a.sortInfo.field!=d?a.multiSort([{direction:a.sortInfo.direction,field:a.sortInfo.field},{direction:"ASC",field:d}]):a.sort(e.getDataIndex(b));else a.sort(e.getDataIndex(b))},beforeLoad:function(a,b){b.params.multisort=a.hasMultiSort?
Ext.util.JSON.encode(a.multiSortInfo.sorters):void 0},beforeBuffer:function(a,b,d,e,f,g){g.params.multisort=b.hasMultiSort?Ext.util.JSON.encode(b.multiSortInfo.sorters):void 0},realMultiSort:function(a,b){this.hasMultiSort=!0;this.multiSortInfo={sorters:a,direction:"ASC"};this.remoteSort?this.load(this.lastOptions):(this.applySort(),this.fireEvent("datachanged",this))},realUpdateHeaderSortState:function(){var a=this.ds.hasMultiSort?this.ds.multiSortInfo:this.ds.sortInfo;if(a){if(!this.hasMultiSort&&
this.ds.hasMultiSort||this.hasMultiSort&&!this.ds.hasMultiSort)this.grid.fireEvent("sortchange",this.grid,a);else if(this.ds.hasMultiSort){for(var b=!1,d=0,e=0,f=a.sorters.length;e<f;e++){for(var g=0,h=this.sortState.sorters.length;g<h;g++)if(this.sortState.sorters[g].field==a.sorters[e].field){d+=1;this.sortState.sorters[g].direction!=a.sorters[e].direction&&(b=!0);break}if(b)break}(b||this.sortState.length!=d)&&this.grid.fireEvent("sortchange",this.grid,a)}else this.sortState&&this.sortState.field==
a.field&&this.sortState.direction==a.direction||this.grid.fireEvent("sortchange",this.grid,a);this.sortState=a;if(this.hasMultiSort=this.ds.hasMultiSort)for(this.mainHd.select(this.cellSelector||"td").removeClass(this.sortClasses),e=0,f=this.sortState.sorters.length;e<f;e++)b=this.cm.findColumnIndex(this.sortState.sorters[e].field),-1!=b&&(a=this.sortState.sorters[e].direction,this.updateSortIcon(b,a));else b=this.cm.findColumnIndex(a.field),-1!=b&&(a=a.direction,this.mainHd.select(this.cellSelector||
"td").removeClass(this.sortClasses),this.updateSortIcon(b,a))}},realUpdateSortIcon:function(a,b){var d=this.sortClasses["DESC"==b?1:0];this.mainHd.select(this.cellSelector||"td").item(a).addClass(d)}});Ext.define("Ext.m3.GroupingJsonStore",{extend:"Ext.data.GroupingStore",xtype:"m3-grouping-json-store",constructor:function(a){Ext.m3.GroupingJsonStore.superclass.constructor.call(this,Ext.apply(a,{reader:new Ext.data.JsonReader(a)}))}});
Ext.define("Ext.m3.HelpWindow",{extend:"Ext.Window",constructor:function(a){this.title="\u0421\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f";this.minimizable=this.maximizable=this.maximized=!0;this.width=800;this.height=550;Ext.m3.HelpWindow.superclass.constructor.call(this,a)}});function showHelpWindow(a){window.open(a)}
Ext.define("Ext.ux.grid.LockingGridColumnWithHeaderGroup",{extend:"Ext.util.Observable",constructor:function(a){this.config=a},init:function(a){!a instanceof Ext.grid.GridPanel||!a.getStore()instanceof Ext.data.GroupingStore||(Ext.applyIf(a.colModel,this.columnModelConfig),Ext.apply(a.colModel,this.config.columnModelCfg),Ext.apply(a.colModel,this.columnModelFunctions),Ext.applyIf(a.getView(),this.viewConfig),Ext.apply(a.getView(),this.config.viewCfg),Ext.apply(a.getView(),this.viewFunctions),a.colModel.prepareHdRows.call(a.colModel))},
columnModelFunctions:{isLocked:function(a){return!0===this.config[a].locked},isLockedHdGroup:function(a,b){return!0===this.rows[a][b].locked},setLocked:function(a,b,d){this.isLocked(a)!=b&&(this.config[a].locked=b,d||this.fireEvent("columnlockchange",this,a,b))},setLockedHdGroup:function(a,b,d){this.isLockedHdGroup(a,b)!=d&&(this.rows[a][b].locked=d)},getTotalLockedWidth:function(){for(var a=0,b=0,d=this.config.length;b<d;b++)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},getLockedHdGroupCount:function(a){for(var b=this.rows[a].length,d=0;d<b;d++)if(!this.isLockedHdGroup(a,d))return d;return b},moveColumn:function(a,b){var d=this.isLocked(a),e=this.isLocked(b);a<b&&d&&!e?this.setLocked(a,!1,!0):a>b&&!d&&e&&this.setLocked(a,!0,!0);Ext.grid.ColumnModel.prototype.moveColumn.apply(this,arguments)},processLockingHdGroups:function(a){var b=this.rows,d=[],e,f=this.getLockedHdGroupCount(0);
if(0<f)this.getHdGroupsPositionsToMovie(a,0,0,f-1,d,!1);else for(f=0;f<b.length;f++)d[f]=0;for(f=0;f<b.length;f++){var g=this.findHdGroupIndex(a,f);this.getLockedHdGroupCount(f);var h=b[f][g];f==b.length-1&&(e=this.getBeforeHdGroupColCount(f,d[f]));this.setLockedHdGroup(f,g,!0);if(1==h.colspan)this.moveHdGroup(f,g,d[f]);else{var k={};Ext.apply(k,h);k.colspan=h.colspan-1;k.locked=!1;h.colspan=1;this.moveHdGroup(f,g,d[f],k)}}this.joinHdGroups();return e},processUnLockingHdGroups:function(a){var b=this.rows,
d=[],e,f=this.getLockedHdGroupCount(0);if(f<b[0].length-1)this.getHdGroupsPositionsToMovie(a,0,f,b[0].length-1,d,!0);else for(f=0;f<b.length;f++)d[f]=this.getLockedHdGroupCount(f);for(f=0;f<b.length;f++){var g=this.findHdGroupIndex(a,f);this.getLockedHdGroupCount(f);var h=b[f][g];this.setLockedHdGroup(f,g,!1);if(1==h.colspan)f==b.length-1&&(e=this.getBeforeHdGroupColCount(f,d[f]-1)),this.moveHdGroup(f,g,d[f]-1);else{f==b.length-1&&(e=this.getBeforeHdGroupColCount(f,d[f]));var k={};Ext.apply(k,h);
k.colspan=h.colspan-1;k.locked=!0;h.colspan=1;this.moveHdGroup(f,g,d[f],k)}}this.joinHdGroups();return e},findHdGroupIndex:function(a,b){for(var d=this.rows[b],e=0,f=0;e<d.length&&f-1<a;)f+=d[e].colspan,e++;return e-1},getHdGroupsPositionsToMovie:function(a,b,d,e,f,g){for(var h=this.findHdGroupIndex(a,b),k=this.rows[b][h],h=d;h<=e;h++)if(this.rows[b][h].id==k.id)return d=g?h:h+1,f[f.length]=d,b+1<this.rows.length&&(k=this.getBeforeHdGroupColCount(b,h),d=this.findHdGroupIndex(k,b+1),e=this.findHdGroupIndex(k+
this.rows[b][h].colspan-1,b+1),this.getHdGroupsPositionsToMovie(a,b+1,d,e,f,g)),f;f[f.length]=g?d:e+1;b+1<this.rows.length&&(k=this.getBeforeHdGroupColCount(b,d),h=this.getBeforeHdGroupColCount(b,e),d=this.findHdGroupIndex(k,b+1),e=this.findHdGroupIndex(h+this.rows[b][e].colspan-1,b+1),this.getHdGroupsPositionsToMovie(a,b+1,d,e,f,g));return f},getBeforeHdGroupColCount:function(a,b){for(var d=0,e=0;e<b;e++)d+=this.rows[a][e].colspan;return d},moveHdGroup:function(a,b,d,e){var f=this.rows[a],g=f[b];
if(b>d){var h=f.slice(0,d),k=f.slice(d,b);b=f.slice(b+1,f.length);this.rows[a]=e?h.concat([g]).concat(k).concat([e]).concat(b):h.concat([g]).concat(k).concat(b)}else b<d?e?(h=f.slice(0,b),k=f.slice(b+1,d),b=f.slice(d,f.length),this.rows[a]=h.concat([e]).concat(k).concat([g]).concat(b)):(h=f.slice(0,b),k=f.slice(b+1,d+1),b=f.slice(d+1,f.length),this.rows[a]=h.concat(k).concat([g]).concat(b)):e&&(h=f.slice(0,b),k=f.slice(b+1,f.length),this.rows[a]=e.locked?h.concat([e]).concat([g]).concat(k):h.concat([g]).concat([e]).concat(k))},
prepareHdRows:function(){var a=this.rows,b=this.lockedCount;if(b)for(g=0;g<b;g++)this.setLocked(g,!0,!0);for(var d=0;d<a.length;d++){var e=a[d],f=0,g=0;for(this.setHdGroupsId(d);g<e.length&&f<b;){var h=e[g];h.colspan=h.colspan||1;var f=f+h.colspan,k=f-b;if(0<k){var l=e.slice(0,g+1),m=e.slice(g+1,e.length),n={};Ext.apply(n,h);n.colspan=k;h.colspan-=k;this.setLockedHdGroup(d,g,!0);a[d]=l.concat([n]).concat(m)}else this.setLockedHdGroup(d,g,!0);g++}}},setHdGroupsId:function(a){a=this.rows[a];for(var b=
0;b<a.length;b++)a[b].id=b},joinHdGroups:function(){for(var a=this.rows,b=a.length-1;0<=b;b--)for(var d=a[b],e=0;e<d.length-1;e++){var f=d[e],g=d[e+1];f.header==g.header&&this.isLockedHdGroup(b,e)==this.isLockedHdGroup(b,e+1)&&f.id==g.id&&(f.colspan+=g.colspan,d.splice(e+1,1))}}},columnModelConfig:{lockedCount:0,rows:[],hierarchicalColMenu:!0},viewConfig:{lockText:"Lock",unlockText:"Unlock",rowBorderWidth:1,lockedBorderWidth:1,syncHeights:!1,groupByText:"Group By This Field",showGroupsText:"Show in Groups",
hideGroupedColumn:!1,showGroupName:!0,startCollapsed:!1,enableGrouping:!0,enableGroupingMenu:!0,enableNoGroups:!0,emptyGroupText:"(None)",ignoreAdd:!1,groupTextTpl:"{text}",groupMode:"value",cancelEditOnToggle:!0,totalSummaryEnabled:!0},viewFunctions:{initTemplates:function(){Ext.grid.GridView.prototype.initTemplates.apply(this,arguments);var a=this.templates||{};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 class="x-grid3-total-summary"><div class="x-grid3-total-summary-inner"><div class="x-grid3-total-summary-offset" style="{lstyle}">{lockedTotalSummary}</div></div><div class="x-clear"></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 class="x-grid3-total-summary"><div class="x-grid3-total-summary-inner"><div class="x-grid3-total-summary-offset" style="{ostyle}">{totalSummary}</div></div><div class="x-clear"></div></div>',"</div>",'<div class="x-grid3-resize-marker">&#160;</div>','<div class="x-grid3-resize-proxy">&#160;</div>',"</div>"));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 href="#"></a>':"","{value}</div></td>"));a.startGroup||(a.startGroup=new Ext.XTemplate('<div id="{groupId}" class="x-grid-group {cls}">','<div id="{groupId}-hd" class="x-grid-group-hd" style="{style}"><div class="x-grid-group-title">',this.groupTextTpl,"</div></div>",'<div id="{groupId}-bd" class="x-grid-group-body">'));a.startLockedGroup||(a.startLockedGroup=new Ext.XTemplate('<div id="{groupId}-l" class="x-grid-group {cls}">',
'<div id="{groupId}-lhd" class="x-grid-group-hd" style="{style}"><div class="x-grid-group-title">',this.groupTextTpl,"</div></div>",'<div id="{groupId}-lbd" class="x-grid-group-body">'));a.endGroup||(a.endGroup="</div></div>");a.summaryRow||(a.summaryRow=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>"),a.summaryRow.disableFormats=
!0);a.totalSummary||(a.totalSummary=new Ext.Template('<table border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',"<thead>",'<tr class="x-grid3-total-summary-row x-grid3-hd-row">{cells}</tr>',"</thead>","</table>"));a.totalSummaryCell||(a.totalSummaryCell=new Ext.XTemplate('<td class="x-grid3-hd x-grid3-total-td-{id} {css}" style="{style}">','<div {tooltip} class="x-grid3-cell-inner x-grid3-total-summary-cell-{id}" unselectable="on" style="{istyle}">',"{value}</div></td>"));this.templates=
a;this.hrowRe=/ux-grid-hd-group-row-(\d+)/;this.state={};a=this.grid.getSelectionModel();a.on(a.selectRow?"beforerowselect":"beforecellselect",this.onBeforeRowSelect,this)},initElements:function(){var a=Ext.get(this.grid.getGridEl().dom.firstChild),b=a.child("div.x-grid3-locked"),d=b.child("div.x-grid3-header"),e=b.child("div.x-grid3-scroller"),f=b.child("div.x-grid3-total-summary"),g=a.child("div.x-grid3-viewport"),h=g.child("div.x-grid3-header"),k=g.child("div.x-grid3-scroller"),l=g.child("div.x-grid3-total-summary");
this.grid.hideHeaders&&(d.setDisplayed(!1),h.setDisplayed(!1));!0!==this.totalSummaryEnabled&&(f.setDisplayed(!1),l.setDisplayed(!1));this.forceFit&&k.setStyle("overflow-x","hidden");Ext.apply(this,{el:a,mainWrap:g,mainHd:h,innerHd:h.dom.firstChild,scroller:k,totalSummary:l,totalSummaryInner:l.dom.firstChild,mainBody:k.child("div.x-grid3-body"),focusEl:k.child("a"),resizeMarker:a.child("div.x-grid3-resize-marker"),resizeProxy:a.child("div.x-grid3-resize-proxy"),lockedWrap:b,lockedHd:d,lockedScroller:e,
lockedBody:e.child("div.x-grid3-body"),lockedInnerHd:d.child("div.x-grid3-header-inner",!0),lockedTotalSummary:f,lockedTotalSummaryInner:f.dom.firstChild});this.focusEl.swallowEvent("click",!0)},renderHeaders:function(){for(var a=this.cm,b=a.rows,d=this.templates,e=d.hcell,f=[],g=[],h=a.getColumnCount(),k=b.length,l="width:"+this.getTotalWidth()+";",m="width:"+this.getLockedWidth()+";",n=0;n<k;n++){for(var p=b[n],q=[],t=[],u=0,v=0;u<p.length;u++){var s=p[u],w=s.dataIndex?a.findColumnIndex(s.dataIndex):
v;s.colspan=s.colspan||1;if(void 0!==a.getColumnAt(w)){var w=this.getColumnId(w),x=this.getGroupStyle(s,v),v=v+s.colspan,s=d.gcell.apply({cls:"ux-grid-hd-group-cell",id:w,row:n,style:"width:"+x.width+";"+(x.hidden?"display:none;":"")+(s.align?"text-align:"+s.align+";":""),tooltip:s.tooltip?(Ext.QuickTips.isEnabled()?"ext:qtip":"title")+'="'+s.tooltip+'"':"",istyle:"right"==s.align?"padding-right:16px":"",btn:this.grid.enableHdMenu&&s.header,value:s.header||"&nbsp;"});a.isLockedHdGroup(n,u)?t[t.length]=
s:q[q.length]=s}}f[n]=d.header.apply({tstyle:l,cells:q.join("")});g[n]=d.header.apply({tstyle:m,cells:t.join("")})}b=[];n=[];for(u=0;u<h;u++)void 0!==a.getColumnAt(u)&&(p={},p.id=a.getColumnId(u),p.value=a.getColumnHeader(u)||"",p.style=this.getColumnStyle(u,!0),p.tooltip=this.getColumnTooltip(u),p.css=(0===u?"x-grid3-cell-first ":u==h-1?"x-grid3-cell-last ":"")+(a.config[u].headerCls?" "+a.config[u].headerCls:""),"right"==a.config[u].align?p.istyle="padding-right:16px":delete p.istyle,a.isLocked(u)?
n[n.length]=e.apply(p):b[b.length]=e.apply(p));f[k]=d.header.apply({tstyle:l,cells:b.join("")});g[k]=d.header.apply({tstyle:m,cells:n.join("")});return[f.join(""),g.join("")]},renderTotalSummary:function(){for(var a=this.cm,b=this.templates,d=b.totalSummaryCell,b=b.totalSummary,e=[],f=[],g=a.getColumnCount(),h="width:"+this.getTotalWidth()+";",k="width:"+this.getLockedWidth()+";",l=this.getColumnData(),l=this.calculate(this.grid.store.allData?this.grid.store.allData.items:this.grid.store.data.items,
l),m=0;m<g;m++){var n=a.getColumnAt(m);if(void 0!==n){var p={};p.id=n.id;p.style=this.getColumnStyle(m);p.tooltip="";p.css=(0===m?"x-grid3-total-summary-cell-first ":m==g-1?"x-grid3-total-summary-cell-last ":"")+(n.headerCls?" "+n.headerCls:"");"right"==n.align&&(p.istyle="padding-right:16px");p.value=n.summaryRenderer?n.summaryRenderer(l[n.dataIndex],p,l,void 0,m,this.ds):l[n.dataIndex];if(void 0==p.value||""===p.value)p.value="&#160;";a.isLocked(m)?f[f.length]=d.apply(p):e[e.length]=d.apply(p)}}a=
b.apply({tstyle:h,cells:e.join("")});d=b.apply({tstyle:k,cells:f.join("")});return[a,d]},onColumnWidthUpdated:function(){Ext.grid.GridView.prototype.onColumnWidthUpdated.apply(this,arguments);this.updateHdGroupStyles();this.updateGroupWidths()},onAllColumnWidthsUpdated:function(){Ext.grid.GridView.prototype.onAllColumnWidthsUpdated.apply(this,arguments);this.updateHdGroupStyles();this.updateGroupWidths()},onColumnHiddenUpdated:function(){Ext.grid.GridView.prototype.onColumnHiddenUpdated.apply(this,
arguments);this.updateHdGroupStyles();this.updateGroupWidths()},getHeaderCell:function(a){var b=this.cm.getLockedCount();if(a<b)for(var b=this.lockedHd.dom.getElementsByTagName("td"),d=0,e=0;d<b.length;d++){if(0>b[d].className.indexOf("ux-grid-hd-group-cell")){if(e==a)return b[d];e++}}else for(var d=this.mainHd.dom.getElementsByTagName("td"),f=e=0;e<d.length;e++)if(0>d[e].className.indexOf("ux-grid-hd-group-cell")){if(f+b==a)return d[e];f++}},findHeaderCell:function(a){return a?this.fly(a).findParent("td.x-grid3-hd",
this.cellSelectorDepth):!1},findHeaderIndex:function(a){return(a=this.findHeaderCell(a))?this.getCellIndex(a):!1},updateSortIcon:function(a,b){var d=this.sortClasses,e=this.lockedHd.select(this.cellSelector).removeClass(d),f=this.mainHd.select(this.cellSelector).removeClass(d),g=this.cm.getLockedCount(),d=d["DESC"==b?1:0];a<g?e.item(a).addClass(d):f.item(a-g).addClass(d)},handleHdDown:function(a,b){Ext.grid.GridView.prototype.handleHdDown.call(this,a,b);var d=Ext.get(b);if(d.hasClass("x-grid3-hd-btn")){a.stopEvent();
var e=this.findHeaderCell(b);Ext.fly(e).addClass("x-grid3-hd-menu-open");this.hdCtxIndex=d=this.getCellIndex(e);var f=this.hmenu.items,g=this.cm;f.get("asc").setDisabled(!g.isSortable(d));f.get("desc").setDisabled(!g.isSortable(d));f.get("lock").setDisabled(g.isLocked(d));f.get("unlock").setDisabled(!g.isLocked(d));this.hmenu.on("hide",function(){Ext.fly(e).removeClass("x-grid3-hd-menu-open")},this,{single:!0});this.hmenu.show(b,"tl-bl?")}else(d.hasClass("ux-grid-hd-group-cell")||Ext.fly(b).up(".ux-grid-hd-group-cell"))&&
a.stopEvent()},handleHdMenuClick:function(a){var b=this.hdCtxIndex,d=this.cm,e=this.ds,f=a.getItemId(),g=d.getLockedCount();switch(f){case "asc":e.sort(d.getDataIndex(b),"ASC");break;case "desc":e.sort(d.getDataIndex(b),"DESC");break;case "lock":if(d.getColumnCount(!0)<=g+1){this.onDenyColumnLock();return}(a=d.processLockingHdGroups(b))||(a=g);d.setLocked(b,!0,a!=b);a!=b&&(d.moveColumn(b,a),this.grid.fireEvent("columnmove",b,a));break;case "unlock":(a=d.processUnLockingHdGroups(b))||(a=g-1);a!=b?
(d.setLocked(b,!1,!0),d.moveColumn(b,a),this.grid.fireEvent("columnmove",b,a)):d.setLocked(b,!1);break;default:return this.handleHdMenuClickDefault(a)}return!0},handleHdMenuClickDefault:function(a){var b=this.cm,d=a.getItemId();if("group-"==d.substr(0,6)){for(var e=d.split("-"),f=parseInt(e[1],10),g=parseInt(e[2],10),h=this.cm.rows[f],k,e=f=0,l=h.length;e<l;e++){k=h[e];if(g>=f&&g<f+k.colspan)break;f+=k.colspan}if(a.checked){g=b.getColumnsBy(this.isHideableColumn,this).length;e=f;for(l=f+k.colspan;e<
l;e++)b.isHidden(e)||g--;if(1>g)return this.onDenyColumnHide(),!1}e=f;for(l=f+k.colspan;e<l;e++)!0!==b.config[e].fixed&&!1!==b.config[e].hideable&&b.setHidden(e,a.checked)}else if("col-"==d.substr(0,4)&&(e=b.getIndexById(d.substr(4)),-1!=e)){if(a.checked&&1>=b.getColumnsBy(this.isHideableColumn,this).length)return this.onDenyColumnHide(),!1;b.setHidden(e,a.checked)}if("group-"==d.substr(0,6)||"col-"==d.substr(0,4)){a.checked=!a.checked;if(a.menu){var m=function(b){b.items.each(function(b){b.disabled||
(b.setChecked(a.checked,!1),b.menu&&m(b.menu))})};m(a.menu)}for(var b=a,n;(b=b.parentMenu)&&b.parentMenu&&(n=b.parentMenu.items.get(b.getItemId()))&&n.setChecked;)d=0<=b.items.findIndexBy(function(a){return a.checked}),n.setChecked(d,!0);a.checked=!a.checked}},handleHdMove:function(a,b){var d=this.findHeaderCell(this.activeHdRef);if(d&&!this.headersDisabled&&!Ext.fly(d).hasClass("ux-grid-hd-group-cell")){var e=this.splitHandleWidth||5,f=this.activeHdRegion,g=a.getPageX(),d=d.style,h="";!1!==this.grid.enableColumnResize&&
(g-f.left<=e&&this.cm.isResizable(this.activeHdIndex-1)?h=Ext.isAir?"move":Ext.isWebKit?"e-resize":"col-resize":f.right-g<=(this.activeHdBtn?2:e)&&this.cm.isResizable(this.activeHdIndex)&&(h=Ext.isAir?"move":Ext.isWebKit?"w-resize":"col-resize"));d.cursor=h}},handleHdOver:function(a,b){var d=this.findHeaderCell(b);if(d&&!this.headersDisabled){this.activeHdRef=b;this.activeHdIndex=this.getCellIndex(d);var e=this.fly(d);this.activeHdRegion=e.getRegion();!this.cm.isMenuDisabled(this.activeHdIndex)&&
!e.hasClass("ux-grid-hd-group-cell")&&(e.addClass("x-grid3-hd-over"),this.activeHdBtn=e.child(".x-grid3-hd-btn"))&&(this.activeHdBtn.dom.style.height=d.firstChild.offsetHeight-1+"px")}},handleHdOut:function(a,b){var d=this.findHeaderCell(b);!d||Ext.isIE&&a.within(d,!0)||(this.activeHdRef=null,this.fly(d).removeClass("x-grid3-hd-over"),d.style.cursor="")},beforeColMenuShow:function(){var a=this.cm,b=this.cm.rows;this.colMenu.removeAll();for(var d=0,e=a.getColumnCount();d<e;d++){var f=this.colMenu,
g=a.getColumnHeader(d),h=[];if(!0!==a.config[d].fixed&&!1!==a.config[d].hideable){for(var k=0,l=b.length;k<l;k++){for(var m=b[k],n,p=0,q=0,t=m.length;q<t;q++){n=m[q];if(d>=p&&d<p+n.colspan)break;p+=n.colspan}if(n&&n.header)if(a.hierarchicalColMenu){m="group-"+k+"-"+p;q=(q=f.items?f.getComponent(m):null)?q.menu:null;if(!q){q=new Ext.menu.Menu({itemId:m});q.on("itemclick",this.handleHdMenuClick,this);for(var t=!1,u=!0,v=p,p=p+n.colspan;v<p;v++)a.isHidden(v)||(t=!0),!1!==a.config[v].hideable&&(u=!1);
f.add({itemId:m,text:n.header,menu:q,hideOnClick:!1,checked:t,disabled:u})}f=q}else h.push(n.header)}h.push(g);f.add(new Ext.menu.CheckItem({itemId:"col-"+a.getColumnId(d),text:h.join(" "),checked:!a.isHidden(d),hideOnClick:!1,disabled:!1===a.config[d].hideable}))}}},getEditorParent:function(a){return this.el.dom},getLockedRows:function(){if(!this.canGroup())return this.hasRows()?this.lockedBody.dom.childNodes:[];for(var a=[],b=this.getGroups(!0),d,e=0,f=b.length,g,h;e<f;++e)if(d=b[e].childNodes[1])for(d=
d.childNodes,g=0,h=d.length;g<h;++g)a[a.length]=d[g];return a},getLockedRow:function(a){return this.getLockedRows()[a]},getTotalSummaryRow:function(a){return!0===a?this.lockedTotalSummaryInner.firstChild.firstChild.firstChild.firstChild:this.totalSummaryInner.firstChild.firstChild.firstChild.firstChild},getCell:function(a,b){var d=this.cm.getLockedCount();return b<d?Ext.fly(this.getLockedRow(a)).query(this.cellSelector)[b]:Ext.grid.GridView.prototype.getCell.call(this,a,b-d)},addRowClass:function(a,
b){var d=this.getLockedRow(a);d&&this.fly(d).addClass(b);Ext.grid.GridView.prototype.addRowClass.call(this,a,b)},removeRowClass:function(a,b){var d=this.getLockedRow(a);d&&this.fly(d).removeClass(b);Ext.grid.GridView.prototype.removeRowClass.call(this,a,b)},removeRow:function(a){Ext.removeNode(this.getLockedRow(a));Ext.grid.GridView.prototype.removeRow.call(this,a)},removeRows:function(a,b){for(var d=this.lockedBody.dom,e=a;e<=b;e++)Ext.removeNode(d.childNodes[a]);Ext.grid.GridView.prototype.removeRows.call(this,
a,b)},syncScroll:function(a){this.lockedScroller.dom.scrollTop=this.scroller.dom.scrollTop;this.totalSummaryInner.scrollLeft=this.scroller.dom.scrollLeft;this.totalSummaryInner.scrollLeft=this.scroller.dom.scrollLeft;Ext.grid.GridView.prototype.syncScroll.call(this,a)},updateAllColumnWidths:function(){var a=this.getTotalWidth(),b=this.cm.getColumnCount(),d=this.getLockedWidth(),e=this.cm.getLockedCount(),f=[],g,h;this.updateLockedWidth();for(h=0;h<b;h++)f[h]=this.getColumnWidth(h),this.getHeaderCell(h).style.width=
f[h];var k=this.getLockedRows(),l=this.getRows(),m,n;h=0;for(g=l.length;h<g;h++){m=k[h];m.style.width=d;if(m.firstChild)for(m.firstChild.style.width=d,m=m.firstChild.rows[0],n=0;n<e;n++)m.childNodes[n].style.width=f[n];m=l[h];m.style.width=a;if(m.firstChild)for(m.firstChild.style.width=a,m=m.firstChild.rows[0],n=e;n<b;n++)m.childNodes[n-e].style.width=f[n]}this.onAllColumnWidthsUpdated(f,a);this.syncHeaderHeight()},updateColumnWidth:function(a,b){var d=this.getColumnWidth(a),e=this.cm.getLockedCount(),
f,g,h,k;this.updateLockedWidth();a<e?(f=this.getLockedRows(),g=this.getLockedWidth(),e=this.getTotalSummaryRow(!0),h=a):(f=this.getRows(),g=this.getTotalWidth(),h=a-e,e=this.getTotalSummaryRow(!1));this.getHeaderCell(a).style.width=d;for(var l=0,m=f.length;l<m;l++)k=f[l],k.style.width=g,k.firstChild&&(k.firstChild.style.width=g,k.firstChild.rows[0].childNodes[h].style.width=d);e.childNodes[h].style.width=d;this.onColumnWidthUpdated(a,d,this.getTotalWidth());this.syncHeaderHeight()},updateColumnHidden:function(a,
b){var d=this.cm.getLockedCount(),e,f,g,h,k=b?"none":"";this.updateLockedWidth();a<d?(e=this.getLockedRows(),f=this.getLockedWidth(),h=this.getTotalSummaryRow(!0),d=a):(e=this.getRows(),f=this.getTotalWidth(),h=this.getTotalSummaryRow(!1),d=a-d);this.getHeaderCell(a).style.display=k;for(var l=0,m=e.length;l<m;l++)g=e[l],g.style.width=f,g.firstChild&&(g.firstChild.style.width=f,g.firstChild.rows[0].childNodes[d].style.display=k);h.childNodes[d].style.display=k;this.onColumnHiddenUpdated(a,b,this.getTotalWidth());
delete this.lastViewWidth;this.layout()},doRender:function(a,b,d,e,f,g){if(1>b.length)return"";if(!this.canGroup()||this.isUpdating)return this.doRenderRows(a,b,d,e,f,g);var h=this.getGroupField(),k=this.cm.findColumnIndex(h),l,m="width:"+this.getTotalWidth()+";",n="width:"+this.getLockedWidth()+";";l=this.cm.config[k];var p=l.groupRenderer||l.renderer,q=this.showGroupName?(l.groupName||l.header)+": ":"",t=[],u,v,s,w;v=0;for(s=b.length;v<s;v++){var x=e+v,z=b[v],A=z.data[h];l=this.getGroup(A,z,p,x,
k,d);u&&u.group==l?u.rs.push(z):(w=this.constructId(A,h,k),this.state[w]=!(Ext.isDefined(this.state[w])?!this.state[w]:this.startCollapsed),u={group:l,gvalue:A,text:q+l,groupId:w,startRow:x,rs:[z],cls:this.state[w]?"":"x-grid-group-collapsed"},t.push(u));z._groupId=w}b=[];e=[];v=0;for(s=t.length;v<s;v++)l=t[v],l.style=m,this.doGroupStart(b,l,a,d,f,!1),l.style=n,this.doGroupStart(e,l,a,d,f,!0),h=this.doRenderRows(a,l.rs,d,l.startRow,f,g),b[b.length]=h[0],e[e.length]=h[1],this.doGroupEnd(b,l,a,d,f,
!1),this.doGroupEnd(e,l,a,d,f,!0);return[b.join(""),e.join("")]},doRenderRows:function(a,b,d,e,f,g){for(var h=this.templates,k=h.cell,h=h.row,l=f-1,m="width:"+this.getTotalWidth()+";",n="width:"+this.getLockedWidth()+";",p=[],q=[],t,u,v,s={},w={},x,z=0,A=b.length;z<A;z++){x=b[z];t=[];u=[];for(var B=z+e,y=0;y<f;y++){v=a[y];s.id=v.id;s.css=(0===y?"x-grid3-cell-first ":y==l?"x-grid3-cell-last ":"")+(this.cm.config[y].cellCls?" "+this.cm.config[y].cellCls:"");s.attr=s.cellAttr="";s.value=v.renderer.call(v.scope,
x.data[v.name],s,x,B,y,d);s.style=v.style;Ext.isEmpty(s.value)&&(s.value="&#160;");this.markDirty&&x.dirty&&Ext.isDefined(x.modified[v.name])&&(s.css+=" x-grid3-dirty-cell");if(!Ext.isEmpty(x.error)&&Ext.isDefined(x.data[v.name])){var C=x.error.filter(function(a){return a.errorText&&a.column==v.name});Ext.isEmpty(C)||(s.css+=" x-grid3-row-invalid",s.css+=" x-form-invalid")}v.locked?u[u.length]=k.apply(s):t[t.length]=k.apply(s)}y=[];g&&0===(B+1)%2&&(y[0]="x-grid3-row-alt");x.dirty&&(y[1]=" x-grid3-dirty-row");
w.cols=f;this.getRowClass&&(y[2]=this.getRowClass(x,B,w,d));w.alt=y.join(" ");w.cells=t.join("");w.tstyle=m;p[p.length]=h.apply(w);w.cells=u.join("");w.tstyle=n;q[q.length]=h.apply(w)}return[p.join(""),q.join("")]},processRows:function(a,b){if(this.ds&&!(1>this.ds.getCount())){var d=this.getRows(),e=this.getLockedRows(),f,g;b=b||!this.grid.stripeRows;a=a||0;for(var h=0,k=d.length;h<k;++h)f=d[h],g=e[h],f.rowIndex=h,g.rowIndex=h,b||(f.className=f.className.replace(this.rowClsRe," "),g.className=g.className.replace(this.rowClsRe,
" "),0===(h+1)%2&&(f.className+=" x-grid3-row-alt",g.className+=" x-grid3-row-alt")),this.syncRowHeights(f,g);0===a&&(Ext.fly(d[0]).addClass(this.firstRowCls),Ext.fly(e[0]).addClass(this.firstRowCls));Ext.fly(d[d.length-1]).addClass(this.lastRowCls);Ext.fly(e[e.length-1]).addClass(this.lastRowCls)}},syncRowHeights:function(a,b){if(this.syncHeights){var d=Ext.get(a),e=Ext.get(b);d.dom.style.height="";e.dom.style.height="";var f=d.getHeight(),g=e.getHeight();f>g?e.setHeight(f):g>f&&d.setHeight(g)}},
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,!0);!0!==this.deferEmptyText&&this.applyEmptyText();this.grid.fireEvent("viewready",this.grid);this.grid.deferRowRender&&this.updateGroupWidths()}},layout:function(){if(this.mainBody){var a=this.grid,b=a.getGridEl().getSize(!0),d=b.width;if(a.hideHeaders||!(20>d||20>b.height)){this.syncHeaderHeight();if(a.autoHeight)this.scroller.dom.style.overflow=
"visible",this.lockedScroller.dom.style.overflow="visible",Ext.isWebKit&&(this.scroller.dom.style.position="static",this.lockedScroller.dom.style.position="static");else{this.el.setSize(b.width,b.height);var a=this.mainHd.getHeight(),e=this.totalSummary.getHeight(),e=b.height-a-e}this.updateLockedWidth();this.forceFit?this.lastViewWidth!=d&&(this.fitColumns(!1,!1),this.lastViewWidth=d):(this.autoExpand(),this.syncHeaderScroll());this.onLayout(d,e)}}},getOffsetWidth:function(){return this.cm.getTotalWidth()-
this.cm.getTotalLockedWidth()+this.getScrollOffset()+"px"},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},updateTotalSummary:function(){var a=this.renderTotalSummary();
this.totalSummaryInner.firstChild.innerHTML=a[0];this.totalSummaryInner.firstChild.style.width=this.getOffsetWidth();this.totalSummaryInner.firstChild.firstChild.style.width=this.getTotalWidth();this.lockedTotalSummaryInner.firstChild.innerHTML=a[1];a=this.getLockedWidth();this.lockedTotalSummaryInner.firstChild.style.width=a;this.lockedTotalSummaryInner.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,d){Ext.grid.GridView.prototype.syncFocusEl.call(this,a,b,b<this.cm.getLockedCount()?!1:d)},ensureVisible:function(a,b,d){return Ext.grid.GridView.prototype.ensureVisible.call(this,a,b,b<this.cm.getLockedCount()?!1:d)},insertRows:function(a,b,d,e){a=a.getCount()-1;if(!e&&0===b&&d>=a)this.refresh();else{e||this.fireEvent("beforerowsinserted",this,b,d);var f=this.renderRows(b,d),g=this.getRow(b);g?(0===b&&this.removeRowClass(0,this.firstRowCls),Ext.DomHelper.insertHtml("beforeBegin",
g,f[0]),g=this.getLockedRow(b),Ext.DomHelper.insertHtml("beforeBegin",g,f[1])):(this.removeRowClass(a-1,this.lastRowCls),Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,f[0]),Ext.DomHelper.insertHtml("beforeEnd",this.lockedBody.dom,f[1]));e?(0===b||b>=a)&&this.addRowClass(b,0===b?this.firstRowCls:this.lastRowCls):(this.fireEvent("rowsinserted",this,b,d),this.processRows(b))}this.syncFocusEl(b)},getColumnStyle:function(a,b){var d=b?this.cm.config[a].headerStyle||"":this.cm.config[a].cellStyle||
this.cm.config[a].css||"",d=d+("width:"+this.getColumnWidth(a)+";");this.cm.isHidden(a)&&(d+="display:none;");var e=this.cm.config[a].align;e&&(d+="text-align:"+e+";");return d},getColumnWidth:function(a){a=this.cm.getColumnWidth(a);var b=this.borderWidth;return Ext.isNumber(a)?Ext.isBorderBox||Ext.isWebKit&&!Ext.isSafari2&&!Ext.isChrome?a+"px":Math.max(a-b,0)+"px":a},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,d=b.getColumnCount(),e=0;e<d;e++){var f=b.getDataIndex(e);a[e]={name:Ext.isDefined(f)?f:this.ds.fields.get(e).name,renderer:b.getRenderer(e),scope:b.getRendererScope(e),id:b.getColumnId(e),style:this.getColumnStyle(e),locked:b.isLocked(e)}}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,d=this.cm.getColumnCount(),
e=this.getColumnData(),f=d-1,g=["x-grid3-row"],h={tstyle:String.format("width: {0};",this.getTotalWidth())},k={tstyle:String.format("width: {0};",this.getLockedWidth())},l=[],m=[],n=this.templates.cell,p,q,t,u;this.isUpdating=!0;Ext.isNumber(a)?(p=a,a=b.getAt(p)):p=b.indexOf(a);if(a&&!(0>p)){for(u=0;u<d;u++){q=e[u];t=0==u?"x-grid3-cell-first":u==f?"x-grid3-cell-last ":"";t={id:q.id,style:q.style,css:t,attr:"",cellAttr:""};t.value=q.renderer.call(q.scope,a.data[q.name],t,a,p,u,b);Ext.isEmpty(t.value)&&
(t.value="&#160;");this.markDirty&&a.dirty&&Ext.isDefined(a.modified[q.name])&&(t.css+=" x-grid3-dirty-cell");if(!Ext.isEmpty(a.error)&&Ext.isDefined(a.data[q.name])){var v=a.error.filter(function(a){return a.errorText&&a.column==q.name});Ext.isEmpty(v)||(t.css+=" x-grid3-row-invalid",t.css+=" x-form-invalid")}q.locked?m[u]=n.apply(t):l[u]=n.apply(t)}e=this.getRow(p);e.className="";f=this.getLockedRow(p);f.className="";this.grid.stripeRows&&0===(p+1)%2&&g.push("x-grid3-row-alt");this.getRowClass&&
(h.cols=d,g.push(this.getRowClass(a,p,h,b)));this.fly(e).addClass(g).setStyle(h.tstyle);h.cells=l.join("");e.innerHTML=this.templates.rowInner.apply(h);this.fly(f).addClass(g).setStyle(k.tstyle);k.cells=m.join("");f.innerHTML=this.templates.rowInner.apply(k);f.rowIndex=p;this.syncRowHeights(e,f);this.fireEvent("rowupdated",this,p,a);this.isUpdating=!1}},refresh:function(a){this.fireEvent("beforerefresh",this);this.grid.stopEditing(!0);var b=this.renderBody();this.mainBody.update(b[0]).setWidth(this.getTotalWidth());
this.lockedBody.update(b[1]).setWidth(this.getLockedWidth());!0===a&&(this.updateHeaders(),this.updateHeaderSortState());this.processRows(0,!0);this.updateTotalSummary();this.layout();this.applyEmptyText();this.fireEvent("refresh",this)},onDenyColumnLock:function(){},initData:function(a,b){this.cm&&this.cm.un("columnlockchange",this.onColumnLock,this);Ext.grid.GridView.prototype.initData.call(this,a,b);if(this.cm)this.cm.on("columnlockchange",this.onColumnLock,this)},onColumnLock:function(){this.refresh(!0)},
syncHeaderHeight:function(){var a=this.mainHd.dom.getElementsByTagName("tr"),b=this.lockedHd.dom.getElementsByTagName("tr");if(b.length==a.length)for(var d=0;d<a.length;d++){var e=a[d],f=b[d];e.style.height="auto";f.style.height="auto";var g=Math.max(f.offsetHeight,e.offsetHeight)+"px";e.style.height=g;f.style.height=g}},updateLockedWidth:function(){var a=this.cm.getTotalLockedWidth(),b=this.cm.getTotalWidth()-a,d=this.grid.getGridEl().getSize(!0),e=Ext.isBorderBox?0:this.lockedBorderWidth,f=Ext.isBorderBox?
0:this.rowBorderWidth,g=Math.max(d.width-a-e-f,0)+"px",h=this.getScrollOffset();this.grid.autoHeight||(d=Math.max(d.height-this.mainHd.getHeight()-this.totalSummary.getHeight(),0)+"px",this.lockedScroller.dom.style.height=d,this.scroller.dom.style.height=d);this.lockedWrap.dom.style.width=a+f+"px";this.scroller.dom.style.width=g;this.mainWrap.dom.style.left=a+e+f+"px";this.lockedInnerHd&&(this.lockedInnerHd.firstChild.style.width=a+"px",this.lockedInnerHd.firstChild.firstChild.style.width=a+"px");
this.innerHd&&(this.innerHd.style.width=g,this.innerHd.firstChild.style.width=b+f+h+"px",this.innerHd.firstChild.firstChild.style.width=b+"px");this.lockedBody&&(this.lockedBody.dom.style.width=a+f+"px");this.mainBody&&(this.mainBody.dom.style.width=b+f+"px");this.totalSummaryInner&&(this.totalSummaryInner.style.width=g,this.totalSummaryInner.firstChild.style.width=b+f+h+"px",this.totalSummaryInner.firstChild.firstChild.style.width=b+"px");this.lockedTotalSummaryInner&&(this.lockedTotalSummaryInner.firstChild.style.width=
a+"px",this.lockedTotalSummaryInner.firstChild.firstChild.style.width=a+"px")},getGroupStyle:function(a,b){for(var d=0,e=!0,f=b,g=b+a.colspan;f<g;f++)void 0===this.cm.getColumnAt(f)||this.cm.isHidden(f)||(e=this.cm.getColumnWidth(f),"number"==typeof e&&(d+=e),e=!1);return{width:(Ext.isBorderBox||Ext.isWebKit&&!Ext.isSafari2&&!Ext.isChrome?d:Math.max(d-this.borderWidth,0))+"px",hidden:e}},updateHdGroupStyles:function(a){for(var b=this.mainHd.query(".x-grid3-header-offset > table"),d=this.lockedHd.query(".x-grid3-header-offset > table"),
e=this.getLockedWidth(),f=this.getTotalWidth(),g=this.cm.rows,h=this.cm.getLockedCount(),k=0;k<b.length;k++)if(b[k].style.width=f,k<g.length)for(var l=this.cm.getLockedHdGroupCount(k),m=b[k].firstChild.firstChild.childNodes,n=0,p=h;n<m.length;n++){var q=g[k][n+l];if("number"!=typeof a||a>=p&&a<p+q.colspan){var t=this.getGroupStyle(q,p);m[n].style.width=t.width;m[n].style.display=t.hidden?"none":""}p+=q.colspan}for(k=0;k<d.length;k++)if(d[k].style.width=e,k<g.length)for(m=d[k].firstChild.firstChild.childNodes,
p=n=0;n<m.length;n++){q=g[k][n];if("number"!=typeof a||a>=p&&a<p+q.colspan)t=this.getGroupStyle(q,p),m[n].style.width=t.width,m[n].style.display=t.hidden?"none":"";p+=q.colspan}},renderUI:function(){var a=this.templates,b=this.renderHeaders(),d=a.body.apply({rows:"&#160;"}),e=this.renderTotalSummary();return a.masterTpl.apply({body:d,header:b[0],totalSummary:e[0],ostyle:"width:"+this.getOffsetWidth()+";",bstyle:"width:"+this.getTotalWidth()+";",lockedBody:d,lockedHeader:b[1],lockedTotalSummary:e[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);!1!==
a.enableColumnResize&&(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)),Ext.apply(this.splitZone,Ext.ux.grid.LockingGridColumnWithHeaderGroup.prototype.splitZoneConfig));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),Ext.apply(this.columnDrop,Ext.ux.grid.LockingGridColumnWithHeaderGroup.prototype.columnDropConfig));!1!==a.enableHdMenu&&(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"}),!1!==a.enableColLock&&this.hmenu.add("-",{itemId:"lock",text:this.lockText,cls:"xg-hmenu-lock"},{itemId:"unlock",text:this.unlockText,
cls:"xg-hmenu-unlock"}),!1!==a.enableColumnHide&&(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:!1,text:this.columnsText,menu:this.colMenu,iconCls:"x-cols-icon"})),this.enableGroupingMenu&&(this.hmenu.add("-",{itemId:"groupBy",text:this.groupByText,handler:this.onGroupByClick,scope:this,iconCls:"x-group-by-icon"}),this.enableNoGroups&&this.hmenu.add({itemId:"showGroups",
text:this.showGroupsText,checked:!0,checkHandler:this.onShowGroupsClick,scope:this}),this.hmenu.on("beforeshow",this.beforeMenuShow,this)),this.hmenu.on("itemclick",this.handleHdMenuClick,this));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()},
syncGroupHeaderHeights:function(){if(this.canGroup()&&this.hasRows()){var a=this.getGroups(!1),b=this.getGroups(!0);if(a.length==b.length)for(var d=0,e=a.length;d<e;d++){var f=a[d].childNodes[0],g=b[d].childNodes[0];f.style.height="auto";g.style.height="auto";var h=Math.max(f.offsetHeight,g.offsetHeight)+"px";f.style.height=h;g.style.height=h}}},findGroup:function(a){return Ext.fly(a).up(".x-grid-group",this.mainBody.dom)},getGroups:function(a){return this.hasRows()?a?this.lockedBody.dom.childNodes:
this.mainBody.dom.childNodes:[]},onAdd:function(a,b,d){if(this.canGroup()&&!this.ignoreAdd){var e=this.getScrollState();this.fireEvent("beforerowsinserted",a,d,d+(b.length-1));this.refresh();this.restoreScroll(e);this.fireEvent("rowsinserted",a,d,d+(b.length-1))}else this.canGroup()||Ext.grid.GridView.prototype.onAdd.apply(this,arguments)},onRemove:function(a,b,d,e){Ext.grid.GridView.prototype.onRemove.apply(this,arguments);var f=this.findGroupNodes(b._groupId),g=f[0],f=f[1],h=!1;g&&1>g.childNodes[1].childNodes.length?
Ext.removeNode(g):h=!0;f&&1>f.childNodes[1].childNodes.length?Ext.removeNode(f):h=!0;!e&&h&&(this.refreshSummaryById(b._groupId),this.updateTotalSummary());this.applyEmptyText()},beforeMenuShow:function(){var a,b=this.hmenu.items,d=!1===this.cm.config[this.hdCtxIndex].groupable;(a=b.get("groupBy"))&&a.setDisabled(d);if(a=b.get("showGroups"))a.setDisabled(d),a.setChecked(this.canGroup(),!0)},processEvent:function(a,b){Ext.grid.GridView.prototype.processEvent.call(this,a,b);var d=b.getTarget(".x-grid-group-hd",
this.mainBody);if(d){var e=this.getGroupField(),f=this.getPrefix(e),f=d.id.substring(f.length),g=RegExp("gp-"+Ext.escapeRe(e)+"--hd");((f=f.substr(0,f.length-3))||g.test(d.id))&&this.grid.fireEvent("group"+a,this.grid,e,f,b);"mousedown"==a&&0==b.button&&this.toggleGroup(d.parentNode)}},onGroupByClick:function(){var a=this.grid;this.enableGrouping=!0;a.store.groupBy(this.cm.getDataIndex(this.hdCtxIndex));a.fireEvent("groupchange",a,a.store.getGroupState());this.beforeMenuShow();this.refresh()},onShowGroupsClick:function(a,
b){if(this.enableGrouping=b)this.onGroupByClick();else this.grid.store.clearGrouping(),this.grid.fireEvent("groupchange",this,null)},toggleRowIndex:function(a,b){if(this.canGroup()){var d=this.getRow(a);d&&this.toggleGroup(this.findGroup(d),b)}},findGroupNodes:function(a){var b,d,e=this.mainBody.dom.childNodes,f=this.lockedBody.dom.childNodes,g=function(a,b){a&&"-l"!==a.substr(a.length-2)&&(a+="-l");b&&"-l"!==b.substr(a.length-2)&&(b+="-l");return a===b};if(e&&f){for(var h=0;h<e.length;h++)if(g(e[h].id,
a)){b=e[h];break}for(e=0;e<f.length;e++)if(g(f[e].id,a)){d=f[e];break}}return[b,d]},toggleGroup:function(a,b){var d=this.findGroupNodes(a.id),e=d[0],d=d[1];if(e&&d&&(b=Ext.isDefined(b)?b:-1<a.className.indexOf("x-grid-group-collapsed"),this.state[a.id]!==b))if(!1!==this.cancelEditOnToggle&&this.grid.stopEditing(!0),this.state[a.id]=b){var f=e.className.indexOf("x-grid-group-collapsed");-1<f&&(e.className=e.className.replace("x-grid-group-collapsed",""));e=d.className.indexOf("x-grid-group-collapsed");
-1<e&&(d.className=d.className.replace("x-grid-group-collapsed",""))}else f=e.className.indexOf("x-grid-group-collapsed"),0>f&&(e.className=e.className.concat(" x-grid-group-collapsed")),e=d.className.indexOf("x-grid-group-collapsed"),0>e&&(d.className=d.className.concat(" x-grid-group-collapsed"))},toggleAllGroups:function(a){for(var b=this.getGroups(),d=0,e=b.length;d<e;d++)this.toggleGroup(b[d],a)},expandAllGroups:function(){this.toggleAllGroups(!0)},collapseAllGroups:function(){this.toggleAllGroups(!1)},
getGroup:function(a,b,d,e,f,g){var h=this.cm.config[f];a=d?d.call(h.scope,a,{},b,e,f,g):String(a);if(""===a||"&#160;"===a)a=h.emptyGroupText||this.emptyGroupText;return a},getGroupField:function(){return this.grid.store.getGroupState()},renderRows:function(){var a=this.getGroupField(),b=!!a;if(this.hideGroupedColumn){var d=this.cm.findColumnIndex(a),e=Ext.isDefined(this.lastGroupField);!b&&e?(this.mainBody.update(""),this.lockedBody.update(""),this.cm.setHidden(this.cm.findColumnIndex(this.lastGroupField),
!1),delete this.lastGroupField):b&&!e?(this.lastGroupField=a,this.cm.setHidden(d,!0)):b&&e&&a!==this.lastGroupField&&(this.mainBody.update(""),this.lockedBody.update(""),b=this.cm.findColumnIndex(this.lastGroupField),this.cm.setHidden(b,!1),this.lastGroupField=a,this.cm.setHidden(d,!0))}return Ext.grid.GridView.prototype.renderRows.apply(this,arguments)},getGroupId:function(a){var b=this.getGroupField();return this.constructId(a,b,this.cm.findColumnIndex(b))},constructId:function(a,b,d){var e=this.cm.config[d],
e=e.groupRenderer||e.renderer;a="value"==this.groupMode?a:this.getGroup(a,{data:{}},e,0,d,this.ds);return this.getPrefix(b)+Ext.util.Format.htmlEncode(a)},canGroup:function(){return this.enableGrouping&&!!this.getGroupField()},getPrefix:function(a){return this.grid.getGridEl().id+"-gp-"+a+"-"},doGroupStart:function(a,b,d,e,f,g){a[a.length]=g?this.templates.startGroup.apply(b):this.templates.startLockedGroup.apply(b)},doGroupEnd:function(a,b,d,e,f,g){b=this.calculate(b.rs,d);a.push("</div>",this.renderSummary({data:b},
d,g),"</div>")},getRows:function(){if(!this.canGroup())return Ext.grid.GridView.prototype.getRows.call(this);for(var a=[],b=this.getGroups(),d,e=0,f=b.length,g,h;e<f;++e)if(d=b[e].childNodes[1])for(d=d.childNodes,g=0,h=d.length;g<h;++g)a[a.length]=d[g];return a},updateGroupWidths:function(){if(this.canGroup()&&this.hasRows()){for(var a=this.getTotalWidth(),b=this.getLockedWidth(),d=this.getGroups(!1),e=this.getGroups(!0),f=this.cm.getLockedCount(),g=0,h=d.length;g<h;g++){d[g].firstChild.style.width=
a;var k=d[g].childNodes[2];if(k){k.style.width=a;k.firstChild.style.width=a;for(var k=k.firstChild.rows[0].childNodes,l=0;l<k.length;l++)k[l].style.width=this.getColumnWidth(l+f),k[l].style.display=this.cm.isHidden(l+f)?"none":""}}a=0;for(h=e.length;a<h;a++)if(e[a].firstChild.style.width=b,k=e[a].childNodes[2])for(k.style.width=b,k.firstChild.style.width=b,k=k.firstChild.rows[0].childNodes,l=0;l<k.length;l++)k[l].style.width=this.getColumnWidth(l),k[l].style.display=this.cm.isHidden(l)?"none":"";
this.syncGroupHeaderHeights()}},onLayout:function(){this.updateGroupWidths()},onBeforeRowSelect:function(a,b){this.toggleRowIndex(b,!0)},calculate:function(a,b){for(var d={},e,f,g=this.cm.config,h,k=0,l=a.length;k<l;k++){e=a[k];for(var m=0,n=b.length;m<n;m++)f=b[m],h=g[m],h.summaryType&&(d[f.name]=Ext.ux.grid.GroupSummary.Calculations[h.summaryType](d[f.name]||0,e,f.name,d))}return d},renderSummary:function(a,b,d){b=b||this.getColumnData();for(var e=this.cm.config,f=[],g=d?0:this.cm.getLockedCount(),
h=d?this.cm.getLockedCount()-1:b.length-1;g<=h;g++){var k=b[g],l=e[g],m={};m.id=k.id;m.style=k.style;m.css=0==g?"x-grid3-cell-first ":g==b.length-1?"x-grid3-cell-last ":"";m.value=l.summaryRenderer?l.summaryRenderer(a.data[k.name],m,a,void 0,g,this.ds):a.data[k.name];if(void 0==m.value||""===m.value)m.value="&#160;";f[f.length]=this.templates.cell.apply(m)}return this.templates.summaryRow.apply({tstyle:"width:"+(d?this.getLockedWidth():this.getTotalWidth())+";",cells:f.join("")})},refreshSummaryById:function(a){var b=
this.findGroupNodes(a),d=b[1],b=b[0],e=[];if(!d||!b)return!1;this.grid.getStore().each(function(b){b._groupId==a&&(e[e.length]=b)});var f=this.getColumnData(),g=this.calculate(e,f),h=this.renderSummary({data:g},f,!1),f=this.renderSummary({data:g},f,!0),g=b.childNodes[2],k=d.childNodes[2];g&&b.removeChild(g);Ext.DomHelper.append(b,h);k&&d.removeChild(k);Ext.DomHelper.append(d,f);return!0},onUpdate:function(a,b){Ext.grid.GridView.prototype.onUpdate.apply(this,arguments);this.refreshSummaryById(b._groupId);
this.updateTotalSummary()}},splitZoneConfig:{allowHeaderDrag:function(a){return!a.getTarget(null,null,!0).hasClass("ux-grid-hd-group-cell")}},columnDropConfig:{getTargetFromEvent:function(a){a=Ext.lib.Event.getTarget(a);return this.view.findHeaderCell(a)},positionIndicator:function(a,b,d){a=Ext.ux.grid.LockingGridColumnWithHeaderGroup.prototype.getDragDropData.call(this,a,b,d);if(!1===a)return!1;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,d,e){b=e.header;if(b!=a){a=Ext.ux.grid.LockingGridColumnWithHeaderGroup.prototype.getDragDropData.call(this,b,a,d);if(!1===a)return!1;d=this.grid.colModel;b=a.oldIndex<a.newIndex;e=d.rows;for(var f=a.row,g=e.length;f<g;f++){for(var h=e[f],k=h.length,l=0,m=1,n=k,p=0,q=0;p<k;p++){var t=h[p];a.oldIndex>=q&&a.oldIndex<q+t.colspan&&(l=p);a.oldIndex+a.colspan-1>=q&&a.oldIndex+a.colspan-1<q+t.colspan&&
(m=p-l+1);a.newIndex>=q&&a.newIndex<q+t.colspan&&(n=p);q+=t.colspan}k=h.splice(l,m);e[f]=h.splice(0,n-(b?m:0)).concat(k).concat(h)}for(e=0;e<a.colspan;e++)f=a.oldIndex+(b?0:e),g=a.newIndex+(b?-1:e),d.moveColumn(f,g),this.grid.fireEvent("columnmove",f,g);return!0}return!1}},getGroupRowIndex:function(a){return a&&(a=a.className.match(this.hrowRe))&&a[1]?parseInt(a[1],10):this.cm.rows.length},getGroupSpan:function(a,b){if(0>a)return{col:0,colspan:this.cm.getColumnCount()};var d=this.cm.rows[a];if(d){for(var e=
0,f=0,g=d.length;e<g;e++){var h=d[e];if(b>=f&&b<f+h.colspan)return{col:f,colspan:h.colspan};f+=h.colspan}return{col:f,colspan:0}}return{col:b,colspan:1}},getDragDropData:function(a,b,d){if(a.parentNode!=b.parentNode)return!1;var e=this.grid.colModel,f=Ext.lib.Event.getPageX(d);d=Ext.lib.Dom.getRegion(b.firstChild);var g;d.right-f<=(d.right-d.left)/2?(f=d.right+this.view.borderWidth,g="after"):(f=d.left,g="before");var h=this.view.getCellIndex(a);b=this.view.getCellIndex(b);if(e.isFixed(b))return!1;
a=Ext.ux.grid.LockingGridColumnWithHeaderGroup.prototype.getGroupRowIndex.call(this.view,a);e=Ext.ux.grid.LockingGridColumnWithHeaderGroup.prototype.getGroupSpan.call(this.view,a,h);b=Ext.ux.grid.LockingGridColumnWithHeaderGroup.prototype.getGroupSpan.call(this.view,a,b);h=e.col;b=b.col+("after"==g?b.colspan:0);if(b>=e.col&&b<=e.col+e.colspan)return!1;var k=Ext.ux.grid.ColumnHeaderGroup.prototype.getGroupSpan.call(this.view,a-1,h);return b<k.col||b>k.col+k.colspan?!1:{r:d,px:f,pt:g,row:a,oldIndex:h,
newIndex:b,colspan:e.colspan}}});Ext.preg("m3-locking-column-header-group",Ext.ux.grid.LockingGridColumnWithHeaderGroup);
Ext.ux.MonthPickerPlugin=Ext.extend(Ext.util.Observable,{constructor:function(a){a&&Ext.apply(this,a);Ext.ux.MonthPickerPlugin.superclass.constructor.call(this)},init:function(a){this.submitFormat=this.submitFormat||"d.m.Y";this.picker=a;this.picker.altFormats=this.submitFormat;this.picker.onTriggerClick=this.picker.onTriggerClick.createSequence(this.onClick,this);this.picker.baseTriggers[0].handler=this.picker.onTriggerClick;this.picker.onRender=this.picker.onRender.createSequence(this.onRender,
this);this.picker.getValue=this.picker.getValue.createInterceptor(this.setDefaultMonthDay,this).createSequence(this.restoreDefaultMonthDay,this);this.picker.setValue=this.picker.setValue.createSequence(this.updateHidden,this);this.picker.beforeBlur=this.picker.beforeBlur.createInterceptor(this.setDefaultMonthDay,this).createSequence(this.restoreDefaultMonthDay,this);this.picker.onDisable=this.picker.onDisable.createSequence(this.onDisable,this);this.picker.onEnable=this.picker.onEnable.createSequence(this.onEnable,
this)},setDefaultMonthDay:function(){this.oldDateDefaults=Date.defaults.d;Date.defaults.d=1;return!0},restoreDefaultMonthDay:function(a){Date.defaults.d=this.oldDateDefaults;return a},onClick:function(a,b,d){a=this.picker.menu.picker;a.activeDate=a.activeDate.getFirstDateOfMonth();a.value&&(a.value=a.value.getFirstDateOfMonth());a.showMonthPicker();a.disabled||(a.monthPicker.stopFx(),a.monthPicker.show(),a.mun(a.monthPicker,"click",a.onMonthClick,a),a.mun(a.monthPicker,"dblclick",a.onMonthDblClick,
a),a.onMonthClick=a.onMonthClick.createSequence(this.pickerClick,this),a.onMonthDblClick=a.onMonthDblClick.createSequence(this.pickerDblclick,this),a.mon(a.monthPicker,"click",a.onMonthClick,a),a.mon(a.monthPicker,"dblclick",a.onMonthDblClick,a))},pickerClick:function(a,b){var d=new Ext.Element(b);d.is("button.x-date-mp-cancel")?this.picker.menu.hide():d.is("button.x-date-mp-ok")&&(d=this.picker.menu.picker,d.setValue(d.activeDate),d.fireEvent("select",d,d.value))},pickerDblclick:function(a,b){var d=
new Ext.Element(b);d.parent()&&(d.parent().is("td.x-date-mp-month")||d.parent().is("td.x-date-mp-year"))&&(d=this.picker.menu.picker,d.setValue(d.activeDate),d.fireEvent("select",d,d.value))},onRender:function(a,b){var d=this.picker.name||this.picker.el.dom.name;this.picker.hiddenField=this.picker.el.insertSibling({tag:"input",type:"hidden",name:d,value:this.formatHiddenDate(this.picker.parseDate(this.picker.value))});this.picker.hiddenName=d;this.picker.el.dom.removeAttribute("name");this.picker.el.on({keyup:{scope:this,
fn:this.updateHidden},blur:{scope:this,fn:this.updateHidden}},Ext.isIE?"after":"before")},onDisable:function(){this.picker.hiddenField&&this.picker.hiddenField.dom.setAttribute("disabled","disabled")},onEnable:function(){this.picker.hiddenField&&this.picker.hiddenField.dom.removeAttribute("disabled")},formatHiddenDate:function(a){return Ext.isDate(a)?"timestamp"===this.submitFormat?a.getTime()/1E3:Ext.util.Format.date(a,this.submitFormat):a},updateHidden:function(){this.picker.hiddenField.dom.value=
this.formatHiddenDate(this.picker.getValue())}});
Ext.define("Ext.m3.MultiSelectField",{extend:"Ext.m3.AdvancedComboBox",xtype:"m3-multiselect",delimeter:",",multipleDisplayValue:null,initComponent:function(){this.checkedItems=[];this.hideTriggerDictEdit=!0;this.editable=!1;this.tpl||(this.tpl='<tpl for="."><div class="x-combo-list-item x-multi-combo-item"><img src="'+Ext.BLANK_IMAGE_URL+'" class="{[this.getImgClass(values)]}" /><div>{'+this.displayField+"}</div></div></tpl>",this.tpl=new Ext.XTemplate(this.tpl,{getImgClass:this.getCheckboxCls.createDelegate(this)}));
Ext.m3.MultiSelectField.superclass.initComponent.apply(this)},setValue:function(a){a&&"[]"!==a?this.showClearBtn():this.hideClearBtn();this.value=this.getValue();this.setRawValue(this.getText());this.hiddenField&&(this.hiddenField.value=this.value);this.el&&this.el.removeClass(this.emptyClass)},getValue:function(){var a=[];Ext.each(this.checkedItems,function(b){a.push(b.get(this.valueField))},this);return a.length?Ext.util.JSON.encode(a):""},initValue:function(){var a=0,b,d,e;if(this.store&&this.value&&
"local"===this.mode)b=Ext.util.JSON.decode(this.value),this.store.each(function(a){Ext.each(b,function(b){if(a.get(this.valueField)==b)return this.checkedItems.push(a),!1},this)},this);else if(this.value)for(b=Ext.util.JSON.decode(this.value);a<b.length;a++)d=b[a],"object"===typeof d&&d[this.displayField]&&d[this.valueField]&&(e=new Ext.data.Record,e.data[this.valueField]=d[this.valueField],e.data[this.displayField]=d[this.displayField],this.checkedItems.push(e));Ext.m3.MultiSelectField.superclass.initValue.call(this)},
getText:function(){var a=[];Ext.each(this.checkedItems,function(b){a.push(b.get(this.displayField))},this);return 1<a.length&&this.multipleDisplayValue?this.multipleDisplayValue:a.join(this.delimeter+" ")},getCheckboxCls:function(a){for(var b=0;b<this.checkedItems.length;b++)if(a[this.valueField]==this.checkedItems[b].data[this.valueField])return"x-grid3-check-col-on";return"x-grid3-check-col"},getCheckedRecords:function(){return this.checkedItems},onSelect:function(a,b){var d;d=this.findCheckedRecord(a);
!1!==this.fireEvent("beforeselect",this,a,b)&&(-1===d?this.checkedItems.push(a):this.checkedItems.remove(this.checkedItems[d]),this.refreshItem(a),this.setValue(this.getValue()),this.fireChangeEventOnDemand(),this.fireEvent("select",this,this.checkedItems))},fireChangeEventOnDemand:function(){var a=this.getValue();String(a)!==String(this.startValue)&&this.fireEvent("change",this,a,this.startValue);this.startValue=a},refreshItem:function(a){this.view&&this.view.refreshNode(this.store.indexOf(a))},
onSelectInDictionary:function(){this.fireEvent("beforerequest",this)&&Ext.Ajax.request({url:this.actionSelectUrl,method:"POST",params:this.getContext(),success:function(a){if(a=smart_eval(a.responseText))a.initMultiSelect(this.checkedItems),a.on("closed_ok",function(a){this.addRecordsToStore(a);this.fireChangeEventOnDemand();this.fireEvent("select",this,this.checkedItems)},this)},failure:function(a,b){window.uiAjaxFailMessage.apply(this,arguments)},scope:this})},clearValue:function(){this.checkedItems=
[];this.view&&this.view.refresh();this.setValue(this.getValue());this.fireChangeEventOnDemand()},addRecordsToStore:function(a){for(var b=0,d=[],e;b<a.length;b++)e=new Ext.data.Record,e.data[this.valueField]=a[b].data[this.valueField],e.data[this.displayField]=a[b].data[this.displayField],d.push(e);this.checkedItems=d;this.view&&this.view.refresh();this.setValue(this.getValue())},findCheckedRecord:function(a){for(var b=0,d=-1;b<this.checkedItems.length;b++)if(this.checkedItems[b].data[this.valueField]===
a.data[this.valueField]){d=b;break}return d}});Ext.namespace("Ext.ux");Ext.ux.NotificationMgr={notifications:[],originalBodyOverflowY:null};
Ext.ux.Notification=Ext.extend(Ext.Window,{initComponent:function(){Ext.apply(this,{iconCls:this.iconCls||"icon-accept",cls:"x-notification",autoHeight:!0,plain:!0,draggable:!1,bodyStyle:"text-align:center",padding:5,header:!1,shadow:!1,"float":!0});this.closedCallback=function(){};this.autoDestroy?this.task=new Ext.util.DelayedTask(this.hide,this):this.closable=!0;Ext.ux.Notification.superclass.initComponent.apply(this)},setMessage:function(a){this.body.update(a)},setTitle:function(a,b){Ext.ux.Notification.superclass.setTitle.call(this,
a,b||this.iconCls)},registerCallbackOnClosed:function(a){this.closedCallback=a},onDestroy:function(){Ext.ux.NotificationMgr.notifications.remove(this);Ext.ux.Notification.superclass.onDestroy.call(this);this.closedCallback()},cancelHiding:function(){this.addClass("fixed");this.autoDestroy&&this.task.cancel()},afterShow:function(){Ext.ux.Notification.superclass.afterShow.call(this);Ext.fly(this.body.dom).on("click",this.cancelHiding,this)},animShow:function(){var a=120,b=0,d=Ext.ux.NotificationMgr.notifications.length;
null==Ext.ux.NotificationMgr.originalBodyOverflowY&&(Ext.ux.NotificationMgr.originalBodyOverflowY=document.body.style.overflowY);document.body.style.overflow="hidden";this.setSize(this.width,100);for(null;b<d;b+=1)a+=Ext.ux.NotificationMgr.notifications[b].getSize().height+10;Ext.ux.NotificationMgr.notifications.push(this);this.el.alignTo(document.body,"br-br",[-10,-a]);this.el.slideIn("b",{duration:1.2,callback:this.afterShow,scope:this})},animHide:function(){this.el.ghost("t",{duration:1.2,remove:!1,
callback:function(){Ext.ux.NotificationMgr.notifications.remove(this);document.body.style.overflow="auto";this.destroy()}.createDelegate(this)})},focus:Ext.emptyFn});
(function(){var a=function(){var a=this.params||{};assert(void 0!==a.allowPaging,"allowPaging is undefined");assert(void 0!==a.rowIdName,"rowIdName is undefined");a.actions=a.actions||{};this.allowPaging=a.allowPaging;this.rowIdName=a.rowIdName;this.columnParamName=a.columnParamName;this.actionNewUrl=a.actions.newUrl;this.actionEditUrl=a.actions.editUrl;this.actionDeleteUrl=a.actions.deleteUrl;this.actionDataUrl=a.actions.dataUrl;this.localEdit=a.localEdit;this.name=a.name;this.store&&!this.store.url&&
(this.store.url=this.actionDataUrl);this.configureItem(this.getTopToolbar(),"button_new",this.actionNewUrl,this.onNewRecord);var b=this.configureItem(this.getTopToolbar(),"button_edit",this.actionEditUrl,this.onEditRecord);if(b&&this.actionEditUrl)this.on("dblclick",b.handler);this.configureItem(this.getTopToolbar(),"button_delete",this.actionDeleteUrl,this.onDeleteRecord);this.configureItem(this.getTopToolbar(),"button_refresh",this.actionDataUrl,this.refreshStore);a.contextMenu&&(this.configureItem(a.contextMenu,
"menuitem_new",this.actionNewUrl,this.onNewRecord),this.configureItem(a.contextMenu,"menuitem_edit",!1,this.onEditRecord),this.configureItem(a.contextMenu,"menuitem_delete",!1,this.onDeleteRecord));a.rowContextMenu&&(this.configureItem(a.rowContextMenu,"menuitem_new",this.actionNewUrl,this.onNewRecord),this.configureItem(a.rowContextMenu,"menuitem_edit",this.actionEditUrl,this.onEditRecord),this.configureItem(a.rowContextMenu,"menuitem_delete",this.actionDeleteUrl,this.onDeleteRecord));this.configureItem(a.contextMenu,
"menuitem_refresh",this.actionDataUrl,this.refreshStore);this.configureItem(a.rowContextMenu,"menuitem_refresh",this.actionDataUrl,this.refreshStore);a=this.getStore();a.on("beforeload",function(a){a.baseParams=Ext.apply(a.baseParams||{},this.getContext())},this);a.on("beforeload",this.fireEvent.createDelegate(this,["mask",this,"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430..."]));a.on("load",this.fireEvent.createDelegate(this,["unmask",this]));a.on("loadexception",this.fireEvent.createDelegate(this,
["unmask",this]));this.addEvents("beforenewrequest","afternewrequest","beforeeditrequest","aftereditrequest","beforedeleterequest","afterdeleterequest","rowadded","rowedited","rowdeleted")},b={bubbleEvents:["mask","unmask","getcontext"],configureItem:function(a,b,f,g){if(a=a.getComponent(b))f||a.hide(),a.handler||a.setHandler(g,this);return a},onNewRecord:function(){assert(this.actionNewUrl,"actionNewUrl is not define");var a=Ext.apply({},this.getContext());a[this.rowIdName]="";a={url:this.actionNewUrl,
params:a,success:this.newRecord.createDelegate(this),failure:uiAjaxFailMessage,mode:"\u0420\u0435\u0436\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f"};this.fireEvent("beforenewrequest",this,a)&&UI.callAction.call(this,a)},onEditRecord:function(){assert(this.actionEditUrl,"actionEditUrl is not define");assert(this.rowIdName,"rowIdName is not define");if(!this.getTopToolbar().getComponent("button_edit").disabled)if(this.getSelectionModel().hasSelection()){var a=this.getSelectionContext(this.localEdit);
-1!=String(a[this.rowIdName]).indexOf(",")?Ext.Msg.show({title:"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435",msg:"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043b\u0438\u0448\u044c \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442!",
buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO}):(a={url:this.actionEditUrl,params:a,success:this.editRecord.createDelegate(this),failure:uiAjaxFailMessage,mode:"\u0420\u0435\u0436\u0438\u043c \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f"},this.fireEvent("beforeeditrequest",this,a)&&UI.callAction.call(this,a))}else Ext.Msg.show({title:"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435",msg:"\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d",
buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO})},onDeleteRecord:function(){assert(this.actionDeleteUrl,"actionDeleteUrl is not define");assert(this.rowIdName,"rowIdName is not define");this.getSelectionModel().hasSelection()?Ext.Msg.show({title:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438",msg:"\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c?",
icon:Ext.Msg.QUESTION,buttons:Ext.Msg.YESNO,fn:function(a){"yes"==a&&(a={url:this.actionDeleteUrl,method:"POST",params:this.getSelectionContext(this.localEdit),success:this.deleteRecord.createDelegate(this),failure:uiAjaxFailMessage},this.fireEvent("beforedeleterequest",this,a)&&UI.callAction.call(this,a))}.bind(this)}):Ext.Msg.show({title:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435",msg:"\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d",buttons:Ext.Msg.OK,
icon:Ext.MessageBox.INFO})},newRecord:function(a){if(this.fireEvent("afternewrequest",this,a)&&a instanceof Ext.Component)a.on("closed_ok",function(a){if(this.fireEvent("rowadded",this,a))if(this.localEdit){a=Ext.decode(a);var b=new Ext.data.Record(a.data),d=this.getStore(),h=this.getSelectionModel();b.json=a.data;d.add(b);h.selectRecords([b])}else this.refreshStore()},this);return a},editRecord:function(a){if(this.fireEvent("aftereditrequest",this,a)&&a instanceof Ext.Component)a.on("closed_ok",
function(a){if(this.fireEvent("rowedited",this,a))if(this.localEdit){var b=Ext.decode(a);a=new Ext.data.Record(b.data);var d=this.getStore(),h=this.getSelectionModel();a.json=b.data;if(h.hasSelection()&&h instanceof Ext.grid.RowSelectionModel){var b=h.getSelected(),k=d.indexOf(b);d.remove(b);0>k&&(k=0);d.insert(k,a);h.selectRow(k)}}else this.refreshStore()},this);return a},deleteRecord:function(a){if(this.fireEvent("rowdeleted",this,a))if(this.localEdit){if(a.success){a=this.getStore();var b=this.getSelectionModel();
b.hasSelection()&&b instanceof Ext.grid.RowSelectionModel&&(b=b.getSelections(),a.remove(b))}}else this.refreshStore()},refreshStore:function(){if(this.allowPaging){var a=this.getBottomToolbar();if(a&&a instanceof Ext.PagingToolbar){var b=Math.ceil((a.cursor+a.pageSize)/a.pageSize);a.changePage(b)}else this.getStore().load()}else this.getStore().load()},getSelectionContext:function(a){var b=Ext.apply({},this.getContext()),f=this.getSelectionModel(),g,h,k,l;if(f instanceof Ext.grid.RowSelectionModel)if(f.singleSelect)g=
f.getSelected(),b[this.rowIdName]=g.id;else{f=f.getSelections();h=[];g=[];k=0;for(l=f.length;k<l;k++)g.push(f[k]),h.push(f[k].id);b[this.rowIdName]=h.join()}else f instanceof Ext.grid.CellSelectionModel&&(assert(this.columnParamName,"columnParamName is not define"),f=f.getSelectedCell())&&(g=this.getStore().getAt(f[0]),b[this.rowIdName]=g.id,b[this.columnParamName]=this.getColumnModel().getDataIndex(f[1]));a&&(b=Ext.isArray(g)?Ext.applyIf(b,g[0].json):Ext.applyIf(b,g.json));return b},setBlocked:function(a,
b){b.push("button_refresh");this.callParent(arguments)}};Ext.define("Ext.m3.ObjectGrid",Ext.apply({extend:"Ext.m3.GridPanel",xtype:"m3-object-grid",initComponent:function(){this.callParent();a.apply(this)}},b));Ext.define("Ext.m3.EditorObjectGrid",Ext.apply({extend:"Ext.m3.EditorGridPanel",xtype:"m3-edit-object-grid",initComponent:function(){this.callParent();a.apply(this)}},b))})();
Ext.define("Ext.m3.ObjectSelectionPanel",{extend:"Ext.Container",xtype:"m3-object-selection-panel",selectionColumns:[],selectionGridConf:{},constructor:function(a){assert(a.selectionColumns,"Columns for selection is undefined!");a.grid instanceof Ext.grid.GridPanel?assert(this.grid.sm instanceof Ext.grid.CheckboxSelectionModel,"sm has been Ext.grid.CheckboxSelectionModel"):a.grid.sm=new Ext.grid.CheckboxSelectionModel;for(var b=["_check"],d=0;d<a.selectionColumns.length;d++)b.push(a.selectionColumns[d].data_index);
d=new Ext.grid.CheckboxSelectionModel;a.selectionColumns.unshift(d);b=Ext.applyIf(a.selectionGridConf,{region:"east",width:200,sm:d,title:"\u0412\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438",store:new Ext.data.ArrayStore({autoDestroy:!0,fields:b}),colModel:new Ext.grid.ColumnModel({columns:a.selectionColumns})});a.selectionGrid=new Ext.grid.GridPanel(b);a.items=a.items||[];a.items.unshift(a.selectionGrid);a.items.unshift(a.grid);Ext.m3.ObjectSelectionPanel.superclass.constructor.call(this,
a)},initComponent:function(){this.callParent();this.grid=this.items.first();this.grid.getSelectionModel().on("rowdeselect",this.onRowDeselect,this);this.grid.getSelectionModel().on("rowselect",this.onRowSelect,this);this.grid.getStore().on("load",this.onLoad,this);this.selectionGrid.getSelectionModel().on("rowdeselect",this.onRemoveSelected,this)},onRowSelect:function(a,b,d){0>this.selectionGrid.store.indexOfId(d.id)&&(this.selectionGrid.store.add(d),this.selectionGrid.selModel.selectLastRow(!0))},
onRowDeselect:function(a,b,d){a=this.selectionGrid.store.indexOfId(d.id);0<=a&&this.selectionGrid.store.removeAt(a)},onLoad:function(a){a=this.selectionGrid.store.getRange();for(var b=this.grid.store.getRange(),d=0,e=0,d=0;d<a.length;d++)for(e=0;e<b.length;e++)a[d].id==b[e].id&&this.grid.getSelectionModel().selectRow(e,!0)},getSelectedRecords:function(){return this.selectionGrid.store.getRange()},onRemoveSelected:function(a,b,d){a=this.grid.store.indexOfId(d.id);0<=a&&this.grid.getSelectionModel().deselectRow(a)}});
Ext.define("Ext.m3.ObjectTree",{extend:"Ext.m3.Tree",xtype:"m3-object-tree",bubbleEvents:["mask","unmask","getcontext"],allowPaging:!1,rowIdName:"id",parentIdName:"parent_id",actionNewUrl:null,actionEditUrl:null,actionDeleteUrl:null,incrementalUpdate:!1,folderSort:!0,enableSort:!1,configure:function(){var a=Ext.create({},"menu"),b=Ext.create({},"menu"),d=Ext.create(this.tbar),e,f={text:"\u041d\u043e\u0432\u044b\u0439 \u0432 \u043a\u043e\u0440\u043d\u0435",iconCls:"add_item",handler:this.onNewRecord,
scope:this},g={text:"\u041d\u043e\u0432\u044b\u0439 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0439",iconCls:"add_item",handler:this.onNewRecordChild,scope:this},h={text:"\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c",iconCls:"edit_item",handler:this.onEditRecord,scope:this},k={text:"\u0423\u0434\u0430\u043b\u0438\u0442\u044c",iconCls:"delete_item",handler:this.onDeleteRecord,scope:this},l={text:"\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c",iconCls:"x-tbar-loading",handler:this.refreshStore,
scope:this};e=d.removeAll(!1);this.actionNewUrl&&(a.add(f),a.add(g),b.add(f),d.add({text:"\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c",iconCls:"add_item",menu:{items:[f,g]}}));this.actionEditUrl&&(a.add(h),d.add(h),this.on("dblclick",this.onEditRecord,this));this.actionDeleteUrl&&(a.add(k),d.add(k));if(this.actionNewUrl||this.actionEditUrl||this.actionDeleteUrl)d.add("-"),a.add("-"),b.add("-");this.dataUrl&&(d.add(l),a.add(l),b.add(l));a.items&&0<a.items.length&&(this.contextMenu=a);b.items&&
0<b.items.length&&(this.containerContextMenu=b);d.add(e);this.tbar=d},initComponent:function(){this.configure();this.callParent();var a=this.getLoader();_self=this;a.on("beforeload",function(a){a.baseParams=Ext.apply(a.baseParams||{},_self.getContext())});a.on("beforeload",this.fireEvent.createDelegate(this,["mask",this,"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430..."]),this);a.on("load",this.fireEvent.createDelegate(this,["unmask",this]),this);a.on("loadexception",this.fireEvent.createDelegate(this,
["unmask",this]),this);a.nodeParameter=this.rowIdName;this.addEvents("beforenewrequest","beforeeditrequest","beforedeleterequest")},onNewRecord:function(){assert(this.actionNewUrl,"actionNewUrl is not define");var a={url:this.actionNewUrl,params:this.getContext(),success:this.childWindowOpenHandler.createDelegate(this,["new"],!0),failure:uiAjaxFailMessage,mode:"\u0420\u0435\u0436\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f..."};this.fireEvent("beforenewrequest",this,a)&&UI.callAction.call(this,
a)},onNewRecordChild:function(){assert(this.actionNewUrl,"actionNewUrl is not define");if(this.getSelectionModel().getSelectedNode()){var a=this.getSelectionContext();a[this.parentIdName]=a[this.rowIdName];delete a[this.rowIdName];a={url:this.actionNewUrl,params:a,success:this.childWindowOpenHandler.createDelegate(this,["newChild"],!0),failure:uiAjaxFailMessage,mode:"\u0420\u0435\u0436\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f..."};this.fireEvent("beforenewrequest",this,a)&&UI.callAction.call(this,
a)}else Ext.Msg.show({title:"\u041d\u043e\u0432\u044b\u0439",msg:"\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d",buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO})},onEditRecord:function(){assert(this.actionEditUrl,"actionEditUrl is not define");assert(this.rowIdName,"rowIdName is not define");if(this.getSelectionModel().getSelectedNode()){var a={url:this.actionEditUrl,params:this.getSelectionContext(),success:this.childWindowOpenHandler.createDelegate(this,
["edit"],!0),failure:uiAjaxFailMessage,mode:"\u0420\u0435\u0436\u0438\u043c \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f..."};this.fireEvent("beforeeditrequest",this,a)&&UI.callAction.call(this,a)}},onDeleteRecord:function(){assert(this.actionDeleteUrl,"actionDeleteUrl is not define");assert(this.rowIdName,"rowIdName is not define");this.getSelectionModel().getSelectedNode()?Ext.Msg.show({title:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438",
msg:"\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c?",icon:Ext.Msg.QUESTION,buttons:Ext.Msg.YESNO,fn:function(a){"yes"==a&&this.getSelectionModel().getSelectedNode()&&(a={url:this.actionDeleteUrl,method:"POST",params:this.getSelectionContext(),success:this.deleteOkHandler.createDelegate(this),
failure:uiAjaxFailMessage},this.fireEvent("beforedeleterequest",this,a)&&UI.callAction.call(this,a))}.bind(this)}):Ext.Msg.show({title:"\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435",msg:"\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u0432\u044b\u0431\u0440\u0430\u043d",buttons:Ext.Msg.OK,icon:Ext.MessageBox.INFO})},childWindowOpenHandler:function(a,b){if(a)a.on("closed_ok",function(a){if(this.incrementalUpdate){var e=Ext.decode(a);a=this.getSelectionModel().getSelectedNode();var f=
this.getLoader().createNode(e.data);switch(b){case "edit":var g=a.parentNode;g.removeChild(a);g.expanded||g.expand(!1,!1);g.appendChild(f);break;case "new":this.getRootNode().appendChild(f);break;case "newChild":a.children?(a.expanded||a.expand(!1,!1),a.appendChild(f)):a.expanded?a.appendChild(f):a.leaf||0!=a.childNodes.length?(a.leaf=!1,a.expand(!1,!1),a.appendChild(f)):(a.on("expand",function(){this.getNodeById(e.data.id).select()},this,{single:!0}),a.expand(!1,!1),f=void 0)}f&&f.select()}else this.refreshStore()},
this);return a},deleteOkHandler:function(a){if(this.incrementalUpdate){if(a.success){a=this.getSelectionModel().getSelectedNode();var b=a.parentNode;b.removeChild(a);b.select()}}else this.refreshStore()},refreshStore:function(){this.getLoader().baseParams=Ext.apply({},this.getContext());this.getLoader().load(this.getRootNode())},getSelectionContext:function(){var a=Ext.apply({},this.getContext());this.getSelectionModel().getSelectedNode()&&(a[this.rowIdName]=this.getSelectionModel().getSelectedNode().id);
return a}});Ext.namespace("Ext.ux");
Ext.ux.OnDemandLoad=function(){loadComponent=function(a,b){var d=a.substring(a.lastIndexOf(".")),e=document.getElementsByTagName("head")[0],f=!1;if(".js"===d){var g=document.createElement("script");g.setAttribute("type","text/javascript");g.setAttribute("src",a);g.onload=g.onreadystatechange=function(){f||(f=!0,"function"==typeof b&&b(),e.removeChild(g))}}else".css"===d&&(g=document.createElement("link"),g.setAttribute("type","text/css"),g.setAttribute("rel","stylesheet"),g.setAttribute("href",a));
"undefined"!=typeof g&&e.appendChild(g)};return{load:function(a,b){loadComponent(a,b)}}}();
Ext.override(Ext.form.NumberField,{decimalSeparator:",",currencySymbol:null,useThousandSeparator:!0,thousandSeparator:" ",alwaysDisplayDecimals:!0,currencySymbolPosition:"before",numberFieldAlign:"left",initComponent:function(){"before"!=this.currencySymbolPosition&&"after"!=this.currencySymbolPosition&&(this.currencySymbolPosition="before");"left"!=this.numberFieldAlign&&"right"!=this.numberFieldAlign&&(this.numberFieldAlign="left");this.useThousandSeparator&&Ext.isEmpty(this.thousandSeparator)&&
(this.thousandSeparator=",");this.allowDecimals&&Ext.isEmpty(this.decimalSeparator)&&(this.decimalSeparator=".");if(this.allowDecimals&&this.thousandSeparator==this.decimalSeparator)throw this.name+" [NumberFormatException]: thousandSeparator must be different from decimalSeparator.";var a={style:"text-align:"+this.numberFieldAlign+";"};this.allowDecimals&&(this.baseChars+=".");Ext.apply(this,Ext.apply(this.initialConfig,a));Ext.form.NumberField.superclass.initComponent.call(this,arguments)},onRender:function(){Ext.form.NumberField.superclass.onRender.apply(this,
arguments);this.hiddenField=this.el.insertSibling({tag:"input",type:"hidden",name:this.name,value:this.isValid()?this.getValue():""});this.hiddenName=name;this.el.dom.removeAttribute("name")},setValue:function(a){Ext.form.NumberField.superclass.setValue.call(this,a);this.setRawValue(this.getFormattedValue(this.getValue()));void 0!==this.hiddenField&&(this.hiddenField.dom.value=this.getValue())},getFormattedValue:function(a){if(Ext.isEmpty(a)||!this.hasFormat())return a;var b=null;a=(b=0>a)?-1*a:a;
a=this.allowDecimals&&this.alwaysDisplayDecimals?a.toFixed(this.decimalPrecision):a;if(this.useThousandSeparator){a=String(a);a=a.split(".");a[1]=a[1]?a[1]:null;for(var d=a[0],e=/(\d+)(\d{3})/,f=this.thousandSeparator;e.test(d);)d=d.replace(e,"$1"+f+"$2");a=d+(a[1]?this.decimalSeparator+a[1]:"")}return"before"==this.currencySymbolPosition?String.format("{0}{1}{2}",Ext.isEmpty(this.currencySymbol)?"":this.currencySymbol+" ",b?"-":"",a):String.format("{0}{1}{2}",b?"-":"",a,Ext.isEmpty(this.currencySymbol)?
"":" "+this.currencySymbol)},parseValue:function(a){a=this.removeFormat(a);a=parseFloat(String(a).replace(this.decimalSeparator,"."));return isNaN(a)?"":a},removeFormat:function(a){a&&(a=a.replace(this.currencySymbol,"").trim(),a=this.useThousandSeparator?a.replace(RegExp("["+this.thousandSeparator+"]","g"),""):a);return a},getErrors:function(a){a=this.getValue();var b=[];if(1>a.length||a===this.emptyText){if(this.allowBlank)return b;b.push(this.blankText)}isNaN(a)&&b.push(String.format(this.nanText,
a));a<this.minValue&&b.push(String.format(this.minText,this.minValue));a>this.maxValue&&b.push(String.format(this.maxText,this.maxValue));return b},hasFormat:function(){return"."!=this.decimalSeparator||!0==this.useThousandSeparator||!Ext.isEmpty(this.currencySymbol)||this.alwaysDisplayDecimals},onFocus:function(){Ext.form.NumberField.superclass.onFocus.call(this,arguments);this.setRawValue(this.removeFormat(this.getRawValue()))},beforeBlur:function(){var a=this.parseValue(this.getRawValue());this.setValue(a)}});
Ext.ux.PagingTreeNodeUI=Ext.extend(Ext.ux.tree.TreeGridNodeUI,{renderElements:function(a,b,d,e){this.indentMarkup=a.parentNode?a.parentNode.ui.getChildIndent():"";var f=a.attributes,g=parseInt(a.parentNode.attributes.page)||0,h=f.fullCount,k=a.parentNode.attributes.pageLimit||f.limit||25;a.parentNode.attributes.pageLimit=k;var l=Math.ceil(h/k),f=a.getOwnerTree().columns,m=function(a,b,d,e){a.push('<div class="gs_tree_pgbtn');e&&a.push(" "+e);a.push('"><div gs:page="');a.push(b);a.push('" class="x-tree-col-text">');
a.push(d);a.push("</div></div>")},n=['<li class="gs_tree_pagingbar" style="list-style:none;"><div ext:tree-node-id="',a.id,'" class="x-tree-node-el ',b.cls,'">','<span unselectable="on" style="float:left;">\u041b\u0438\u0441\u0442 ',g+1," \u0438\u0437 ",l,"</span></a>"],p;0!=g&&m(n,g-1,"<");if(11>l)for(p=0;p<l;p++)m(n,p,p+1,g==p?"gs_tree_pgbtn_sel":null);else{m(n,0,1,0==g?"gs_tree_pgbtn_sel":null);p=Math.max(1,g-2);var q=Math.min(l-1,g+3);for(1<p&&n.push('<div class="x-tree-col"><div class="x-tree-col-text">...</div></div>');p<
q;p++)m(n,p,p+1,g==p?"gs_tree_pgbtn_sel":null);q<l-1&&n.push('<div class="x-tree-col"><div class="x-tree-col-text">...</div></div>');m(n,l-1,l,g==l-1?"gs_tree_pgbtn_sel":null)}g!=l-1&&m(n,g+1,">");g=['<div class="x-tree-col"><div id="last" class="x-tree-col-text">\u041f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u0441\u0442\u0440\u043e\u043a\u0438 \u043e\u0442 ',g*k+1," \u0434\u043e ",Math.min((g+1)*k,h)," \u0438\u0437 ",h,"</div></div>",'<div class="x-clear"></div></div>','<ul class="x-tree-node-ct" style="display:none;"></ul>',
"</li></div></td>"];g=n.join("")+g.join("");n=['<tbody class="x-tree-node">','<tr ext:tree-node-id="',a.id,'" class="x-tree-node-el x-tree-node-leaf x-tree-pagingnode',b.cls,'">','<td colspan="',f.length,'" class="x-treegrid-col x-tree-pagingnode-td">','<span class="x-tree-node-indent" style="float:left;">',this.indentMarkup,"</span>",'<img src="',this.emptyIcon,'" class="x-tree-elbow" style="float:left;"/>','<img src="',b.icon||this.emptyIcon,'" class="',b.icon?" x-tree-node-inline-icon":"",b.iconCls?
" "+b.iconCls:"",'" unselectable="on" style="float:left;"/>','<a hidefocus="on" class="x-tree-node-anchor" href="',b.href?b.href:"#",'" tabIndex="1" ','<a hidefocus="on" class="x-tree-node-anchor" href="',b.href?b.href:"#",'" tabIndex="1" ',b.hrefTarget?' target="'+b.hrefTarget+'"':"",">",g,"</td>"];g=n.join("");!0!==e&&a.nextSibling&&a.nextSibling.ui.getEl()?this.wrap=Ext.DomHelper.insertHtml("beforeBegin",a.nextSibling.ui.getEl(),g):this.wrap=Ext.DomHelper.insertHtml("beforeEnd",d,g);a.on("click",
function(a,b){var d=a.getOwnerTree().getLoader(),e=b.target;if(!e.attributes.getNamedItem("gs:page"))return!1;var f=a.parentNode,g=f.attributes.pageLimit||25,e=e.attributes.getNamedItem("gs:page").value;d.baseParams.limit=g;d.baseParams.start=e*g;f.attributes.page=e;delete f.attributes.children;f.getUI().beforeLoad();d.load(f,function(){f.getUI().afterLoad();f.expand()});delete d.baseParams.start;delete d.baseParams.limit;return!1});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.reg("paging-tree-node-ui",Ext.ux.PagingTreeNodeUI);
Ext.define("Ext.m3.SearchField",{extend:"Ext.form.TwinTriggerField",xtype:"m3-search-field",initComponent:function(){Ext.m3.SearchField.superclass.initComponent.call(this);this.on("specialkey",function(a,b){if(b.getKey()==b.ENTER)this.onTrigger2Click()},this)},validationEvent:!1,validateOnBlur:!1,trigger1Class:"x-form-clear-trigger",trigger2Class:"x-form-search-trigger",hideTrigger1:!0,width:180,hasSearch:!1,paramName:"filter",paramId:"id",nodeId:"-1",componentItemId:null,_getMainParent:function(a){return a.ownerCt?
this._getMainParent.call(this,a.ownerCt):a},_getComponentForSearch:function(){var a=this._getMainParent.call(this,this.ownerCt).find("itemId",this.componentItemId);return 0<a.length?a[0]:null},onTrigger1Click:function(){if(this.hasSearch){this.el.dom.value="";var a=this._getComponentForSearch();if(a instanceof Ext.grid.GridPanel){var b=a.getStore();b.baseParams=b.baseParams||{};b.baseParams[this.paramName]="";b.baseParams[this.paramId]=this.nodeId||"";b.reload({params:{start:0}})}else a instanceof
Ext.ux.tree.TreeGrid&&(this.el.dom.value="",b=a.getLoader(),b.baseParams=b.baseParams||{},b.baseParams[this.paramName]="",a=a.getRootNode(),b.load(a),a.expand());this.triggers[0].hide();this.hasSearch=!1}},onTrigger2Click:function(){var a=this.getRawValue(),b=this._getComponentForSearch();if(b instanceof Ext.grid.GridPanel){var d=b.getStore();d.baseParams=d.baseParams||{};d.baseParams[this.paramName]=a;d.baseParams[this.paramId]=this.nodeId||"";d.reload({params:{start:0}})}else b instanceof Ext.ux.tree.TreeGrid&&
(d=b.getLoader(),d.baseParams=d.baseParams||{},d.baseParams[this.paramName]=a,b=b.getRootNode(),d.load(b),b.expand());a&&(this.hasSearch=!0,this.triggers[0].show())},clear:function(a){this.onTrigger1Click()},search:function(a){this.onTrigger2Click()}});Ext.namespace("Ext.ux");
(function(){var a=Ext.ux;a.BaseTimePicker=Ext.extend(Ext.Panel,{timeFormat:"H:i:s",header:!0,nowText:"Now",doneText:"Done",hourIncrement:1,minIncrement:1,secIncrement:1,hoursLabel:"Hours",minsLabel:"Minutes",secsLabel:"Seconds",cls:"ux-base-time-picker",width:210,layout:"form",labelAlign:"top",initComponent:function(){this.addEvents("select");this.hourSlider=new Ext.slider.SingleSlider({increment:this.hourIncrement,minValue:0,maxValue:23,fieldLabel:this.hoursLabel,listeners:{change:this._updateTimeValue,
scope:this},plugins:new Ext.slider.Tip});this.minSlider=new Ext.slider.SingleSlider({increment:this.minIncrement,minValue:0,maxValue:59,fieldLabel:this.minsLabel,listeners:{change:this._updateTimeValue,scope:this},plugins:new Ext.slider.Tip});this.secSlider=new Ext.slider.SingleSlider({increment:this.secIncrement,minValue:0,maxValue:59,fieldLabel:this.secsLabel,listeners:{change:this._updateTimeValue,scope:this},plugins:new Ext.slider.Tip});this.setCurrentTime(!1);this.items=[this.hourSlider,this.minSlider,
this.secSlider];this.bbar=[{text:this.nowText,handler:this.setCurrentTime,scope:this},"->",{text:this.doneText,handler:this.onDone,scope:this}];a.BaseTimePicker.superclass.initComponent.call(this)},setCurrentTime:function(a){this.setValue(new Date,!!a)},onDone:function(){this.fireEvent("select",this,this.getValue())},setValue:function(a,d){this.hourSlider.setValue(a.getHours(),d);this.minSlider.setValue(a.getMinutes(),d);this.secSlider.setValue(a.getSeconds(),d);this._updateTimeValue()},_extractValue:function(){var a=
new Date;a.setHours(this.hourSlider.getValue());a.setMinutes(this.minSlider.getValue());a.setSeconds(this.secSlider.getValue());return a},getValue:function(){return this._extractValue()},_updateTimeValue:function(){var a=this._extractValue().format(this.timeFormat);this.rendered&&this.setTitle(a)},afterRender:function(){a.BaseTimePicker.superclass.afterRender.call(this);this._updateTimeValue()},destroy:function(){this.purgeListeners();this.secSlider=this.minSlider=this.hourSlider=null;a.BaseTimePicker.superclass.destroy.call(this)}});
Ext.reg("basetimepicker",a.BaseTimePicker)})();Ext.namespace("Ext.ux");
(function(){var a=Ext.ux;Ext.define("Ext.ux.DateTimePicker",{extend:"Ext.BoxComponent",xtype:"datetimepicker",timeLabel:"Time",timeFormat:"H:i:s",changeTimeText:"Change...",doneText:"Done",initComponent:function(){a.DateTimePicker.superclass.initComponent.call(this);this.addEvents("select");this.timePickerButton=new Ext.Button({text:this.changeTimeText,handler:this._showTimePicker,scope:this});this._initDatePicker();this.timeValue=new Date;this.value&&(this.setValue(this.value),delete this.value)},
_initTimePicker:function(){if(!this.timeMenu){var a=this.initialConfig.timeMenu;if(a&&a.xtype)this.timeMenu=Ext.create(a);else{var e=Ext.create(Ext.applyIf(this.initialConfig.timePicker||{},{timeFormat:this.timeFormat}),"basetimepicker");this.timeMenu=new b(e,a||{})}if(!Ext.isFunction(this.timeMenu.getPicker))throw"Your time menu must provide the getPicker() method";this.timeMenu.on("timeselect",this.onTimeSelect,this)}},_initDatePicker:function(){var a=this.initialConfig.datePicker||{};a.internalRender=
this.initialConfig.internalRender;Ext.applyIf(a,{format:this.dateFormat||Ext.DatePicker.prototype.format});a=this.datePicker=Ext.create(a,"datepicker");a.update=a.update.createSequence(function(){if(null!=this.el&&this.datePicker.rendered){var a=this.datePicker.el.getWidth();this.el.setWidth(a+this.el.getBorderWidth("lr")+this.el.getPadding("lr"))}},this)},_renderDatePicker:function(a){var b=this.datePicker;b.render(a);var f=b.getEl().child(".x-date-bottom").getSize(!0),f=["position: absolute;bottom: 0;left: 0;overflow: hidden",
"width: "+f.width+"px","height: "+f.height+"px"].join(";");a=a.createChild({tag:"div",cls:"x-date-bottom",style:f,children:[{tag:"table",cellspacing:0,style:"width: 100%",children:[{tag:"tr",children:[{tag:"td",align:"left"},{tag:"td",align:"right"}]}]}]});if(b.showToday){var g={};Ext.each(["text","tooltip","handler","scope"],function(a){g[a]=b.todayBtn.initialConfig[a]});this.todayBtn=(new Ext.Button(g)).render(a.child("td:first"))}this.doneBtn=(new Ext.Button({text:this.doneText,handler:this.onDone,
scope:this})).render(a.child("td:last"))},_getFormattedTimeValue:function(a){return a.format(this.timeFormat)},_renderValueField:function(a){var b=Ext.isEmpty(this.timeLabel)?"":'<span class="ux-date-time-picker-value-ct-value-label">'+this.timeLabel+":</span>&nbsp;";a=a.insertFirst({tag:"div",cls:"ux-date-time-picker-value-ct x-date-bottom"}).createChild({tag:"table",cellspacing:0,style:"width: 100%",children:[{tag:"tr",children:[{tag:"td",align:"left",cls:"ux-date-time-picker-value-ct-value-cell",
html:'<div class="ux-date-time-picker-value-ct-value-wrap">'+b+'<span class="ux-date-time-picker-value-ct-value">'+this._getFormattedTimeValue(this.timeValue)+"</span></div>"},{tag:"td",align:"right",cls:"ux-date-time-picker-value-ct-btn-cell"}]}]});this.timeValueEl=a.child(".ux-date-time-picker-value-ct-value");this.timeValueEl.on("click",this._showTimePicker,this);this.timePickerButton.render(a.child("td:last"))},onRender:function(b,e){this.el=b.createChild({tag:"div",cls:"ux-date-time-picker",
children:[{tag:"div",cls:"ux-date-time-picker-inner"}]},e);a.DateTimePicker.superclass.onRender.call(this,b,e);var f=this.el.first();this._renderDatePicker(f);this._renderValueField(f)},_updateTimeValue:function(a){this.timeValue=a;null!=this.timeValueEl&&this.timeValueEl.update(this._getFormattedTimeValue(a))},setValue:function(a){this._updateTimeValue(a);this.datePicker.setValue(a.clone())},getValue:function(){var a=this.datePicker.getValue(),b=this.timeValue.getElapsed(this.timeValue.clone().clearTime());
return new Date(a.getTime()+b)},onTimeSelect:function(a,b,f){this._updateTimeValue(f)},_showTimePicker:function(){this._initTimePicker();this.timeMenu.getPicker().setValue(this.timeValue,!1);this.timeMenu.isVisible()?this.timeMenu.hide():this.timeMenu.show(this.timePickerButton.el,null,this.parentMenu)},onDone:function(){this.fireEvent("select",this,this.getValue())},destroy:function(){Ext.destroy(this.timePickerButton);this.timePickerButton=null;this.timeValueEl&&(this.timeValueEl.remove(),this.timeValueEl=
null);Ext.destroy(this.datePicker);this.datePicker=null;this.timeMenu&&(Ext.destroy(this.timeMenu),this.timeMenu=null);this.todayBtn&&(Ext.destroy(this.todayBtn),this.todayBtn=null);this.doneBtn&&(Ext.destroy(this.doneBtn),this.doneBtn=null);this.parentMenu=null;a.DateTimePicker.superclass.destroy.call(this)}});var b=a.DateTimePicker.Menu=Ext.extend(Ext.menu.Menu,{enableScrolling:!1,hideOnClick:!1,plain:!0,showSeparator:!1,constructor:function(a,e){e=e||{};e.picker&&delete e.picker;this.picker=Ext.create(a);
b.superclass.constructor.call(this,Ext.applyIf({items:this.picker},e));this.addEvents("timeselect");this.picker.on("select",this.onTimeSelect,this)},getPicker:function(){return this.picker},onTimeSelect:function(a,b){this.hide();this.fireEvent("timeselect",this,a,b)},destroy:function(){this.purgeListeners();this.picker=null;b.superclass.destroy.call(this)}})})();Ext.namespace("Ext.ux.form");
(function(){var a=Ext.ux.form,b=Ext.isIE7&&Ext.isStrict,d=Ext.extend(Ext.menu.Menu,{enableScrolling:!1,plain:!0,showSeparator:!1,hideOnClick:!0,pickerId:null,cls:"x-date-menu x-date-time-menu",constructor:function(a,f){d.superclass.constructor.call(this,Ext.applyIf({items:a},f||{}));this.primaryPicker=a;a.parentMenu=this;this.on("beforeshow",this.onBeforeShow,this);if(this.strict=b)this.on("show",this.onShow,this,{single:!0,delay:20});this.picker=a.datePicker;this.relayEvents(a,["select"]);this.on("show",
a.focus,a);this.on("select",this.menuHide,this);if(this.handler)this.on("select",this.handler,this.scope||this)},menuHide:function(){this.hideOnClick&&this.hide(!0)},onBeforeShow:function(){this.picker&&this.picker.hideMonthPicker(!0)},onShow:function(){var a=this.picker.getEl();a.setWidth(a.getWidth())},destroy:function(){this.picker=this.primaryPicker=null;d.superclass.destroy.call(this)}});Ext.define("Ext.ux.form.DateTimeField",{extend:"Ext.m3.AdvancedDataField",xtype:"datetimefield",timeFormat:"H:i:s",
defaultAutoCreate:{tag:"input",type:"text",size:"22",autocomplete:"off"},initComponent:function(){a.DateTimeField.superclass.initComponent.call(this);this.dateFormat=this.dateFormat||this.format;var b=this._createPicker();this.format=this.dateFormat+" "+this.timeFormat;this.menu=new d(b,{hideOnClick:!1})},_createPicker:function(){var a=this.initialConfig.picker||{};Ext.apply(a,{ctCls:"x-menu-date-item",internalRender:b||!Ext.isIE});Ext.applyIf(a,{dateFormat:this.dateFormat,timeFormat:this.timeFormat});
return Ext.create(a,"datetimepicker")},onTriggerClick:function(){a.DateTimeField.superclass.onTriggerClick.apply(this,arguments);this.menu.primaryPicker.setValue(this.getValue()||new Date)}})})();Ext.ux.DateTimePicker&&(Ext.ux.DateTimePicker.prototype.timeLabel="\u0412\u0440\u0435\u043c\u044f",Ext.ux.DateTimePicker.prototype.changeTimeText="\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c...",Ext.ux.DateTimePicker.prototype.doneText="\u041e\u041a");
Ext.ux.BaseTimePicker&&(Ext.ux.BaseTimePicker.prototype.nowText="\u0422\u0435\u043a\u0443\u0449\u0435\u0435",Ext.ux.BaseTimePicker.prototype.doneText="\u041e\u041a",Ext.ux.BaseTimePicker.prototype.hoursLabel="\u0427\u0430\u0441\u044b",Ext.ux.BaseTimePicker.prototype.minsLabel="\u041c\u0438\u043d\u0443\u0442\u044b",Ext.ux.BaseTimePicker.prototype.secsLabel="\u0421\u0435\u043a\u0443\u043d\u0434\u044b");
(function(){var a=Ext.ux.form,b=Ext.isIE7&&Ext.isStrict,d=Ext.extend(Ext.menu.Menu,{enableScrolling:!1,hideOnClick:!1,plain:!0,showSeparator:!1,constructor:function(a,b){b=b||{};b.picker&&delete b.picker;this.picker=Ext.create(a);d.superclass.constructor.call(this,Ext.applyIf({items:this.picker},b));this.addEvents("timeselect");this.picker.on("select",this.onTimeSelect,this)},getPicker:function(){return this.picker},onTimeSelect:function(a,b){this.hide();this.fireEvent("timeselect",this,a,b)},destroy:function(){this.purgeListeners();
this.picker=null;d.superclass.destroy.call(this)}});Ext.define("Ext.ux.form.AdvTimeField",{extend:"Ext.m3.AdvancedDataField",xtype:"advtimefield",timeFormat:"H:i:s",defaultAutoCreate:{tag:"input",type:"text",size:"22",autocomplete:"off"},initComponent:function(){a.AdvTimeField.superclass.initComponent.call(this);this.dateFormat=this.dateFormat||this.format;var b=this._createPicker();this.format=this.timeFormat;this.menu=new d(b,{hideOnClick:!1});this.menu.on("timeselect",this.onTimeSelect,this)},
_createPicker:function(){var a=this.initialConfig.picker||{};Ext.apply(a,{ctCls:"x-menu-date-item",internalRender:b||!Ext.isIE});Ext.applyIf(a,{timeFormat:this.timeFormat});return Ext.create(a,"basetimepicker")},onTriggerClick:function(){a.AdvTimeField.superclass.onTriggerClick.apply(this,arguments);this.menu.picker.setValue(this.getValue()||new Date)},onTimeSelect:function(a,b,d){this._updateTimeValue(b,d)},_updateTimeValue:function(a){var b=this.getValue()||new Date;b.setHours(a.hourSlider.getValue());
b.setMinutes(a.minSlider.getValue());b.setSeconds(a.secSlider.getValue());this.setValue(b)},setValue:function(b){a.AdvTimeField.superclass.setValue.call(this,b)}})})();
Ext.define("Ext.ux.form.FileUploadField",{extend:"Ext.form.TextField",xtype:"fileuploadfield",readOnlyButton:!1,readOnly:!0,autoSize:Ext.emptyFn,iconClsSelectFile:"x-form-file-icon",iconClsClearFile:"x-form-file-clear-icon",iconClsDownloadFile:"x-form-file-download-icon",fileUrl:null,possibleFileExtensions:null,prefixUploadField:"file_",initComponent:function(){Ext.ux.form.FileUploadField.superclass.initComponent.call(this);this.addEvents("fileselected","change","beforechange")},onRender:function(a,
b){Ext.ux.form.FileUploadField.superclass.onRender.call(this,a,b);this.value=this.getFileName();this.wrap=this.el.wrap({cls:"x-form-field-wrap x-form-file-wrap"});this.el.addClass("x-form-file-text");this.createFileInput();var d=Ext.applyIf(this.buttonCfg||{},{iconCls:this.iconClsSelectFile});this.buttonFile=new Ext.Button(Ext.apply(d,{renderTo:this.wrap,width:16,cls:"x-form-file-btn"+(d.iconCls?" x-btn-icon":""),tooltip:{text:"\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0444\u0430\u0439\u043b",
width:150}}));this.buttonClear=new Ext.Button({renderTo:this.wrap,width:16,cls:"x-form-file-clear",iconCls:this.iconClsClearFile,handler:this.clickClearField,scope:this,hidden:this.value?!1:!0,tooltip:{text:"\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c",width:65}});this.renderHelperBtn();this.bindListeners();this.resizeEl=this.positionEl=this.wrap;this.readOnlyButton&&(this.buttonFile.setDisabled(!0),this.buttonFile.getEl().setStyle("z-index",3),this.buttonClear.setDisabled(!0),this.getHelperBtn()&&
this.getHelperBtn().setDisabled(!0))},renderHelperBtn:function(){this.buttonDownload=new Ext.Button({renderTo:this.wrap,width:16,cls:"x-form-file-download",iconCls:this.iconClsDownloadFile,handler:this.clickDownload,scope:this,hidden:this.value?!1:!0,tooltip:{text:"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c",width:65}})},getHelperBtn:function(){return this.buttonDownload},bindListeners:function(){this.fileInput.on({scope:this,mouseenter:function(){this.buttonFile.addClass(["x-btn-over",
"x-btn-focus"])},mouseleave:function(){this.buttonFile.removeClass(["x-btn-over","x-btn-focus","x-btn-click"])},mousedown:function(){this.buttonFile.addClass("x-btn-click")},mouseup:function(){this.buttonFile.removeClass(["x-btn-over","x-btn-focus","x-btn-click"])},change:function(){if(this.isFileExtensionOK()){var a=this.fileInput.dom.value;this.fireEvent("beforechange",this,a)&&(this.setValue(a),this.fireEvent("fileselected",this,a),this.fireEvent("change",this,a),a&&(this.fileUrl=null,this.buttonClear.isVisible()||
(this.buttonClear.show(),this.el.setWidth(this.el.getWidth()-this.buttonClear.getWidth()))))}else Ext.Msg.show({title:"\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435",msg:"\u041d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430",buttons:Ext.Msg.OK,fn:Ext.emptyFn,animEl:"elId",icon:Ext.MessageBox.WARNING}),this.reset()}})},createFileInput:function(){this.fileInput=this.wrap.createChild({id:this.getFileInputId(),
name:(this.prefixUploadField||"")+this.name,cls:"x-form-file",tag:"input",type:"file",size:1,width:20});Ext.QuickTips.unregister(this.fileInput);Ext.QuickTips.register({target:this.fileInput,text:"\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0444\u0430\u0439\u043b",width:86,dismissDelay:1E4})},reset:function(){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);a=this.wrap.getWidth()-this.buttonFile.getEl().getWidth();var d=this.buttonClear.getWidth();d&&(a-=d);(d=this.getHelperBtn()?this.getHelperBtn().getWidth():0)&&(a-=d);Ext.isWebKit?this.el.setWidth(a+5):this.el.setWidth(a)},onDestroy:function(){Ext.ux.form.FileUploadField.superclass.onDestroy.call(this);Ext.QuickTips.unregister(this.fileInput);Ext.destroy(this.fileInput,this.buttonFile,this.buttonClear,this.getHelperBtn(),
this.wrap)},onDisable:function(){Ext.ux.form.FileUploadField.superclass.onDisable.call(this);this.doDisable(!0)},onEnable:function(){Ext.ux.form.FileUploadField.superclass.onEnable.call(this);this.doDisable(!1)},doDisable:function(a){this.fileInput.dom.disabled=a;this.buttonFile.setDisabled(a);this.buttonClear.setDisabled(a);this.getHelperBtn()&&this.getHelperBtn().setDisabled(a)},preFocus:Ext.emptyFn,alignErrorIcon:function(){this.errorIcon.alignTo(this.wrap,"tl-tr",[2,0])},clickClearField:function(){this.fireEvent("beforechange",
this,"")&&this.clearFeild()},clearFeild:function(){this.reset();this.setValue("");this.fireEvent("change",this,"");var a=this.el.getWidth()+this.buttonClear.getWidth();this.getHelperBtn()&&(a+=this.getHelperBtn().isVisible()?this.getHelperBtn().getWidth():0,this.getHelperBtn().hide());this.el.setWidth(a);this.buttonClear.hide()},getFileUrl:function(a){return document.location.protocol+"//"+document.location.host+"/"+a},clickDownload:function(){var a=this.getFileUrl(this.fileUrl);a&&window.open(a)},
getFileName:function(){return this.value?this.value.split("/").reverse()[0]:""},isFileExtensionOK:function(){var a=this.fileInput.dom.value.split(".");return 0<a.length?this.possibleFileExtensions?-1!=this.possibleFileExtensions.split(",").indexOf(a[a.length-1].toLowerCase()):!0:!1},setReadOnly:function(a){Ext.ux.form.FileUploadField.superclass.setReadOnly.call(this,a)}});Ext.form.FileUploadField=Ext.ux.form.FileUploadField;
Ext.define("Ext.ux.form.ImageUploadField",{extend:"Ext.form.FileUploadField",xtype:"imageuploadfield",iconClsSelectFile:"x-form-image-icon",iconClsClearFile:"x-form-image-clear-icon",iconClsPreviewImage:"x-form-image-preview-icon",thumbnailSize:[300,300],prefixThumbnailImg:null,thumbnail:!0,initComponent:function(){Ext.ux.form.ImageUploadField.superclass.initComponent.call(this);if(this.fileUrl){var a=this.fileUrl.split("/"),b=a.slice(0,a.length-1),a=a[a.length-1],d=this.prefixThumbnailImg||"",b=
String.format("{0}/{1}{2}",b.join("/"),d,a);this.fileUrl&&(this.previewTip=new Ext.QuickTip({id:"preview_tip_window",html:String.format('<a href="{0}" rel="lightbox"><image src="{1}" WIDTH={2} HEIGHT={3} OnClick=Ext.getCmp("preview_tip_window").hide()></a>',this.fileUrl,this.getFileUrl(b),this.thumbnailSize[0],this.thumbnailSize[1]),autoHide:!1,width:this.thumbnailSize[0]+10,height:this.thumbnailSize[1]+10}))}},renderHelperBtn:function(){this.thumbnail&&(this.buttonPreview=new Ext.Button({renderTo:this.wrap,
width:16,cls:"x-form-file-download",iconCls:this.iconClsPreviewImage,handler:this.clickHelperBtn,scope:this,hidden:this.value?!1:!0,tooltip:{text:"\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u043a\u0430\u0437",width:140}}))},getHelperBtn:function(){return this.buttonPreview},clickHelperBtn:function(){var a=this.getEl(),b=a.getXY();this.previewTip.showAt([b[0],b[1]+a.getHeight()])},createFileInput:function(){this.fileInput=this.wrap.createChild({id:this.getFileInputId(),
name:(this.prefixUploadField||"")+this.name,cls:"x-form-file",tag:"input",type:"file",size:1,width:20});Ext.QuickTips.unregister(this.fileInput);Ext.QuickTips.register({target:this.fileInput,text:"\u0412\u044b\u0431\u0440\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435",width:130,dismissDelay:1E4})},onDestroy:function(){Ext.ux.form.ImageUploadField.superclass.onDestroy.call(this);Ext.destroy(this.previewTip)}});Ext.ux.Lightbox.register("a[rel^=lightbox]");
Ext.define("Ext.Window",{override:"Ext.Window",manager:new Ext.WindowGroup,constrain:!0,listeners:{beforeshow:function(){var a=Ext.get(this.renderTo);a&&a.getHeight()<this.getHeight()&&this.setHeight(a.getHeight())}}});
Ext.override(Ext.ux.tree.TreeGrid,{fitColumns:function(){var a=this.getInnerWidth()-Ext.num(this.scrollOffset,Ext.getScrollBarWidth()),b=this.getTotalColumnWidth(),d=this.getVisibleColumns(),e,f=0;for(e=0;e<d.length;e++){if(e==d.length-1){d[e].width=a-f-1;break}d[e].width=Math.floor(a/100*(100*d[e].width/b))-1;f+=d[e].width}this.updateColumnWidths()},onResize:function(a,b){Ext.ux.tree.TreeGrid.superclass.onResize.apply(this,arguments);var d=this.innerBody.dom,e=this.innerHd.dom;if(d){Ext.isNumber(b)&&
(d.style.height=this.body.getHeight(!0)-e.offsetHeight+"px");if(Ext.isNumber(a)){var f=Ext.num(this.scrollOffset,Ext.getScrollBarWidth());if(this.reserveScrollOffset||10<d.offsetWidth-d.clientWidth)this.setScrollOffset(f);else{var g=this;setTimeout(function(){g.setScrollOffset(10<d.offsetWidth-d.clientWidth?f:0)},10)}}this.fitColumns()}}});
Ext.override(Ext.tree.ColumnResizer,{onEnd:function(){var a=this.proxy.getWidth(),b=this.tree;this.proxy.remove();delete this.dragHd;b.columns[this.hdIndex].width=a;b.fitColumns();setTimeout(function(){b.headersDisabled=!1},100)}});Ext.override(Ext.tree.TreeNodeUI,{onDblClick:function(a){a.preventDefault();this.disabled||!1===this.fireEvent("beforedblclick",this.node,a)||(this.checkbox&&this.toggleCheck(),this.fireEvent("dblclick",this.node,a))}});
Ext.override(Ext.form.Action.Submit,{run:function(){var a=this.options,b=this.getMethod(),d="GET"==b;if(!1===a.clientValidation||this.form.isValid()){if(!1===a.submitEmptyText){var e=[],f=function(a){a.rendered&&a.el.getValue()==a.emptyText&&(e.push(a),a.el.dom.value="");a.isComposite&&a.items.each(f)};this.form.items.each(f)}Ext.Ajax.request(Ext.apply(this.createCallback(a),{form:this.form.el.dom,url:this.getUrl(d),method:b,headers:a.headers,params:d?null:this.getParams(),isUpload:this.form.fileUpload}));
!1===a.submitEmptyText&&Ext.each(e,function(a){a.applyEmptyText&&a.applyEmptyText()})}else!1!==a.clientValidation&&(this.failureType=Ext.form.Action.CLIENT_INVALID,this.form.afterAction(this,!1))}});Ext.override(Ext.form.Checkbox,{onClick:function(a){if(this.readOnly)return a.stopEvent(),!1;this.el.dom.checked!=this.checked&&this.setValue(this.el.dom.checked)}});Ext.override(Ext.PagingToolbar,{onPagingBlur:Ext.emptyFn});
(Ext.isIE7||Ext.isIE6)&&Ext.Panel.override({setAutoScroll:function(){if(this.rendered&&this.autoScroll){var a=this.body||this.el;a&&(a.setOverflow("auto"),a.dom.style.position="relative")}}});
Ext.override(Ext.ux.tree.TreeGridNodeUI,{renderElements:function(a,b,d,e){var f=a.getOwnerTree(),g=Ext.isBoolean(b.checked),h=f.columns,k=h[0],l,m,n;this.indentMarkup=a.parentNode?a.parentNode.ui.getChildIndent():"";m=['<tbody class="x-tree-node">','<tr ext:tree-node-id="',a.id,'" class="x-tree-node-el x-tree-node-leaf x-unselectable ',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" />',g?'<input class="x-tree-node-cb" type="checkbox" '+(b.checked?'checked="checked" />':"/>"):"",'<a hidefocus="on" class="x-tree-node-anchor" href="',b.href?b.href:"#",'" tabIndex="1" ',b.hrefTarget?' target="'+b.hrefTarget+'"':"",">",'<span unselectable="on">',k.tpl?k.tpl.apply(b):b[k.dataIndex]||k.text,"</span></a>","</td>"];l=1;for(n=h.length;l<
n;l++)k=h[l],m.push('<td class="x-treegrid-col ',k.cls?k.cls:"",'">','<div unselectable="on" class="x-treegrid-text"',k.align?' style="text-align: '+k.align+';"':"",">",k.tpl?k.tpl.apply(b):b[k.dataIndex],"</div>","</td>");m.push('</tr><tr class="x-tree-node-ct"><td colspan="',h.length,'">','<table class="x-treegrid-node-ct-table" cellpadding="0" cellspacing="0" style="table-layout: fixed; display: none; width: ',f.innerCt.getWidth(),'px;"><colgroup>');l=0;for(n=h.length;l<n;l++)m.push('<col style="width: ',
h[l].hidden?0:h[l].width,'px;" />');m.push("</colgroup></table></td></tr></tbody>");!0!==e&&a.nextSibling&&a.nextSibling.ui.getEl()?this.wrap=Ext.DomHelper.insertHtml("beforeBegin",a.nextSibling.ui.getEl(),m.join("")):this.wrap=Ext.DomHelper.insertHtml("beforeEnd",d,m.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];b=3;g&&(this.checkbox=a[3],this.checkbox.defaultChecked=
this.checkbox.checked,b++);this.anchor=a[b];this.textNode=a[b].firstChild}});Ext.override(Ext.ux.tree.TreeGrid,{getChecked:function(a,b){b=b||this.root;var d=[];b.cascade(function(){this.attributes.checked&&d.push(a?"id"==a?this.id:this.attributes[a]:this)});return d}});Ext.apply(Ext,function(){return{BLANK_IMAGE_URL:Ext.isIE6||Ext.isIE7||Ext.isAir?"/m3static/vendor/extjs/resources/images/default/s.gif":"data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="}}());
Ext.override(Ext.form.ComboBox,{findRecord:function(a,b){var d;0<this.store.getCount()&&this.store.each(function(e){if(String(e.data[a])==String(b))return d=e,!1});return d}});
(function(){function a(a){a?(this.addClass("m3-grey-field"),this.el.dom.setAttribute("readonly","")):(this.removeClass("m3-grey-field"),this.el.dom.removeAttribute("readonly"))}var b=Ext.form.Field.prototype.setReadOnly.bind({});Ext.define("Ext.form.Field",{override:"Ext.form.Field",setReadOnly:function(d){b(d);a.call(this,d)}});var d=Ext.form.TriggerField.prototype.setReadOnly;Ext.define("Ext.form.TriggerField",{override:"Ext.form.TriggerField",setReadOnly:function(b){d.call(this,b);a.call(this,
b)}})})();
Ext.override(Ext.grid.GridView,{fitColumns:function(a,b,d){b=this.cm;var e=b.getTotalWidth(!1),f=this.getGridInnerWidth(),g=[],h=0,k=0,l;if(20>f||0===f-e)return!1;var m=b.getColumnCount(!0),n=b.getColumnCount(!1),p=m-(Ext.isNumber(d)?1:0);0===p&&(p=1,d=void 0);for(l=0;l<n;l++)b.isFixed(l)||l===d||(e=b.getColumnWidth(l),g.push(l,e),b.isHidden(l)||(h=l,k+=e));for(k=(f-b.getTotalWidth())/k;g.length;)e=g.pop(),l=g.pop(),b.setColumnWidth(l,Math.floor(e+e*k),!0);e=b.getTotalWidth(!1);e>f&&(d=p==m?h:d,f=
Math.max(1,b.getColumnWidth(d)-(e-f)),b.setColumnWidth(d,f,!0));!0!==a&&this.updateAllColumnWidths();return!0}});Ext.define("Ext.Component",{override:"Ext.Component",setBlocked:Ext.emptyFn,getContext:function(){Ext.isFunction(this._getContext)||this.fireEvent("getcontext",this);if(Ext.isFunction(this._getContext))return this._getContext()}});Ext.define("Ext.form.Field",{override:"Ext.form.Field",setBlocked:function(a,b){includeInArr(b,this.itemId)||this.setReadOnly(a)}});
Ext.define("Ext.menu.Item",{override:"Ext.menu.Item",bubbleEvents:["gethandler"],initComponent:Ext.menu.Item.prototype.initComponent.createSequence(function(){"string"===typeof this.handler&&(this.un("click",this.handler,this.scope),this.fireEvent("gethandler",this,this.handler),this.on("click",this.handler,this.scope))}),setBlocked:function(a,b){includeInArr(b,this.itemId)||this.setDisabled(a)}});
Ext.define("Ext.Ajax",{override:"Ext.Ajax",request:Ext.Ajax.request.createInterceptor(function(a){Ext.iterate(a.params,function(b,d){if(Ext.isObject(d)||Ext.isArray(d))a.params[b]=Ext.encode(d)});return a})});
Ext.define("Ext.form.TextField",{override:"Ext.form.TextField",initComponent:Ext.form.TextField.prototype.initComponent.createInterceptor(function(){this.maxLength&&this.maxLength!=Number.MAX_VALUE&&(this.autoCreate=Ext.applyIf({tag:"input",type:"text",maxlength:this.maxLength},this.autoCreate));this.maskRe&&Ext.isString(this.maskRe)&&(this.maskRe=RegExp(this.maskRe))})});
