MODx.tree.UserGroup=function(A){A=A||{};Ext.applyIf(A,{title:_("user_groups"),id:"modx-tree-usergroup",url:MODx.config.connectors_url+"security/group.php",root_id:"n_ug_0",root_name:_("user_groups"),enableDrag:true,enableDrop:true,rootVisible:false,ddAppendOnly:true,useDefaultToolbar:true,tbar:[{text:_("user_group_new"),scope:this,handler:this.create.createDelegate(this,[true],true)}]});MODx.tree.UserGroup.superclass.constructor.call(this,A);};Ext.extend(MODx.tree.UserGroup,MODx.tree.Tree,{windows:{},addUser:function(B,C){var E=this.cm.activeNode;var D=E.id.substr(2).split("_");D=D[1];if(D===undefined){D=0;}var A={usergroup:D};if(!this.windows.adduser){this.windows.adduser=MODx.load({xtype:"modx-window-usergroup-adduser",record:A,listeners:{"success":{fn:this.refresh,scope:this}}});}this.windows.adduser.setValues(A);this.windows.adduser.show(C.target);},create:function(B,D,F){F=F||false;var C;if(F===false){var E=this.cm.activeNode;C=E.id.substr(2).split("_");C=C[1];if(C===undefined){C=0;}}else{C=0;}var A={"parent":C};if(!this.windows.createUsergroup){this.windows.createUsergroup=MODx.load({xtype:"modx-window-usergroup-create",record:A,listeners:{"success":{fn:this.refresh,scope:this}}});}else{this.windows.createUsergroup.setValues(A);}this.windows.createUsergroup.show(D.target);},update:function(A,B){var D=this.cm.activeNode;var C=D.id.substr(2).split("_");C=C[1];location.href="index.php"+"?a="+MODx.action["security/usergroup/update"]+"&id="+C;},remove:function(A,B){var D=this.cm.activeNode;var C=D.id.substr(2).split("_");C=C[1];MODx.msg.confirm({title:_("warning"),text:_("user_group_remove_confirm"),url:this.config.url,params:{action:"remove",id:C},listeners:{"success":{fn:this.refresh,scope:this}}});},removeUser:function(C,D){var E=this.cm.activeNode;var A=E.id.substr(2).split("_");A=A[1];var B=E.parentNode.id.substr(2).split("_");B=B[1];MODx.msg.confirm({title:_("warning"),text:_("user_group_user_remove_confirm"),url:this.config.url,params:{action:"removeUser",user_id:A,group_id:B},listeners:{"success":{fn:this.refresh,scope:this}}});}});Ext.reg("modx-tree-usergroup",MODx.tree.UserGroup);MODx.window.CreateUserGroup=function(A){A=A||{};Ext.applyIf(A,{title:_("user_group_create"),height:150,width:400,url:MODx.config.connectors_url+"security/usergroup/index.php",action:"create",fields:[{xtype:"hidden",name:"parent",value:0},{fieldLabel:_("name"),name:"name",hiddenName:"name",id:"modx-cug-name",xtype:"textfield",allowBlank:false,anchor:"90%"}]});MODx.window.CreateUserGroup.superclass.constructor.call(this,A);};Ext.extend(MODx.window.CreateUserGroup,MODx.Window);Ext.reg("modx-window-usergroup-create",MODx.window.CreateUserGroup);MODx.window.CreateUserGroup=function(A){A=A||{};this.ident=A.ident||"cugrp"+Ext.id();Ext.applyIf(A,{title:_("create_user_group"),id:this.ident,height:150,width:375,url:MODx.config.connectors_url+"security/group.php",action:"create",fields:[{fieldLabel:_("name"),name:"name",id:"modx-"+this.ident+"-name",xtype:"textfield",anchor:"90%"},{name:"parent",id:"modx-"+this.ident+"-parent",xtype:"hidden"}]});MODx.window.CreateUserGroup.superclass.constructor.call(this,A);};Ext.extend(MODx.window.CreateUserGroup,MODx.Window);Ext.reg("modx-window-usergroup-create",MODx.window.CreateUserGroup);MODx.window.AddUserToUserGroup=function(A){A=A||{};this.ident=A.ident||"adtug"+Ext.id();Ext.applyIf(A,{title:_("user_group_user_add"),id:this.ident,height:150,width:375,url:MODx.config.connectors_url+"security/usergroup/user.php",action:"create",fields:[{fieldLabel:_("name"),name:"user",hiddenName:"user",xtype:"modx-combo-user",editable:true,typeAhead:true,id:"modx-"+this.ident+"-user",anchor:"90%"},{fieldLabel:_("role"),name:"role",hiddenName:"role",xtype:"modx-combo-role",id:"modx-"+this.ident+"-role",allowBlank:false,anchor:"90%"},{name:"usergroup",xtype:"hidden",id:"modx-"+this.ident+"-user-group"}]});MODx.window.AddUserToUserGroup.superclass.constructor.call(this,A);};Ext.extend(MODx.window.AddUserToUserGroup,MODx.Window);Ext.reg("modx-window-usergroup-adduser",MODx.window.AddUserToUserGroup);