MODx.panel.ResourceTV=function(A){A=A||{};Ext.applyIf(A,{id:"modx-panel-resource-tv",title:_("template_variables"),class_key:"",resource:"",bodyStyle:"padding: 15px;",autoHeight:true,autoLoad:this.autoload(A),width:"97%",templateField:"modx-resource-template"});MODx.panel.ResourceTV.superclass.constructor.call(this,A);this.addEvents({load:true});};Ext.extend(MODx.panel.ResourceTV,MODx.Panel,{autoload:function(B){var C=Ext.getCmp(B.templateField);if(!C&&!B.template){setTimeout("MODx.fireEvent('ready');",300);return false;}var D=B.template?B.template:C.getValue();var A={url:MODx.config.manager_url+"index.php?a="+MODx.action["resource/tvs"],method:"GET",params:{a:MODx.action["resource/tvs"],class_key:B.class_key,template:D,resource:B.resource,ctx:MODx.ctx},scripts:true,callback:function(){MODx.fireEvent("ready");MODx.sleep(4);if(MODx.afterTVLoad){MODx.afterTVLoad();}this.fireEvent("load");},scope:this};return A;},refreshTVs:function(){var A=Ext.getCmp(this.config.templateField);if(!A&&!this.config.template){return false;}var B=this.config.template?this.config.template:A.getValue();this.getUpdater().update({url:MODx.config.manager_url+"index.php?a="+MODx.action["resource/tvs"],method:"GET",params:{class_key:this.config.class_key,template:B,resource:this.config.resource},scripts:true,callback:function(){this.fireEvent("load");if(MODx.afterTVLoad){MODx.afterTVLoad();}},scope:this});}});Ext.reg("modx-panel-resource-tv",MODx.panel.ResourceTV);