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.

74 lines
2.5 KiB

  1. // kate: space-indent on; indent-width 4; replace-tabs on;
  2. Ext.namespace('Ext.ux');
  3. Ext.ux.BanViewerPanel = function( config ){
  4. Ext.apply( this, config );
  5. Ext.applyIf( this, {
  6. xtype: 'grid',
  7. title: gettext('Bans'),
  8. colModel: new Ext.grid.ColumnModel([{
  9. header: gettext('Timestamp'),
  10. dataIndex: 'start',
  11. width: 150,
  12. renderer: function( value ){
  13. return new Date(value*1000).format( "Y-m-d H:i:s" );
  14. }
  15. }, {
  16. header: gettext('Address'),
  17. width: 250,
  18. dataIndex: 'addrstr',
  19. renderer: function( value, meta, record, rowIdx, colIdx, store ){
  20. return value + "/" + record.data['bits'];
  21. }
  22. }, {
  23. header: gettext('User name'),
  24. width: 150,
  25. dataIndex: 'name'
  26. }, {
  27. header: gettext('Duration'),
  28. width: 100,
  29. dataIndex: 'duration'
  30. }, {
  31. header: gettext('Reason'),
  32. width: 300,
  33. dataIndex: 'reason'
  34. }]),
  35. bbar: [{
  36. iconCls: 'x-tbar-loading',
  37. tooltip: gettext('Refresh'),
  38. handler: function(){
  39. this.ownerCt.ownerCt.store.reload();
  40. }
  41. }, {
  42. text: gettext('Delete'),
  43. handler: function(){
  44. var grid = this.ownerCt.ownerCt;
  45. var mdl = grid.getSelectionModel();
  46. if( mdl.hasSelection() ){
  47. Mumble.removeBan(this.ownerCt.ownerCt.server, mdl.selection.record.data, function(){
  48. grid.store.reload();
  49. });
  50. }
  51. }
  52. }],
  53. store: new Ext.data.DirectStore({
  54. baseParams: {'server': this.server},
  55. directFn: Mumble.bans,
  56. paramOrder: ['server'],
  57. root: 'data',
  58. fields: ['start', 'address', 'bits', 'duration', 'reason', 'addrstr', 'name'],
  59. autoLoad: true,
  60. remoteSort: false
  61. }),
  62. viewConfig: { forceFit: true }
  63. });
  64. Ext.ux.LogViewerPanel.superclass.constructor.call( this );
  65. }
  66. Ext.extend( Ext.ux.BanViewerPanel, Ext.grid.EditorGridPanel, {
  67. } );
  68. Ext.reg( 'banViewerPanel', Ext.ux.BanViewerPanel );