MODx.panel.ErrorLog=function(config){config=config||{};Ext.applyIf(config,{url:MODx.config.connector_url,id:'modx-panel-error-log',cls:'container',baseParams:{action:'system/errorlog/clear'},items:[{html:'<h2>'+_('error_log')+'</h2>',id:'modx-error-log-header',cls:'modx-page-header',border:false,anchor:'100%'},{layout:'form',hideLabels:true,autoHeight:true,border:true,items:[{html:'<p>'+_('error_log_desc')+'</p>',bodyCssClass:'panel-desc',border:false},{xtype:'panel',border:false,cls:'main-wrapper',layout:'form',labelAlign:'top',items:[{xtype:'textarea',name:'log',hideLabel:true,id:'modx-error-log-content',cls:'modx-code-content',grow:true,growMax:400,anchor:'100%',hidden:config.record.tooLarge?true:false},{html:'<p>'+_('error_log_too_large',{name:config.record.name})+'</p>',border:false,hidden:config.record.tooLarge?false:true},{xtype:'button',text:_('error_log_download',{size:config.record.size}),cls:'primary-button',style:'margin-top: 15px;',hidden:config.record.tooLarge?false:true,handler:this.download,scope:this}]}]}]});MODx.panel.ErrorLog.superclass.constructor.call(this,config);this.setup();};Ext.extend(MODx.panel.ErrorLog,MODx.FormPanel,{initialized:false,setup:function(){if(this.initialized){this.clearDirty();return true;}
this.getForm().setValues(this.config.record);this.clearDirty();MODx.fireEvent('ready');this.initialized=true;return true;},download:function(){location.href=this.config.url+'?action=system/errorlog/download&HTTP_MODAUTH='+MODx.siteId;}});Ext.reg('modx-panel-error-log',MODx.panel.ErrorLog);;MODx.page.ErrorLog=function(config){config=config||{};Ext.applyIf(config,{formpanel:'modx-panel-error-log',buttons:[{text:_('ext_refresh'),id:'modx-abtn-refresh',cls:'primary-button',handler:this.refreshLog,scope:this,hidden:config.record.tooLarge},{text:_('clear'),id:'modx-abtn-clear',handler:this.clear,scope:this,hidden:MODx.hasEraseErrorLog?false:true},{text:_('cancel'),id:'modx-abtn-cancel'}],components:[{xtype:'modx-panel-error-log',record:config.record||{}}]});MODx.page.ErrorLog.superclass.constructor.call(this,config);};Ext.extend(MODx.page.ErrorLog,MODx.Component,{clear:function(){var panel=Ext.getCmp('modx-panel-error-log');panel.el.mask(_('working'));MODx.Ajax.request({url:panel.config.url,params:{action:'system/errorlog/clear'},listeners:{'success':{fn:function(r){this.el.unmask();if(!r.object.tooLarge&&this.config.record.tooLarge){location.href=location.href;}else{this.getForm().setValues(r.object);}},scope:panel}}});},refreshLog:function(){var panel=Ext.getCmp('modx-panel-error-log');panel.el.mask(_('working'));MODx.Ajax.request({url:panel.config.url,params:{action:'system/errorlog/get'},listeners:{'success':{fn:function(r){this.el.unmask();if(r.object.tooLarge){location.href=location.href;}else{this.getForm().setValues(r.object);}},scope:panel}}});}});Ext.reg('modx-page-error-log',MODx.page.ErrorLog);