MODx.tree.Action=function(A){A=A||{};Ext.applyIf(A,{root_id:"n_root_0",root_name:_("actions"),rootVisible:true,expandFirst:true,enableDrag:true,enableDrop:true,ddAppendOnly:true,ddGroup:"modx-action",url:MODx.config.connectors_url+"system/action.php",action:"getNodes"});MODx.tree.Action.superclass.constructor.call(this,A);};Ext.extend(MODx.tree.Action,MODx.tree.Tree,{windows:{},getMenu:function(E,D){var B=E.attributes;var C=E.getUI();var A=[];switch(B.type){case"namespace":A.push({text:_("action_create_here"),handler:this.createAction});break;case"action":A.push({text:_("action_update"),handler:this.updateAction});A.push({text:_("action_create_here"),handler:this.createAction});A.push({text:_("action_remove"),handler:this.removeAction});break;}return A;},refreshActionCombos:function(){var A;var B=["modx-cact-parent","modx-cmen-action","modx-umen-action"];for(var C=0;C<B.length;C++){A=Ext.getCmp(B[C]);if(A){A.store.reload();}}},createAction:function(D,C){var B=this.cm.activeNode.attributes;var A=B.data;if(B.type=="namespace"){A={namespace:A.name};}else{A={parent:A.id,namespace:A.namespace};}if(!this.windows.create_action){this.windows.create_action=MODx.load({xtype:"modx-window-action-create",record:A,listeners:{success:{fn:function(E){this.refresh();this.refreshActionCombos();},scope:this}}});}this.windows.create_action.setValues(A);this.windows.create_action.show(C.target);return false;},updateAction:function(C,B){var A=this.cm.activeNode.attributes.data;if(!this.windows.update_action){this.windows.update_action=MODx.load({xtype:"modx-window-action-update",record:A,listeners:{success:{fn:function(D){this.refresh();this.refreshActionCombos();},scope:this}}});}this.windows.update_action.setValues(A);this.windows.update_action.show(B.target);},removeAction:function(B,A){MODx.msg.confirm({title:_("warning"),text:_("action_confirm_remove"),url:this.config.url,params:{action:"remove",id:this.cm.activeNode.attributes.pk},listeners:{success:{fn:function(){this.refresh();this.refreshActionCombos();},scope:this}}});}});Ext.reg("modx-tree-action",MODx.tree.Action);MODx.window.CreateAction=function(A){A=A||{};Ext.applyIf(A,{title:_("action_create"),width:430,url:MODx.config.connectors_url+"system/action.php",action:"create",fields:[{fieldLabel:_("controller"),name:"controller",xtype:"textfield",anchor:"90%"},{fieldLabel:_("namespace"),name:"namespace",xtype:"modx-combo-namespace",anchor:"90%",allowBlank:false,value:"core"},{fieldLabel:_("controller_parent"),name:"parent",hiddenName:"parent",xtype:"modx-combo-action",editable:false,anchor:"90%",id:"modx-cact-parent"},{fieldLabel:_("load_headers"),name:"haslayout",xtype:"xcheckbox",checked:true,inputValue:1},{fieldLabel:_("lang_topics"),description:_("lang_topics_desc"),name:"lang_topics",xtype:"textfield",anchor:"90%"},{fieldLabel:_("assets"),name:"assets",xtype:"textarea",anchor:"90%",grow:false}]});MODx.window.CreateAction.superclass.constructor.call(this,A);};Ext.extend(MODx.window.CreateAction,MODx.Window);Ext.reg("modx-window-action-create",MODx.window.CreateAction);MODx.window.UpdateAction=function(A){A=A||{};Ext.applyIf(A,{title:_("action_update"),width:430,url:MODx.config.connectors_url+"system/action.php",action:"update",fields:[{name:"id",xtype:"hidden"},{name:"parent",xtype:"hidden"},{fieldLabel:_("controller"),name:"controller",xtype:"textfield",anchor:"90%"},{fieldLabel:_("namespace"),name:"namespace",hiddenName:"namespace",xtype:"modx-combo-namespace",anchor:"90%",allowBlank:false},{name:"parent",xtype:"hidden",editable:false},{fieldLabel:_("load_headers"),name:"haslayout",xtype:"xcheckbox",checked:true},{fieldLabel:_("lang_topics"),description:_("lang_topics_desc"),name:"lang_topics",xtype:"textfield",anchor:"90%"},{fieldLabel:_("assets"),name:"assets",xtype:"textarea",anchor:"90%",grow:false}]});MODx.window.UpdateAction.superclass.constructor.call(this,A);};Ext.extend(MODx.window.UpdateAction,MODx.Window);Ext.reg("modx-window-action-update",MODx.window.UpdateAction);