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({title:_("resources"),id:"modx-resource-tree-ct",listeners:{activate:function(D){if(Ext.get("modx-resource-tree")==null){Ext.get(Ext.query("#"+D.id+" div.x-panel-bwrap")).item(0).remove();MODx.load({xtype:"modx-tree-resource",id:"modx-resource-tree",renderTo:D.id});}}}});C=true;}if(MODx.perm.element_tree){B.push({title:_("elements"),id:"modx-element-tree-ct",listeners:{activate:function(D){if(Ext.get("modx-element-tree")==null){Ext.get(Ext.query("#"+D.id+" div.x-panel-bwrap")).item(0).remove();MODx.load({xtype:"modx-tree-element",id:"modx-element-tree",renderTo:D.id});}}}});C=true;}if(MODx.perm.file_tree){B.push({title:_("files"),id:"modx-file-tree-ct",hideFiles:false,listeners:{activate:function(D){if(Ext.get("modx-file-tree")==null){Ext.get(Ext.query("#"+D.id+" div.x-panel-bwrap")).item(0).remove();MODx.load({xtype:"modx-tree-directory",id:"modx-file-tree",renderTo:D.id});}}}});C=true;}Ext.applyIf(A,{layout:"border",id:"modx-layout",items:[{xtype:"box",region:"north",applyTo:"modx-header",height:90},{region:"west",applyTo:"modx-leftbar",id:"modx-leftbar-tabs",split:true,width:310,minSize:150,maxSize:800,autoScroll: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},id:"modx-leftbar-tabpanel",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,autoScroll:true,margins:"0 0 20 15",padding:"0 1px 0 0",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;