Ext.apply(Ext,{isFirebug:(window.console&&window.console.firebug)});MODx.Layout=function(A){A=A||{};Ext.BLANK_IMAGE_URL=MODx.config.manager_url+"assets/ext3/resources/images/default/s.gif";Ext.Ajax.defaultHeaders={"modAuth":A.auth};Ext.Ajax.extraParams={"HTTP_MODAUTH":A.auth};MODx.siteId=A.auth;var B=[];var C=false;if(MODx.perm.resource_tree){B.push({xtype:"modx-tree-resource",title:_("resources"),id:"modx-resource-tree"});C=true;}if(MODx.perm.element_tree){B.push({xtype:"modx-tree-element",title:_("elements"),id:"modx-element-tree"});C=true;}if(MODx.perm.file_tree){B.push({xtype:"modx-tree-directory",title:_("files"),id:"modx-file-tree",hideFiles:false});C=true;}Ext.applyIf(A,{layout:"border",id:"modx-layout",items:[{region:"west",applyTo:"modx-leftbar",id:"modx-leftbar-tabs",split:true,width:310,minSize:150,maxSize:800,autoHeight:true,unstyled:true,collapseMode:"mini",useSplitTips:true,monitorResize:true,forceLayout:true,stateful:false,items:[{xtype:"modx-tabs",plain:true,forceLayout:true,deferredRender:false,defaults:{autoScroll:true,fitToFrame:true},border:false,activeTab:0,stateful:true,stateId:"modx-leftbar-state",stateEvents:["tabchange"],getState:function(){return{activeTab:this.items.indexOf(this.getActiveTab())};},items:B}]},{region:"center",applyTo:"modx-content",id:"modx-content",border:false,autoHeight:true,margins:"0 30 0 15",bodyStyle:"background-color:transparent;"}]});MODx.Layout.superclass.constructor.call(this,A);this.config=A;this.addEvents({"afterLayout":true,"loadKeyMap":true,"loadTabs":true});this.loadKeys();if(!C){Ext.getCmp("modx-leftbar-tabs").collapse(false);Ext.get("modx-leftbar").hide();Ext.get("modx-leftbar-tabs-xcollapsed").setStyle("display","none");}this.fireEvent("afterLayout");};Ext.extend(MODx.Layout,Ext.Viewport,{loadKeys:function(){Ext.KeyMap.prototype.stopEvent=true;var A=new Ext.KeyMap(Ext.get(document));A.addBinding({key:Ext.EventObject.H,ctrl:true,shift:true,fn:this.toggleLeftbar,scope:this,stopEvent:true});A.addBinding({key:Ext.EventObject.N,ctrl:true,shift:true,fn:function(){var B=Ext.getCmp("modx-resource-tree");if(B){B.quickCreate(document,{},"modResource","web",0);}},stopEvent:true});A.addBinding({key:Ext.EventObject.U,ctrl:true,shift:true,fn:MODx.clearCache,scope:this,stopEvent:true});this.fireEvent("loadKeyMap",{keymap:A});},refreshTrees:function(){var A;A=Ext.getCmp("modx-resource-tree");if(A){A.refresh();}A=Ext.getCmp("modx-element-tree");if(A){A.refresh();}A=Ext.getCmp("modx-file-tree");if(A){A.refresh();}},leftbarVisible:true,toggleLeftbar:function(){this.leftbarVisible?this.hideLeftbar(0.3):this.showLeftbar(0.3);this.leftbarVisible=!this.leftbarVisible;},hideLeftbar:function(A){Ext.getCmp("modx-leftbar-tabs").collapse();},showLeftbar:function(A){Ext.getCmp("modx-leftbar-tabs").expand();}});Ext.reg("modx-layout",MODx.Layout);MODx.LayoutMgr=function(){var A="menu0";return{loadPage:function(B,C){location.href="?a="+B+"&"+(C||"");return false;},changeMenu:function(B,D){if(D===A){return false;}Ext.get(D).addClass("active");var C=Ext.get(A);if(C){C.removeClass("active");}A=D;return false;}};}();MODx.loadPage=MODx.LayoutMgr.loadPage;MODx.showDashboard=MODx.LayoutMgr.showDashboard;MODx.hideDashboard=MODx.LayoutMgr.hideDashboard;MODx.changeMenu=MODx.LayoutMgr.changeMenu;