Browse Source

add usersAboveChannels config option to the channel viewer

Natenom/support-murmur-13-1446181288462
Michael Ziegler 13 years ago
parent
commit
47b202c6e3
  1. 13
      pyweb/mumble/media/js/channelviewer.js

13
pyweb/mumble/media/js/channelviewer.js

@ -90,6 +90,7 @@ Ext.ux.MumbleChannelViewer = function( config ){
title: gettext("Channel Viewer"), title: gettext("Channel Viewer"),
refreshInterval: 30000, refreshInterval: 30000,
idleInterval: 2, idleInterval: 2,
usersAboveChannels: false,
autoScroll: true, autoScroll: true,
enableDD: false, // Users need to enable this explicitly enableDD: false, // Users need to enable this explicitly
root: { root: {
@ -200,6 +201,7 @@ Ext.extend( Ext.ux.MumbleChannelViewer, Ext.tree.TreePanel, {
tree = this; tree = this;
function populateNode( node, json ){ function populateNode( node, json ){
var subchan_users = 0; var subchan_users = 0;
var popChannels = function(){
json.channels.sort(cmp_channels); json.channels.sort(cmp_channels);
for( var i = 0; i < json.channels.length; i++ ){ for( var i = 0; i < json.channels.length; i++ ){
var child = { var child = {
@ -218,6 +220,8 @@ Ext.extend( Ext.ux.MumbleChannelViewer, Ext.tree.TreePanel, {
node.children.push( child ); node.children.push( child );
subchan_users += populateNode( child, json.channels[i] ); subchan_users += populateNode( child, json.channels[i] );
} }
}
var popUsers = function(){
json.users.sort(cmp_names); json.users.sort(cmp_names);
for( var i = 0; i < json.users.length; i++ ){ for( var i = 0; i < json.users.length; i++ ){
var child = { var child = {
@ -238,6 +242,15 @@ Ext.extend( Ext.ux.MumbleChannelViewer, Ext.tree.TreePanel, {
node.leaf = false; node.leaf = false;
node.children.push( child ); node.children.push( child );
} }
}
if( tree.usersAboveChannels ){
popUsers();
popChannels();
}
else{
popChannels();
popUsers();
}
if( json.id == 0 || json.users.length > 0 || subchan_users ) if( json.id == 0 || json.users.length > 0 || subchan_users )
node.expanded = true; node.expanded = true;
return subchan_users + json.users.length; return subchan_users + json.users.length;

Loading…
Cancel
Save