Browse Source

display user status icons

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
2129fc6db3
  1. 26
      htdocs/js/channelviewer.js

26
htdocs/js/channelviewer.js

@ -2,6 +2,28 @@
Ext.namespace('Ext.ux'); Ext.namespace('Ext.ux');
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( '<img style="position: absolute; top: 0px; right: {pos}px;" src="/static/mumble/{icon}.png"/>' );
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} );
pos += 18
}
}
});
Ext.ux.MumbleChannelViewer = function( config ){ Ext.ux.MumbleChannelViewer = function( config ){
Ext.apply( this, config ); Ext.apply( this, config );
@ -28,7 +50,7 @@ Ext.extend( Ext.ux.MumbleChannelViewer, Ext.tree.TreePanel, {
autoRefresh: function(){ autoRefresh: function(){
this.refresh(); this.refresh();
if( this.refreshInterval > 0 ){ if( this.refreshInterval > 0 ){
this.autoRefresh.defer( this.refreshInterval, this );
//this.autoRefresh.defer( this.refreshInterval, this );
} }
}, },
@ -65,6 +87,8 @@ 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,
uiProvider: Ext.ux.MumbleUserNodeUI,
userdata: json.users[i]
}; };
if( json.users[i].idlesecs == 0 ) if( json.users[i].idlesecs == 0 )
child.icon = '/static/mumble/talking_on.png'; child.icon = '/static/mumble/talking_on.png';

Loading…
Cancel
Save