From ca3966279b04e62dd0056ac53230927b324be6cc Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Sun, 1 Aug 2010 00:49:06 +0200 Subject: [PATCH] display [c] icon for channels with descriptions; talking := idlesecs <= 2 instead of == 0 --- htdocs/js/channelviewer.js | 44 +++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/htdocs/js/channelviewer.js b/htdocs/js/channelviewer.js index 2a67e34..09dabee 100644 --- a/htdocs/js/channelviewer.js +++ b/htdocs/js/channelviewer.js @@ -2,20 +2,38 @@ Ext.namespace('Ext.ux'); -Ext.ux.MumbleUserNodeUI = Ext.extend(Ext.tree.TreeNodeUI, { +Ext.ux.MumbleChannelNodeUI = Ext.extend(Ext.tree.TreeNodeUI, { renderElements : function(n, a, targetNode, bulkRender){ Ext.ux.MumbleUserNodeUI.superclass.renderElements.call( this, n, a, targetNode, bulkRender ); Ext.DomHelper.applyStyles( this.elNode, 'position: relative' ); - var tpl = new Ext.DomHelper.createTemplate( '' ); + var tpl = new Ext.DomHelper.createTemplate( + '' + ); + var icons = [] + if( a.chandata.description != "" ) icons.push( "comment_seen" ); + var pos = 8; + for( var i = 0; i < icons.length; i++ ){ + tpl.append( this.elNode, {'icon': icons[i], 'pos': pos} ); + pos += 18 + } + } +}); - icons = [] - if( a.userdata.userid != 0 ) icons.push( "authenticated" ); - if( a.userdata.selfMute ) icons.push( "muted_self" ); - if( a.userdata.mute ) icons.push( "muted_server" ); - if( a.userdata.suppress ) icons.push( "muted_suppressed" ); - if( a.userdata.selfDeaf ) icons.push( "deafened_self" ); - if( a.userdata.deaf ) icons.push( "deafened_server" ); - if( a.userdata.comment!="" ) icons.push( "comment_seen" ); +Ext.ux.MumbleUserNodeUI = Ext.extend(Ext.tree.TreeNodeUI, { + renderElements : function(n, a, targetNode, bulkRender){ + Ext.ux.MumbleUserNodeUI.superclass.renderElements.call( this, n, a, targetNode, bulkRender ); + Ext.DomHelper.applyStyles( this.elNode, 'position: relative' ); + var tpl = new Ext.DomHelper.createTemplate( + '' + ); + var icons = [] + if( a.userdata.userid != 0 ) icons.push( "authenticated" ); + if( a.userdata.selfMute ) icons.push( "muted_self" ); + if( a.userdata.mute ) icons.push( "muted_server" ); + if( a.userdata.suppress ) icons.push( "muted_suppressed" ); + if( a.userdata.selfDeaf ) icons.push( "deafened_self" ); + if( a.userdata.deaf ) icons.push( "deafened_server" ); + if( a.userdata.comment != "" ) icons.push( "comment_seen" ); var pos = 8; for( var i = 0; i < icons.length; i++ ){ tpl.append( this.elNode, {'icon': icons[i], 'pos': pos} ); @@ -50,7 +68,7 @@ Ext.extend( Ext.ux.MumbleChannelViewer, Ext.tree.TreePanel, { autoRefresh: function(){ this.refresh(); if( this.refreshInterval > 0 ){ - //this.autoRefresh.defer( this.refreshInterval, this ); + this.autoRefresh.defer( this.refreshInterval, this ); } }, @@ -77,6 +95,8 @@ Ext.extend( Ext.ux.MumbleChannelViewer, Ext.tree.TreePanel, { leaf: true, icon: '/static/mumble/channel.png', children: [], + uiProvider: Ext.ux.MumbleChannelNodeUI, + chandata: json.channels[i] }; node.leaf = false; node.children.push( child ); @@ -90,7 +110,7 @@ Ext.extend( Ext.ux.MumbleChannelViewer, Ext.tree.TreePanel, { uiProvider: Ext.ux.MumbleUserNodeUI, userdata: json.users[i] }; - if( json.users[i].idlesecs == 0 ) + if( json.users[i].idlesecs <= 2 ) child.icon = '/static/mumble/talking_on.png'; else child.icon = '/static/mumble/talking_off.png';