Browse Source

add autorefresh and "talking" display, and join forces with the scroller but-ton-nés

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
69e2ca5470
  1. 22
      htdocs/js/channelviewer.js

22
htdocs/js/channelviewer.js

@ -7,6 +7,8 @@ Ext.ux.MumbleChannelViewer = function( config ){
Ext.applyIf( this, { Ext.applyIf( this, {
title: gettext("Channel Viewer"), title: gettext("Channel Viewer"),
refreshInterval: 10000,
autoScroll: true,
root: { root: {
text: gettext("Loading..."), text: gettext("Loading..."),
leaf: true leaf: true
@ -19,10 +21,17 @@ Ext.ux.MumbleChannelViewer = function( config ){
} ); } );
Ext.ux.MumbleChannelViewer.superclass.constructor.call( this ); Ext.ux.MumbleChannelViewer.superclass.constructor.call( this );
this.refresh();
this.autoRefresh();
} }
Ext.extend( Ext.ux.MumbleChannelViewer, Ext.tree.TreePanel, { Ext.extend( Ext.ux.MumbleChannelViewer, Ext.tree.TreePanel, {
autoRefresh: function(){
this.refresh();
if( this.refreshInterval > 0 ){
this.autoRefresh.defer( this.refreshInterval, this );
}
},
refresh: function(){ refresh: function(){
var conn = new Ext.data.Connection(); var conn = new Ext.data.Connection();
conn.request({ conn.request({
@ -56,8 +65,11 @@ Ext.extend( Ext.ux.MumbleChannelViewer, Ext.tree.TreePanel, {
text: json.users[i].name, text: json.users[i].name,
id: ("user_" + json.users[i].id), id: ("user_" + json.users[i].id),
leaf: true, leaf: true,
icon: '/static/mumble/talking_off.png',
}; };
if( json.users[i].idlesecs == 0 )
child.icon = '/static/mumble/talking_on.png';
else
child.icon = '/static/mumble/talking_off.png';
node.leaf = false; node.leaf = false;
node.children.push( child ); node.children.push( child );
} }
@ -69,7 +81,11 @@ Ext.extend( Ext.ux.MumbleChannelViewer, Ext.tree.TreePanel, {
this.setRootNode( root ); this.setRootNode( root );
}, },
failure: function( resp, opt ){ failure: function( resp, opt ){
alert("fail");
if( this.refreshInterval > 0 )
if( this.refreshInterval < 300000 )
this.refreshInterval = 300000;
else
this.refreshInterval = 0;
}, },
}); });
}, },

Loading…
Cancel
Save