From 69e2ca54706911b795e40d36b20ac8adc10c758a Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Fri, 30 Jul 2010 18:39:44 +0200 Subject: [PATCH] =?UTF-8?q?add=20autorefresh=20and=20"talking"=20display,?= =?UTF-8?q?=20and=20join=20forces=20with=20the=20scroller=20but-ton-n?= =?UTF-8?q?=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/js/channelviewer.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/htdocs/js/channelviewer.js b/htdocs/js/channelviewer.js index 569c57b..3ae3779 100644 --- a/htdocs/js/channelviewer.js +++ b/htdocs/js/channelviewer.js @@ -7,6 +7,8 @@ Ext.ux.MumbleChannelViewer = function( config ){ Ext.applyIf( this, { title: gettext("Channel Viewer"), + refreshInterval: 10000, + autoScroll: true, root: { text: gettext("Loading..."), leaf: true @@ -19,10 +21,17 @@ Ext.ux.MumbleChannelViewer = function( config ){ } ); Ext.ux.MumbleChannelViewer.superclass.constructor.call( this ); - this.refresh(); + this.autoRefresh(); } Ext.extend( Ext.ux.MumbleChannelViewer, Ext.tree.TreePanel, { + autoRefresh: function(){ + this.refresh(); + if( this.refreshInterval > 0 ){ + this.autoRefresh.defer( this.refreshInterval, this ); + } + }, + refresh: function(){ var conn = new Ext.data.Connection(); conn.request({ @@ -56,8 +65,11 @@ Ext.extend( Ext.ux.MumbleChannelViewer, Ext.tree.TreePanel, { text: json.users[i].name, id: ("user_" + json.users[i].id), 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.children.push( child ); } @@ -69,7 +81,11 @@ Ext.extend( Ext.ux.MumbleChannelViewer, Ext.tree.TreePanel, { this.setRootNode( root ); }, failure: function( resp, opt ){ - alert("fail"); + if( this.refreshInterval > 0 ) + if( this.refreshInterval < 300000 ) + this.refreshInterval = 300000; + else + this.refreshInterval = 0; }, }); },