Forked mumble-django project from https://bitbucket.org/Svedrin/mumble-django
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
4.9 KiB

  1. // kate: space-indent on; indent-width 4; replace-tabs on;
  2. Ext.namespace('Ext.ux');
  3. Ext.ux.MumbleUserEditor = Ext.extend( Ext.Component, {
  4. clickHandler: function( node, ev ){
  5. if( typeof node.attributes.userdata != "undefined" ){
  6. this.activate(node.attributes.userdata);
  7. }
  8. },
  9. init: function( tree ){
  10. this.tree = tree;
  11. tree.on("click", this.clickHandler, this);
  12. },
  13. activate: function( userdata ){
  14. if( !this.wnd ){
  15. this.userdata = userdata;
  16. this.wnd = new Ext.Window({
  17. title: this.windowTitle || gettext("User details"),
  18. layout: 'fit',
  19. items: [{
  20. xtype: "tabpanel",
  21. activeTab: 0,
  22. border: false,
  23. items: [{
  24. html: userdata.comment || gettext("No user comment set"),
  25. title: gettext("User comment"),
  26. }, {
  27. title: gettext("Avatar"),
  28. html: '<img src="http://www.gravatar.com/avatar/6a11052bfa1ae52aa63fc0001417158d.jpg?d=monsterid&s=80" />',
  29. }, {
  30. title: gettext("Infos"),
  31. html: "<ul><li>admin: yes</li><li>registered: maybe</li></ul>",
  32. }, {
  33. xtype: "form",
  34. border: false,
  35. title: gettext("Kick/Ban"),
  36. items: [{
  37. xtype: "checkbox",
  38. fieldLabel: gettext("Ban"),
  39. name: "ban"
  40. }, {
  41. xtype: "numberfield",
  42. fieldLabel: gettext("Ban duration"),
  43. value: 3600,
  44. name: "duration"
  45. }, {
  46. xtype: "label",
  47. text: gettext("Only if banning. Set to 0 for permanent ban, any other value for the ban duration in seconds."),
  48. cls: "form_hint_label",
  49. }, {
  50. xtype: "textfield",
  51. fieldLabel: gettext("Reason"),
  52. name: "reason"
  53. }],
  54. fbar: [{
  55. scope: this,
  56. text: gettext("Kick"),
  57. handler: function(btn){
  58. f = btn.ownerCt.ownerCt.getForm().getValues();
  59. Mumble.kickUser(
  60. this.serverid, this.userdata.session, f.reason, (f.ban || false), parseInt(f.duration)
  61. );
  62. }
  63. }],
  64. }],
  65. }],
  66. width: 500,
  67. height: 300,
  68. scope: this,
  69. listeners: {
  70. beforeclose: function(){
  71. this.owner.wnd = null;
  72. }
  73. },
  74. });
  75. this.wnd.owner = this;
  76. }
  77. if( !this.wnd.isVisible() ){
  78. this.wnd.show();
  79. mypos = this.tree.getPosition();
  80. mysize = this.tree.getSize();
  81. this.wnd.setPosition( mypos[0] + mysize.width - 50, mypos[1] + 50 );
  82. }
  83. else{
  84. this.wnd.close();
  85. }
  86. },
  87. } );
  88. Ext.ux.MumbleChannelEditor = Ext.extend( Ext.Component, {
  89. clickHandler: function( node, ev ){
  90. if( typeof node.attributes.chandata != "undefined" ){
  91. this.activate(node.attributes.chandata);
  92. }
  93. },
  94. init: function( tree ){
  95. this.tree = tree;
  96. tree.on("click", this.clickHandler, this);
  97. },
  98. activate: function( chandata ){
  99. if( !this.wnd ){
  100. this.wnd = new Ext.Window({
  101. title: this.windowTitle || gettext("Channel details"),
  102. layout: 'fit',
  103. items: [{
  104. xtype: "tabpanel",
  105. activeTab: 0,
  106. items: [{
  107. html: chandata.description || gettext("No channel description set"),
  108. title: gettext("Channel description"),
  109. }],
  110. }],
  111. width: 500,
  112. height: 300,
  113. scope: this,
  114. listeners: {
  115. beforeclose: function(){
  116. this.owner.wnd = null;
  117. }
  118. },
  119. });
  120. this.wnd.owner = this;
  121. }
  122. if( !this.wnd.isVisible() ){
  123. this.wnd.show();
  124. mypos = this.tree.getPosition();
  125. mysize = this.tree.getSize();
  126. this.wnd.setPosition( mypos[0] + mysize.width - 50, mypos[1] + 50 );
  127. }
  128. else{
  129. this.wnd.close();
  130. }
  131. },
  132. } );