Ext.ux.Reorderer=Ext.extend(Object,{defaults:{animate:true,animationDuration:0.2,defaultReorderable:false},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;if(b.fireEvent("before-reorder",a,b,this)!==false){this.doReorder(a);b.fireEvent("reorder",a,b,this)}},doReorder:function(){throw Error("doReorder must be implemented in the Ext.ux.Reorderer subclass");
},createItemDD:function(){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,undefined,{isTarget:false});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(){for(var f=b.getXY()[0],g=f-this.startPosition[0],h=d.items.items,
j=h.indexOf(a),k=0;k<h.length;k++){var l=h[k];if(l.reorderable&&l.id!=a.id){var m=l.getEl().getBox();m=(e.buttonXCache[l.id]||m.x)+m.width/2;l=j>k&&g<0&&f<m;m=j<k&&g>0&&f+b.getWidth()>m;if(l||m){e[l?"onMovedLeft":"onMovedRight"](a,k,j);break}}}},endDrag:function(){e.updateButtonXCache();b.moveTo(e.buttonXCache[a.id],undefined,{duration:e.animationDuration,scope:this,callback:function(){a.resumeEvents();d.fireEvent("reordered",a,d)}});b.setStyle("zIndex",this.startZIndex)}})},createIfReorderable:function(a){if(this.defaultReorderable&&
a.reorderable==undefined)a.reorderable=true;if(a.reorderable&&!a.dd)a.rendered?this.createItemDD(a):a.on("render",this.createItemDD.createDelegate(this,[a]),this,{single:true})},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(b,d){this.createIfReorderable(d)}});Ext.ux.HBoxReorderer.superclass.init.apply(this,arguments)},createItemDD:function(a){if(a.dd==undefined){var b=a.getEl(),d=this,e=d.target;a.dd=new Ext.dd.DD(b,undefined,{isTarget:false});b.applyStyles({position:"absolute"});var f=function(){return false};Ext.apply(a.dd,{b4StartDrag:function(){this.startPosition=b.getXY();this.startZIndex=b.getStyle("zIndex");
b.setStyle("zIndex",1E4);a.suspendEvents();a.menu&&a.menu.on("beforeshow",f,d)},startDrag:function(){this.constrainTo(e.getEl());this.setYConstraint(0,0,0)},onDrag:function(){var g=b.getXY()[0],h=g-this.startPosition[0],j=e.items.items,k=j.length,l=j.indexOf(a),m,n;for(m=0;m<k;m++){n=j[m];if(n.reorderable&&n.id!=a.id){var o=n.getEl().getBox();o=(d.buttonXCache[n.id]||o.x)+o.width/2;n=l>m&&h<0&&g<o;o=l<m&&h>0&&g+b.getWidth()>o;if(n||o){d[n?"onMovedLeft":"onMovedRight"](a,m,l);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(b!=undefined&&b!=d){e.remove(a,false);e.insert(b,a);this.updateButtonXCache();for(b=0;b<g;b++){e=f[b];d=this.buttonXCache[e.id];if(a==e)a.dd.startPosition[0]=d;else{e=e.getEl();e.moveTo(d,e.getY(),
{duration:this.animationDuration})}}}},onMovedRight:function(){this.onMovedLeft.apply(this,arguments)},updateButtonXCache:function(){var a=this.target,b=a.items,d=a.getEl().getBox(true).x;b.each(function(e){this.buttonXCache[e.id]=d;d+=e.getEl().getWidth()},this)}});Ext.ns("Ext.ux.plugins.grid");
Ext.ux.plugins.grid.CellToolTips=function(a){var b;if(Ext.isArray(a)){b=a;a={}}else b=a.ajaxTips;Ext.ux.plugins.grid.CellToolTips.superclass.constructor.call(this,a);if(a.tipConfig)this.tipConfig=a.tipConfig;this.ajaxTips=b};
Ext.extend(Ext.ux.plugins.grid.CellToolTips,Ext.util.Observable,{version:1.3,ajaxTips:false,tipTpls:false,tipFns:false,tipUrls:"",tipConfig:{},request:false,init:function(a){if(this.ajaxTips){this.tipTpls={};this.tipFns={};this.tipAfterFns={};this.tipUrls={};Ext.each(this.ajaxTips,function(b){this.tipTpls[b.field]=new Ext.XTemplate(b.tpl);if(b.url)this.tipUrls[b.field]=b.url;if(b.fn)this.tipFns[b.field]=b.fn;if(b.afterFn)this.tipAfterFns[b.field]=b.afterFn;if(b.tipConfig)this.tipConfig=b.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){if(this.tipTpls){Ext.apply(this.tipConfig,{target:a.getView().mainBody,delegate:".x-grid3-cell-inner",renderTo:document.body,finished:false});Ext.applyIf(this.tipConfig,{trackMouse:true});this.tip=new Ext.ToolTip(this.tipConfig);this.tip.ctt=this;this.tip.on("beforeshow",this.beforeTipShow.createDelegate(this.tip,
[this,a],true));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 false;if(a.finished)a.body.dom.innerHTML=a.ctt.tipTpls[e].apply(a.tipdata);else{var f=typeof b.tipUrls[e]=="string",g=d.getView().findRowIndex(a.triggerElement),h=d.getStore().getAt(g);if(d.CellToolTipCondition&&d.CellToolTipCondition(g,h)===false)return false;g=h.copy().data;if(f){b.loadDetails(b.tipFns[e]?
b.tipFns[e](g):g,a,d,b,e);a.body.dom.innerHTML="Loading..."}else a.body.dom.innerHTML=b.tipTpls[e].apply(b.tipFns[e]?b.tipFns[e](h.data):h.data)}},hideTip:function(a){a.finished=false},loadDetails:function(a,b,d,e,f){Ext.Ajax.request({url:e.tipUrls[f],params:a,method:"POST",success:function(g){b.finished=true;b.tipdata=Ext.decode(g.responseText);if(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:true,highlightColor:"yellow",highlightCls:null,stateful:true,applyMode:"auto",filters:null,filtersInitMode:"replace",ensureFilteredVisible:true,cfgFilterInit:false,containerConfig:null,labelWidth:50,fcc:null,filterFields:null,filterContainers:null,filterContainerCls:"x-ghf-filter-container",inResizeProcess:false,init:function(a){this.grid=a;a=this.grid.getView();a.updateHeaders=a.updateHeaders.createSequence(function(){this.renderFilters.call(this)},
this).createInterceptor(function(){return true},this);this.grid.on({scope:this,render:this.onRender,resize:this.onResize,columnresize:this.onColResize,reconfigure:this.onReconfigure,beforedestroy:this.destroyFilters});if(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:true});this.cfgFilterInit=Ext.isDefined(this.filters)&&
this.filters!==null;if(!this.filters)this.filters={};this.configure(this.grid.getColumnModel());Ext.ux.grid.GridHeaderFilters.superclass.constructor.call(this);if(this.stateful){if(!Ext.isArray(this.grid.stateEvents))this.grid.stateEvents=[];this.grid.stateEvents.push("filterupdate")}Ext.apply(this.grid,{headerFilters:this,getHeaderFilter:function(b){if(!this.headerFilters)return null;return this.headerFilters.filters[b]},setHeaderFilter:function(b,d){if(this.headerFilters){var e={};e[b]=d;this.setHeaderFilters(e)}},
setHeaderFilters:function(b,d,e){if(this.headerFilters){d&&this.resetHeaderFilters(false);if(arguments.length<3)e=true;var f=false,g;for(g in b)if(this.headerFilters.filterFields[g]){f=this.headerFilters.filterFields[g];this.headerFilters.setFieldValue(f,b[g]);this.headerFilters.applyFilter(f,false);f=true}f&&e&&this.headerFilters.storeReload()}},getHeaderFilterField:function(b){if(this.headerFilters)return this.headerFilters.filterFields[b]?this.headerFilters.filterFields[b]:null},resetHeaderFilters:function(b){if(this.headerFilters){if(arguments.length==
0)b=true;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,false)}b&&this.headerFilters.storeReload()}},applyHeaderFilters:function(b){if(arguments.length==0)b=true;this.headerFilters.applyFilters(b)}})},configure:function(a){a=a.getColumnsBy(function(j){return Ext.isObject(j.filter)||Ext.isArray(j.filter)?true:false});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:f>0?d.dataIndex+f:d.dataIndex},e[f]);Ext.apply(g,{columnId:d.id,dataIndex:d.dataIndex,hideLabel:true,anchor:"100%"});if(!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(j){this.applyFilter(j)};delete g.applyFilterEvent}else if(this.applyMode===
"auto"||this.applyMode==="change"||Ext.isEmpty(this.applyMode))if(g.hasListener!=undefined){g.hasListener("change")||g.on("change",function(j){var k=j.getValue();if(String(j.startValue)!==String(k)){k=j.getXType();k=="combo"||k=="datefield"||this.applyFilter(j)}},this);g.hasListener("specialkey")||g.on("specialkey",function(j,k){k.stopPropagation();if(k.getKey()==k.ENTER){this.focusedFilterName=j.filterName;j.el.dom.blur()}},this);g.hasListener("select")||g.on("select",function(j){this.focusedFilterName=
j.filterName;this.applyFilter(j)},this)}else g.listeners={change:function(j){var k=j.getValue();if(String(j.startValue)!==String(k)){k=j.getXType();k=="combo"||k=="datefield"||this.applyFilter(j)}},specialkey:function(j,k){k.stopPropagation();if(k.getKey()==k.TAB)this.focusedFilterName=undefined;if(k.getKey()==k.ENTER)this.focusedFilterName=j.filterName},select:function(j){this.focusedFilterName=j.filterName;this.applyFilter(j)},scope:this};else if(this.applyMode==="enter")g.listeners={specialkey:function(j,
k){k.stopPropagation();if(k.getKey()==k.ENTER){this.focusedFilterName=j.filterName;this.applyFilters()}if(k.getKey()==k.TAB)this.focusedFilterName=undefined},scope:this};var h=this.fcc[g.columnId];if(!h){h={cls:this.filterContainerCls,border:false,bodyBorder:false,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:false,bodyBorder:false,layout:"form",padding:2,margins:"0 0 -4 0",flex:1,items:[g]})}}},renderFilterContainer:function(a,b){if(!this.filterContainers)this.filterContainers={};var d=this.grid.getColumnModel().getIndexById(a),e=this.grid.getView().getHeaderCell(d);e=Ext.get(e);if(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);if(Ext.isIE||window.navigator.userAgent.match(/(Trident|Edge)/)){d.setWidth(b.width<
3?0:b.width-3);d.doLayout(false,true)}this.filterContainers[a]=d;e=0;if(!this.filterFields)this.filterFields={};var f=d.findBy(function(h){return!Ext.isEmpty(h.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},setIsNotRendered:function(a){if(a.items)for(var b in a.items)this.setIsNotRendered(a.items[b]);else if(a.rendered)a.rendered=false},renderFilters:function(){if(this.fcc){for(var a in this.fcc){Ext.isIE&&this.setIsNotRendered(this.fcc[a]);
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(false);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];if(Ext.isEmpty(f))b&&this.setFieldValue(e,"");else this.setFieldValue(e,f)}}},onColResize:function(a,b){if(this.filterContainers){if(!this.inResizeProcess)if(this.grid.viewConfig&&this.grid.viewConfig.forceFit){this.onResize();return}var d=this.filterContainers[this.grid.getColumnModel().getColumnId(a)];if(d){if(isNaN(b))b=0;d.setWidth(b<3?0:b-3);d.doLayout(false,true)}}},onResize:function(){this.inResizeProcess=true;
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=false},onColHidden:function(a,b,d){if(!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 true},loadFilters:function(a,
b){var d=b.gridHeaderFilters;if(d)if(this.cfgFilterInit)this.filtersInitMode==="merge"&&Ext.apply(d,this.filters);else this.filters=d},isFiltered:function(){for(var a in this.filters)if(!Ext.isEmpty(this.filters[a]))return true;return false},highlightFilters:function(a){if(this.highlightOnFilter)if(this.filterContainers)if(this.grid.getView().mainHd){var b=a?this.highlightColor:"transparent",d;for(d in this.filterContainers){var e=this.filterContainers[d];if(e.rendered)if(Ext.isEmpty(this.highlightCls))e.getEl().setStyle("backgroundColor",
b);else 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){if(Ext.isFunction(a.filterDecoder))b=a.filterDecoder.call(a,b);a.setValue(b)},applyFilter:function(a,b){if(arguments.length<2)b=true;if(a)if(a.isValid())if(!(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{this.grid.store.baseParams[a.filterName]=d;this.filters[a.filterName]=d;if(this.ensureFilteredVisible){var e=this.grid.getColumnModel().getIndexById(a.columnId);e>=0&&this.grid.getColumnModel().isHidden(e)&&this.grid.getColumnModel().setHidden(e,false)}}this.highlightFilters(this.isFiltered());this.grid.fireEvent("filterupdate",a.filterName,d,a);a.startValue=d;b&&this.storeReload()}},applyFilters:function(a){if(arguments.length<
1)a=true;for(var b in this.filterFields)this.applyFilter(this.filterFields[b],false);a&&this.storeReload()},storeReload:function(){if(this.grid.store.lastOptions){var a={start:0};if(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.ns("Ext.ux.grid");
Ext.ux.grid.LockingHeaderGroupGridView=Ext.extend(Ext.grid.GridView,{lockText:"Lock",unlockText:"Unlock",rowBorderWidth:1,lockedBorderWidth:1,syncHeights:false,initTemplates:function(){var a=this.templates||{};if(!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>");if(!a.gcell)a.gcell=
new Ext.XTemplate('<td class="x-grid3-hd x-grid3-gcell x-grid3-td-{id} ux-grid-hd-group-row-{row} {cls}" style="{style}">','<div {tooltip} class="x-grid3-hd-inner x-grid3-hd-{id}" unselectable="on" style="{istyle}">',this.grid.enableHdMenu?'<a class="x-grid3-hd-btn" href="#"></a>':"","{value}</div></td>");this.templates=a;this.hrowRe=/ux-grid-hd-group-row-(\d+)/;Ext.ux.grid.LockingHeaderGroupGridView.superclass.initTemplates.call(this)},getEditorParent:function(){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);if(this.grid.hideHeaders){this.lockedHd.setDisplayed(false);this.mainHd.setDisplayed(false)}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",true)},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();if(b<d)return this.getLockedRow(a).getElementsByTagName("td")[b];return Ext.ux.grid.LockingHeaderGroupGridView.superclass.getCell.call(this,a,b-d)},getHeaderCell:function(a){var b=this.cm.getLockedCount();if(a<b)return this.lockedHd.dom.getElementsByTagName("td")[a];return 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[b=="DESC"?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 j=this.getLockedRows(),k=this.getRows(),l,m;h=0;for(g=k.length;h<g;h++){l=j[h];l.style.width=d;if(l.firstChild){l.firstChild.style.width=d;l=l.firstChild.rows[0];for(m=0;m<e;m++)l.childNodes[m].style.width=f[m]}l=k[h];l.style.width=a;if(l.firstChild){l.firstChild.style.width=a;l=l.firstChild.rows[0];for(m=e;m<b;m++)l.childNodes[m-e].style.width=f[m]}}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){var b=this.getColumnWidth(a),d=this.cm.getLockedCount(),e,f,g;this.updateLockedWidth();if(a<d){e=this.getLockedRows();f=
this.getLockedWidth();d=a}else{e=this.getRows();f=this.getTotalWidth();d=a-d}this.getHeaderCell(a).style.width=b;for(var h=0,j=e.length;h<j;h++){g=e[h];g.style.width=f;if(g.firstChild){g.firstChild.style.width=f;g.firstChild.rows[0].childNodes[d].style.width=b}}this.onColumnWidthUpdated(a,b,this.getTotalWidth());this.syncHeaderHeight()},updateColumnHidden:function(a,b){var d=this.cm.getLockedCount(),e,f,g,h=b?"none":"";this.updateLockedWidth();if(a<d){e=this.getLockedRows();f=this.getLockedWidth();
d=a}else{e=this.getRows();f=this.getTotalWidth();d=a-d}this.getHeaderCell(a).style.display=h;for(var j=0,k=e.length;j<k;j++){g=e[j];g.style.width=f;if(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){var h=this.templates,j=h.cell;h=h.row;for(var k=f-1,l="width:"+this.getTotalWidth()+";",m="width:"+this.getLockedWidth()+";",n=[],o=
[],p,s,t,q={},u={},v,x=0,y=b.length;x<y;x++){v=b[x];p=[];s=[];for(var z=x+e,w=0;w<f;w++){t=a[w];q.id=t.id;q.css=(w===0?"x-grid3-cell-first ":w==k?"x-grid3-cell-last ":"")+(this.cm.config[w].cellCls?" "+this.cm.config[w].cellCls:"");q.attr=q.cellAttr="";q.value=t.renderer(v.data[t.name],q,v,z,w,d);q.style=t.style;if(Ext.isEmpty(q.value))q.value="&#160;";if(this.markDirty&&v.dirty&&Ext.isDefined(v.modified[t.name]))q.css+=" x-grid3-dirty-cell";if(t.locked)s[s.length]=j.apply(q);else p[p.length]=j.apply(q)}t=
[];if(g&&(z+1)%2===0)t[0]="x-grid3-row-alt";if(v.dirty)t[1]=" x-grid3-dirty-row";u.cols=f;if(this.getRowClass)t[2]=this.getRowClass(v,z,u,d);u.alt=t.join(" ");u.cells=p.join("");u.tstyle=l;n[n.length]=h.apply(u);u.cells=s.join("");u.tstyle=m;o[o.length]=h.apply(u)}return[n.join(""),o.join("")]},processRows:function(a,b){if(!(!this.ds||this.ds.getCount()<1)){var d=this.getRows(),e=this.getLockedRows(),f,g;b=b||!this.grid.stripeRows;a=a||0;for(var h=0,j=d.length;h<j;++h){f=d[h];g=e[h];f.rowIndex=h;
g.rowIndex=h;if(!b){f.className=f.className.replace(this.rowClsRe," ");g.className=g.className.replace(this.rowClsRe," ");if((h+1)%2===0){f.className+=" x-grid3-row-alt";g.className+=" x-grid3-row-alt"}}if(this.syncHeights){f=Ext.get(f);g=Ext.get(g);var k=f.getHeight(),l=g.getHeight();if(k>l)g.setHeight(k);else l>k&&f.setHeight(l)}}if(a===0){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,true);this.deferEmptyText!==true&&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);if(b.enableColumnResize!==
false){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))}if(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)}if(b.enableHdMenu!==false){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"});this.grid.enableColLock!==false&&this.hmenu.add("-",{itemId:"lock",text:this.lockText,cls:"xg-hmenu-lock"},{itemId:"unlock",text:this.unlockText,cls:"xg-hmenu-unlock"});if(b.enableColumnHide!==false){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:false,text:this.columnsText,menu:this.colMenu,iconCls:"x-cols-icon"})}this.hmenu.on("itemclick",this.handleHdMenuClick,this)}if(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,true).hasClass("ux-grid-hd-group-cell")}},columnDropConfig:{getTargetFromEvent:function(a){return this.view.findHeaderCell(Ext.lib.Event.getTarget(a))},positionIndicator:function(a,b,d){a=this.getDragDropData.call(this,a,b,d);if(a===false)return false;b=a.px+this.proxyOffsets[0];this.proxyTop.setLeftTop(b,a.r.top+this.proxyOffsets[1]);this.proxyTop.show();this.proxyBottom.setLeftTop(b,a.r.bottom);this.proxyBottom.show();return a.pt},onNodeDrop:function(a,b,d,e){b=e.header;if(b!=a){a=this.getDragDropData.call(this,
b,a,d);if(a===false)return false;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],j=h.length,k=0,l=1,m=j,n=0,o=0;n<j;n++){var p=h[n];if(a.oldIndex>=o&&a.oldIndex<o+p.colspan)k=n;if(a.oldIndex+a.colspan-1>=o&&a.oldIndex+a.colspan-1<o+p.colspan)l=n-k+1;if(a.newIndex>=o&&a.newIndex<o+p.colspan)m=n;o+=p.colspan}j=h.splice(k,l);e[f]=h.splice(0,m-(b?l:0)).concat(j).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 true}return false}},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++){b[g].style.width=d;if(g<e.length){var h=b[g].firstChild.firstChild.childNodes;for(var j=f[g]=0,k=0;j<h.length;j++){var l=e[g][j];f[g]+=1;if(typeof a!="number"||a>=k&&a<k+l.colspan){var m=this.getGroupStyle.call(this,l,k);h[j].style.width=m.width;h[j].style.display=m.hidden?"none":
""}k+=l.colspan}}}b=this.mainHd.query(".x-grid3-header-offset > table");d=this.getTotalWidth();e=this.rows;for(g=0;g<b.length;g++){b[g].style.width=d;if(g<e.length){h=b[g].firstChild.firstChild.childNodes;j=0;for(k=this.cm.getLockedCount();j<h.length;j++){l=e[g][f[g]+j];if(typeof a!="number"||a>=k&&a<k+l.colspan){m=this.getGroupStyle.call(this,l,k);h[j].style.width=m.width;h[j].style.display=m.hidden?"none":""}k+=l.colspan}}}},getGroupRowIndex:function(a){if(a)if((a=a.className.match(this.hrowRe))&&
a[1])return parseInt(a[1],10);return this.cm.rows.length},layout:function(){if(this.mainBody){var a=this.grid,b=a.getGridEl().getSize(true),d=b.width;if(!(!a.hideHeaders&&(d<20||b.height<20))){this.syncHeaderHeight();if(a.autoHeight){this.scroller.dom.style.overflow="visible";this.lockedScroller.dom.style.overflow="visible";if(Ext.isWebKit){this.scroller.dom.style.position="static";this.lockedScroller.dom.style.position="static"}}else{this.el.setSize(b.width,b.height);a=this.mainHd.getHeight();var e=
b.height-a}this.updateLockedWidth();if(this.forceFit){if(this.lastViewWidth!=d){this.fitColumns(false,false);this.lastViewWidth=d}}else{this.autoExpand();this.syncHeaderScroll()}this.onLayout(d,e)}}},getGroupSpan:function(a,b){if(a<0)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(){var a=this.cm,b=this.templates;b=b.hcell;for(var d=[],e=[],f={},g=a.getColumnCount(),h=g-1,j=0;j<g;j++){f.id=a.getColumnId(j);f.value=a.getColumnHeader(j)||"";f.style=this.getColumnStyle(j,true);f.tooltip=this.getColumnTooltip(j);f.css=(j===0?"x-grid3-cell-first ":j==h?"x-grid3-cell-last ":"")+(a.config[j].headerCls?" "+a.config[j].headerCls:"");if(a.config[j].align=="right")f.istyle="padding-right:16px";else delete f.istyle;
if(a.isLocked(j))e[e.length]=b.apply(f);else d[d.length]=b.apply(f)}b=this.templates;f=[];h=[];a=this.cm;for(var k=this.rows,l="width:"+this.getTotalWidth()+";",m=0,n=k.length;m<n;m++){var o=k[m],p=[],s=[],t=j=0;for(g=o.length;j<g;j++){var q=o[j];q.colspan=q.colspan||1;var u=this.getColumnId(q.dataIndex?a.findColumnIndex(q.dataIndex):t),v=this.getGroupStyle.call(this,q,t);u=b.gcell.apply({cls:"ux-grid-hd-group-cell",id:u,row:m,style:"width:"+v.width+";"+(v.hidden?"display:none;":"")+(q.align?"text-align:"+
q.align+";":""),tooltip:q.tooltip?(Ext.QuickTips.isEnabled()?"ext:qtip":"title")+'="'+q.tooltip+'"':"",istyle:q.align=="right"?"padding-right:16px":"",btn:this.grid.enableHdMenu&&q.header,value:q.header||"&nbsp;"});if(a.isLocked(q.dataIndex?a.findColumnIndex(q.dataIndex):t))s[j]=u;else p[j]=u;t+=q.colspan}f[m]=b.header.apply({tstyle:l,cells:p.join("")});h[m]=b.header.apply({tstyle:l,cells:s.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=true,f=b,g=b+a.colspan;f<g;f++)if(!this.cm.isHidden(f)){e=this.cm.getColumnWidth(f);if(typeof e=="number")d+=e;e=false}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):false},findHeaderIndex:function(a){return(a=this.findHeaderCell(a))?
this.getCellIndex(a):false},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()?false:d)},ensureVisible:function(a,b,d){return Ext.ux.grid.LockingHeaderGroupGridView.superclass.ensureVisible.call(this,a,b,b<this.cm.getLockedCount()?false:d)},insertRows:function(a,b,d,e){a=a.getCount()-1;if(!e&&b===0&&d>=a)this.refresh();else{e||this.fireEvent("beforerowsinserted",this,b,d);var f=this.renderRows(b,d),g=this.getRow(b);
if(g){b===0&&this.removeRowClass(0,this.firstRowCls);Ext.DomHelper.insertHtml("beforeBegin",g,f[0]);g=this.getLockedRow(b);Ext.DomHelper.insertHtml("beforeBegin",g,f[1])}else{this.removeRowClass(a-1,this.lastRowCls);Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,f[0]);Ext.DomHelper.insertHtml("beforeEnd",this.lockedBody.dom,f[1])}if(e){if(b===0||b>=a)this.addRowClass(b,b===0?this.firstRowCls:this.lastRowCls)}else{this.fireEvent("rowsinserted",this,b,d);this.processRows(b)}}this.syncFocusEl(b)},
getColumnStyle:function(a,b){var d=!b?this.cm.config[a].cellStyle||this.cm.config[a].css||"":this.cm.config[a].headerStyle||"";d+="width:"+this.getColumnWidth(a)+";";if(this.cm.isHidden(a))d+="display:none;";var e=this.cm.config[a].align;if(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)?this.ds.fields.get(e).name:f,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(true);var b=this.renderBody();this.mainBody.update(b[0]).setWidth(this.getTotalWidth());this.lockedBody.update(b[1]).setWidth(this.getLockedWidth());if(a===true){this.updateHeaders();this.updateHeaderSortState()}this.processRows(0,true);this.layout();this.applyEmptyText();this.fireEvent("refresh",this)},onDenyColumnLock:function(){},initData:function(a,b){this.cm&&this.cm.un("columnlockchange",this.onColumnLock,this);
Ext.ux.grid.LockingHeaderGroupGridView.superclass.initData.call(this,a,b);this.cm&&this.cm.on("columnlockchange",this.onColumnLock,this)},onColumnLock:function(){this.refresh(true)},handleHdMenuClick:function(a){var b=this.hdCtxIndex,d=this.cm,e=a.getItemId(),f=d.getLockedCount();switch(e){case "lock":if(d.getColumnCount(true)<=f+1){this.onDenyColumnLock();return}d.setLocked(b,true);if(f!=b){d.moveColumn(b,f);this.grid.fireEvent("columnmove",b,f)}break;case "unlock":if(f-1!=b){d.setLocked(b,false,
true);d.moveColumn(b,f-1);this.grid.fireEvent("columnmove",b,f-1)}else d.setLocked(b,false);break;default:return Ext.ux.grid.LockingHeaderGroupGridView.superclass.handleHdMenuClick.call(this,a)}return true},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:true});this.hmenu.show(b,"tl-bl?")}else if(d.hasClass("ux-grid-hd-group-cell")||Ext.fly(b).up(".ux-grid-hd-group-cell"))a.stopEvent();if(this.grid.enableColLock!==false)if(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();if(!(this.cm.isMenuDisabled(this.activeHdIndex)||e.hasClass("ux-grid-hd-group-cell"))){e.addClass("x-grid3-hd-over");if(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);if(d&&(!Ext.isIE||!a.within(d,true))){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(true),e=Ext.isBorderBox?0:this.lockedBorderWidth,f=Ext.isBorderBox?0:this.rowBorderWidth,g=d.width-a-e-f+"px",h=this.getScrollOffset();if(!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";if(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"}if(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 this.config[a].locked===true},setLocked:function(a,b,d){if(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++)if(this.isLocked(b)&&!this.isHidden(b))a+=this.getColumnWidth(b);return a},getLockedCount:function(){for(var a=this.config.length,b=0;b<a;b++)if(!this.isLocked(b))return b;return a},
moveColumn:function(a,b){var d=this.isLocked(a),e=this.isLocked(b);if(a<b&&d&&!e)this.setLocked(a,false,true);else a>b&&!d&&e&&this.setLocked(a,true,true);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:true,border:false,deferredRender:false,layoutOnTabChange:true,title:"",activeTab:0,listeners:{beforetabchange:function(d){d.expand()},afterrender:{scope:this,fn:function(){if(this.titleId.length>0)for(var d=0;d<this.titleId.length;d++)(r=Ext.get(this.titleId[d].id))&&r.on("click",this.titleId[d].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){for(var b=[],d=0;d<a.ribbon.length;d++){c={xtype:"buttongroup",cls:"x-btn-group-ribbonstyle",defaults:{scale:"small",iconAlign:"left",minWidth:40},items:a.ribbon[d].items};title=a.ribbon[d].title||"";topTitle=a.ribbon[d].topTitle||false;if(onTitleClick=a.ribbon[d].onTitleClick||false){titleId="ux-ribbon-"+Ext.id();title='<span id="'+titleId+
'" style="cursor:pointer;">'+title+"</span>";this.titleId.push({id:titleId,fn:onTitleClick})}if(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[d].cfg||null){Ext.applyIf(c,a.ribbon[d].cfg);cfg.defaults&&Ext.apply(c.defaults,cfg.defaults)}b.push(c)}Ext.apply(a,{baseCls:"x-plain",tbar:b})}});
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){this.dropTarget!=undefined&&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++){b=e[g].getEl().getWidth();var h=d+b/2;d+=b;if(a<h){b=g;break}else b=g+1}return b},canDrop:function(){return true},notifyOver:function(){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;if(a){b=this.calculateEntryIndex(b);e.insert(b,this.createItem(d));e.doLayout();this.afterLayout()}return a},
createItem:function(){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(b,d){this.createIfReorderable(d)}});Ext.ux.ToolbarReorderer.superclass.init.apply(this,arguments)},createItemDD:function(a){if(a.dd==undefined){var b=a.getEl(),d=this.target,e=this;a.dd=new Ext.dd.DD(b,undefined,{isTarget:false});var f=function(){return false};Ext.apply(a.dd,{b4StartDrag:function(){this.startPosition=b.getXY();this.startZIndex=b.getStyle("zIndex");b.setStyle("zIndex",
1E4);a.suspendEvents();a.menu&&a.menu.on("beforeshow",f,e)},startDrag:function(){this.constrainTo(d.getEl());this.setYConstraint(0,0,0)},onDrag:function(){for(var g=b.getXY()[0],h=g-this.startPosition[0],j=d.items.items,k=j.indexOf(a),l=0;l<j.length;l++){var m=j[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&&h<0&&g<n;n=k<l&&h>0&&g+b.getWidth()>n;if(m||n){e[m?"onMovedLeft":"onMovedRight"](a,l,k);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(b!=undefined&&b!=d){e.remove(a,false);e.insert(b,a);this.updateButtonXCache();for(b=0;b<f.length;b++){e=f[b];d=this.buttonXCache[e.id];if(a==e)a.dd.startPosition[0]=d;else{e=e.getEl();e.moveTo(d,e.getY(),{duration:this.animationDuration})}}}},
onMovedRight:function(){this.onMovedLeft.apply(this,arguments)},updateButtonXCache:function(){var a=this.target,b=a.items,d=a.getEl().getBox(true).x;b.each(function(e){this.buttonXCache[e.id]=d;d+=e.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=true;a.on("keypress",function(b,d){return this.press(b,d)},this);a.on("changemask",function(b){this.mask=b},this)},press:function(a,b){var d=a.getValue(),e=b.getKey(),
f=this.mask,g=a.el.dom;if(b){if(g.selectionEnd-g.selectionStart>0)return true;if(g.selectionStart>0&&g.selectionStart<g.textLength)return true;var h=this.Charset.substr(e-32,1);if(e<32||b.isNavKeyPress()||e==b.BACKSPACE)return true;if(Ext.isGecko||Ext.isGecko2||Ext.isGecko3)if(b.charCode==0&&b.keyCode==46||b.isSpecialKey())return true;e=d.length;if(e>=f.length){a.setValue(d);b.stopEvent();return false}for(e=f.substr(e,1);this.Fixos.indexOf(e)!=-1;){d+=e;e=d.length;if(e>=f.length){b.stopEvent();return false}e=
f.substr(e,1)}switch(e){case "#":if(this.Numeros.indexOf(h)==-1){b.stopEvent();return false}break;case "A":h=h.toUpperCase();if(this.LetrasU.indexOf(h)==-1){b.stopEvent();return false}break;case "a":h=h.toLowerCase();if(this.LetrasL.indexOf(h)==-1){b.stopEvent();return false}break;case "Z":if(this.Letras.indexOf(h)==-1){b.stopEvent();return false}break;case "*":a.setValue(d+h);break;default:a.setValue(d)}}a.setValue(d+h);g.selectionEnd=g.selectionStart;b.stopEvent();return false}});Ext.ns("Ext.ux");
Ext.ux.Lightbox=function(){var a={},b=[],d,e=false,f=[];return{overlayOpacity:0.85,animate:true,resizeSpeed:8,borderSize:10,labelImage:"Image",labelOf:"of",init:function(){this.resizeDuration=this.animate?(11-this.resizeSpeed)*0.15:0;this.overlayDuration=this.animate?0.2:0;if(!e){Ext.apply(this,Ext.util.Observable.prototype);Ext.util.Observable.constructor.call(this);this.addEvents("open","close");this.initMarkup();this.initEvents();e=true}},initMarkup:function(){a.shim=Ext.DomHelper.append(document.body,
{tag:"iframe",id:"ux-lightbox-shim"},true);a.overlay=Ext.DomHelper.append(document.body,{id:"ux-lightbox-overlay"},true);var g=new Ext.Template(this.getTemplate());a.lightbox=g.append(document.body,{},true);Ext.each(["outerImageContainer","imageContainer","image","hoverNav","navPrev","navNext","loading","loadingLink","outerDataContainer","dataContainer","data","details","caption","imageNumber","bottomNav","navClose"],function(h){a[h]=Ext.get("ux-lightbox-"+h)});Ext.each([a.overlay,a.lightbox,a.shim],
function(h){h.setVisibilityMode(Ext.Element.DISPLAY);h.hide()});g=(this.animate?250:1)+"px";a.outerImageContainer.setStyle({width:g,height:g})},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>"]},initEvents:function(){var g=function(h){h.preventDefault();this.close()};a.overlay.on("click",g,this);a.loadingLink.on("click",
g,this);a.navClose.on("click",g,this);a.lightbox.on("click",function(h){h.getTarget().id=="ux-lightbox"&&this.close()},this);a.navPrev.on("click",function(h){h.preventDefault();this.setImage(d-1)},this);a.navNext.on("click",function(h){h.preventDefault();this.setImage(d+1)},this)},register:function(g,h){if(f.indexOf(g)===-1){f.push(g);Ext.fly(document).on("click",function(j){var k=j.getTarget(g);if(k){j.preventDefault();this.open(k,g,h)}},this)}},open:function(g,h,j){j=j||false;this.setViewSize();
a.overlay.fadeIn({duration:this.overlayDuration,endOpacity:this.overlayOpacity,callback:function(){b=[];var k=0;if(j){var l=Ext.query(h);for(Ext.each(l,function(n){n.href&&b.push([n.href,n.title])});b[k][0]!=g.href;)k++}else b.push([g.href,g.title]);l=Ext.fly(document).getScroll();var m=l.top+Ext.lib.Dom.getViewportHeight()/10;a.lightbox.setStyle({top:m+"px",left:l.left+"px"}).show();this.setImage(k);this.fireEvent("open",b[k])},scope:this})},setViewSize:function(){var g=this.getViewSize();a.overlay.setStyle({width:g[0]+
"px",height:g[1]+"px"});a.shim.setStyle({width:g[0]+"px",height:g[1]+"px"}).show()},setImage:function(g){d=g;this.disableKeyNav();this.animate&&a.loading.show();a.image.hide();a.hoverNav.hide();a.navPrev.hide();a.navNext.hide();a.dataContainer.setOpacity(1.0E-4);a.imageNumber.hide();var h=new Image;h.onload=function(){a.image.dom.src=b[d][0];this.resizeImage(h.width,h.height)}.createDelegate(this);h.src=b[d][0]},resizeImage:function(g,h){var j=a.outerImageContainer.getWidth(),k=a.outerImageContainer.getHeight(),
l=g+this.borderSize*2,m=h+this.borderSize*2;j=j-l;var n=function(){a.hoverNav.setWidth(a.imageContainer.getWidth()+"px");a.navPrev.setHeight(h+"px");a.navNext.setHeight(h+"px");a.outerDataContainer.setWidth(l+"px");this.showImage()};k-m!=0||j!=0?a.outerImageContainer.shift({height:m,width:l,duration:this.resizeDuration,scope:this,callback:n,delay:50}):n.call(this)},showImage:function(){a.loading.hide();a.image.fadeIn({duration:this.resizeDuration,scope:this,callback:function(){this.updateDetails()}});
this.preloadImages()},updateDetails:function(){var g=a.data.getWidth(true)-a.navClose.getWidth()-10;a.details.setWidth((g>0?g:0)+"px");a.caption.update(b[d][1]);a.caption.show();if(b.length>1){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 h=this.getViewSize();a.overlay.setHeight(h[1]+"px");this.updateNav()}})},updateNav:function(){this.enableKeyNav();a.hoverNav.show();
d>0&&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(g){g=g.getKey();if(g==88||g==67||g==27)this.close();else if(g==80||g==37)d!=0&&this.setImage(d-1);else if(g==78||g==39)d!=b.length-1&&this.setImage(d+1)},preloadImages:function(){var g;if(b.length>d+1){g=new Image;g.src=b[d+1][0]}if(d>0){g=new Image;g.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(typeof console=="undefined")var console={log:function(){}};Ext.namespace("Ext.m3");var SOFTWARE_NAME="\u041f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 \u041c3";
function assert(a,b){if(!a){console.error(b);throw Error(b);}}
function smart_eval(a){if(a!=undefined)if(a.substring(0,1)=="{"){if(a=Ext.util.JSON.decode(a))if(a.code){var b=a.code();b&&b instanceof Ext.Window&&typeof AppDesktop!="undefined"&&AppDesktop&&AppDesktop.getDesktop().createWindow(b);return b}else if(a.message&&a.message!="")Ext.Msg.show({title:"\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435",msg:a.message,buttons:Ext.Msg.OK,icon:a.success!=undefined&&!a.success?Ext.Msg.WARNING:Ext.Msg.Info})}else{try{b=eval(a)}catch(d){Ext.Msg.show({title:"\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435",
msg:"\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430!",buttons:Ext.Msg.OK,fn:Ext.emptyFn,animEl:"elId",icon:Ext.MessageBox.WARNING});throw d;}b&&b instanceof Ext.Window&&typeof AppDesktop!="undefined"&&AppDesktop&&AppDesktop.getDesktop().createWindow(b);return b}}Ext.ns("Ext.app.form");
Ext.app.form.SearchField=Ext.extend(Ext.form.TwinTriggerField,{initComponent:function(){Ext.app.form.SearchField.superclass.initComponent.call(this);this.on("specialkey",function(a,b){b.getKey()==b.ENTER&&this.onTrigger2Click()},this)},validationEvent:false,validateOnBlur:false,trigger1Class:"x-form-clear-trigger",trigger2Class:"x-form-search-trigger",hideTrigger1:true,width:180,hasSearch:false,paramName:"filter",paramId:"id",nodeId:"-1",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 if(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=false}},onTrigger2Click:function(){var a=this.getRawValue(),
b=this.getComponentForSearch(),d=this,e;this.setDisabled(true);this.setHideTrigger(true);if(b instanceof Ext.grid.GridPanel){e={start:0};b=b.getStore();b.baseParams=b.baseParams||{};b.baseParams[this.paramName]=a;b.baseParams[this.paramId]=this.nodeId||"";b.reload({params:e})}else if(b instanceof Ext.ux.tree.TreeGrid){e=b.getLoader();e.baseParams=e.baseParams||{};e.baseParams[this.paramName]=a;b=b.getRootNode();e.load(b);b.expand()}if(a){this.hasSearch=true;this.triggers[0].show()}setTimeout(function(){d.setDisabled(false);
d.setHideTrigger(false)},200)},clear:function(){this.onTrigger1Click()},search:function(){this.onTrigger2Click()}});
Ext.override(Ext.form.Field,{isEdit:true,isModified:false,updateLabel:function(){this.setFieldLabel(this.fieldLabel)},setFieldLabel:function(a){if(a!=undefined){if(this.rendered){var b=a+":";if(this.isModified)b='<span style="color:darkmagenta;">'+b+"</span>";var d=this.el.up(".x-form-item",10,true);d&&d.child(".x-form-item-label").update(b)}this.fieldLabel=a}},fireKey:function(a){if(a.isSpecialKey()){if(a.getKey()==a.ENTER){this.onBlur();this.startValue=this.getValue()}this.fireEvent("specialkey",
this,a)}}});
Ext.app.TitlePanel=Ext.extend(Ext.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;"},true);a.render(b)},onRender:function(){Ext.app.TitlePanel.superclass.onRender.apply(this,arguments);if(this.titleItems!=null){if(Ext.isArray(this.titleItems))for(var a=this.titleItems.length-1;a>=0;a--)this.addTitleItem(this.titleItems[a]);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){if(a.action.failureType=="server"){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})}else Ext.Msg.alert(a.title,a.message)}
function uiAjaxFailMessage(a,b){if(Ext.isEmpty(a)||a.status===0)Ext.Msg.alert(SOFTWARE_NAME,"\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.");else if(a.status===200||b.failureType==="server")b&&b.response&&b.response.responseText?smart_eval(b.response.responseText):smart_eval(a.responseText);else{var d=Ext.getBody().getViewSize(),e=d.width<500?d.width-
50:500;d=d.height<300?d.height-50:300;if(!a.responseText&&b&&b.response)a=b.response;(new Ext.Window({modal:true,width:e,height:d,title:"Request Failure",layout:"fit",maximizable:true,maximized:true,listeners:{maximize:{fn:function(f){var g=Ext.getBody().getViewSize();f.setSize(g.width,g.height)},scope:this},resize:{fn:function(f){var g=Ext.getCmp("__ErrorMessageEditor");f=f.body.getViewSize();g.setSize(f.width,f.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:a.responseText,readOnly:true,enableAlignments:false,enableColors:false,enableFont:false,enableFontSize:false,enableFormat:false,enableLinks:false,enableLists:false,enableSourceEdit:false,
listeners:{push:{fn:function(){(function(f){try{for(var g=f.getElementsByTagName("script"),h=0;h<g.length;h++)g[h].innerText?this.eval(g[h].innerText):this.eval(g[h].textContent);this.hideAll(this.getElementsByClassName(f,"table","vars"));this.hideAll(this.getElementsByClassName(f,"ol","pre-context"));this.hideAll(this.getElementsByClassName(f,"ol","post-context"));this.hideAll(this.getElementsByClassName(f,"div","pastebin"))}catch(j){}}).call(this.iframe.contentWindow,this.iframe.contentDocument)}}}}]})})).show()}}
function uiShowErrorMessage(a){obj=Ext.util.JSON.decode(a.responseText);obj.error_msg&&Ext.Msg.alert(SOFTWARE_NAME,obj.error_msg);return obj.success}function sendRequest(a,b,d){var e=new Ext.LoadMask(Ext.getBody());e.show();Ext.Ajax.request({params:d,url:a,method:"POST",success:function(f){try{smart_eval(f.responseText)}finally{e.hide()}},failure:function(){uiAjaxFailMessage.apply(this,arguments);e.hide()}})}
function thousandCurrencyRenderer(a){if(typeof a!="number"){var b=a;try{b=parseFloat(a.replace(/,+/,".").replace(/\s+/g,""))}catch(d){b=NaN}if(isNaN(b))return a;else a=b}b="";var e=a.toFixed(2).split(".");a=e[0];e=e[1];var f=0,g=0,h=a.length%3;if(h!=0){for(;g<h;g++)b+=a.charAt(g);b+=" "}for(;g<a.length;g++){if(f%3==0&&f!=0)b+=" ";b+=a.charAt(g);f++}if(e)b+=","+e;return b=b.replace(/\s,/,",")}function includeInArr(a,b){return a.indexOf(b)!=-1}
function showMessage(a,b,d){b=b||"\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435";a=a||"";d=d||Ext.MessageBox.INFO;Ext.Msg.show({title:b,msg:a,buttons:Ext.Msg.OK,icon:d})}function showWarning(a,b){showMessage(a,b,Ext.MessageBox.WARNING)}Ext.m3.ComboBox=Ext.extend(Ext.form.ComboBox,{getText:function(){return this.lastSelectionText}});
Ext.m3.GridPanel=Ext.extend(Ext.grid.GridPanel,{constructor:function(a,b){var d=b.selModel,e=b.colModel||[];d&&d instanceof Ext.grid.CheckboxSelectionModel&&e.columns.unshift(d);var f;f=b.menus.contextMenu&&b.menus.contextMenu instanceof Ext.menu.Menu?function(k){k.stopEvent();b.menus.contextMenu.showAt(k.getXY())}:Ext.emptyFn;var g;g=b.menus.rowContextMenu&&b.menus.rowContextMenu instanceof Ext.menu.Menu?function(k,l,m){m.stopEvent();this.getSelectionModel().isSelected(l)||this.getSelectionModel().selectRow(l);
b.menus.rowContextMenu.showAt(m.getXY())}:Ext.emptyFn;var h=b.plugins||[],j=b.bundedColumns;j&&j instanceof Array&&j.length>0&&h.push(new Ext.ux.grid.ColumnHeaderGroup({rows:j}));a.listeners=Ext.applyIf({contextmenu:f,rowcontextmenu:g,beforerender:function(){var k=this.getBottomToolbar();if((k=k&&k.items&&k.items.items&&k.items.items.find(function(m){return m instanceof Ext.PagingToolbar})||k)&&k instanceof Ext.PagingToolbar){var l=this.getStore();l.setBaseParam("start",0);l.setBaseParam("limit",
k.pageSize);k.bind(l)}}},a.listeners||{});d=Ext.applyIf({sm:d,colModel:e,plugins:h},a);Ext.m3.GridPanel.superclass.constructor.call(this,d)},initComponent:function(){Ext.m3.GridPanel.superclass.initComponent.call(this);this.getStore().on("exception",this.storeException,this)},storeException:function(a,b,d,e,f){uiAjaxFailMessage(f,e)}});
Ext.m3.EditorGridPanel=Ext.extend(Ext.grid.EditorGridPanel,{constructor:function(a,b){var d=b.selModel,e=b.colModel||[];d&&d instanceof Ext.grid.CheckboxSelectionModel&&e.columns.unshift(d);var f;f=b.menus.contextMenu&&b.menus.contextMenu instanceof Ext.menu.Menu?function(k){k.stopEvent();b.menus.contextMenu.showAt(k.getXY())}:Ext.emptyFn;var g;g=b.menus.rowContextMenu&&b.menus.contextMenu instanceof Ext.menu.Menu?function(k,l,m){m.stopEvent();k=this.getSelectionModel();if(k instanceof Ext.grid.RowSelectionModel){k.selectRow(l);
b.menus.rowContextMenu.showAt(m.getXY())}}:Ext.emptyFn;var h=b.plugins||[],j=b.bundedColumns;j&&j instanceof Array&&j.length>0&&h.push(new Ext.ux.grid.ColumnHeaderGroup({rows:j}));a.listeners=Ext.applyIf({contextmenu:f,rowcontextmenu:g,beforerender:function(){var k=this.getBottomToolbar();if(k&&k instanceof Ext.PagingToolbar){var l=this.getStore();l.setBaseParam("limit",k.pageSize);k.bind(l)}}},a.listeners||{});d=Ext.applyIf({sm:d,colModel:e,plugins:h},a);Ext.m3.EditorGridPanel.superclass.constructor.call(this,
d)},initComponent:function(){Ext.m3.EditorGridPanel.superclass.initComponent.call(this);this.getStore().on("exception",this.storeException,this)},storeException:function(a,b,d,e,f){if(b=="remote"&&d!=Ext.data.Api.actions.read)f.raw.message&&Ext.Msg.show({title:"\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435!",msg:f.raw.message,buttons:Ext.Msg.CANCEL,icon:Ext.Msg.WARNING});else uiAjaxFailMessage(f,e)}});
Ext.version=="3.0"&&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;var g=0,h=e,j=this.el.dom;h=e;for(j=this.el.dom;h&&h!=j;){g+=h.offsetTop;h=h.offsetParent}g-=this.mainHd.dom.offsetHeight;e=g+e.offsetHeight;h=b.clientHeight;j=parseInt(b.scrollTop,10);var k=j+h;if(g<j)b.scrollTop=g;else if(e>k)b.scrollTop=e-h;if(d!==false){d=parseInt(f.offsetLeft,10);f=d+f.offsetWidth;g=parseInt(b.scrollLeft,10);j=g+b.clientWidth;
if(d<g)b.scrollLeft=d;else if(f>j)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);if(!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){if(a)if(a.params){if(a.params[this.paramNames.active_node]===undefined)a.params[this.paramNames.active_node]=this.active_node?this.active_node.id:null}else{a.params={};a.params[this.paramNames.active_node]=this.active_node?this.active_node.id:null}else{a={params:{}};a.params[this.paramNames.active_node]=
this.active_node?this.active_node.id:null}if(a.params[this.paramNames.active_node]!==null)a.add=true;return Ext.ux.maximgb.tg.AbstractTreeStore.superclass.load.call(this,a)},loadRecords:function(a,b,d){if(!a||d===false){d!==false&&this.fireEvent("load",this,[],b);if(b.callback)b.callback.call(b.scope||this,[],b,false)}else{d=a.records;var e=a.totalRecords||d.length,f=this.getPageOffsetFromOptions(b);a=this.getLoadedNodeIdFromOptions(b);var g,h,j=this;if(!b||b.add!==true){if(this.pruneModifiedRecords)this.modified=
[];g=0;for(a=d.length;g<a;g++)d[g].join(this);if(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)}else{if(a)g=this.getById(a);if(g){this.setNodeLoaded(g,true);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);if(h==
-1){f[e.id]=false;this.add(e)}else{f[e.id]=true;h=this.getAt(h);h.reject();h.data=e.data;d[g]=h}}this.applySort();this.resumeEvents();d.sort(function(k,l){var m=j.data.indexOf(k),n=j.data.indexOf(l);return m>n?1:-1});g=0;for(a=d.length;g<a;g++){e=d[g];f[e.id]==true?this.fireEvent("update",this,e,Ext.data.Record.COMMIT):this.fireEvent("add",this,[e],this.data.indexOf(e))}}this.fireEvent("load",this,d,b);if(b.callback)b.callback.call(b.scope||this,d,b,true)}},sort:function(a,b){if(this.remoteSort){this.setActiveNode(null);
if(this.lastOptions){this.lastOptions.add=false;if(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(f,g){var h=d(f.data[a]),j=d(g.data[a]);return h>j?1:h<j?-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)}if(e.length>0){this.data.clear();this.data.addAll(e)}if(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(this.data.indexOf(a)!=-1){if(this.fireEvent("beforeactivenodechange",this,this.active_node,a)!==false){this.active_node=a;this.fireEvent("activenodechange",this,this.active_node,a)}}else throw"Given record is not from the store.";else if(this.fireEvent("beforeactivenodechange",
this,this.active_node,a)!==false){this.active_node=a;this.fireEvent("activenodechange",this,this.active_node,a)}},isExpandedNode:function(a){return a.ux_maximgb_tg_expanded===true},setNodeExpanded:function(a,b){a.ux_maximgb_tg_expanded=b},isVisibleNode:function(a){var b,d=this.getNodeAncestors(a),e=true;a=0;for(b=d.length;a<b;a++){e=e&&this.isExpandedNode(d[a]);if(!e)break}return e},isLeafNode:function(a){return a.get(this.leaf_field_name)==true},isLoadedNode:function(a){return a.ux_maximgb_tg_loaded!==
undefined?a.ux_maximgb_tg_loaded:this.isLeafNode(a)||this.hasChildNodes(a)?true:false},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){if(this.isExpandedNode(a)&&this.fireEvent("beforecollapsenode",this,a)!==
false){this.setNodeExpanded(a,false);this.fireEvent("collapsenode",this,a)}},expandNode:function(a){var b;if(!this.isExpandedNode(a)&&this.fireEvent("beforeexpandnode",this,a)!==false)if(this.isLoadedNode(a)){this.setNodeExpanded(a,true);this.fireEvent("expandnode",this,a)}else{b={};b[this.paramNames.active_node]=a.id;this.load({add:true,params:b,callback:this.expandNodeCallback,scope:this})}},expandNodeCallback:function(a,b,d){a=this.getById(b.params[this.paramNames.active_node]);if(d&&a){this.setNodeExpanded(a,
true);this.fireEvent("expandnode",this,a)}else 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;if(a&&a.params&&a.params[this.paramNames.active_node])b=a.params[this.paramNames.active_node];return b},getPageOffsetFromOptions:function(a){var b=0;if(a&&a.params&&a.params[this.paramNames.start]){b=parseInt(a.params[this.paramNames.start],10);if(isNaN(b))b=0}return b},hasNextSiblingNode:function(a){return this.getNodeNextSibling(a)!==null},hasPrevSiblingNode:function(a){return this.getNodePrevSibling(a)!==null},
hasChildNodes:function(a){return this.getNodeChildrenCount(a)>0},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);if(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);if(a>0)d=b[a-1];return d},getRootNodes:function(){throw"Abstract method call";},getNodeDepth:function(){throw"Abstract method call";},getNodeParent:function(){throw"Abstract method call";},getNodeChildren:function(){throw"Abstract method call";},addToNode:function(){throw"Abstract method call";},removeFromNode:function(){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++)e[a].get(this.parent_id_field_name)==null&&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,j,k,l,m;g=a.get(this.left_field_name);
j=a.get(this.right_field_name);l=a.get(this.level_field_name);e=0;for(f=d.length;e<f;e++){a=d[e];h=a.get(this.left_field_name);k=a.get(this.right_field_name);m=a.get(this.level_field_name);if(m==l-1&&h<g&&k>j){b=a;break}}return b},getNodeChildren:function(a){var b,d,e,f,g,h,j,k=[];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++){j=h[i];a=j.get(this.left_field_name);e=j.get(this.right_field_name);g=j.get(this.level_field_name);
g==f+1&&a>b&&e<d&&k.push(j)}return k}});
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||{};if(!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>");if(!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>");if(!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>");if(!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,j=h.cell,k=h.row,l=f-1,m=[],n,o={},p={tstyle:"width:"+
this.getTotalWidth()+";"},s,t=0,q=b.length;t<q;t++){s=b[t];n=[];var u=t+e,v=this.renderRow(s,u,f,d,this.cm.getTotalWidth());if(v===false)for(v=0;v<f;v++){j=a[v];o.id=j.id;o.css=v==0?"x-grid3-cell-first ":v==l?"x-grid3-cell-last ":"";o.attr=o.cellAttr="";o.value=j.renderer.call(j.scope,s.data[j.name],o,s,u,v,d);o.style=j.style;if(Ext.isEmpty(o.value))o.value="&#160;";if(this.markDirty&&s.dirty&&typeof s.modified[j.name]!=="undefined")o.css+=" x-grid3-dirty-cell";if(j.id==this.grid.master_column_id){o.treeui=
this.renderCellTreeUI(s,d);j=h.mastercell}else j=h.cell;n[n.length]=j.apply(o)}else n.push(v);v=[];if(g&&(u+1)%2==0)v[0]="x-grid3-row-alt";if(s.dirty)v[1]=" x-grid3-dirty-row";p.cols=f;if(this.getRowClass)v[2]=this.getRowClass(s,u,p,d);p.alt=v.join(" ");p.cells=n.join("");p.display_style=d.isVisibleNode(s)?"":"display: none;";p.level=d.getNodeDepth(s);m[m.length]=k.apply(p)}return m.join("")},renderCellTreeUI:function(a,b){var d=this.templates.treeui,e=this.templates.elbow_line,f={},g,h,j=level=b.getNodeDepth(a);
f.wrap_width=(j+1)*16;if(level>0){f.elbow_line="";g=a;for(left=0;level--;){if(h=b.getNodeParent(g))f.elbow_line=b.hasNextSiblingNode(h)?e.apply({left:level*16,cls:"ux-maximgb-tg-elbow-line"})+f.elbow_line:e.apply({left:level*16,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}}if(b.isLeafNode(a))f.cls=b.hasNextSiblingNode(a)?"ux-maximgb-tg-elbow":"ux-maximgb-tg-elbow-end";else{f.cls="ux-maximgb-tg-elbow-active ";
f.cls+=b.isExpandedNode(a)?b.hasNextSiblingNode(a)?this.expanded_icon_class:this.last_expanded_icon_class:b.hasNextSiblingNode(a)?this.collapsed_icon_class:this.last_collapsed_icon_class}f.left=1+j*16;return d.apply(f)},renderRow:function(){return false},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++){h=g[f];h.style.width=a;if(h.firstChild){h.firstChild.style.width=a;h=h.firstChild.rows[0];for(var j=0;j<b&&j<h.childNodes.length;j++)if(!Ext.fly(h.childNodes[j]).hasClass(this.skip_width_update_class))h.childNodes[j].style.width=d[j]}}this.onAllColumnWidthsUpdated(d,
a)},updateColumnWidth:function(a){var b=this.getColumnWidth(a),d=this.getTotalWidth();this.innerHd.firstChild.style.width=this.getOffsetWidth();this.innerHd.firstChild.firstChild.style.width=d;this.mainBody.dom.style.width=d;this.getHeaderCell(a).style.width=b;for(var e=this.getRows(),f,g=0,h=e.length;g<h;g++){f=e[g];f.style.width=d;if(f.firstChild){f.firstChild.style.width=d;if(a<f.firstChild.rows[0].childNodes.length)if(!Ext.fly(f.firstChild.rows[0].childNodes[a]).hasClass(this.skip_width_update_class))f.firstChild.rows[0].childNodes[a].style.width=
b}}this.onColumnWidthUpdated(a,b,d)},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,j=f.length;h<j;h++){g=f[h];g.style.width=d;if(g.firstChild){g.firstChild.style.width=d;if(a<g.firstChild.rows[0].childNodes.length)if(!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(!(this.ds.getCount()<1)){b=!this.grid.stripeRows;var e=this.getRows();d=0;Ext.each(e,function(f,g){f.rowIndex=g;f.className=f.className.replace(this.rowClsRe," ");if(f.style.display!="none"){if(!b&&(d+1)%2===0)f.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);e.length>0;){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,j;if(typeof a=="number"){e=a;a=d.getAt(e)}else e=d.indexOf(a);b=b||false;g=this.getRow(e);if(e=Ext.fly(g).child(".ux-maximgb-tg-elbow-active"))if(d.hasNextSiblingNode(a)){e.removeClass(this.collapsed_icon_class);e.removeClass(this.last_collapsed_icon_class);
e.addClass(this.expanded_icon_class)}else{e.removeClass(this.collapsed_icon_class);e.removeClass(this.last_collapsed_icon_class);e.addClass(this.last_expanded_icon_class)}if(d.isVisibleNode(a)){h=d.getNodeChildren(a);e=0;for(f=h.length;e<f;e++){j=d.indexOf(h[e]);g=this.getRow(j);g.style.display="block";d.isExpandedNode(h[e])&&this.expandRow(j,true)}}b||this.processRows(0)},collapseRow:function(a,b){var d=this.ds,e,f,g,h,j;if(typeof a=="number"){e=a;a=d.getAt(e)}else e=d.indexOf(a);b=b||false;h=this.getRow(e);
if(pmel=Ext.fly(h).child(".ux-maximgb-tg-elbow-active"))if(d.hasNextSiblingNode(a)){pmel.removeClass(this.expanded_icon_class);pmel.removeClass(this.last_expanded_icon_class);pmel.addClass(this.collapsed_icon_class)}else{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++){j=d.indexOf(g[e]);h=this.getRow(j);if(h.style.display!="none"){h.style.display="none";this.collapseRow(j,
true)}}b||this.processRows(0)},initData:function(a,b){Ext.ux.maximgb.tg.GridView.superclass.initData.call(this,a,b);if(this.ds){this.ds.un("expandnode",this.onStoreExpandNode,this);this.ds.un("collapsenode",this.onStoreCollapseNode,this)}if(a){a.on("expandnode",this.onStoreExpandNode,this);a.on("collapsenode",this.onStoreCollapseNode,this)}},onLoad:function(a,b,d){if(d&&d.params&&(d.params[a.paramNames.active_node]===null||a.indexOfId(d.params[a.paramNames.active_node])==-1))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);e!==true&&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(){if(!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=true;if(d!==false)if(Ext.fly(b).hasClass("ux-maximgb-tg-elbow-active")){b=e.getAt(d);e.isExpandedNode(b)?e.collapseNode(b):e.expandNode(b);f=false}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();if(a.getSelected){d=a.getSelected();e.setActiveNode(d)}else if(a.getSelectedCell&&b){d=b.record;e.setActiveNode(d)}if(d)if(!e.isVisibleNode(d))for(d=e.getNodeAncestors(d);d.length>0;)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(){if(!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=true;if(d!==false)if(Ext.fly(b).hasClass("ux-maximgb-tg-elbow-active")){b=e.getAt(d);e.isExpandedNode(b)?e.collapseNode(b):e.expandNode(b);f=false}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();if(a.getSelected){d=a.getSelected();e.setActiveNode(d)}else if(a.getSelectedCell&&b){d=b.record;e.setActiveNode(d)}if(d)if(!e.isVisibleNode(d))for(d=e.getNodeAncestors(d);d.length>0;)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;if(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;if(this.displayItem){if(this.store){b=this.store.getActiveNodePageOffset();
a=this.store.getActiveNodeCount();d=this.store.getActiveNodeTotalCount()}a=a==0?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(b==1);this.prev.setDisabled(b==1);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);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);if(b&&b.params){if(b.params[d.start]===undefined)b.params[d.start]=0;if(b.params[d.limit]===undefined)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;this.doLoad((a?a.getActiveNodePageOffset():0)+this.pageSize)},moveLast:function(){var a=this.store;a&&a.getActiveNodePageOffset();a=a?a.getActiveNodeTotalCount():0;var b=a%this.pageSize;this.doLoad(b?a-b:a-this.pageSize)},onStoreActiveNodeChange:function(){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.m3.Window=Ext.extend(Ext.Window,{constructor:function(a,b){this.actionContextJson=this.parentWindow=null;if(b&&b.parentWindowID)this.parentWindow=Ext.getCmp(b.parentWindowID);if(b&&b.helpTopic)this.m3HelpTopic=b.helpTopic;if(b&&b.contextJson)this.actionContextJson=b.contextJson;Ext.m3.Window.superclass.constructor.call(this,a)},initTools:function(){if(this.m3HelpTopic){var a=this.m3HelpTopic;this.addTool({id:"help",handler:function(){showHelpWindow(a)}})}Ext.m3.Window.superclass.initTools.call(this)}});
Ext.m3.AddrField=Ext.extend(Ext.Container,{constructor:function(a,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!=""&&b.place_record!=undefined){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.form.ComboBox({name:b.place_field_name,
fieldLabel:b.place_label,allowBlank:b.place_allow_blank,readOnly:b.read_only,cls:g,hideTrigger:true,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:true,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]/});if(b.level>1){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"}]});if(b.street_record!=""&&b.street_record!=undefined){f=Ext.util.JSON.decode(b.street_record);e.loadData({total:1,rows:[f]})}this.street=
new Ext.form.ComboBox({name:b.street_field_name,fieldLabel:b.street_label,allowBlank:b.street_allow_blank,readOnly:b.read_only,cls:g,hideTrigger:true,minChars:2,emptyText:"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0443\u043b\u0438\u0446\u0443...",queryParam:"filter",store:e,resizable:true,displayField:"display_name",valueField:"code",mode:"remote",hiddenName:b.street_field_name,valueNotFoundText:"",invalidClass:b.invalid_class});this.street.setValue(b.street_value);if(b.level>2){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});if(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});if(b.level>3)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})}}if(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:true,cls:g,height:36});if(b.view_mode==1){this.place.flex=1;f=b.level>2?[this.place,this.zipcode]:[this.place];if(b.level>1){this.street.flex=1;this.street.fieldLabel=b.street_label;f.push({xtype:"label",style:{padding:"3px"},text:b.street_label+":"},this.street);if(b.level>2){this.house.fieldLabel=
b.house_label;f.push({xtype:"label",style:{padding:"3px"},text:b.house_label+":"},this.house);if(b.use_corps){this.corps.fieldLabel=b.corps_label;f.push({xtype:"label",style:{padding:"3px"},text:b.corps_label+":"},this.corps)}if(b.level>3){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)}if(b.view_mode==
2){if(b.level>2){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)}else{this.place.anchor="100%";d.push(this.place)}if(b.level>1){this.street.flex=1;f=[this.street];if(b.level>2){this.house.fieldLabel=b.house_label;f.push({xtype:"label",style:{padding:"3px"},text:b.house_label+":"},this.house);if(b.use_corps){this.corps.fieldLabel=b.corps_label;f.push({xtype:"label",style:{padding:"3px"},
text:b.corps_label+":"},this.corps)}if(b.level>3){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)}if(b.view_mode==3){if(b.level>2){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)}else{this.place.anchor="100%";d.push(this.place)}if(b.level>1){this.street.anchor="100%";d.push(this.street);if(b.level>2){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"}});b.level>3&&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(){this.street.getStore().baseParams.place_code=this.place.value},clearStreet:function(){this.street!=undefined&&this.street.setValue("")},afterRenderAddr:function(){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);if(this.level>1){this.mon(this.street,"change",this.onChangeStreet,this);if(this.level>2){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);this.level>3&&this.mon(this.flat,"change",this.onChangeFlat,this)}}this.mon(this.place,"beforequery",
this.beforePlaceQuery,this);this.level>1&&this.mon(this.street,"beforequery",this.beforeStreetQuery,this);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;if(this.place!=undefined)a=this.place.getValue();var b;if(this.street!=undefined)b=this.street.getValue();var d;if(this.house!=undefined)d=this.house.getValue();
var e;if(this.corps!=undefined)e=this.corps.getValue();var f;if(this.flat!=undefined)f=this.flat.getValue();var g;if(this.zipcode!=undefined)g=this.zipcode.getValue();var h=null;a=this.place.getStore().data.get(a);if(a!=undefined)h=a.data;a=null;if(this.street!=undefined)var j=this.street.getStore().data.get(b);if(j!=undefined)a=j.data;b=this.generateTextAddr(h,a,d,e,f,g);this.addr!=undefined&&this.addr.setValue(b);return b},generateTextAddr:function(a,b,d,e,f,g){var h="";h=b!=undefined?a.addr_name+
", "+b.socr+" "+b.name:a.addr_name;if(g!="")h=g+", "+h;if(d!=""&&d!=undefined)h=h+", \u0434. "+d;if(e!=""&&e!=undefined)h=h+", \u043a\u043e\u0440\u043f. "+e;if(f!=""&&f!=undefined)h=h+", \u043a\u0432. "+f;return h},setNewAddr:function(a){if(this.addr!=undefined)this.addr.value=a},onChangePlace:function(){var a=this.place.getValue(),b=this.place.getStore().data.get(a);if(b!=undefined){b=b.data;b.zipcode&&this.zipcode.setValue(b.zipcode)}else 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);if(b!=undefined){b=b.data;b.zipcode&&this.zipcode.setValue(b.zipcode)}else 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(){this.addr_visible&&this.addr.setReadOnly(false)}});
Ext.m3.AdvancedComboBox=Ext.extend(Ext.m3.ComboBox,{constructor:function(a,b){this.askBeforeDeleting=true;this.actionContextJson=this.actionEditUrl=this.actionSelectUrl=null;this.hideBaseTrigger=false;this.defaultRecord=this.defaultText=this.defaultValue=null;this.hideTriggerClear=b.hideClearTrigger||false;this.hideTriggerDropDown=false;this.hideTriggerDictSelect=b.hideDictSelectTrigger||false;this.hideTriggerDictEdit=true;if(!b.hideEditTrigger)this.hideTriggerDictEdit=b.hideEditTrigger;this.defaultLimit=
"50";this.triggerClearClass="x-form-clear-trigger";this.triggerSelectClass="x-form-select-trigger";this.triggerEditClass="x-form-edit-trigger";assert(b.actions,"params.actions is undefined");if(b.actions.actionSelectUrl)this.actionSelectUrl=b.actions.actionSelectUrl;if(b.actions.actionEditUrl)this.actionEditUrl=b.actions.actionEditUrl;this.askBeforeDeleting=b.askBeforeDeleting;this.actionContextJson=b.actions.contextJson;this.hideBaseTrigger=false;if(a.hideTrigger){delete a.hideTrigger;this.hideBaseTrigger=
true}this.defaultValue=b.defaultValue;this.defaultText=b.defaultText;this.defaultRecord=Ext.decode(b.recordValue);this.baseTriggers=[{iconCls:"x-form-clear-trigger",handler:null,hide:null},{iconCls:"x-form-dropdown-trigger",handler:null,hide:null},{iconCls:"x-form-select-trigger",handler:null,hide:null},{iconCls:"x-form-edit-trigger",handler:null,hide:true}];this.allTriggers=[].concat(this.baseTriggers);b.customTriggers&&Ext.each(b.customTriggers,function(d){this.allTriggers.push(d)},this);Ext.m3.AdvancedComboBox.superclass.constructor.call(this,
a)},initComponent:function(){Ext.m3.AdvancedComboBox.superclass.initComponent.call(this);this.triggerConfig={tag:"span",cls:"x-form-twin-triggers",cn:[]};Ext.each(this.allTriggers,function(a){this.triggerConfig.cn.push({tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger "+a.iconCls})},this);if(!this.actionSelectUrl)this.hideTriggerDictSelect=true;if(!this.actionEditUrl)this.hideTriggerDictEdit=true;if(this.hideBaseTrigger)this.hideTriggerDropDown=true;this.initDefault();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"},initDefault:function(){if(this.defaultRecord)this.setRecord(new Ext.data.Record(this.defaultRecord));else this.defaultValue&&this.defaultText&&this.addRecordToStore(this.defaultValue,this.defaultText)},getTrigger:function(a){return this.triggers[a]},initTrigger:function(){var a=this.trigger.select(".x-form-trigger",
true),b=this;a.each(function(d,e,f){var g="Trigger"+(f+1);d.hide=function(){var h=b.wrap.getWidth();if(h===0){h=b.bufferSize;b.wrap.setWidth(h)}this.dom.style.display="none";b["hidden"+g]=true;b.el.setWidth(h-b.getTriggerWidth())};d.show=function(){var h=b.wrap.getWidth();if(h===0){h=b.bufferSize;b.wrap.setWidth(h)}this.dom.style.display="";b["hidden"+g]=false;b.el.setWidth(h-b.getTriggerWidth())};if(this.allTriggers[f].hide){d.dom.style.display="none";this["hidden"+g]=true}},this);this.disableTriggers(this.disabled);
this.triggers=a.elements},getWidth:function(){return this.el.getWidth()+this.getTriggerWidth()},disableTriggers:function(a){if(this.trigger)this.trigger.select(".x-form-trigger",true).each(function(b,d,e){d=this.allTriggers[e].handler;e=Ext.elCache[b.id].events;if(a)b.un("click",d,this,{preventDefault:true});else if(!e.click||e.click.length===0){b.on("click",d,this,{preventDefault:true});b.addClassOnOver("x-form-trigger-over");b.addClassOnClick("x-form-trigger-click")}},this);else{this.baseTriggers[0].hide=
a;this.baseTriggers[1].hide=a;this.baseTriggers[2].hide=a;this.baseTriggers[3].hide=a}},initBaseTrigger:function(){this.baseTriggers[0].handler=this.onTriggerClearClick;this.baseTriggers[1].handler=this.onTriggerDropDownClick;this.baseTriggers[2].handler=this.onTriggerDictSelectClick;this.baseTriggers[3].handler=this.onTriggerDictEditClick;this.baseTriggers[0].hide=this.hideTriggerClear||this.readOnly||this.disabled;this.baseTriggers[1].hide=this.hideTriggerDropDown||this.readOnly||this.disabled;
this.baseTriggers[2].hide=this.hideTriggerDictSelect||this.readOnly||this.disabled;this.baseTriggers[3].hide=this.hideTriggerDictEdit||this.readOnly||this.disabled;if(!this.getValue()){this.baseTriggers[0].hide=true;this.baseTriggers[3].hide=true}},getTriggerWidth:function(){var a=0;Ext.each(this.triggers,function(b,d){var e="Trigger"+(d+1),f=b.getWidth();a+=f===0&&!this["hidden"+e]?this.defaultTriggerWidth:f},this);return a},onDestroy:function(){Ext.destroy(this.triggers);Ext.destroy(this.allTriggers);
Ext.destroy(this.baseTriggers);Ext.m3.AdvancedComboBox.superclass.onDestroy.call(this)},onTriggerDropDownClick:function(){if(this.fireEvent("beforerequest",this)){if(this.isExpanded())this.collapse();else{this.onFocus({});this.doQuery(this.allQuery,true)}this.el.focus()}},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){a==="yes"&&this.clearValue()},scope:this}):this.clearValue()},onTriggerDictEditClick:function(){this.onEditBtn()},onSelect:function(a,b){var d=this.getValue();if(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],d);this.fireEvent("changed",
this)}},showClearBtn:function(){if(!this.hideTriggerClear&&this.rendered&&!this.readOnly&&!this.disabled)this.getTrigger(0).show();else this.hiddenTrigger1=this.hideTriggerClear||this.readOnly||this.disabled},hideClearBtn:function(){if(this.rendered)this.getTrigger(0).hide();else this.hiddenTrigger1=true},showDictSelectBtn:function(){if(!this.hideTriggerDictSelect&&this.rendered&&!this.readOnly&&!this.disabled)this.getTrigger(2).show();else this.hiddenTrigger3=this.hideTriggerDictSelect||this.readOnly||
this.disabled},hideDictSelectBtn:function(){if(this.rendered)this.getTrigger(2).hide();else this.hiddenTrigger3=true},showDropDownBtn:function(){if(!this.hideTriggerDropDown&&this.rendered&&!this.readOnly&&!this.disabled)this.getTrigger(1).show();else this.hiddenTrigger2=this.hideTriggerDropDown||this.readOnly||this.disabled},hideDropDownBtn:function(){if(this.rendered)this.getTrigger(1).hide();else this.hiddenTrigger2=true},showEditBtn:function(){if(this.actionEditUrl&&this.rendered&&!this.hideTriggerDictEdit&&
this.getValue())this.getTrigger(3).show();else this.hiddenTrigger4=this.actionEditUrl||this.hideTriggerDictEdit||this.readOnly||this.disabled},hideEditBtn:function(){if(this.actionEditUrl&&this.rendered)this.getTrigger(3).hide();else this.hiddenTrigger4=true},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.m3.AdvancedComboBox.superclass.setValue.call(this,
a);if(a){this.showClearBtn();this.showEditBtn()}},onSelectInDictionary:function(){assert(this.actionSelectUrl,"actionSelectUrl is undefined");if(this.fireEvent("beforerequest",this)){var a=Ext.getCmp(this.actionContextJson.m3_window_id),b;if(a){b=new Ext.LoadMask(a.getEl(),{msg:"\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...",msgCls:"x-mask"});b.show()}Ext.Ajax.request({url:this.actionSelectUrl,
method:"POST",params:this.actionContextJson,success:function(d){try{var e=smart_eval(d.responseText);if(e){e.on("closed_ok",function(f,g,h){this.fireEvent("afterselect",this,f,g,h)&&this.addRecordToStore(f,g,h)},this);b&&e.on("close",function(){b.hide()})}}finally{b&&b.hide()}},failure:function(){b&&b.hide();uiAjaxFailMessage.apply(this,arguments)},scope:this})}},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]},true);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]);d>=0&&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);if(b>=0)return a.getAt(b);return 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.actionContextJson),success:function(b){smart_eval(b.responseText)},failure:function(){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(){return this.getRawValue()===
this.getText()},showTriggers:function(a){if(a){if(this.getValue()){this.showClearBtn();this.showEditBtn()}this.showDictSelectBtn();this.showDropDownBtn()}else if(this.triggers){this.hideClearBtn();this.hideEditBtn();this.hideDictSelectBtn();this.hideDropDownBtn()}else this.hiddenTrigger4=this.hiddenTrigger3=this.hiddenTrigger2=this.hiddenTrigger1=true},setDisabled:function(a){this.disableTriggers(a);Ext.m3.AdvancedComboBox.superclass.setDisabled.call(this,a);this.showTriggers(!a)},setReadOnly:function(a){var b=
this.getWidth();if(b===0)b=this.bufferSize;Ext.m3.AdvancedComboBox.superclass.setReadOnly.call(this,a);this.disableTriggers(a);this.showTriggers(!a);if(a){this.el.setWidth(b);this.wrap&&this.wrap.setWidth(b)}else this.onResize(b)}});Ext.reg("m3-select",Ext.m3.AdvancedComboBox);
Ext.m3.AdvancedDataField=Ext.extend(Ext.form.DateField,{constructor:function(a,b){this.baseTriggers=[{iconCls:"x-form-date-trigger",handler:null,hide:null},{iconCls:"x-form-current-date-trigger",handler:null,hide:null}];this.hideTriggerToday=false;if(b&&b.hideTriggerToday)this.hideTriggerToday=true;Ext.m3.AdvancedDataField.superclass.constructor.call(this,a)},initComponent:function(){Ext.m3.AdvancedDataField.superclass.initComponent.call(this);this.triggerConfig={tag:"span",cls:"x-form-twin-triggers",
cn:[]};Ext.each(this.baseTriggers,function(a){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",true),b=this;a.each(function(d,e,f){var g="Trigger"+(f+1);d.hide=function(){var h=b.wrap.getWidth();this.dom.style.display="none";b.el.setWidth(h-b.trigger.getWidth());this["hidden"+g]=true};d.show=function(){var h=b.wrap.getWidth();this.dom.style.display="";b.el.setWidth(h-
b.trigger.getWidth());this["hidden"+g]=false};if(this.baseTriggers[f].hide){d.dom.style.display="none";this["hidden"+g]=true}this.mon(d,"click",this.baseTriggers[f].handler,this,{preventDefault:true});d.addClassOnOver("x-form-trigger-over");d.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=false;if(this.validationEvent!==false&&(this.validateOnBlur||this.validationEvent=="blur"))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.m3.MultipleDateField=Ext.extend(Ext.m3.AdvancedDataField,{clsHighlightClass:"x-date-selected",constructor:function(a,b){this.delimiter=b.delimiter;this.selectedDates={};this.csvSelectedDates="";Ext.m3.MultipleDateField.superclass.constructor.call(this,a,b)},initComponent:function(){Ext.m3.MultipleDateField.superclass.initComponent.call(this);var a=this;if(this.csvSelectedDates=this.value){this.csvSelectedDates.split(this.delimiter).forEach(function(b){a.setDateSelected(a,new Date(b))});this.highlightDates()}this.on("select",
this.handleSelectionChanged,this);this.on("afterrender",this.highlightDates,this)},onTriggerClick:function(){Ext.m3.MultipleDateField.superclass.onTriggerClick.call(this);this.highlightDates()},onSelect:function(a,b){this.fireEvent("select",this,b);this.setValue(b)},setDateSelected:function(a,b){this.selectedDates[b.toDateString()]=this.formatDate(this.parseDate(b));var d=this;this.csvSelectedDates=Object.keys(d.selectedDates).map(function(e){return d.selectedDates[e]}).join(", ")},handleSelectionChanged:function(a,
b){if(this.selectedDates[b.toDateString()])delete this.selectedDates[b.toDateString()];else this.selectedDates[b.toDateString()]=this.formatDate(this.parseDate(b));this.highlightDates();var d=this;this.csvSelectedDates=Object.keys(d.selectedDates).map(function(e){return d.selectedDates[e]}).join(", ")},highlightDates:function(){var a=this;if(a.menu){picker=a.menu.picker;picker.cells&&picker.cells.each(function(b){var d=(new Date(b.dom.firstChild.dateValue)).toDateString();if(a.selectedDates[d])b.getAttribute("class").indexOf(a.clsHighlightClass)===
-1&&b.addClass(a.clsHighlightClass);else b.removeClass(a.clsHighlightClass)})}},setValue:function(){return Ext.form.DateField.superclass.setValue.call(this,this.csvSelectedDates)},checkOneDate:function(a){var b=[];a=this.formatDate(a);if(a.length<1)return b;var d=a;a=this.parseDate(a);if(!a){b.push(String.format(this.invalidText,d,this.format));return b}d=a.getTime();this.minValue&&d<this.minValue.clearTime().getTime()&&b.push(String.format(this.minText,this.formatDate(this.minValue)));this.maxValue&&
d>this.maxValue.clearTime().getTime()&&b.push(String.format(this.maxText,this.formatDate(this.maxValue)));if(this.disabledDays){d=a.getDay();for(var e=0;e<this.disabledDays.length;e++)if(d===this.disabledDays[e]){b.push(this.disabledDaysText);break}}a=this.formatDate(a);this.disabledDatesRE&&this.disabledDatesRE.test(a)&&b.push(String.format(this.disabledDatesText,a));return b},getErrors:function(){var a,b=this;Object.keys(b.selectedDates).map(function(d){return b.selectedDates[d]}).forEach(function(d){if(a=
b.checkOneDate(d))return a});return[]}});Ext.reg("m3-multiple-date",Ext.m3.MultipleDateField);Ext.reg("m3-date",Ext.m3.AdvancedDataField);
Ext.m3.AdvancedScrollComboBox=Ext.extend(Ext.m3.AdvancedComboBox,{constructor:function(a,b){this.scrolled=0;this.loading=false;this.loadScrollPercent=0.8;Ext.m3.AdvancedScrollComboBox.superclass.constructor.call(this,a,b);this.bufferStore=new Ext.data.Store({model:this.store.model,recordType:this.store.recordType,proxy:this.store.proxy,reader:this.store.reader,sortInfo:this.store.sortInfo});this.bufferStore.on("load",this.onBufferLoad,this);this.isCorrect=true;this.on("correct",this.onCorrect,this);
this.on("incorrect",this.onIncorrect,this);this.on("expand",this.onExpand,this);this.elem=undefined},initComponent:function(){Ext.m3.AdvancedScrollComboBox.superclass.initComponent.call(this);this.getStore().on("load",this.onStoreLoad,this)},onScroll:function(a,b){var d=Ext.DomQuery.selectNode(".x-combo-list-item",b),e=parseInt(this.defaultLimit)||0;a.stopPropagation();this.elem=b;if(!this.loading&&d&&e>0&&this.store.getCount()!==this.store.getTotalCount()){d=b.childElementCount;if((b.scrollTop+b.offsetHeight)/
b.scrollHeight>this.loadScrollPercent){this.loading=true;this.scrolled=d;e=Ext.applyIf({start:d,limit:e},this.store.baseParams);this.bufferStore.load({params:e})}}},onBufferLoad:function(){var a=[],b,d;this.bufferStore.each(function(e){var f=true;this.store.data.each(function(g){if(g===e.data)return f=false});f&&a.push(e)});this.store.add(a);b=Ext.DomQuery.jsSelect(".x-combo-list-item",this.elem);for(d in b)if(this.store.data.items[d]&&this.store.data.items[d].json)if(this.store.data.items[d]&&this.store.data.items[d].json&&
b[d].className.indexOf(this.store.data.items[d].json.item_option)<0)b[d].className+=" "+this.store.data.items[d].json.item_option;this.loading=false},onStoreLoad:function(){this.scrolled=0},onTriggerDropDownClick:function(){Ext.m3.AdvancedScrollComboBox.superclass.onTriggerDropDownClick.call(this);this.innerList&&this.mon(this.innerList,"scroll",this.onScroll,this)},onCorrect:function(a){a.isCorrect=true},onIncorrect:function(a){a.isCorrect=false},onExpand:function(a){var b=$("#"+a.id);a.isCorrect||
a.doQuery(b.val(),true)}});Ext.ns("Ext.m3.CodeEditorConfig");Ext.apply(Ext.m3.CodeEditorConfig,{parser:{python:{mode:{name:"python",version:2,singleLineStringErrors:false}},css:{mode:"css"},html:{mode:"text/html",tabMode:"indent"},javascript:{mode:{name:"javascript",json:true}},sql:{lineNumbers:true,matchBrackets:true,indentUnit:4,mode:"text/x-plsql"}}});
Ext.m3.CodeEditor=Ext.extend(Ext.Panel,{sourceCode:"/*Default code*/ ",readOnly:false,theme:"default",constructor:function(a){Ext.m3.CodeEditor.superclass.constructor.call(this,a)},initComponent:function(){this.contentChanged=false;Ext.apply(this,{items:[{xtype:"textarea",readOnly:this.readOnly,hidden:true,value:this.sourceCode,enableKeyEvents:true}]});this.addEvents("editorkeyevent","editorfocus");Ext.m3.CodeEditor.superclass.initComponent.apply(this,arguments)},onRender:function(){Ext.m3.CodeEditor.superclass.onRender.apply(this,
arguments);this.oldSourceCode=this.sourceCode;this.on("afterlayout",this.triggerCodeEditor,this,{single:true})},fireKeyEvent:function(a,b){this.fireEvent("editorkeyevent",a,b)},fireFocusEvent:function(){this.fireEvent("editorfocus")},contentChange:function(){var a=this.getTextArea(),b=this.codeMirrorEditor.getValue();a.setValue(b);this.oldSourceCode==b?this.setTitleClass(true):this.setTitleClass();this.fireEvent("contentchanged",this)},triggerCodeEditor:function(){var a=this.getTextArea(),b=Ext.applyIf(this.codeMirrorEditor||
{},{height:"100%",width:"100%",theme:this.theme,lineNumbers:true,indentUnit:4,tabMode:"shift",matchBrackets:true,textWrapping:false,content:a.getValue(),readOnly:a.readOnly,autoMatchParens:true,onKeyEvent:this.fireKeyEvent.createDelegate(this),onChange:this.contentChange.createDelegate(this),onFocus:this.fireFocusEvent.createDelegate(this)});b=Ext.applyIf(b,Ext.m3.CodeEditorConfig.parser[this.parser||"python"]);this.codeMirrorEditor=new CodeMirror.fromTextArea(Ext.getDom(a.id),b)},setTitleClass:function(a){this.contentChanged=
a!==true},getTextArea:function(){return this.findByType("textarea")[0]}});Ext.reg("uxCodeEditor",Ext.m3.CodeEditor);
Ext.m3.CountFreePagingToolbar=Ext.extend(Ext.PagingToolbar,{displayMsg:"\u041f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 {0} - {1}",initComponent:function(){Ext.m3.CountFreePagingToolbar.superclass.initComponent.call(this);this.items.remove(this.last);this.items.remove(this.afterTextItem)},onLoad:function(a,b,d){if(this.rendered){a=this.getParams();this.cursor=d.params&&d.params[a.start]?d.params[a.start]:0;d=this.getPageData();a=d.activePage;this.inputItem.setValue(a);
this.first.setDisabled(a==1);this.prev.setDisabled(a==1);this.next.setDisabled(this.store.getCount()<=this.pageSize);if(this.store.getCount()>this.pageSize)for(a=this.store.getCount()-1;a>this.pageSize-1;--a)this.store.removeAt(a);this.refresh.enable();this.updateInfo();this.fireEvent("change",this,d)}else this.dsLoaded=[a,b,d]},getPageData:function(){return{total:0,activePage:Math.ceil((this.cursor+this.pageSize)/this.pageSize),pages:0}},changePage:function(a){a=(a-1)*this.pageSize;if(a<0)a=0;this.doLoad(a)},
doLoad:function(a){var b={},d=this.getParams();b[d.start]=a;b[d.limit]=this.pageSize+1;this.fireEvent("beforechange",this,b)!==false&&this.store.load({params:b})},onPagingKeyDown:function(a,b){var d=b.getKey(),e=this.getPageData();if(d==b.RETURN){b.stopEvent();e=this.readPage(e);if(e!==false){e=Math.max(1,e)-1;this.doLoad(e*this.pageSize)}}else if(d==b.HOME){b.stopEvent();a.setValue(1)}else if(d==b.UP||d==b.PAGEUP||d==b.DOWN||d==b.PAGEDOWN){b.stopEvent();if(e=this.readPage(e)){var f=b.shiftKey?10:
1;if(d==b.DOWN||d==b.PAGEDOWN)f*=-1;e+=f;e>=1&&a.setValue(e)}}},bindStore:function(a,b){var d;if(!b&&this.store){if(a!==this.store&&this.store.autoDestroy)this.store.destroy();else{this.store.un("beforeload",this.beforeLoad,this);this.store.un("load",this.onLoad,this);this.store.un("exception",this.onLoadError,this)}if(!a)this.store=null}if(a){a=Ext.StoreMgr.lookup(a);a.on({scope:this,beforeload:this.beforeLoad,load:this.onLoad,exception:this.onLoadError});d=true;Ext.apply(a.baseParams,{limit:this.pageSize+
1})}this.store=a;d&&this.onLoad(a,null,{})}});Ext.reg("countFreePagingToolbar",Ext.m3.CountFreePagingToolbar);
Ext.m3.EditWindow=Ext.extend(Ext.m3.Window,{constructor:function(a,b){this.dataUrl=this.formUrl=this.formId=null;this.changesCount=0;this.originalTitle=null;if(b){if(b.form){if(b.form.id)this.formId=b.form.id;if(b.form.url)this.formUrl=b.form.url}if(b.dataUrl)this.dataUrl=b.dataUrl}Ext.m3.EditWindow.superclass.constructor.call(this,a,b)},initComponent:function(){Ext.m3.EditWindow.superclass.initComponent.call(this);this.items.each(function(a){this.setFieldOnChange(a,this)},this);this.addEvents("beforesubmit",
"aftersubmit","submitfailed","closing_canceled","beforeloaddata","dataloaded")},getForm:function(){assert(this.formId,"\u041d\u0435 \u0437\u0430\u0434\u0430\u043d formId \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u044b");return Ext.getCmp(this.formId).getForm()},getInvalidNames:function(a){var b=[];a.items.each(function(d){d.validate()||b.push("<br>- "+d.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.formUrl,"\u041d\u0435 \u0437\u0430\u0434\u0430\u043d url \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u044b");if(a=Ext.getCmp(this.formId).getForm()){b=
this.getInvalidNames(a);if(b.length){this.showInvalidFields(b);return}}var e=new Ext.LoadMask(this.body,{msg:"\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435..."}),f=Ext.applyIf(d||{},this.actionContextJson||{}),g=function(n){for(var o=[],p=0;p<n.getCount();p++){var s=n.get(p);if(s.name&&s.localEdit)o.push(s);else if(s instanceof Ext.Container&&s.items!=undefined){s=g(s.items);o=o.concat(s)}}return o};d=g(this.items);for(b=0;b<d.length;b++){for(var h=d[b],j=h.getStore(),k=[],l=0;l<j.data.items.length;l++)k.push(j.data.items[l].data);
f[h.name]=Ext.util.JSON.encode(k)}d=a.el.dom.elements||(document.forms[a.el.dom]||Ext.getDom(a.el.dom)).elements;var m;Ext.each(d,function(n){m=n.name;!n.disabled&&m&&delete f[m]});d={url:this.formUrl,submitEmptyText:false,params:f,scope:this,success:function(n,o){try{if(this.fireEvent("aftersubmit",this,n,o)){this.fireEvent("closed_ok",o.response.responseText);this.close(true);smart_eval(o.response.responseText)}}finally{e.hide();this.disableToolbars(false)}},failure:function(n,o){this.fireEvent("submitfailed",
this,n,o)&&uiAjaxFailMessage.apply(this,arguments);e.hide();this.disableToolbars(false)}};if(this.fireEvent("beforesubmit",d)){this.disableToolbars(true);e.show();a.submit(d)}},onChangeFieldValue:function(a,b,d,e){if(a.originalValue!==b){a.isModified||e.changesCount++;a.isModified=true}else{a.isModified&&e.changesCount--;a.isModified=false}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(b){if(b instanceof Ext.form.Field&&b.isEdit){b.originalValue=b.getValue();b.startValue=b.getValue();b.isModified=false;b.updateLabel()}else b instanceof Ext.Container&&this.clearModificationFlag(b)},this)},setFieldOnChange:function(a,b){if(a){if(a instanceof Ext.form.Field&&a.isEdit)a instanceof Ext.form.Checkbox?a.on("check",function(e,f){b.onChangeFieldValue(e,f,!f,b)}):a.on("change",function(e,f,g){b.onChangeFieldValue(e,f,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(e){b.setFieldOnChange(e,b)});if(a.titleItems)for(d=0;d<a.titleItems.length;d++)b.setFieldOnChange(a.titleItems[d],b)}},updateTitle:function(){if(this.title!==this.originalTitle&&this.originalTitle===null)this.originalTitle=this.title;this.changesCount!==0?this.setTitle("*"+this.originalTitle):this.setTitle(this.originalTitle)},close:function(a){if(this.changesCount!==0&&!a)this.fireEvent("beforeclose",
this)!==false&&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(b){if(b==="yes")this.submitForm();else if(b==="no")this.hidden?this.doClose():this.hide(null,this.doClose,this);else this.fireEvent("closing_canceled")},
animEl:"elId",icon:Ext.MessageBox.QUESTION,scope:this});else Ext.m3.EditWindow.superclass.close.call(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(true);var a=new Ext.LoadMask(this.body,{msg:"\u0427\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445..."});a.show();if(this.fireEvent("beforeloaddata",this)){assert(this.dataUrl,"\u041d\u0435 \u0437\u0430\u0434\u0430\u043d dataUrl \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u044b");
this.getForm().doAction("load",{url:this.dataUrl,params:Ext.applyIf({isGetData:true},this.actionContextJson||{}),success:this.onSuccessLoadForm.createDelegate(this,[a],true),failure:this.onFailureLoadForm.createDelegate(this,[a],true),scope:this})}},onSuccessLoadForm:function(a,b,d){var e,f,g,h=b.result.complex_data,j;for(j in h){e=a.findField(j);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",
j));if(f=h[j].id){g=new Ext.data.Record;g.set("id",f);g.set(e.displayField,h[j].value);e.getStore().add([g]);e.setValue(f);e.collapse()}else e.clearValue()}d.hide();this.disableToolbars(false);this.fireEvent("dataloaded",b)},onFailureLoadForm:function(a,b,d){uiAjaxFailMessage.apply(this,arguments);d.hide();this.disableToolbars(false)}});Ext.ns("Ext.ux.grid");
Ext.ux.grid.Exporter=Ext.extend(Ext.util.Observable,{title:"",sendDatFromStore:true,constructor:function(){Ext.ux.grid.Exporter.superclass.constructor.call(this)},init:function(a){if(a instanceof Ext.grid.GridPanel){this.grid=a;this.grid.on("afterrender",this.onRender,this)}this.dataUrl=this.grid.dataUrl},onRender:function(){if(!this.grid.getTopToolbar()){this.grid.elements+=",tbar";this.grid.topToolbar=this.grid.createToolbar(this.grid.tbar)}this.grid.getTopToolbar().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(){columns=[];Ext.each(this.grid.colModel.config,function(a){columns.push({data_index:a.dataIndex,header:a.header,id:a.id,is_column:a.isCoumn,sortable:a.sortable,width:a.width})});data=[];this.sendDatFromStore&&Ext.each(this.grid.store.data.items,function(a){data.push(a.data)});params={columns:Ext.encode(columns),title:this.title||this.grid.title||this.grid.id,data:Ext.encode(data)};Ext.Ajax.request({url:"/ui/exportgrid-export",
success:function(a){location.href=a.responseText},failure:function(){},params:params})}});
Ext.ux.tree.TreeHeaderFilters=Ext.extend(Ext.util.Observable,{fieldHeight:22,fieldPadding:1,highlightOnFilter:true,highlightColor:"yellow",highlightCls:null,stateful:true,applyMode:"auto",filters:null,filtersInitMode:"replace",ensureFilteredVisible:true,cfgFilterInit:false,containerConfig:null,labelWidth:50,fcc:null,filterFields:null,filterContainers:null,filterContainerCls:"x-ghf-filter-container",inResizeProcess:false,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});if(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:true});this.cfgFilterInit=Ext.isDefined(this.filters)&&this.filters!==null;if(!this.filters)this.filters={};this.configure(this.tree.columns);
Ext.ux.tree.TreeHeaderFilters.superclass.constructor.call(this);if(this.stateful){if(!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(b){if(!this.headerFilters)return null;return this.headerFilters.filters[b]},
setHeaderFilter:function(b,d){if(this.headerFilters){var e={};e[b]=d;this.setHeaderFilters(e)}},setHeaderFilters:function(b,d,e){if(this.headerFilters){d&&this.resetHeaderFilters(false);if(arguments.length<3)e=true;var f=false,g;for(g in b)if(this.headerFilters.filterFields[g]){f=this.headerFilters.filterFields[g];this.headerFilters.setFieldValue(f,b[g]);this.headerFilters.applyFilter(f,false);f=true}f&&e&&this.headerFilters.storeReload()}},getHeaderFilterField:function(b){if(this.headerFilters)return this.headerFilters.filterFields[b]?
this.headerFilters.filterFields[b]:null},resetHeaderFilters:function(b){if(this.headerFilters){if(arguments.length==0)b=true;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,false)}b&&this.headerFilters.storeReload()}},applyHeaderFilters:function(b){if(arguments.length==0)b=true;this.headerFilters.applyFilters(b)}})},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:f>0?a.dataIndex+f:a.dataIndex},e[f]);Ext.apply(g,{columnId:a.id,dataIndex:a.dataIndex,hideLabel:true,anchor:"100%"});if(!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(j){this.applyFilter(j)};delete g.applyFilterEvent}else if(this.applyMode==="auto"||this.applyMode===
"change"||Ext.isEmpty(this.applyMode))if(g.hasListener!=undefined){g.hasListener("change")||g.on("change",function(j){var k=j.getXType();(k=="combo"||k=="datefield"||k=="m3-select")&&this.checkHasValue(j)||this.applyFilter(j)},this);g.hasListener("specialkey")||g.on("specialkey",function(j,k){k.stopPropagation();if(k.getKey()==k.ENTER)this.focusedFilterName=j.filterName},this);g.hasListener("select")||g.on("select",function(j){this.focusedFilterName=j.filterName;this.applyFilter(j)},this)}else g.listeners=
{change:function(j){var k=j.getXType();if(!(k=="combo"||k=="datefield")){j.startValue=j.getValue();this.applyFilter(j)}},specialkey:function(j,k){k.stopPropagation();if(k.getKey()==k.TAB)this.focusedFilterName=undefined;if(k.getKey()==k.ENTER)this.focusedFilterName=j.filterName},select:function(j){this.focusedFilterName=j.filterName;this.applyFilter(j)},scope:this};else if(this.applyMode==="enter")g.listeners={specialkey:function(j,k){k.stopPropagation();if(k.getKey()==k.ENTER){this.focusedFilterName=
j.filterName;this.applyFilters()}if(k.getKey()==k.TAB)this.focusedFilterName=undefined},scope:this};var h=this.fcc[g.columnId];if(!h){h={cls:this.filterContainerCls,border:false,bodyBorder:false,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:false,bodyBorder:false,
layout:"form",padding:2,margins:"0 0 -4 0",flex:1,items:[g]})}}},checkHasValue:function(a){a=this.getFieldValue(a);return!(a===null||a===""||a===undefined)},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++){e=Ext.fly(d[f]);if(b[f].dataIndex==a)return e}return null},renderFilterContainer:function(a,b){if(!this.filterContainers)this.filterContainers={};for(var d=0,e=this.tree.columns.length;d<e;d++);
d=this.getHeaderCell(a);d=Ext.get(d);if(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;if(!this.filterFields)this.filterFields={};var g=e.findBy(function(h){return!Ext.isEmpty(h.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},setIsNotRendered:function(a){if(a.items)for(var b in a.items)this.setIsNotRendered(a.items[b]);
else if(a.rendered)a.rendered=false},renderFilters:function(){if(this.fcc){for(var a in this.fcc){Ext.isIE&&this.setIsNotRendered(this.fcc[a]);this.renderFilterContainer(a,this.fcc[a])}this.setFilters(this.filters);this.highlightFilters(this.isFiltered())}},onRender:function(){this.isFiltered()&&this.applyFilters(false);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];if(Ext.isEmpty(f))b&&this.setFieldValue(e,"");else this.setFieldValue(e,f)}}},onColResize:function(a,b){if(this.filterContainers){var d=this.filterContainers[this.tree.columns[a].dataIndex];if(d){if(isNaN(b))b=0;d.setWidth(b<3?0:b-3);d.doLayout(false,true)}}},onResize:function(){this.inResizeProcess=true;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=false},onColHidden:function(a,b,d){if(!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];if(b===null)b={};b.gridHeaderFilters=d;return true},loadFilters:function(a,b){var d=b.gridHeaderFilters;
if(d)if(this.cfgFilterInit)this.filtersInitMode==="merge"&&Ext.apply(d,this.filters);else this.filters=d},isFiltered:function(){for(var a in this.filters)if(!Ext.isEmpty(this.filters[a]))return true;return false},highlightFilters:function(a){if(this.highlightOnFilter)if(this.filterContainers)if(this.tree.mainHd){var b=a?this.highlightColor:"transparent",d;for(d in this.filterContainers){var e=this.filterContainers[d];if(e.rendered)if(Ext.isEmpty(this.highlightCls))e.getEl().setStyle("backgroundColor",
b);else 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){if(Ext.isFunction(a.filterDecoder))b=a.filterDecoder.call(a,b);a.setValue(b)},applyFilter:function(a,b){if(arguments.length<2)b=true;if(a)if(a.isValid()){var d=this.getFieldValue(a);if(a.disabled||Ext.isEmpty(d))delete this.filters[a.filterName];else this.filters[a.filterName]=
d;this.highlightFilters(this.isFiltered());this.tree.fireEvent("filterupdate",a.filterName,d,a);b&&this.storeReload()}},applyFilters:function(a){if(arguments.length<1)a=true;for(var b in this.filterFields)this.applyFilter(this.filterFields[b],false);a&&this.storeReload()},storeReload:function(){for(var a in this.filterFields)this.tree.actionContextJson&&delete this.tree.actionContextJson[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){if(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,true);this.grid.getStore().on("beforeload",this.beforeLoad,this)}},onAfterRender:function(){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))){a.stopEditing(true);a=a.getStore();if(d.ctrlKey){d=e.getDataIndex(b);
if(a.hasMultiSort){b=a.multiSortInfo;e=false;for(var 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=true;break}e||b.sorters.push({direction:"ASC",field:d});a.multiSort(b.sorters)}else!a.sortInfo||a.sortInfo.field==d?a.sort(e.getDataIndex(b)):a.multiSort([{direction:a.sortInfo.direction,field:a.sortInfo.field},{direction:"ASC",field:d}])}else a.sort(e.getDataIndex(b))}},beforeLoad:function(a,b){b.params.multisort=a.hasMultiSort?
Ext.util.JSON.encode(a.multiSortInfo.sorters):undefined},beforeBuffer:function(a,b,d,e,f,g){g.params.multisort=b.hasMultiSort?Ext.util.JSON.encode(b.multiSortInfo.sorters):undefined},realMultiSort:function(a){this.hasMultiSort=true;this.multiSortInfo={sorters:a,direction:"ASC"};if(this.remoteSort)this.load(this.lastOptions);else{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=false,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;if(this.sortState.sorters[g].direction!=a.sorters[e].direction)b=true;break}if(b)break}if(b||this.sortState.length!=d)this.grid.fireEvent("sortchange",this.grid,a)}else if(!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){this.mainHd.select(this.cellSelector||"td").removeClass(this.sortClasses);e=0;for(f=this.sortState.sorters.length;e<f;e++){b=this.cm.findColumnIndex(this.sortState.sorters[e].field);if(b!=-1){a=this.sortState.sorters[e].direction;this.updateSortIcon(b,a)}}}else{b=this.cm.findColumnIndex(a.field);if(b!=-1){a=a.direction;this.mainHd.select(this.cellSelector||
"td").removeClass(this.sortClasses);this.updateSortIcon(b,a)}}}},realUpdateSortIcon:function(a,b){var d=this.sortClasses[b=="DESC"?1:0];this.mainHd.select(this.cellSelector||"td").item(a).addClass(d)}});
Ext.m3.HelpWindow=Ext.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=true;this.width=800;this.height=550;Ext.m3.HelpWindow.superclass.constructor.call(this,a)}});function showHelpWindow(a){window.open(a)}
Ext.define("Ext.m3.InputTextMask",{constructor:function(a,b){this.clearWhenInvalid=b===undefined?true:b;this.clearWhenInvalid=false;this.rawMask=a;this.viewMask="";this.maskArray=[];for(var d=0,e="",f=0;f<a.length;f++)if(e){if(e=="X")e="";if(a.charAt(f)=="X"){this.maskArray[d]=e;d++;e=""}else e+=a.charAt(f)}else if(a.charAt(f)=="X"){e+="X";this.viewMask+=" "}else{if(a.charAt(f)=="9"||a.charAt(f)=="L"||a.charAt(f)=="l"||a.charAt(f)=="A"){this.viewMask+=" ";this.maskArray[d]=a.charAt(f)}else{this.viewMask+=
a.charAt(f);this.maskArray[d]=RegExp.escape(a.charAt(f))}d++}this.specialChars=this.viewMask.replace(/(L|l|9|A| |X)/g,"");return this},init:function(a){this.field=a;a.rendered?this.assignEl():a.on("render",this.assignEl,this);a.on("blur",this.removeValueWhenInvalid,this);a.on("focus",this.processMaskFocus,this)},assignEl:function(){this.inputTextElement=this.field.el.dom;this.field.el.on("keypress",this.processKeyPress,this);this.field.el.on("keydown",this.processKeyDown,this);if(Ext.isSafari||Ext.isIE){this.field.el.on("paste",
this.startTask,this);this.field.el.on("cut",this.startTask,this)}if(Ext.isGecko||Ext.isOpera)this.field.el.on("mousedown",this.setPreviousValue,this);Ext.isGecko&&this.field.el.on("input",this.onInput,this);Ext.isOpera&&this.field.el.on("input",this.onInputOpera,this)},changeMask:function(a){var b=this,d=b.field;d.un("render",b.assignEl,b);d.un("blur",b.removeValueWhenInvalid,b);d.un("focus",b.processMaskFocus,b);d.getEl().un("keypress",b.processKeyPress,b);d.getEl().un("keydown",b.processKeyDown,
b);if(Ext.isSafari||Ext.isIE){d.getEl().un("paste",b.startTask,b);d.getEl().un("cut",b.startTask,b)}if(Ext.isGecko||Ext.isOpera)d.getEl().un("mousedown",b.setPreviousValue,b);Ext.isGecko&&d.getEl().un("input",b.onInput,b);Ext.isOpera&&d.getEl().un("input",b.onInputOpera,b);delete d.plugins;b=new Ext.ux.netbox.InputTextMask({mask:a});d.plugins=b;b.init(d)},onInput:function(){this.startTask(false)},onInputOpera:function(){this.prevValueOpera?this.manageBackspaceAndDeleteOpera():this.startTask(false)},
manageBackspaceAndDeleteOpera:function(){this.inputTextElement.value=this.prevValueOpera.cursorPos.previousValue;this.manageTheText(this.prevValueOpera.keycode,this.prevValueOpera.cursorPos);this.prevValueOpera=null},setPreviousValue:function(){this.oldCursorPos=this.getCursorPosition()},getValidatedKey:function(a,b){var d=this.maskArray[b.start];if(d=="9")return a.pressedKey.match(/[0-9]/);else if(d=="L")return a.pressedKey.match(/[A-Za-z\u0410-\u042f\u0430-\u044f\u0451\u0401]/)?a.pressedKey.toUpperCase():
null;else if(d=="l")return a.pressedKey.match(/[A-Za-z\u0410-\u042f\u0430-\u044f\u0451\u0401]/)?a.pressedKey.toLowerCase():null;else if(d=="A")return a.pressedKey.match(/[A-Za-z\u0410-\u042f\u0430-\u044f\u0451\u04010-9]/);else if(d)return a.pressedKey.match(RegExp(d));return null},removeValueWhenInvalid:function(){if(this.clearWhenInvalid&&this.inputTextElement.value.indexOf(" ")>-1)this.inputTextElement.value=""},managePaste:function(){if(this.oldCursorPos!=null){var a=this.inputTextElement.value.substring(this.oldCursorPos.start,
this.inputTextElement.value.length-(this.oldCursorPos.previousValue.length-this.oldCursorPos.end));if(this.oldCursorPos.start<this.oldCursorPos.end){this.oldCursorPos.previousValue=this.oldCursorPos.previousValue.substring(0,this.oldCursorPos.start)+this.viewMask.substring(this.oldCursorPos.start,this.oldCursorPos.end)+this.oldCursorPos.previousValue.substring(this.oldCursorPos.end,this.oldCursorPos.previousValue.length);a=a.substr(0,this.oldCursorPos.end-this.oldCursorPos.start)}this.inputTextElement.value=
this.oldCursorPos.previousValue;keycode={unicode:"",isShiftPressed:false,isTab:false,isBackspace:false,isLeftOrRightArrow:false,isDelete:false,pressedKey:""};for(var b=false,d=0;d<a.length;d++){keycode.pressedKey=a.substr(d,1);keycode.unicode=a.charCodeAt(d);this.oldCursorPos=this.skipMaskCharacters(keycode,this.oldCursorPos);if(this.oldCursorPos===false)break;if(this.injectValue(keycode,this.oldCursorPos)){b=true;this.moveCursorToPosition(keycode,this.oldCursorPos);this.oldCursorPos.previousValue=
this.inputTextElement.value;this.oldCursorPos.start+=1}}!b&&this.oldCursorPos!==false&&this.moveCursorToPosition(null,this.oldCursorPos);this.oldCursorPos=null}},processKeyDown:function(a){this.processMaskFormatting(a,"keydown")},processKeyPress:function(a){this.processMaskFormatting(a,"keypress")},startTask:function(a){if(this.task==undefined)this.task=new Ext.util.DelayedTask(this.managePaste,this);if(a!==false)this.oldCursorPos=this.getCursorPosition();this.task.delay(0)},skipMaskCharacters:function(a,
b){if(b.start!=b.end&&(a.isDelete||a.isBackspace))return b;for(;this.specialChars.match(RegExp.escape(this.viewMask.charAt(a.isBackspace?b.start-1:b.start)));){a.isBackspace?b.dec():b.inc();if(b.start>=b.previousValue.length||b.start<0)return false}return b},isManagedByKeyDown:function(a){if(a.isDelete||a.isBackspace)return true;return false},processMaskFormatting:function(a,b){this.oldCursorPos=null;var d=this.getCursorPosition(),e=this.getKeyCode(a,b);if(e.unicode!=0)if(!((e.unicode==67||e.unicode==
99)&&a.ctrlKey))if((e.unicode==88||e.unicode==120)&&a.ctrlKey)this.startTask();else if((e.unicode==86||e.unicode==118)&&a.ctrlKey)this.startTask();else if((e.isBackspace||e.isDelete)&&Ext.isOpera)this.prevValueOpera={cursorPos:d,keycode:e};else{if(b=="keydown"&&!this.isManagedByKeyDown(e))return true;if(b=="keypress"&&this.isManagedByKeyDown(e))return true;if(this.handleEventBubble(a,e,b))return true;return this.manageTheText(e,d)}},manageTheText:function(a,b){if(this.inputTextElement.value.length===
0)this.inputTextElement.value=this.viewMask;b=this.skipMaskCharacters(a,b);if(b===false)return false;this.injectValue(a,b)&&this.moveCursorToPosition(a,b);return false},processMaskFocus:function(){if(this.inputTextElement.value.length==0){var a=this.getCursorPosition();this.inputTextElement.value=this.viewMask;this.moveCursorToPosition(null,a)}},isManagedByBrowser:function(a,b,d){if((d=="keypress"&&a.charCode===0||d=="keydown")&&(b.unicode==Ext.EventObject.TAB||b.unicode==Ext.EventObject.RETURN||
b.unicode==Ext.EventObject.ENTER||b.unicode==Ext.EventObject.SHIFT||b.unicode==Ext.EventObject.CONTROL||b.unicode==Ext.EventObject.ESC||b.unicode==Ext.EventObject.PAGEUP||b.unicode==Ext.EventObject.PAGEDOWN||b.unicode==Ext.EventObject.END||b.unicode==Ext.EventObject.HOME||b.unicode==Ext.EventObject.LEFT||b.unicode==Ext.EventObject.UP||b.unicode==Ext.EventObject.RIGHT||b.unicode==Ext.EventObject.DOWN))return true;return false},handleEventBubble:function(a,b,d){try{if(b&&this.isManagedByBrowser(a,b,
d))return true;a.stopEvent();return false}catch(e){alert(e.message)}},getCursorPosition:function(){var a,b,d;if(this.inputTextElement.createTextRange){d=document.selection.createRange().duplicate();d.moveEnd("character",this.inputTextElement.value.length);a=d.text===""?this.inputTextElement.value.length:this.inputTextElement.value.lastIndexOf(d.text);d=document.selection.createRange().duplicate();d.moveStart("character",-this.inputTextElement.value.length);b=d.text.length}else{a=this.inputTextElement.selectionStart;
b=this.inputTextElement.selectionEnd}return this.CursorPosition(a,b,d,this.inputTextElement.value)},moveCursorToPosition:function(a,b){var d=!a||a&&a.isBackspace?b.start:b.start+1;if(this.inputTextElement.createTextRange){b.range.move("character",d);b.range.select()}else{this.inputTextElement.selectionStart=d;this.inputTextElement.selectionEnd=d}},injectValue:function(a,b){if(!a.isDelete&&a.unicode==b.previousValue.charCodeAt(b.start))return true;var d;if(!a.isDelete&&!a.isBackspace)d=this.getValidatedKey(a,
b);else if(b.start==b.end){d=" ";a.isBackspace&&b.dec()}else d=this.viewMask.substring(b.start,b.end);if(d){this.inputTextElement.value=b.previousValue.substring(0,b.start)+d+b.previousValue.substring(b.start+d.length,b.previousValue.length);return true}return false},getKeyCode:function(a,b){var d={};d.unicode=a.getKey();d.isShiftPressed=a.shiftKey;d.isDelete=a.getKey()==Ext.EventObject.DELETE&&b=="keydown"||b=="keypress"&&a.charCode===0&&a.keyCode==Ext.EventObject.DELETE?true:false;d.isTab=a.getKey()==
Ext.EventObject.TAB?true:false;d.isBackspace=a.getKey()==Ext.EventObject.BACKSPACE?true:false;d.isLeftOrRightArrow=a.getKey()==Ext.EventObject.LEFT||a.getKey()==Ext.EventObject.RIGHT?true:false;d.pressedKey=String.fromCharCode(d.unicode);return d},CursorPosition:function(a,b,d,e){var f={};f.start=isNaN(a)?0:a;f.end=isNaN(b)?0:b;f.range=d;f.previousValue=e;f.inc=function(){f.start++;f.end++};f.dec=function(){f.start--;f.end--};return f},destroy:function(){var a=this.field;a.un("render",this.assignEl,
this);a.un("blur",this.removeValueWhenInvalid,this);a.un("focus",this.processMaskFocus,this);a.getEl().un("keypress",this.processKeyPress,this);a.getEl().un("keydown",this.processKeyDown,this);if(Ext.isSafari||Ext.isIE){a.getEl().un("paste",this.startTask,this);a.getEl().un("cut",this.startTask,this)}if(Ext.isGecko||Ext.isOpera)a.getEl().un("mousedown",this.setPreviousValue,this);Ext.isGecko&&a.getEl().un("input",this.onInput,this);Ext.isOpera&&a.getEl().un("input",this.onInputOpera,this);if(Ext.isArray(a.plugins))a.plugins.remove(this);
else a.plugins=null}});Ext.applyIf(RegExp,{escape:function(a){return(new String(a)).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}});Ext.ns("Ext.ux.grid");if(![].includes)Array.prototype.includes=function(a,b){var d=Object(this),e=parseInt(d.length)||0;if(e===0)return false;var f=parseInt(b)||0;if(f>=0)f=f;else{f=e+f;if(f<0)f=0}for(;f<e;){var g=d[f];if(a===g||a!==a&&g!==g)return true;f++}return false};
Ext.ux.grid.LockingGridColumnWithHeaderGroup=Ext.extend(Ext.util.Observable,{constructor:function(a){this.config=a},init:function(a){if(!(!a instanceof Ext.grid.GridPanel))if(!(!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 this.config[a].locked===true},isLockedHdGroup:function(a,b){return this.rows[a][b].locked===true},setLocked:function(a,b,d){if(this.isLocked(a)!=b){this.config[a].locked=b;d||this.fireEvent("columnlockchange",this,a,b)}},setLockedHdGroup:function(a,b,d){if(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++)if(this.isLocked(b)&&!this.isHidden(b))a+=this.getColumnWidth(b);
return a},getLockedCount:function(){for(var a=this.config.length,b=0;b<a;b++)if(!this.isLocked(b))return b;return a},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);if(a<b&&d&&!e)this.setLocked(a,false,true);else a>b&&!d&&e&&this.setLocked(a,true,true);Ext.grid.ColumnModel.prototype.moveColumn.apply(this,arguments)},processLockingHdGroups:function(a){var b=
this.rows,d=[],e,f=this.getLockedHdGroupCount(0);if(f>0)this.getHdGroupsPositionsToMovie(a,0,0,f-1,d,false);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];if(f==b.length-1)e=this.getBeforeHdGroupColCount(f,d[f]);this.setLockedHdGroup(f,g,true);if(h.colspan==1)this.moveHdGroup(f,g,d[f]);else{var j={};Ext.apply(j,h);j.colspan=h.colspan-1;j.locked=false;h.colspan=1;this.moveHdGroup(f,g,d[f],j)}}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,true);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,false);if(h.colspan==1){if(f==b.length-1)e=this.getBeforeHdGroupColCount(f,d[f]-1);this.moveHdGroup(f,g,d[f]-1)}else{if(f==b.length-
1)e=this.getBeforeHdGroupColCount(f,d[f]);var j={};Ext.apply(j,h);j.colspan=h.colspan-1;j.locked=true;h.colspan=1;this.moveHdGroup(f,g,d[f],j)}}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){var h=this.findHdGroupIndex(a,b),j=this.rows[b][h];for(h=d;h<=e;h++)if(this.rows[b][h].id==j.id){j=g?h:h+1;f[f.length]=j;if(b+1<this.rows.length){j=this.getBeforeHdGroupColCount(b,
h);d=this.findHdGroupIndex(j,b+1);e=this.findHdGroupIndex(j+this.rows[b][h].colspan-1,b+1);this.getHdGroupsPositionsToMovie(a,b+1,d,e,f,g)}return f}j=g?d:e+1;f[f.length]=j;if(b+1<this.rows.length){j=this.getBeforeHdGroupColCount(b,d);h=this.getBeforeHdGroupColCount(b,e);d=this.findHdGroupIndex(j,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),j=f.slice(d,b);b=f.slice(b+1,f.length);this.rows[a]=e?h.concat([g]).concat(j).concat([e]).concat(b):h.concat([g]).concat(j).concat(b)}else if(b<d)if(e){h=f.slice(0,b);j=f.slice(b+1,d);b=f.slice(d,f.length);this.rows[a]=h.concat([e]).concat(j).concat([g]).concat(b)}else{h=f.slice(0,b);j=f.slice(b+1,d+1);b=f.slice(d+1,f.length);this.rows[a]=h.concat(j).concat([g]).concat(b)}else if(e){h=f.slice(0,b);j=f.slice(b+
1,f.length);this.rows[a]=e.locked?h.concat([e]).concat([g]).concat(j):h.concat([g]).concat([e]).concat(j)}},prepareHdRows:function(){var a=this.rows,b=this.lockedCount;if(b)for(g=0;g<b;g++)this.setLocked(g,true,true);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;f+=h.colspan;var j=f-b;if(j>0){var k=e.slice(0,g+1),l=e.slice(g+1,e.length),m={};Ext.apply(m,h);m.colspan=j;h.colspan-=j;this.setLockedHdGroup(d,g,true);a[d]=k.concat([m]).concat(l)}else this.setLockedHdGroup(d,
g,true);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;b>=0;b--)for(var d=a[b],e=0;e<d.length-1;e++){var f=d[e],g=d[e+1];if(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:true},viewConfig:{lockText:"Lock",unlockText:"Unlock",rowBorderWidth:1,lockedBorderWidth:1,
syncHeights:false,groupByText:"Group By This Field",showGroupsText:"Show in Groups",hideGroupedColumn:false,showGroupName:true,startCollapsed:false,enableGrouping:true,enableGroupingMenu:true,enableNoGroups:true,emptyGroupText:"(None)",ignoreAdd:false,groupTextTpl:"{text}",groupMode:"value",cancelEditOnToggle:true,totalSummaryEnabled:true},viewFunctions:{initTemplates:function(){Ext.grid.GridView.prototype.initTemplates.apply(this,arguments);var a=this.templates||{};if(!a.masterTpl)a.masterTpl=new Ext.Template('<div class="x-grid3" hidefocus="true">',
'<div class="x-grid3-locked">','<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset" style="{lstyle}">{lockedHeader}</div></div><div class="x-clear"></div></div>','<div class="x-grid3-scroller"><div class="x-grid3-body" style="{lstyle}">{lockedBody}</div><div class="x-grid3-scroll-spacer"></div></div>','<div 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>");if(!a.gcell)a.gcell=new Ext.XTemplate('<td class="x-grid3-hd x-grid3-gcell x-grid3-td-{id} ux-grid-hd-group-row-{row} {cls}" style="{style}">','<div {tooltip} class="x-grid3-hd-inner x-grid3-hd-{id}" unselectable="on" style="{istyle}">',this.grid.enableHdMenu?'<a href="#"></a>':"","{value}</div></td>");if(!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">');if(!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">');if(!a.endGroup)a.endGroup=
"</div></div>";if(!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=true}if(!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>");if(!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"),j=g.child("div.x-grid3-scroller"),k=g.child("div.x-grid3-total-summary");if(this.grid.hideHeaders){d.setDisplayed(false);h.setDisplayed(false)}if(this.totalSummaryEnabled!==true){f.setDisplayed(false);k.setDisplayed(false)}this.forceFit&&j.setStyle("overflow-x","hidden");Ext.apply(this,{el:a,mainWrap:g,
mainHd:h,innerHd:h.dom.firstChild,scroller:j,totalSummary:k,totalSummaryInner:k.dom.firstChild,mainBody:j.child("div.x-grid3-body"),focusEl:j.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",true),lockedTotalSummary:f,lockedTotalSummaryInner:f.dom.firstChild});this.focusEl.swallowEvent("click",true)},renderHeaders:function(){for(var a=
this.cm,b=a.rows,d=this.templates,e=d.hcell,f=[],g=[],h=a.getColumnCount(),j=b.length,k="width:"+this.getTotalWidth()+";",l="width:"+this.getLockedWidth()+";",m=0;m<j;m++){for(var n=b[m],o=[],p=[],s=0,t=0;s<n.length;s++){var q=n[s],u=q.dataIndex?a.findColumnIndex(q.dataIndex):t;q.colspan=q.colspan||1;if(a.getColumnAt(u)!==undefined){u=this.getColumnId(u);var v=this.getGroupStyle(q,t);t+=q.colspan;q=d.gcell.apply({cls:"ux-grid-hd-group-cell",id:u,row:m,style:"width:"+v.width+";"+(v.hidden?"display:none;":
"")+(q.align?"text-align:"+q.align+";":""),tooltip:q.tooltip?(Ext.QuickTips.isEnabled()?"ext:qtip":"title")+'="'+q.tooltip+'"':"",istyle:q.align=="right"?"padding-right:16px":"",btn:this.grid.enableHdMenu&&q.header,value:q.header||"&nbsp;"});if(a.isLockedHdGroup(m,s))p[p.length]=q;else o[o.length]=q}}f[m]=d.header.apply({tstyle:k,cells:o.join("")});g[m]=d.header.apply({tstyle:l,cells:p.join("")})}b=[];m=[];for(s=0;s<h;s++)if(a.getColumnAt(s)!==undefined){n={};n.id=a.getColumnId(s);n.value=a.getColumnHeader(s)||
"";n.style=this.getColumnStyle(s,true);n.tooltip=this.getColumnTooltip(s);n.css=(s===0?"x-grid3-cell-first ":s==h-1?"x-grid3-cell-last ":"")+(a.config[s].headerCls?" "+a.config[s].headerCls:"");if(a.config[s].align=="right")n.istyle="padding-right:16px";else delete n.istyle;if(a.isLocked(s))m[m.length]=e.apply(n);else b[b.length]=e.apply(n)}f[j]=d.header.apply({tstyle:k,cells:b.join("")});g[j]=d.header.apply({tstyle:l,cells:m.join("")});return[f.join(""),g.join("")]},renderTotalSummary:function(){var a=
this.cm,b=this.templates,d=b.totalSummaryCell;b=b.totalSummary;for(var e=[],f=[],g=a.getColumnCount(),h="width:"+this.getTotalWidth()+";",j="width:"+this.getLockedWidth()+";",k=this.calculate(this.grid.store.allData?this.grid.store.allData.items:this.grid.store.data.items,this.getColumnData()),l=0;l<g;l++){var m=a.getColumnAt(l);if(m!==undefined){var n={};n.id=m.id;n.style=this.getColumnStyle(l);n.tooltip="";n.css=(l===0?"x-grid3-total-summary-cell-first ":l==g-1?"x-grid3-total-summary-cell-last ":
"")+(m.headerCls?" "+m.headerCls:"");if(m.align=="right")n.istyle="padding-right:16px";n.value=m.summaryRenderer?m.summaryRenderer(k[m.dataIndex],n,k,undefined,l,this.ds):k[m.dataIndex];if(n.value==undefined||n.value==="")n.value="&#160;";if(a.isLocked(l))f[f.length]=d.apply(n);else e[e.length]=d.apply(n)}}a=b.apply({tstyle:h,cells:e.join("")});d=b.apply({tstyle:j,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){b=this.lockedHd.dom.getElementsByTagName("td");for(var d=0,e=
0;d<b.length;d++)if(b[d].className.indexOf("ux-grid-hd-group-cell")<0){if(e==a)return b[d];e++}}else{d=this.mainHd.dom.getElementsByTagName("td");for(var f=e=0;e<d.length;e++)if(d[e].className.indexOf("ux-grid-hd-group-cell")<0){if(f+b==a)return d[e];f++}}},findHeaderCell:function(a){return a?this.fly(a).findParent("td.x-grid3-hd",this.cellSelectorDepth):false},findHeaderIndex:function(a){return(a=this.findHeaderCell(a))?this.getCellIndex(a):false},updateSortIcon:function(a,b){var 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[b=="DESC"?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:true});this.hmenu.show(b,"tl-bl?")}else if(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(true)<=g+1){this.onDenyColumnLock();return}(a=d.processLockingHdGroups(b))||(a=g);d.setLocked(b,true,a!=b);if(a!=b){d.moveColumn(b,a);this.grid.fireEvent("columnmove",b,a)}break;case "unlock":(a=d.processUnLockingHdGroups(b))||(a=g-1);if(a!=b){d.setLocked(b,false,true);d.moveColumn(b,a);this.grid.fireEvent("columnmove",b,a)}else d.setLocked(b,false);break;default:return this.handleHdMenuClickDefault(a)}return true},
handleHdMenuClickDefault:function(a){var b=this.cm,d=a.getItemId();if(d.substr(0,6)=="group-"){var e=d.split("-"),f=parseInt(e[1],10),g=parseInt(e[2],10),h=this.cm.rows[f],j;e=f=0;for(var k=h.length;e<k;e++){j=h[e];if(g>=f&&g<f+j.colspan)break;f+=j.colspan}if(a.checked){g=b.getColumnsBy(this.isHideableColumn,this).length;e=f;for(k=f+j.colspan;e<k;e++)b.isHidden(e)||g--;if(g<1){this.onDenyColumnHide();return false}}e=f;for(k=f+j.colspan;e<k;e++)b.config[e].fixed!==true&&b.config[e].hideable!==false&&
b.setHidden(e,a.checked)}else if(d.substr(0,4)=="col-"){e=b.getIndexById(d.substr(4));if(e!=-1){if(a.checked&&b.getColumnsBy(this.isHideableColumn,this).length<=1){this.onDenyColumnHide();return false}b.setHidden(e,a.checked)}}if(d.substr(0,6)=="group-"||d.substr(0,4)=="col-"){a.checked=!a.checked;if(a.menu){var l=function(n){n.items.each(function(o){if(!o.disabled){o.setChecked(a.checked,false);o.menu&&l(o.menu)}})};l(a.menu)}b=a;for(var m;b=b.parentMenu;){if(!b.parentMenu||!(m=b.parentMenu.items.get(b.getItemId()))||
!m.setChecked)break;d=b.items.findIndexBy(function(n){return n.checked})>=0;m.setChecked(d,true)}a.checked=!a.checked}},handleHdMove:function(a){var b=this.findHeaderCell(this.activeHdRef);if(b&&!this.headersDisabled&&!Ext.fly(b).hasClass("ux-grid-hd-group-cell")){var d=this.splitHandleWidth||5,e=this.activeHdRegion;a=a.getPageX();b=b.style;var f="";if(this.grid.enableColumnResize!==false)if(a-e.left<=d&&this.cm.isResizable(this.activeHdIndex-1))f=Ext.isAir?"move":Ext.isWebKit?"e-resize":"col-resize";
else if(e.right-a<=(!this.activeHdBtn?d:2)&&this.cm.isResizable(this.activeHdIndex))f=Ext.isAir?"move":Ext.isWebKit?"w-resize":"col-resize";b.cursor=f}},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();if(!(this.cm.isMenuDisabled(this.activeHdIndex)||e.hasClass("ux-grid-hd-group-cell"))){e.addClass("x-grid3-hd-over");if(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);if(d&&(!Ext.isIE||!a.within(d,true))){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(a.config[d].fixed!==true&&a.config[d].hideable!==false){for(var j=0,k=b.length;j<k;j++){for(var l=b[j],m,n=0,o=0,
p=l.length;o<p;o++){m=l[o];if(d>=n&&d<n+m.colspan)break;n+=m.colspan}if(m&&m.header)if(a.hierarchicalColMenu){l="group-"+j+"-"+n;o=(o=f.items?f.getComponent(l):null)?o.menu:null;if(!o){o=new Ext.menu.Menu({itemId:l});o.on("itemclick",this.handleHdMenuClick,this);p=false;var s=true,t=n;for(n=n+m.colspan;t<n;t++){a.isHidden(t)||(p=true);if(a.config[t].hideable!==false)s=false}f.add({itemId:l,text:m.header,menu:o,hideOnClick:false,checked:p,disabled:s})}f=o}else h.push(m.header)}h.push(g);f.add(new Ext.menu.CheckItem({itemId:"col-"+
a.getColumnId(d),text:h.join(" "),checked:!a.isHidden(d),hideOnClick:false,disabled:a.config[d].hideable===false}))}}},getEditorParent:function(){return this.el.dom},getLockedRows:function(){if(!this.canGroup())return this.hasRows()?this.lockedBody.dom.childNodes:[];for(var a=[],b=this.getGroups(true),d,e=0,f=b.length,g,h;e<f;++e)if(d=b[e].childNodes[1]){d=d.childNodes;g=0;for(h=d.length;g<h;++g)a[a.length]=d[g]}return a},getLockedRow:function(a){return this.getLockedRows()[a]},getTotalSummaryRow:function(a){return a===
true?this.lockedTotalSummaryInner.firstChild.firstChild.firstChild.firstChild:this.totalSummaryInner.firstChild.firstChild.firstChild.firstChild},getCell:function(a,b){var d=this.cm.getLockedCount();if(b<d)return Ext.fly(this.getLockedRow(a)).query(this.cellSelector)[b];return 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 j=this.getLockedRows(),k=this.getRows(),l,m;h=0;for(g=k.length;h<g;h++){l=j[h];l.style.width=d;if(l.firstChild){l.firstChild.style.width=
d;l=l.firstChild.rows[0];for(m=0;m<e;m++)l.childNodes[m].style.width=f[m]}l=k[h];l.style.width=a;if(l.firstChild){l.firstChild.style.width=a;l=l.firstChild.rows[0];for(m=e;m<b;m++)l.childNodes[m-e].style.width=f[m]}}this.onAllColumnWidthsUpdated(f,a);this.syncHeaderHeight()},updateColumnWidth:function(a){var b=this.getColumnWidth(a),d=this.cm.getLockedCount(),e,f,g,h;this.updateLockedWidth();if(a<d){e=this.getLockedRows();f=this.getLockedWidth();d=this.getTotalSummaryRow(true);g=a}else{e=this.getRows();
f=this.getTotalWidth();g=a-d;d=this.getTotalSummaryRow(false)}this.getHeaderCell(a).style.width=b;for(var j=0,k=e.length;j<k;j++){h=e[j];h.style.width=f;if(h.firstChild){h.firstChild.style.width=f;h.firstChild.rows[0].childNodes[g].style.width=b}}d.childNodes[g].style.width=b;this.onColumnWidthUpdated(a,b,this.getTotalWidth());this.syncHeaderHeight()},updateColumnHidden:function(a,b){var d=this.cm.getLockedCount(),e,f,g,h,j=b?"none":"";this.updateLockedWidth();if(a<d){e=this.getLockedRows();f=this.getLockedWidth();
h=this.getTotalSummaryRow(true);d=a}else{e=this.getRows();f=this.getTotalWidth();h=this.getTotalSummaryRow(false);d=a-d}this.getHeaderCell(a).style.display=j;for(var k=0,l=e.length;k<l;k++){g=e[k];g.style.width=f;if(g.firstChild){g.firstChild.style.width=f;g.firstChild.rows[0].childNodes[d].style.display=j}}h.childNodes[d].style.display=j;this.onColumnHiddenUpdated(a,b,this.getTotalWidth());delete this.lastViewWidth;this.layout()},doRender:function(a,b,d,e,f,g){if(b.length<1)return"";if(!this.canGroup()||
this.isUpdating)return this.doRenderRows(a,b,d,e,f,g);var h=this.getGroupField(),j=this.cm.findColumnIndex(h),k,l="width:"+this.getTotalWidth()+";",m="width:"+this.getLockedWidth()+";";k=this.cm.config[j];var n=k.groupRenderer||k.renderer,o=this.showGroupName?(k.groupName||k.header)+": ":"",p=[],s,t,q,u;t=0;for(q=b.length;t<q;t++){var v=e+t,x=b[t],y=x.data[h];k=this.getGroup(y,x,n,v,j,d);if(!s||s.group!=k){u=this.constructId(y,h,j);this.state[u]=!(Ext.isDefined(this.state[u])?!this.state[u]:this.startCollapsed);
s={group:k,gvalue:y,text:o+k,groupId:u,startRow:v,rs:[x],cls:this.state[u]?"":"x-grid-group-collapsed"};p.push(s)}else s.rs.push(x);x._groupId=u}b=[];e=[];t=0;for(q=p.length;t<q;t++){k=p[t];k.style=l;this.doGroupStart(b,k,a,d,f,false);k.style=m;this.doGroupStart(e,k,a,d,f,true);h=this.doRenderRows(a,k.rs,d,k.startRow,f,g);b[b.length]=h[0];e[e.length]=h[1];this.doGroupEnd(b,k,a,d,f,false);this.doGroupEnd(e,k,a,d,f,true)}return[b.join(""),e.join("")]},doRenderRows:function(a,b,d,e,f,g){var h=this.templates,
j=h.cell;h=h.row;for(var k=f-1,l="width:"+this.getTotalWidth()+";",m="width:"+this.getLockedWidth()+";",n=[],o=[],p,s,t,q={},u={},v,x=0,y=b.length;x<y;x++){v=b[x];p=[];s=[];for(var z=x+e,w=0;w<f;w++){t=a[w];q.id=t.id;q.css=(w===0?"x-grid3-cell-first ":w==k?"x-grid3-cell-last ":"")+(this.cm.config[w].cellCls?" "+this.cm.config[w].cellCls:"");q.attr=q.cellAttr="";q.value=t.renderer.call(t.scope,v.data[t.name],q,v,z,w,d);q.style=t.style;if(Ext.isEmpty(q.value))q.value="&#160;";if(this.markDirty&&v.dirty&&
Ext.isDefined(v.modified[t.name]))q.css+=" x-grid3-dirty-cell";if(!Ext.isEmpty(v.error)&&Ext.isDefined(v.data[t.name])){var B=v.error.filter(function(A){return A.errorText&&A.column==t.name});if(!Ext.isEmpty(B)){q.css+=" x-grid3-row-invalid";q.css+=" x-form-invalid"}}if(t.locked)s[s.length]=j.apply(q);else p[p.length]=j.apply(q)}w=[];if(g&&(z+1)%2===0)w[0]="x-grid3-row-alt";if(v.dirty)w[1]=" x-grid3-dirty-row";u.cols=f;if(this.getRowClass)w[2]=this.getRowClass(v,z,u,d);u.alt=w.join(" ");u.cells=p.join("");
u.tstyle=l;n[n.length]=h.apply(u);u.cells=s.join("");u.tstyle=m;o[o.length]=h.apply(u)}return[n.join(""),o.join("")]},processRows:function(a,b){if(!(!this.ds||this.ds.getCount()<1)){var d=this.getRows(),e=this.getLockedRows(),f,g;b=b||!this.grid.stripeRows;a=a||0;for(var h=0,j=d.length;h<j;++h){f=d[h];g=e[h];f.rowIndex=h;g.rowIndex=h;if(!b){f.className=f.className.replace(this.rowClsRe," ");g.className=g.className.replace(this.rowClsRe," ");if((h+1)%2===0){f.className+=" x-grid3-row-alt";g.className+=
" x-grid3-row-alt"}}this.syncRowHeights(f,g)}if(a===0){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="";try{var f=d.dom.getBoundingClientRect().height,g=e.dom.getBoundingClientRect().height}catch(h){f=d.getHeight();g=e.getHeight()}if(f>g)e.setHeight(f);
else 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,true);this.deferEmptyText!==true&&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(true),d=b.width;if(!(!a.hideHeaders&&(d<20||b.height<20))){this.syncHeaderHeight();
if(a.autoHeight){this.scroller.dom.style.overflow="visible";this.lockedScroller.dom.style.overflow="visible";if(Ext.isWebKit){this.scroller.dom.style.position="static";this.lockedScroller.dom.style.position="static"}}else{this.el.setSize(b.width,b.height);a=this.mainHd.getHeight();var e=this.totalSummary.getHeight();e=b.height-a-e}this.updateLockedWidth();if(this.forceFit){if(this.lastViewWidth!=d){this.fitColumns(false,false);this.lastViewWidth=d}}else{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;if(Ext.isChrome){a=this.el.select(".x-grid3-header-offset").elements;for(var b=0;b<a.length;b++)for(var d=Array.prototype.slice.call(a[b].children,0).reverse(),e=1;e<d.length;e++){var f=d[e-1],g=d[e].querySelectorAll("td.x-grid3-gcell");if(!(g.length<=0)){for(var h=[],j=0;j<g.length;j++){var k=g[j];h.push(k.classList[2])}for(j=0;j<g.length;j++){k=g[j];var l=f.querySelectorAll("."+k.classList[2])[0],m=[l];for(l=l.nextElementSibling;l&&!h.includes(l.classList[2]);){m.push(l);l=l.nextElementSibling}for(var n=
l=0;n<m.length;n++){var o=m[n];try{var p=o.getBoundingClientRect().width}catch(s){p=o.getWidth()}l+=parseFloat(p)}Ext.isBorderBox||Ext.isWebKit&&!Ext.isSafari2&&!Ext.isChrome||(l=Math.max(l-this.borderWidth,0));k.style.width=l+"px"}}}}},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()?false:d)},ensureVisible:function(a,b,d){return Ext.grid.GridView.prototype.ensureVisible.call(this,a,b,b<this.cm.getLockedCount()?
false:d)},insertRows:function(a,b,d,e){a=a.getCount()-1;if(!e&&b===0&&d>=a)this.refresh();else{e||this.fireEvent("beforerowsinserted",this,b,d);var f=this.renderRows(b,d),g=this.getRow(b);if(g){b===0&&this.removeRowClass(0,this.firstRowCls);Ext.DomHelper.insertHtml("beforeBegin",g,f[0]);g=this.getLockedRow(b);Ext.DomHelper.insertHtml("beforeBegin",g,f[1])}else{this.removeRowClass(a-1,this.lastRowCls);Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,f[0]);Ext.DomHelper.insertHtml("beforeEnd",
this.lockedBody.dom,f[1])}if(e){if(b===0||b>=a)this.addRowClass(b,b===0?this.firstRowCls:this.lastRowCls)}else{this.fireEvent("rowsinserted",this,b,d);this.processRows(b)}}this.syncFocusEl(b)},getColumnStyle:function(a,b){var d=!b?this.cm.config[a].cellStyle||this.cm.config[a].css||"":this.cm.config[a].headerStyle||"";d+="width:"+this.getColumnWidth(a)+";";if(this.cm.isHidden(a))d+="display:none;";var e=this.cm.config[a].align;if(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)?this.ds.fields.get(e).name:f,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())},j={tstyle:String.format("width: {0};",this.getLockedWidth())},k=[],l=[],m=this.templates.cell,
n,o,p,s;this.isUpdating=true;if(Ext.isNumber(a)){n=a;a=b.getAt(n)}else n=b.indexOf(a);if(!(!a||n<0)){for(s=0;s<d;s++){o=e[s];p=s==0?"x-grid3-cell-first":s==f?"x-grid3-cell-last ":"";p={id:o.id,style:o.style,css:p,attr:"",cellAttr:""};p.value=o.renderer.call(o.scope,a.data[o.name],p,a,n,s,b);if(Ext.isEmpty(p.value))p.value="&#160;";if(this.markDirty&&a.dirty&&Ext.isDefined(a.modified[o.name]))p.css+=" x-grid3-dirty-cell";if(!Ext.isEmpty(a.error)&&Ext.isDefined(a.data[o.name])){var t=a.error.filter(function(q){return q.errorText&&
q.column==o.name});if(!Ext.isEmpty(t)){p.css+=" x-grid3-row-invalid";p.css+=" x-form-invalid"}}if(o.locked)l[s]=m.apply(p);else k[s]=m.apply(p)}e=this.getRow(n);e.className="";f=this.getLockedRow(n);f.className="";this.grid.stripeRows&&(n+1)%2===0&&g.push("x-grid3-row-alt");if(this.getRowClass){h.cols=d;g.push(this.getRowClass(a,n,h,b))}this.fly(e).addClass(g).setStyle(h.tstyle);h.cells=k.join("");e.innerHTML=this.templates.rowInner.apply(h);this.fly(f).addClass(g).setStyle(j.tstyle);j.cells=l.join("");
f.innerHTML=this.templates.rowInner.apply(j);f.rowIndex=n;this.syncRowHeights(e,f);this.fireEvent("rowupdated",this,n,a);this.isUpdating=false}},refresh:function(a){this.fireEvent("beforerefresh",this);this.grid.stopEditing(true);var b=this.renderBody();this.mainBody.update(b[0]).setWidth(this.getTotalWidth());this.lockedBody.update(b[1]).setWidth(this.getLockedWidth());if(a===true){this.updateHeaders();this.updateHeaderSortState()}this.processRows(0,true);this.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);this.cm&&this.cm.on("columnlockchange",this.onColumnLock,this)},onColumnLock:function(){this.refresh(true)},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(true),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();if(!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";if(this.lockedInnerHd){this.lockedInnerHd.firstChild.style.width=a+"px";this.lockedInnerHd.firstChild.firstChild.style.width=a+"px"}if(this.innerHd){this.innerHd.style.width=g;this.innerHd.firstChild.style.width=b+f+h+"px";this.innerHd.firstChild.firstChild.style.width=b+"px"}if(this.lockedBody)this.lockedBody.dom.style.width=
a+f+"px";if(this.mainBody)this.mainBody.dom.style.width=b+f+"px";if(this.totalSummaryInner){this.totalSummaryInner.style.width=g;this.totalSummaryInner.firstChild.style.width=b+f+h+"px";this.totalSummaryInner.firstChild.firstChild.style.width=b+"px"}if(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=true,f=b,g=b+a.colspan;f<g;f++)if(this.cm.getColumnAt(f)!==
undefined&&!this.cm.isHidden(f)){e=this.cm.getColumnWidth(f);if(typeof e=="number")d+=e;e=false}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(),j=0;j<b.length;j++){b[j].style.width=f;if(j<
g.length)for(var k=this.cm.getLockedHdGroupCount(j),l=b[j].firstChild.firstChild.childNodes,m=0,n=h;m<l.length;m++){var o=g[j][m+k];if(typeof a!="number"||a>=n&&a<n+o.colspan){var p=this.getGroupStyle(o,n);l[m].style.width=p.width;l[m].style.display=p.hidden?"none":""}n+=o.colspan}}for(j=0;j<d.length;j++){d[j].style.width=e;if(j<g.length){l=d[j].firstChild.firstChild.childNodes;for(n=m=0;m<l.length;m++){o=g[j][m];if(typeof a!="number"||a>=n&&a<n+o.colspan){p=this.getGroupStyle(o,n);l[m].style.width=
p.width;l[m].style.display=p.hidden?"none":""}n+=o.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);if(a.enableColumnResize!==false){this.splitZone=new Ext.grid.GridView.SplitDragZone(a,this.mainHd.dom);this.splitZone.setOuterHandleElId(Ext.id(this.lockedHd.dom));
this.splitZone.setOuterHandleElId(Ext.id(this.mainHd.dom));Ext.apply(this.splitZone,Ext.ux.grid.LockingGridColumnWithHeaderGroup.prototype.splitZoneConfig)}if(a.enableColumnMove){this.columnDrag=new Ext.grid.GridView.ColumnDragZone(a,this.innerHd);this.columnDrag.setOuterHandleElId(Ext.id(this.lockedInnerHd));this.columnDrag.setOuterHandleElId(Ext.id(this.innerHd));this.columnDrop=new Ext.grid.HeaderDropZone(a,this.mainHd.dom);Ext.apply(this.columnDrop,Ext.ux.grid.LockingGridColumnWithHeaderGroup.prototype.columnDropConfig)}if(a.enableHdMenu!==
false){this.hmenu=new Ext.menu.Menu({id:a.id+"-hctx"});this.hmenu.add({itemId:"asc",text:this.sortAscText,cls:"xg-hmenu-sort-asc"},{itemId:"desc",text:this.sortDescText,cls:"xg-hmenu-sort-desc"});a.enableColLock!==false&&this.hmenu.add("-",{itemId:"lock",text:this.lockText,cls:"xg-hmenu-lock"},{itemId:"unlock",text:this.unlockText,cls:"xg-hmenu-unlock"});if(a.enableColumnHide!==false){this.colMenu=new Ext.menu.Menu({id:a.id+"-hcols-menu"});this.colMenu.on({scope:this,beforeshow:this.beforeColMenuShow,
itemclick:this.handleHdMenuClick});this.hmenu.add("-",{itemId:"columns",hideOnClick:false,text:this.columnsText,menu:this.colMenu,iconCls:"x-cols-icon"})}if(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:true,checkHandler:this.onShowGroupsClick,scope:this});this.hmenu.on("beforeshow",this.beforeMenuShow,this)}this.hmenu.on("itemclick",
this.handleHdMenuClick,this)}if(a.trackMouseOver){this.mainBody.on({scope:this,mouseover:this.onRowOver,mouseout:this.onRowOut});this.lockedBody.on({scope:this,mouseover:this.onRowOver,mouseout:this.onRowOut})}if(a.enableDragDrop||a.enableDrag)this.dragZone=new Ext.grid.GridDragZone(a,{ddGroup:a.ddGroup||"GridDD"});this.updateHeaderSortState()},syncGroupHeaderHeights:function(){if(this.canGroup()&&this.hasRows()){var a=this.getGroups(false),b=this.getGroups(true);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){if(!this.hasRows())return[];return 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];var h=false;if(g&&g.childNodes[1].childNodes.length<1)Ext.removeNode(g);else h=true;if(f&&f.childNodes[1].childNodes.length<1)Ext.removeNode(f);else h=true;if(!e&&h){this.refreshSummaryById(b._groupId);
this.updateTotalSummary()}this.applyEmptyText()},beforeMenuShow:function(){var a,b=this.hmenu.items,d=this.cm.config[this.hdCtxIndex].groupable===false;if(a=b.get("groupBy"))a.setDisabled(d);if(a=b.get("showGroups")){a.setDisabled(d);a.setChecked(this.canGroup(),true)}},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);var g=RegExp("gp-"+
Ext.escapeRe(e)+"--hd");if((f=f.substr(0,f.length-3))||g.test(d.id))this.grid.fireEvent("group"+a,this.grid,e,f,b);a=="mousedown"&&b.button==0&&this.toggleGroup(d.parentNode)}},onGroupByClick:function(){var a=this.grid;this.enableGrouping=true;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(j,k){if(j&&j.substr(j.length-2)!=="-l")j+="-l";if(k&&k.substr(j.length-2)!=="-l")k+="-l";return j===k};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:a.className.indexOf("x-grid-group-collapsed")>-1;if(this.state[a.id]!==b){this.cancelEditOnToggle!==false&&this.grid.stopEditing(true);if(this.state[a.id]=b){var f=e.className.indexOf("x-grid-group-collapsed");if(f>-1)e.className=e.className.replace("x-grid-group-collapsed","");e=d.className.indexOf("x-grid-group-collapsed");if(e>-1)d.className=d.className.replace("x-grid-group-collapsed","")}else{f=
e.className.indexOf("x-grid-group-collapsed");if(f<0)e.className=e.className.concat(" x-grid-group-collapsed");e=d.className.indexOf("x-grid-group-collapsed");if(e<0)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(true)},collapseAllGroups:function(){this.toggleAllGroups(false)},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===""||a==="&#160;")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);if(!b&&e){this.mainBody.update("");this.lockedBody.update("");this.cm.setHidden(this.cm.findColumnIndex(this.lastGroupField),false);delete this.lastGroupField}else if(b&&
!e){this.lastGroupField=a;this.cm.setHidden(d,true)}else if(b&&e&&a!==this.lastGroupField){this.mainBody.update("");this.lockedBody.update("");this.cm.setHidden(this.cm.findColumnIndex(this.lastGroupField),false);this.lastGroupField=a;this.cm.setHidden(d,true)}}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=this.groupMode=="value"?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]){d=d.childNodes;g=0;for(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(false),e=this.getGroups(true),f=this.cm.getLockedCount(),g=0,h=d.length;g<h;g++){d[g].firstChild.style.width=
a;var j=d[g].childNodes[2];if(j){j.style.width=a;j.firstChild.style.width=a;j=j.firstChild.rows[0].childNodes;for(var k=0;k<j.length;k++){j[k].style.width=this.getColumnWidth(k+f);j[k].style.display=this.cm.isHidden(k+f)?"none":""}}}a=0;for(h=e.length;a<h;a++){e[a].firstChild.style.width=b;if(j=e[a].childNodes[2]){j.style.width=b;j.firstChild.style.width=b;j=j.firstChild.rows[0].childNodes;for(k=0;k<j.length;k++){j[k].style.width=this.getColumnWidth(k);j[k].style.display=this.cm.isHidden(k)?"none":
""}}}this.syncGroupHeaderHeights()}},onLayout:function(){this.updateGroupWidths()},onBeforeRowSelect:function(a,b){this.toggleRowIndex(b,true)},calculate:function(a,b){for(var d={},e,f,g=this.cm.config,h,j=0,k=a.length;j<k;j++){e=a[j];for(var l=0,m=b.length;l<m;l++){f=b[l];h=g[l];if(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();var e=this.cm.config,f=[],g=d?0:this.cm.getLockedCount(),
h=d?this.cm.getLockedCount()-1:b.length-1;for(g=g;g<=h;g++){var j=b[g],k=e[g],l={};l.id=j.id;l.style=j.style;l.css=g==0?"x-grid3-cell-first ":g==b.length-1?"x-grid3-cell-last ":"";l.value=k.summaryRenderer?k.summaryRenderer(a.data[j.name],l,a,undefined,g,this.ds):a.data[j.name];if(l.value==undefined||l.value==="")l.value="&#160;";f[f.length]=this.templates.cell.apply(l)}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];var e=[];if(!d||!b)return false;this.grid.getStore().each(function(k){if(k._groupId==a)e[e.length]=k});var f=this.getColumnData(),g=this.calculate(e,f),h=this.renderSummary({data:g},f,false);f=this.renderSummary({data:g},f,true);g=b.childNodes[2];var j=d.childNodes[2];g&&b.removeChild(g);Ext.DomHelper.append(b,h);j&&d.removeChild(j);Ext.DomHelper.append(d,f);return true},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,true).hasClass("ux-grid-hd-group-cell")}},columnDropConfig:{getTargetFromEvent:function(a){return this.view.findHeaderCell(Ext.lib.Event.getTarget(a))},positionIndicator:function(a,b,d){a=Ext.ux.grid.LockingGridColumnWithHeaderGroup.prototype.getDragDropData.call(this,a,b,d);if(a===false)return false;b=a.px+this.proxyOffsets[0];this.proxyTop.setLeftTop(b,a.r.top+this.proxyOffsets[1]);this.proxyTop.show();
this.proxyBottom.setLeftTop(b,a.r.bottom);this.proxyBottom.show();return a.pt},onNodeDrop:function(a,b,d,e){b=e.header;if(b!=a){a=Ext.ux.grid.LockingGridColumnWithHeaderGroup.prototype.getDragDropData.call(this,b,a,d);if(a===false)return false;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],j=h.length,k=0,l=1,m=j,n=0,o=0;n<j;n++){var p=h[n];if(a.oldIndex>=o&&a.oldIndex<o+p.colspan)k=n;if(a.oldIndex+a.colspan-1>=o&&a.oldIndex+a.colspan-1<o+p.colspan)l=
n-k+1;if(a.newIndex>=o&&a.newIndex<o+p.colspan)m=n;o+=p.colspan}j=h.splice(k,l);e[f]=h.splice(0,m-(b?l:0)).concat(j).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 true}return false}},getGroupRowIndex:function(a){if(a)if((a=a.className.match(this.hrowRe))&&a[1])return parseInt(a[1],10);return this.cm.rows.length},getGroupSpan:function(a,b){if(a<0)return{col:0,colspan:this.cm.getColumnCount()};var 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 false;var e=this.grid.colModel,f=Ext.lib.Event.getPageX(d);d=Ext.lib.Dom.getRegion(b.firstChild);var g;if(d.right-f<=(d.right-d.left)/2){f=d.right+this.view.borderWidth;g="after"}else{f=d.left;g="before"}var h=this.view.getCellIndex(a);b=this.view.getCellIndex(b);
if(e.isFixed(b))return false;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+(g=="after"?b.colspan:0);if(b>=e.col&&b<=e.col+e.colspan)return false;var j=Ext.ux.grid.ColumnHeaderGroup.prototype.getGroupSpan.call(this.view,a-1,h);if(b<j.col||b>j.col+j.colspan)return false;
return{r:d,px:f,pt:g,row:a,oldIndex:h,newIndex:b,colspan:e.colspan}}});
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 true},restoreDefaultMonthDay:function(a){Date.defaults.d=this.oldDateDefaults;return a},onClick:function(){var a=this.picker.menu.picker;a.activeDate=a.activeDate.getFirstDateOfMonth();if(a.value)a.value=a.value.getFirstDateOfMonth();a.showMonthPicker();if(!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);if(d.is("button.x-date-mp-cancel"))this.picker.menu.hide();else if(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);if(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(){var a=this.picker.name||this.picker.el.dom.name;this.picker.hiddenField=this.picker.el.insertSibling({tag:"input",type:"hidden",name:a,value:this.formatHiddenDate(this.picker.parseDate(this.picker.value))});this.picker.hiddenName=a;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){if(!Ext.isDate(a))return a;return"timestamp"===this.submitFormat?a.getTime()/1E3:Ext.util.Format.date(a,this.submitFormat)},updateHidden:function(){this.picker.hiddenField.dom.value=
this.formatHiddenDate(this.picker.getValue())}});Ext.ns("Ext.m3");
Ext.m3.MultiSelectField=Ext.extend(Ext.m3.AdvancedComboBox,{delimeter:",",multipleDisplayValue:null,initComponent:function(){this.checkedItems=[];this.hideTriggerDictEdit=true;this.displayField=this.displayField||"name";this.defaultValue=Ext.decode(this.defaultValue);if(!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)},initDefault:function(){this.defaultRecord&&Ext.each(this.defaultRecord,function(b){var d=new Ext.data.Record;d.data[this.valueField]=b.data[this.valueField];d.data[this.displayField]=b.data[this.displayField];this.setRecord(d)},this);if(this.defaultValue){var a=this.getStore();Ext.each(this.defaultValue,function(b){var d;if(typeof b!=="object"||!(b[this.displayField]&&b[this.valueField]))d=
a.getAt(a.find(this.valueField,b));else{d=a.getAt(a.find(this.valueField,b[this.valueField],0,false,false,true));if(!d&&b[this.displayField]&&b[this.valueField]){d=new Ext.data.Record;d.data[this.valueField]=b[this.valueField];d.data[this.displayField]=b[this.displayField]}}d&&this.setRecord(d)},this)}this.view&&this.view.refresh()},setValue:function(a){!a||a==="[]"?this.hideClearBtn():this.showClearBtn();this.value=this.getValue();this.setRawValue(this.getText());if(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;if(this.store&&this.value&&this.mode==="local"){a=Ext.util.JSON.decode(this.value);Ext.each(a,function(b){(b=this.store.getAt(this.store.find(this.valueField,b,0,false,false,true)))&&!this.checkedItems.includes(b)&&this.setRecord(b)},this)}else if(this.value){a=Ext.util.JSON.decode(this.value);
Ext.each(a,function(b){if(typeof b==="object"&&b[this.displayField]&&b[this.valueField]){var d;if(this.store)d=this.store.getAt(this.store.find(this.valueField,b[this.valueField]));if(!d){d=new Ext.data.Record;d.data[this.valueField]=b[this.valueField];d.data[this.displayField]=b[this.displayField]}this.setRecord(d)}},this)}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 a.length>
1&&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);if(this.fireEvent("beforeselect",this,a,b)!==false){d===-1?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.actionContextJson,success:function(a){if(a=smart_eval(a.responseText)){a.initMultiSelect(this.checkedItems);a.on("closed_ok",function(b){this.addRecordsToStore(b);this.fireChangeEventOnDemand();this.fireEvent("select",this,this.checkedItems)},this)}},failure:function(){window.uiAjaxFailMessage.apply(this,arguments)},scope:this})},clearValue:function(){this.checkedItems.splice(0,this.checkedItems.length);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.reg("m3-multiselect",Ext.m3.MultiSelectField);
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:true,plain:true,draggable:false,bodyStyle:"text-align:center",padding:5,header:false,shadow:false,"float":true});this.closedCallback=function(){};if(this.autoDestroy)this.task=new Ext.util.DelayedTask(this.hide,this);else this.closable=true;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;if(Ext.ux.NotificationMgr.originalBodyOverflowY==null)Ext.ux.NotificationMgr.originalBodyOverflowY=document.body.style.overflowY;document.body.style.overflow="hidden";for(this.setSize(this.width,100);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:false,callback:function(){Ext.ux.NotificationMgr.notifications.remove(this);document.body.style.overflow="auto";this.destroy()}.createDelegate(this)})},focus:Ext.emptyFn});
Ext.m3.ObjectGrid=Ext.extend(Ext.m3.GridPanel,{constructor:function(a,b){assert(b.allowPaging!==undefined,"allowPaging is undefined");assert(b.rowIdName!==undefined,"rowIdName is undefined");assert(b.actions!==undefined,"actions is undefined");this.allowPaging=b.allowPaging;this.rowIdName=b.rowIdName;this.columnParamName=b.columnParamName;this.actionNewUrl=b.actions.newUrl;this.actionEditUrl=b.actions.editUrl;this.actionDeleteUrl=b.actions.deleteUrl;this.actionDataUrl=b.actions.dataUrl;this.actionContextJson=
b.actions.contextJson;this.readOnly=b.readOnly;this.localEdit=b.localEdit;this.name=b.name;Ext.m3.ObjectGrid.superclass.constructor.call(this,a,b)},initComponent:function(){Ext.m3.ObjectGrid.superclass.initComponent.call(this);var a=this.getStore();a.baseParams=Ext.applyIf(a.baseParams||{},this.actionContextJson||{});this.on("beforestatesave",this.onBeforeStateSave);this.addEvents("beforenewrequest","afternewrequest","beforeeditrequest","aftereditrequest","beforedeleterequest","afterdeleterequest",
"rowadded","rowedited","rowdeleted")},onNewRecord:function(){assert(this.actionNewUrl,"actionNewUrl is not define");var a=new Ext.LoadMask(this.body),b=this.getMainContext();b[this.rowIdName]="";b={url:this.actionNewUrl,params:b,success:function(e,f){if(d.fireEvent("afternewrequest",d,e,f)){try{var g=d.onNewRecordWindowOpenHandler(e,f)}finally{a.hide()}return g}a.hide()},failure:function(){uiAjaxFailMessage.apply(this,arguments);a.hide()}};if(this.fireEvent("beforenewrequest",this,b)){var d=this;
a.show();Ext.Ajax.request(b)}},onEditRecord:function(){assert(this.actionEditUrl,"actionEditUrl is not define");assert(this.rowIdName,"rowIdName is not define");if(this.getSelectionModel().hasSelection()){var a=this.getSelectionContext(this.localEdit);if(String(a[this.rowIdName]).indexOf(",")!=-1)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});else{var b=new Ext.LoadMask(this.body);a={url:this.actionEditUrl,params:a,success:function(e,f){if(d.fireEvent("aftereditrequest",d,e,f)){try{var g=d.onEditRecordWindowOpenHandler(e,f)}finally{b.hide()}return g}b.hide()},failure:function(){uiAjaxFailMessage.apply(this,arguments);b.hide()}};if(this.fireEvent("beforeeditrequest",this,a)){var d=this;b.show();Ext.Ajax.request(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");var a=this;a.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(b){if(b=="yes"){b=a.getSelectionContext(a.localEdit);var d=new Ext.LoadMask(a.body);b={url:a.actionDeleteUrl,params:b,success:function(e,f){if(a.fireEvent("afterdeleterequest",a,e,f)){try{var g=a.deleteOkHandler(e,f)}finally{d.hide()}return g}d.hide()},failure:function(){uiAjaxFailMessage.apply(this,arguments);d.hide()}};if(a.fireEvent("beforedeleterequest",a,b)){d.show();Ext.Ajax.request(b)}}}}):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})},onNewRecordWindowOpenHandler:function(a){if(a=smart_eval(a.responseText)){var b=this;a.on("closed_ok",function(d){if(b.fireEvent("rowadded",b,d))if(b.localEdit){d=Ext.util.JSON.decode(d);var e=new Ext.data.Record(d.data);e.json=d.data;b.getStore().add(e);b.getSelectionModel().selectRecords([e])}else return b.refreshStore()})}},onEditRecordWindowOpenHandler:function(a){if(a=
smart_eval(a.responseText)){var b=this;a.on("closed_ok",function(d){if(b.fireEvent("rowedited",b,d))if(b.localEdit){var e=Ext.util.JSON.decode(d);d=new Ext.data.Record(e.data);d.json=e.data;e=b.getStore();var f=b.getSelectionModel();if(f.hasSelection())if(f instanceof Ext.grid.RowSelectionModel){var g=f.getSelected(),h=e.indexOf(g);e.remove(g);if(h<0)h=0;e.insert(h,d);f.selectRow(h)}}else return b.refreshStore()})}},deleteOkHandler:function(a){if(this.fireEvent("rowdeleted",this,a))if(this.localEdit)if(Ext.util.JSON.decode(a.responseText).success){a=
this.getStore();var b=this.getSelectionModel();if(b.hasSelection())if(b instanceof Ext.grid.RowSelectionModel){b=b.getSelections();a.remove(b)}}else smart_eval(a.responseText);else{smart_eval(a.responseText);this.refreshStore()}},refreshStore:function(){if(this.allowPaging){var a=this.getBottomToolbar();a&&a instanceof Ext.PagingToolbar&&a.changePage(Math.ceil((a.cursor+a.pageSize)/a.pageSize))}else this.getStore().load()},getMainContext:function(){return Ext.applyIf({},this.actionContextJson)},getSelectionContext:function(a){var b=
this.getMainContext(),d=this.getSelectionModel(),e;if(d instanceof Ext.grid.RowSelectionModel)if(d.singleSelect){e=d.getSelected();b[this.rowIdName]=e.id}else{d=d.getSelections();var f=[];e=[];for(var g=0,h=d.length;g<h;g++){e.push(d[g]);f.push(d[g].id)}b[this.rowIdName]=f.join()}else if(d instanceof Ext.grid.CellSelectionModel){assert(this.columnParamName,"columnParamName is not define");if(d=d.getSelectedCell()){e=this.getStore().getAt(d[0]);b[this.rowIdName]=e.id;b[this.columnParamName]=this.getColumnModel().getDataIndex(d[1])}}if(a)b=
Ext.isArray(e)?Ext.applyIf(b,e[0].json):Ext.applyIf(b,e.json);return b},onBeforeStateSave:function(){this.fireEvent("resize")}});
Ext.m3.EditorObjectGrid=Ext.extend(Ext.m3.EditorGridPanel,{constructor:function(a,b){assert(b.allowPaging!==undefined,"allowPaging is undefined");assert(b.rowIdName!==undefined,"rowIdName is undefined");assert(b.actions!==undefined,"actions is undefined");this.allowPaging=b.allowPaging;this.rowIdName=b.rowIdName;this.columnParamName=b.columnParamName;this.actionNewUrl=b.actions.newUrl;this.actionEditUrl=b.actions.editUrl;this.actionDeleteUrl=b.actions.deleteUrl;this.actionDataUrl=b.actions.dataUrl;
this.actionContextJson=b.actions.contextJson;this.localEdit=b.localEdit;this.name=b.name;Ext.m3.EditorObjectGrid.superclass.constructor.call(this,a,b)},initComponent:function(){Ext.m3.EditorObjectGrid.superclass.initComponent.call(this);var a=this.getStore();a.baseParams=Ext.applyIf(a.baseParams||{},this.actionContextJson||{});this.addEvents("beforenewrequest","afternewrequest","beforeeditrequest","aftereditrequest","beforedeleterequest","afterdeleterequest")},onNewRecord:function(){assert(this.actionNewUrl,
"actionNewUrl is not define");var a=this.getMainContext();a[this.rowIdName]="";a={url:this.actionNewUrl,params:a,success:function(d,e){if(b.fireEvent("afternewrequest",b,d,e))return b.childWindowOpenHandler(d,e)},failure:Ext.emptyFn};if(this.fireEvent("beforenewrequest",this,a)){var b=this;Ext.Ajax.request(a)}},onEditRecord:function(){assert(this.actionEditUrl,"actionEditUrl is not define");assert(this.rowIdName,"rowIdName is not define");if(this.getSelectionModel().hasSelection()){var a={url:this.actionEditUrl,
params:this.getSelectionContext(this.localEdit),success:function(d,e){if(b.fireEvent("aftereditrequest",b,d,e))return b.childWindowOpenHandler(d,e)},failure:Ext.emptyFn};if(this.fireEvent("beforeeditrequest",this,a)){var b=this;Ext.Ajax.request(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");var a=this;a.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(b){if(b=="yes"){b=a.getSelectionContext(a.localEdit);b={url:a.actionDeleteUrl,params:b,success:function(d,e){if(a.fireEvent("afterdeleterequest",a,d,e))return a.deleteOkHandler(d,e)},failure:Ext.emptyFn};a.fireEvent("beforedeleterequest",a,b)&&Ext.Ajax.request(b)}}}):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){if(a=smart_eval(a.responseText)){var b=this;a.on("closed_ok",function(){return b.refreshStore()})}},deleteOkHandler:function(a){smart_eval(a.responseText);this.refreshStore()},refreshStore:function(){if(this.allowPaging){var a=this.getBottomToolbar();a&&a instanceof Ext.PagingToolbar&&a.changePage(Math.ceil((a.cursor+a.pageSize)/a.pageSize))}else this.getStore().load()},getMainContext:function(){return Ext.applyIf({},this.actionContextJson)},
getSelectionContext:function(a){var b=this.getMainContext(),d=this.getSelectionModel(),e;if(d instanceof Ext.grid.RowSelectionModel)if(d.singleSelect){e=d.getSelected();b[this.rowIdName]=e.id}else{d=d.getSelections();var f=[];e=[];for(var g=0,h=d.length;g<h;g++){e.push(d[g]);f.push(d[g].id)}b[this.rowIdName]=f.join()}else if(d instanceof Ext.grid.CellSelectionModel){assert(this.columnParamName,"columnParamName is not define");if(d=d.getSelectedCell()){e=this.getStore().getAt(d[0]);b[this.rowIdName]=
e.id;b[this.columnParamName]=this.getColumnModel().getDataIndex(d[1])}}if(a)b=Ext.isArray(e)?Ext.applyIf(b,e[0].json):Ext.applyIf(b,e.json);return b}});Ext.ns("Ext.m3");
Ext.m3.ObjectSelectionPanel=Ext.extend(Ext.Container,{selectionColumns:[],selectionGridConf:{},initComponent:function(){assert(this.selectionColumns,"Columns for selection is undefined!");this.add(this.grid);for(var a=["_check"],b=0;b<this.selectionColumns.length;b++)a.push(this.selectionColumns[b].data_index);b=new Ext.grid.CheckboxSelectionModel;this.selectionColumns.unshift(b);a=Ext.applyIf(this.selectionGridConf,{region:"east",width:200,sm:b,title:"\u0412\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438",
store:new Ext.data.ArrayStore({autoDestroy:true,fields:a}),colModel:new Ext.grid.ColumnModel({columns:this.selectionColumns})});this.selectionGrid=new Ext.grid.GridPanel(a);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);this.add(this.selectionGrid)},onRowSelect:function(a,b,
d){if(this.selectionGrid.store.indexOfId(d.id)<0){this.selectionGrid.store.add(d);this.selectionGrid.selModel.selectLastRow(true)}},onRowDeselect:function(a,b,d){a=this.selectionGrid.store.indexOfId(d.id);a>=0&&this.selectionGrid.store.removeAt(a)},onLoad:function(){var a=this.selectionGrid.store.getRange(),b=this.grid.store.getRange(),d=0,e=0;for(d=0;d<a.length;d++)for(e=0;e<b.length;e++)a[d].id==b[e].id&&this.grid.getSelectionModel().selectRow(e,true)},getSelectedRecords:function(){return this.selectionGrid.store.getRange()},
onRemoveSelected:function(a,b,d){a=this.grid.store.indexOfId(d.id);a>=0&&this.grid.getSelectionModel().deselectRow(a)}});Ext.reg("object-selection-panel",Ext.m3.ObjectSelectionPanel);
Ext.m3.ObjectTree=Ext.extend(Ext.ux.tree.TreeGrid,{constructor:function(a,b){assert(b.rowIdName!==undefined,"rowIdName is undefined");assert(b.actions!==undefined,"actions is undefined");this.rootVisible=b.rootVisible;this.allowPaging=b.allowPaging;this.rowIdName=b.rowIdName;this.actionNewUrl=b.actions.newUrl;this.actionEditUrl=b.actions.editUrl;this.actionDeleteUrl=b.actions.deleteUrl;this.actionDataUrl=b.actions.dataUrl;this.actionContextJson=b.actions.contextJson;this.parentIdName=b.parentIdName;
this.incrementalUpdate=b.incrementalUpdate;this.enableTreeSort=b.enableTreeSort;if(b.customLoad){var d=Ext.Ajax;this.on("expandnode",function(e){var f=[];if(e.hasChildNodes())for(var g=0;g<e.childNodes.length;g++)e.childNodes[g].isLoaded()||f.push(e.childNodes[g].id);f.length>0&&d.request({url:b.actions.dataUrl,params:{list_nodes:f.join(",")},success:function(h){if(h=Ext.util.JSON.decode(h.responseText))for(var j=0;j<h.length;j++)for(var k=e.childNodes[j],l=0;l<h[j].children.length;l++){var m=new Ext.tree.AsyncTreeNode(h[j].children[l]);
k.appendChild(m);k.loaded=true}},failure:function(){Ext.Msg.alert("","failed")}})})}a.folderSort=true;a.enableSort=false;if(b.folderSort!=undefined)a.folderSort=b.folderSort;Ext.m3.ObjectTree.superclass.constructor.call(this,a,b)},initComponent:function(){var a=this.getLoader();a.baseParams=this.getMainContext();Ext.m3.ObjectTree.superclass.initComponent.call(this);if(this.enableTreeSort)new Ext.ux.tree.TreeGridSorter(this,{folderSort:this.folderSort,property:this.columns[0].dataIndex||"text"});a.on("beforeload",
this.onBeforeLoad,this);a.on("load",this.onLoad,this);a.on("loadexception",this.onLoadException,this);a.nodeParameter=this.rowIdName;this.addEvents("beforenewrequest","beforeeditrequest","beforedeleterequest")},showMask:function(a){this.getLoader();if(this.treeLoadingMask==undefined)this.treeLoadingMask=new Ext.LoadMask(this.el,{msg:"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430..."});a?this.treeLoadingMask.show():this.treeLoadingMask.hide()},onBeforeLoad:function(){this.showMask(true)},onLoad:function(){this.showMask(false)},
onLoadException:function(){this.showMask(false)},onNewRecord:function(){assert(this.actionNewUrl,"actionNewUrl is not define");var a={url:this.actionNewUrl,method:"POST",params:this.getMainContext(),scope:this,success:function(b,d){return this.childWindowOpenHandler(b,d,"new")},failure:function(){uiAjaxFailMessage.apply(this,arguments)}};this.fireEvent("beforenewrequest",this,a,false)&&Ext.Ajax.request(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,scope:this,method:"POST",params:a,success:function(b,d){return this.childWindowOpenHandler(b,d,"newChild")},failure:function(){uiAjaxFailMessage.apply(this,arguments)}};this.fireEvent("beforenewrequest",this,a,true)&&Ext.Ajax.request(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,scope:this,method:"POST",params:this.getSelectionContext(),success:function(b,d){return this.childWindowOpenHandler(b,d,"edit")},failure:function(){uiAjaxFailMessage.apply(this,arguments)}};this.fireEvent("beforeeditrequest",this,a)&&Ext.Ajax.request(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",scope:this,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){if(a=="yes")if(this.getSelectionModel().getSelectedNode()){a={url:this.actionDeleteUrl,scope:this,params:this.getSelectionContext(),success:function(b,d){return this.deleteOkHandler(b,d)},failure:function(){uiAjaxFailMessage.apply(this,arguments)}};this.fireEvent("beforedeleterequest",this,a)&&Ext.Ajax.request(a)}}}):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,d){(a=smart_eval(a.responseText))&&a.on("closed_ok",function(e){if(this.incrementalUpdate){var f=Ext.util.JSON.decode(e);e=this.getSelectionModel().getSelectedNode();var g=this.getLoader().createNode(f.data);switch(d){case "edit":var h=e.parentNode;h.removeChild(e);h.expanded||h.expand(false,false);h.appendChild(g);break;case "new":this.getRootNode().appendChild(g);break;case "newChild":if(e.children){e.expanded||e.expand(false,
false);e.appendChild(g)}else if(e.expanded)e.appendChild(g);else if(!e.leaf&&e.childNodes.length==0){e.on("expand",function(){this.getNodeById(f.data.id).select()},this,{single:true});e.expand(false,false);g=undefined}else{e.leaf=false;e.expand(false,false);e.appendChild(g)}}g&&g.select()}else return this.refreshStore()},this)},deleteOkHandler:function(a){if(this.incrementalUpdate)if(Ext.util.JSON.decode(a.responseText).success){a=this.getSelectionModel().getSelectedNode();var b=a.parentNode;b.removeChild(a);
b.select()}else smart_eval(a.responseText);else{smart_eval(a.responseText);this.refreshStore()}},refreshStore:function(){this.getLoader().baseParams=this.getMainContext();this.getLoader().load(this.getRootNode())},getMainContext:function(){return Ext.applyIf({},this.actionContextJson)},getSelectionContext:function(){var a=this.getMainContext();if(this.getSelectionModel().getSelectedNode())a[this.rowIdName]=this.getSelectionModel().getSelectedNode().id;return a}});Ext.reg("m3-object-tree",Ext.m3.ObjectTree);
Ext.namespace("Ext.ux");
Ext.ux.OnDemandLoad=function(){loadComponent=function(a,b){var d=a.substring(a.lastIndexOf(".")),e=document.getElementsByTagName("head")[0],f=false;if(d===".js"){var g=document.createElement("script");g.setAttribute("type","text/javascript");g.setAttribute("src",a);g.onload=g.onreadystatechange=function(){if(!f){f=true;typeof b=="function"&&b();e.removeChild(g)}}}else if(d===".css"){g=document.createElement("link");g.setAttribute("type","text/css");g.setAttribute("rel","stylesheet");g.setAttribute("href",
a)}typeof g!="undefined"&&e.appendChild(g)};return{load:function(a,b){loadComponent(a,b)}}}();
Ext.override(Ext.form.NumberField,{decimalSeparator:",",currencySymbol:null,useThousandSeparator:true,thousandSeparator:" ",alwaysDisplayDecimals:true,currencySymbolPosition:"before",numberFieldAlign:"left",initComponent:function(){if(this.currencySymbolPosition!="before"&&this.currencySymbolPosition!="after")this.currencySymbolPosition="before";if(this.numberFieldAlign!="left"&&this.numberFieldAlign!="right")this.numberFieldAlign="left";if(this.useThousandSeparator&&Ext.isEmpty(this.thousandSeparator))this.thousandSeparator=
",";if(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+";"};if(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()));if(this.hiddenField!==undefined)this.hiddenField.dom.value=this.getValue()},getFormattedValue:function(a){if(Ext.isEmpty(a)||!this.hasFormat())return a;else{var b=null;a=(b=a<0)?
a*-1: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 this.currencySymbolPosition=="before"?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){if(a){a=a.replace(this.currencySymbol,"").trim();a=this.useThousandSeparator?a.replace(RegExp("["+this.thousandSeparator+"]","g"),""):a}return a},getErrors:function(){var a=this.getValue(),b=[];if(a.length<1||a===this.emptyText)if(this.allowBlank)return b;else 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!="."||this.useThousandSeparator==true||!Ext.isEmpty(this.currencySymbol)||this.alwaysDisplayDecimals},onFocus:function(){Ext.form.NumberField.superclass.onFocus.call(this,arguments);this.setRawValue(this.removeFormat(this.getRawValue()))},beforeBlur:function(){this.setValue(this.parseValue(this.getRawValue()))}});
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,j=a.parentNode.attributes.pageLimit||f.limit||25;a.parentNode.attributes.pageLimit=j;var k=Math.ceil(h/j);f=a.getOwnerTree().columns;var l=function(p,s,t,q){p.push('<div class="gs_tree_pgbtn');q&&p.push(" "+q);p.push('"><div gs:page="');p.push(s);p.push('" class="x-tree-col-text">');
p.push(t);p.push("</div></div>")},m=['<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 ",k,"</span></a>"],n;g!=0&&l(m,g-1,"<");if(k<11)for(n=0;n<k;n++)l(m,n,n+1,g==n?"gs_tree_pgbtn_sel":null);else{l(m,0,1,g==0?"gs_tree_pgbtn_sel":null);n=Math.max(1,g-2);var o=Math.min(k-1,g+3);n>1&&m.push('<div class="x-tree-col"><div class="x-tree-col-text">...</div></div>');
for(n=n;n<o;n++)l(m,n,n+1,g==n?"gs_tree_pgbtn_sel":null);o<k-1&&m.push('<div class="x-tree-col"><div class="x-tree-col-text">...</div></div>');l(m,k-1,k,g==k-1?"gs_tree_pgbtn_sel":null)}g!=k-1&&l(m,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*j+1," \u0434\u043e ",Math.min((g+1)*j,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=m.join("")+g.join("");m=['<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=m.join("");this.wrap=e!==true&&a.nextSibling&&a.nextSibling.ui.getEl()?Ext.DomHelper.insertHtml("beforeBegin",a.nextSibling.ui.getEl(),g):Ext.DomHelper.insertHtml("beforeEnd",d,g);a.on("click",function(p,
s){var t=p.getOwnerTree().getLoader(),q=s.target;if(!q.attributes.getNamedItem("gs:page"))return false;var u=p.parentNode,v=u.attributes.pageLimit||25;q=q.attributes.getNamedItem("gs:page").value;t.baseParams.limit=v;t.baseParams.start=q*v;u.attributes.page=q;delete u.attributes.children;u.getUI().beforeLoad();t.load(u,function(){u.getUI().afterLoad();u.expand()});delete t.baseParams.start;delete t.baseParams.limit;return false});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.namespace("Ext.ux");
(function(){var a=Ext.ux;a.BaseTimePicker=Ext.extend(Ext.Panel,{timeFormat:"H:i:s",header:true,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(false);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(b){this.setValue(new Date,!!b)},onDone:function(){this.fireEvent("select",this,this.getValue())},setValue:function(b,d){this.hourSlider.setValue(b.getHours(),d);this.minSlider.setValue(b.getMinutes(),d);this.secSlider.setValue(b.getSeconds(),d);this._updateTimeValue()},_extractValue:function(){var b=
new Date;b.setHours(this.hourSlider.getValue());b.setMinutes(this.minSlider.getValue());b.setSeconds(this.secSlider.getValue());return b},getValue:function(){return this._extractValue()},_updateTimeValue:function(){var b=this._extractValue().format(this.timeFormat);this.rendered&&this.setTitle(b)},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;a.DateTimePicker=Ext.extend(Ext.BoxComponent,{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;if(this.value){this.setValue(this.value);delete this.value}},_initTimePicker:function(){if(!this.timeMenu){var d=
this.initialConfig.timeMenu;if(d&&d.xtype)this.timeMenu=Ext.create(d);else{var e=Ext.create(Ext.applyIf(this.initialConfig.timePicker||{},{timeFormat:this.timeFormat}),"basetimepicker");this.timeMenu=new b(e,d||{})}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 d=this.initialConfig.datePicker||{};d.internalRender=this.initialConfig.internalRender;Ext.applyIf(d,
{format:this.dateFormat||Ext.DatePicker.prototype.format});d=this.datePicker=Ext.create(d,"datepicker");d.update=d.update.createSequence(function(){this.el!=null&&this.datePicker.rendered&&this.el.setWidth(this.datePicker.el.getWidth()+this.el.getBorderWidth("lr")+this.el.getPadding("lr"))},this)},_renderDatePicker:function(d){var e=this.datePicker;e.render(d);var f=e.getEl().child(".x-date-bottom").getSize(true);f=["position: absolute;bottom: 0;left: 0;overflow: hidden","width: "+f.width+"px","height: "+
f.height+"px"].join(";");d=d.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(e.showToday){var g={};Ext.each(["text","tooltip","handler","scope"],function(h){g[h]=e.todayBtn.initialConfig[h]});this.todayBtn=(new Ext.Button(g)).render(d.child("td:first"))}this.doneBtn=(new Ext.Button({text:this.doneText,handler:this.onDone,scope:this})).render(d.child("td:last"))},
_getFormattedTimeValue:function(d){return d.format(this.timeFormat)},_renderValueField:function(d){var e=!Ext.isEmpty(this.timeLabel)?'<span class="ux-date-time-picker-value-ct-value-label">'+this.timeLabel+":</span>&nbsp;":"";d=d.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">'+
e+'<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=d.child(".ux-date-time-picker-value-ct-value");this.timeValueEl.on("click",this._showTimePicker,this);this.timePickerButton.render(d.child("td:last"))},onRender:function(d,e){this.el=d.createChild({tag:"div",cls:"ux-date-time-picker",children:[{tag:"div",cls:"ux-date-time-picker-inner"}]},e);a.DateTimePicker.superclass.onRender.call(this,
d,e);var f=this.el.first();this._renderDatePicker(f);this._renderValueField(f)},_updateTimeValue:function(d){this.timeValue=d;this.timeValueEl!=null&&this.timeValueEl.update(this._getFormattedTimeValue(d))},setValue:function(d){this._updateTimeValue(d);this.datePicker.setValue(d.clone())},getValue:function(){var d=this.datePicker.getValue(),e=this.timeValue.getElapsed(this.timeValue.clone().clearTime());return new Date(d.getTime()+e)},onTimeSelect:function(d,e,f){this._updateTimeValue(f)},_showTimePicker:function(){this._initTimePicker();
this.timeMenu.getPicker().setValue(this.timeValue,false);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;if(this.timeValueEl){this.timeValueEl.remove();this.timeValueEl=null}Ext.destroy(this.datePicker);this.datePicker=null;if(this.timeMenu){Ext.destroy(this.timeMenu);this.timeMenu=null}if(this.todayBtn){Ext.destroy(this.todayBtn);
this.todayBtn=null}if(this.doneBtn){Ext.destroy(this.doneBtn);this.doneBtn=null}this.parentMenu=null;a.DateTimePicker.superclass.destroy.call(this)}});Ext.reg("datetimepicker",a.DateTimePicker);var b=a.DateTimePicker.Menu=Ext.extend(Ext.menu.Menu,{enableScrolling:false,hideOnClick:false,plain:true,showSeparator:false,constructor:function(d,e){e=e||{};e.picker&&delete e.picker;this.picker=Ext.create(d);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(d,e){this.hide();this.fireEvent("timeselect",this,d,e)},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:false,plain:true,showSeparator:false,hideOnClick:true,pickerId:null,cls:"x-date-menu x-date-time-menu",constructor:function(e,f){d.superclass.constructor.call(this,Ext.applyIf({items:e},f||{}));this.primaryPicker=e;e.parentMenu=this;this.on("beforeshow",this.onBeforeShow,this);(this.strict=b)&&this.on("show",this.onShow,this,{single:true,delay:20});this.picker=e.datePicker;this.relayEvents(e,["select"]);
this.on("show",e.focus,e);this.on("select",this.menuHide,this);if(this.handler)this.on("select",this.handler,this.scope||this)},menuHide:function(){this.hideOnClick&&this.hide(true)},onBeforeShow:function(){this.picker&&this.picker.hideMonthPicker(true)},onShow:function(){var e=this.picker.getEl();e.setWidth(e.getWidth())},destroy:function(){this.picker=this.primaryPicker=null;d.superclass.destroy.call(this)}});a.DateTimeField=Ext.extend(Ext.m3.AdvancedDataField,{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 e=this._createPicker();this.format=this.dateFormat+" "+this.timeFormat;this.menu=new d(e,{hideOnClick:false})},_createPicker:function(){var e=this.initialConfig.picker||{};Ext.apply(e,{ctCls:"x-menu-date-item",internalRender:b||!Ext.isIE});Ext.applyIf(e,{dateFormat:this.dateFormat,timeFormat:this.timeFormat});return Ext.create(e,"datetimepicker")},
onTriggerClick:function(){a.DateTimeField.superclass.onTriggerClick.apply(this,arguments);this.menu.primaryPicker.setValue(this.getValue()||new Date)}});Ext.reg("datetimefield",a.DateTimeField)})();if(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"}
if(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:false,hideOnClick:false,plain:true,showSeparator:false,constructor:function(e,f){f=f||{};f.picker&&delete f.picker;this.picker=Ext.create(e);d.superclass.constructor.call(this,Ext.applyIf({items:this.picker},f));this.addEvents("timeselect");this.picker.on("select",this.onTimeSelect,this)},getPicker:function(){return this.picker},onTimeSelect:function(e,f){this.hide();this.fireEvent("timeselect",this,
e,f)},destroy:function(){this.purgeListeners();this.picker=null;d.superclass.destroy.call(this)}});a.AdvTimeField=Ext.extend(Ext.m3.AdvancedDataField,{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 e=this._createPicker();this.format=this.timeFormat;this.menu=new d(e,{hideOnClick:false});this.menu.on("timeselect",this.onTimeSelect,
this)},_createPicker:function(){var e=this.initialConfig.picker||{};Ext.apply(e,{ctCls:"x-menu-date-item",internalRender:b||!Ext.isIE});Ext.applyIf(e,{timeFormat:this.timeFormat});return Ext.create(e,"basetimepicker")},onTriggerClick:function(){a.AdvTimeField.superclass.onTriggerClick.apply(this,arguments);this.menu.picker.setValue(this.getValue()||new Date)},onTimeSelect:function(e,f,g){this._updateTimeValue(f,g)},_updateTimeValue:function(e){var f=this.getValue()||new Date;f.setHours(e.hourSlider.getValue());
f.setMinutes(e.minSlider.getValue());f.setSeconds(e.secSlider.getValue());this.setValue(f)},setValue:function(e){a.AdvTimeField.superclass.setValue.call(this,e)}});Ext.reg("advtimefield",a.AdvTimeField)})();Ext.ns("Ext.ux.form");
Ext.ux.form.FileUploadField=Ext.extend(Ext.form.TextField,{readOnly:true,autoSize:Ext.emptyFn,iconClsSelectFile:"x-form-file-icon",iconClsClearFile:"x-form-file-clear-icon",iconClsDownloadFile:"x-form-file-download-icon",multiple:false,constructor:function(a,b){if(b){this.hideClearButton=b.hideClearButton||false;this.hideUploadButton=b.hideUploadButton||false;this.hideDownloadButton=b.hideDownloadButton||false;if(b.prefixUploadField)this.prefixUploadField=b.prefixUploadField;if(b.fileUrl)this.fileUrl=
b.fileUrl;if(a.readOnly)this.readOnlyAll=true;if(b.possibleFileExtensions)this.possibleFileExtensions=b.possibleFileExtensions;if(b.multiple)this.multiple=b.multiple}Ext.ux.form.FileUploadField.superclass.constructor.call(this,a,b)},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,hidden:this.hideUploadButton}}));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&&!this.hideClearButton),tooltip:{text:"\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c",width:65}});this.renderHelperBtn();this.bindListeners();this.resizeEl=this.positionEl=this.wrap;if(this.readOnlyAll){this.buttonFile.setDisabled(true);this.buttonFile.getEl().setStyle("z-index",3);this.buttonClear.setDisabled(true);this.getHelperBtn()&&this.getHelperBtn().setDisabled(true)}},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&&!this.hideDownloadButton),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()){if(this.multiple){var a,b=[];Ext3.each(this.fileInput.dom.files,function(d){b.push(d.name)});a=b.join(";")}else a=this.fileInput.dom.value;if(this.fireEvent("beforechange",this,a)){this.setValue(a);this.fireEvent("fileselected",this,a);this.fireEvent("change",this,a);if(a){this.fileUrl=
null;if(!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(){var a={id:this.getFileInputId(),
name:(this.prefixUploadField||"")+this.name,cls:"x-form-file",tag:"input",type:"file",size:1,width:20};if(this.multiple)a.multiple=this.multiple;this.fileInput=this.wrap.createChild(a);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();if(d)a-=d;if(d=this.getHelperBtn()?this.getHelperBtn().getWidth():0)a-=d;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(true)},onEnable:function(){Ext.ux.form.FileUploadField.superclass.onEnable.call(this);this.doDisable(false)},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();if(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(".");if(a.length>0)return this.possibleFileExtensions?this.possibleFileExtensions.split(",").indexOf(a[a.length-1].toLowerCase())!=-1:true;return false},setReadOnly:function(a){Ext.ux.form.FileUploadField.superclass.setReadOnly.call(this,a)},validate:function(){var a=Ext.ux.form.FileUploadField.superclass.validate.call(this);
this.allowBlank||(a?this.addClass("m3-grey-field"):this.removeClass("m3-grey-field"));return a}});Ext.reg("fileuploadfield",Ext.ux.form.FileUploadField);Ext.form.FileUploadField=Ext.ux.form.FileUploadField;Ext.ns("Ext.ux.form");
Ext.ux.form.ImageUploadField=Ext.extend(Ext.form.FileUploadField,{iconClsSelectFile:"x-form-image-icon",iconClsClearFile:"x-form-image-clear-icon",iconClsPreviewImage:"x-form-image-preview-icon",constructor:function(a,b){if(b){if(b.thumbnailWidth)this.thumbnailWidth=b.thumbnailWidth;if(b.thumbnailHeight)this.thumbnailHeight=b.thumbnailHeight;if(b.prefixThumbnailImg)this.prefixThumbnailImg=b.prefixThumbnailImg;if(b.thumbnail)this.thumbnail=b.thumbnail;if(b.fileUrl)this.fileUrl=b.fileUrl}Ext.ux.form.ImageUploadField.superclass.constructor.call(this,
a,b)},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];var d=this.prefixThumbnailImg||"";b=String.format("{0}/{1}{2}",b.join("/"),d,a);a="preview_tip_window_to_"+this.id;Ext.QuickTips.register({id:a,html:String.format('<a href="{0}" rel="lightbox"><image src="{1}" WIDTH={2} HEIGHT={3} OnClick=Ext.getCmp("{4}").hide()></a>',this.fileUrl,this.getFileUrl(b),this.thumbnailWidth,
this.thumbnailHeight,a),autoHide:false,width:this.thumbnailWidth+10,height:this.thumbnailHeight+10})}},renderHelperBtn:function(){if(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?false:true,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();Ext.QuickTips.getQuickTip().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.ux.Lightbox.register("a[rel^=lightbox]");Ext.reg("imageuploadfield",Ext.ux.form.ImageUploadField);function createGridPanel(a,b){return a.editor?new Ext.m3.EditorGridPanel(a,b):new Ext.m3.GridPanel(a,b)}function createObjectGrid(a,b){return a.editor?new Ext.m3.EditorObjectGrid(a,b):new Ext.m3.ObjectGrid(a,b)}function createObjectTree(a,b){return new Ext.m3.ObjectTree(a,b)}
function createAdvancedComboBox(a,b){return new Ext.m3.AdvancedComboBox(a,b)}function createAdvancedScrollComboBox(a,b){return new Ext.m3.AdvancedScrollComboBox(a,b)}function createAdvancedDataField(a,b){return new Ext.m3.AdvancedDataField(a,b)}function createMultipleDateField(a,b){return new Ext.m3.MultipleDateField(a,b)}
Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(a,b){if(this==null)throw new TypeError('"this" is null or not defined');var d=Object(this),e=d.length>>>0;if(typeof a!=="function")throw new TypeError("predicate must be a function");for(var f=0;f<e;){var g=d[f];if(a.call(b,g,f,d))return g;f++}}});
if(!Function.prototype.bind)Function.prototype.bind=function(a){if(typeof this!=="function")throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),d=this,e=function(){},f=function(){return d.apply(this instanceof e&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};e.prototype=this.prototype;f.prototype=new e;return f};
Ext.XTemplate=function(){Ext.XTemplate.superclass.constructor.apply(this,arguments);var a=this.html,b=/<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/,d=/^<tpl\b[^>]*?for="(.*?)"/,e=/^<tpl\b[^>]*?if="(.*?)"/,f=/^<tpl\b[^>]*?exec="(.*?)"/,g,h=0,j=[];for(a=["'<tpl>",a,"</tpl>'"].join("");g=a.match(b);){var k=g[0].match(d),l=g[0].match(e),m=g[0].match(f),n=null,o=null,p=null;k=k&&k[1]?k[1]:"";if(l)if(n=l&&l[1]?l[1]:null)o=new Function("xvalues","parent","xindex","xcount","with(xvalues){ return "+
Ext.util.Format.htmlDecode(n)+"; }");if(m)if(n=m&&m[1]?m[1]:null)p=new Function("xvalues","parent","xindex","xcount","with(xvalues){ "+Ext.util.Format.htmlDecode(n)+"; }");if(k)switch(k){case ".":k=new Function("xvalues","parent","with(xvalues){ return xvalues; }");break;case "..":k=new Function("xvalues","parent","with(xvalues){ return parent; }");break;default:k=new Function("xvalues","parent","with(xvalues){ return "+k+"; }")}j.push({id:h,target:k,exec:p,test:o,body:g[1]||""});a=a.replace(g[0],
"{xtpl"+h+"}");++h}for(a=j.length-1;a>=0;--a)this.compileTpl(j[a]);this.master=j[j.length-1];this.tpls=j};
Ext.extend(Ext.XTemplate,Ext.Template,{re:/\{([\w\-\.\#]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?(\s?[\+\-\*\\]\s?[\d\.\+\-\*\\\(\)]+)?\}/g,codeRe:/\{\[((?:\\\]|.|\n)*?)\]\}/g,applySubTemplate:function(a,b,d,e,f){a=this.tpls[a];var g,h=[];if(a.test&&!a.test.call(this,b,d,e,f)||a.exec&&a.exec.call(this,b,d,e,f))return"";g=a.target?a.target.call(this,b,d):b;d=a.target?b:d;if(a.target&&Ext.isArray(g)){e=0;for(b=g.length;e<b;e++)h[h.length]=a.compiled.call(this,g[e],d,e+1,b);return h.join("")}return a.compiled.call(this,
g,d,e,f)},compileTpl:function(a){function b(h,j,k,l,m){if(j.substr(0,4)==="xtpl")return"'"+f+"this.applySubTemplate("+j.substr(4)+", values, parent, xindex, xcount)"+f+"'";h=j==="."?"values":j==="#"?"xindex":j.indexOf(".")!==-1?j:"values['"+j+"']";if(m)h="("+h+m+")";if(k&&e){l=l?","+l:"";if(k.substr(0,5)!=="this.")k="fm."+k+"(";else{k='this.call("'+k.substr(5)+'", ';l=", values"}}else{l="";k="("+h+" === undefined ? '' : "}return"'"+f+k+h+l+")"+f+"'"}function d(h,j){return"'"+f+"("+j.replace(/\\'/g,
"'")+")"+f+"'"}var e=this.disableFormats!==true,f=Ext.isGecko?"+":",",g;if(Ext.isGecko)g="arguments[0].compiled = function(values, parent, xindex, xcount){ return '"+a.body.replace(/(\r\n|\n)/g,"\\n").replace(/'/g,"\\'").replace(this.re,b).replace(this.codeRe,d)+"';};";else{g=["arguments[0].compiled = function(values, parent, xindex, xcount){ return ['"];g.push(a.body.replace(/(\r\n|\n)/g,"\\n").replace(/'/g,"\\'").replace(this.re,b).replace(this.codeRe,d));g.push("'].join('');};");g=g.join("")}eval(g);
return this},applyTemplate:function(a){return this.master.compiled.call(this,a,{},1,1)},compile:function(){return this}});Ext.XTemplate.prototype.apply=Ext.XTemplate.prototype.applyTemplate;Ext.override(Ext.Element,{insertAfter:function(a){(a=Ext.getDom(a))&&a.parentNode&&a.parentNode.insertBefore(this.dom,a.nextSibling);return this}});
Ext.onReady(function(){Ext.override(Ext.Window,{tmpModal:false,manager:new Ext.WindowGroup,constrain:true,activateChildWindow:function(){this.toFront()},listeners:{beforeshow:function(){var a=Ext.get(this.renderTo);a&&a.getHeight()<this.getHeight()&&this.setHeight(a.getHeight());if(this.parentWindow){this.parentWindow.setDisabled(true);this.parentWindow.el.removeClass("x-masked-relative");this.parentWindow.on("activate",this.activateChildWindow,this);this.modal=false;this.tmpModal=true;if(window.AppDesktop)(a=
AppDesktop.getDesktop().taskbar.tbPanel.getTabWin(this.parentWindow))&&a.mask()}if(this.modal){(a=Ext.get("ux-taskbar"))&&a.mask();(a=Ext.get("ux-toptoolbar"))&&a.mask()}},close:function(){if(this.tmpModal&&this.parentWindow){this.parentWindow.un("activate",this.activateChildWindow,this);this.parentWindow.setDisabled(false);this.parentWindow.toFront();if(window.AppDesktop){var a=AppDesktop.getDesktop().taskbar.tbPanel.getTabWin(this.parentWindow);a&&a.unmask()}}if(this.modal){(a=Ext.get("ux-taskbar"))&&
a.unmask();(a=Ext.get("ux-toptoolbar"))&&a.unmask()}},hide:function(){if(this.modal)if(!this.parentWindow){var a=Ext.get("ux-taskbar");a&&a.unmask();(a=Ext.get("ux-toptoolbar"))&&a.unmask()}}}})});
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*(d[e].width*100/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){if(Ext.isNumber(b))d.style.height=
this.body.getHeight(true)-e.offsetHeight+"px";if(Ext.isNumber(a)){var f=Ext.num(this.scrollOffset,Ext.getScrollBarWidth());if(this.reserveScrollOffset||d.offsetWidth-d.clientWidth>10)this.setScrollOffset(f);else{var g=this;setTimeout(function(){g.setScrollOffset(d.offsetWidth-d.clientWidth>10?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=false},100)}});Ext.override(Ext.tree.TreeNodeUI,{onDblClick:function(a){a.preventDefault();if(!this.disabled)if(this.fireEvent("beforedblclick",this.node,a)!==false){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=b=="GET";if(a.clientValidation===false||this.form.isValid()){if(a.submitEmptyText===false){var e=[],f=function(g){if(g.rendered&&g.el.getValue()==g.emptyText){e.push(g);g.el.dom.value=""}g.isComposite&&g.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?this.getParams():null,isUpload:this.form.fileUpload}));
a.submitEmptyText===false&&Ext.each(e,function(g){g.applyEmptyText&&g.applyEmptyText()})}else if(a.clientValidation!==false){this.failureType=Ext.form.Action.CLIENT_INVALID;this.form.afterAction(this,false)}}});Ext.override(Ext.form.Checkbox,{onClick:function(a){if(this.readOnly){a.stopEvent();return false}this.el.dom.checked!=this.checked&&this.setValue(this.el.dom.checked)}});Ext.override(Ext.PagingToolbar,{onPagingBlur:Ext.emptyFn});
if(Ext.isIE7||Ext.isIE6)Ext.Panel.override({setAutoScroll:function(){if(this.rendered&&this.autoScroll){var a=this.body||this.el;if(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,j=h[0],k,l,m;this.indentMarkup=a.parentNode?a.parentNode.ui.getChildIndent():"";l=['<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">',j.tpl?j.tpl.apply(b):b[j.dataIndex]||j.text,"</span></a>","</td>"];k=1;for(m=h.length;k<
m;k++){j=h[k];l.push('<td class="x-treegrid-col ',j.cls?j.cls:"",'">','<div unselectable="on" class="x-treegrid-text"',j.align?' style="text-align: '+j.align+';"':"",">",j.tpl?j.tpl.apply(b):b[j.dataIndex],"</div>","</td>")}l.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>');k=0;for(m=h.length;k<m;k++)l.push('<col style="width: ',
h[k].hidden?0:h[k].width,'px;" />');l.push("</colgroup></table></td></tr></tbody>");this.wrap=e!==true&&a.nextSibling&&a.nextSibling.ui.getEl()?Ext.DomHelper.insertHtml("beforeBegin",a.nextSibling.ui.getEl(),l.join("")):Ext.DomHelper.insertHtml("beforeEnd",d,l.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;if(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(){if(this.attributes.checked)d.push(!a?this:a=="id"?this.id:this.attributes[a])});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;this.store.getCount()>0&&this.store.each(function(e){if(String(e.data[a])==String(b)){d=e;return false}});return d}});var setReadOnlyField=Ext.form.Field.prototype.setReadOnly.bind({}),restoreClass=function(a){if(a){this.addClass("m3-grey-field");this.el.dom.setAttribute("readonly","")}else{this.removeClass("m3-grey-field");this.el.dom.removeAttribute("readonly")}};
Ext.override(Ext.form.Field,{setReadOnly:function(a){setReadOnlyField.call(this,a);restoreClass.call(this,a)}});var setReadOnlyTriggerField=Ext.form.TriggerField.prototype.setReadOnly;Ext.override(Ext.form.TriggerField,{setReadOnly:function(a){setReadOnlyTriggerField.call(this,a);restoreClass.call(this,a)}});
Ext.override(Ext.grid.GridView,{renderHeaders:function(){var a=this.cm,b=this.templates,d=b.hcell,e={},f=a.getColumnCount(),g=f-1,h=[],j;for(j=0;j<f;j++){e=j==0?"x-grid3-cell-first ":j==g?"x-grid3-cell-last ":"";if(a.config[j].cls)e+=a.columns[j].cls;e={id:a.getColumnId(j),value:a.getColumnHeader(j)||"",style:this.getColumnStyle(j,true),css:e,tooltip:this.getColumnTooltip(j)};if(a.config[j].align=="right")e.istyle="padding-right: 16px;";else delete e.istyle;h[j]=d.apply(e)}return b.header.apply({cells:h.join(""),
tstyle:String.format("width: {0};",this.getTotalWidth())})},fitColumns:function(a,b,d){b=this.cm;var e=b.getTotalWidth(false),f=this.getGridInnerWidth(),g=f-e;e=[];var h=0,j=0,k,l;if(f<20||g===0)return false;g=b.getColumnCount(true);var m=b.getColumnCount(false),n=g-(Ext.isNumber(d)?1:0);if(n===0){n=1;d=undefined}for(l=0;l<m;l++)if(!b.isFixed(l)&&l!==d){k=b.getColumnWidth(l);e.push(l,k);if(!b.isHidden(l)){h=l;j+=k}}for(j=(f-b.getTotalWidth())/j;e.length;){k=e.pop();l=e.pop();b.setColumnWidth(l,Math.floor(k+
k*j),true)}e=b.getTotalWidth(false);if(e>f){d=n==g?h:d;f=Math.max(1,b.getColumnWidth(d)-(e-f));b.setColumnWidth(d,f,true)}a!==true&&this.updateAllColumnWidths();return true}});Ext.override(Ext.Element,{addStyles:function(a,b){var d=0,e=a.match(/\w/g),f,g,h=e.length;for(g=0;g<h;g++)if(f=(f=e[g])&&parseFloat(this.getStyle(b[f])))d+=Math.abs(f);return d}});
Ext.ToolTip.override({onMouseMove:function(a){var b=this.delegate?a.getTarget(this.delegate):this.triggerElement=true;if(b){this.targetXY=a.getXY();if(b===this.triggerElement)!this.hidden&&this.trackMouse&&this.setPagePosition(this.getTargetXY());else{this.hide();this.lastActive=new Date(0);this.onTargetOver(a)}}else if(!this.closable){this.clearTimer("show");this.hide()}}});Ext.apply(Ext.EventManager,{useKeydown:Ext.isWebKit?Ext.num(navigator.userAgent.match(/AppleWebKit\/(\d+)/)[1])>=525:!Ext.isOpera});
Ext.data.Store.override({find:function(a,b,d,e,f,g){return(a=this.createFilterFn(a,b,e,f,g))?this.data.findIndexBy(a,null,d):-1}});Ext.ux.grid.ColumnHeaderGroup.override({getGroupStyle:function(a,b){for(var d=0,e=true,f=b,g=b+a.colspan;f<g;f++)if(!this.cm.isHidden(f)){e=this.cm.getColumnWidth(f);if(typeof e=="number")d+=e;e=false}return{width:(Ext.isBorderBox?d:Math.max(d-this.borderWidth,0))+"px",hidden:e}}});
Ext.override(Ext.form.HtmlEditor,{updateToolbar:function(){if(!this.readOnly)if(this.activated){var a=this.tb.items.map,b=this.getDoc();if(this.enableFont&&!Ext.isSafari2){var d=(b.queryCommandValue("FontName").split(", ")[0].replace(/"/g,"")||this.defaultFont).toLowerCase();if(d!=this.fontSelect.dom.value)this.fontSelect.dom.value=d}if(this.enableFormat){a.bold.toggle(b.queryCommandState("bold"));a.italic.toggle(b.queryCommandState("italic"));a.underline.toggle(b.queryCommandState("underline"))}if(this.enableAlignments){a.justifyleft.toggle(b.queryCommandState("justifyleft"));
a.justifycenter.toggle(b.queryCommandState("justifycenter"));a.justifyright.toggle(b.queryCommandState("justifyright"))}if(!Ext.isSafari2&&this.enableLists){a.insertorderedlist.toggle(b.queryCommandState("insertorderedlist"));a.insertunorderedlist.toggle(b.queryCommandState("insertunorderedlist"))}Ext.menu.MenuMgr.hideAll();this.syncValue()}else this.onFirstFocus()}});
