Browse Source
implement rendering the server overview in JS to allow dynamically rendering it in the server list
Natenom/support-murmur-13-1446181288462
implement rendering the server overview in JS to allow dynamically rendering it in the server list
Natenom/support-murmur-13-1446181288462
Michael Ziegler
15 years ago
5 changed files with 58 additions and 22 deletions
-
32htdocs/js/rendermumbleserver.js
-
4pyweb/mumble/models.py
-
10pyweb/mumble/templates/mumble/list.html
-
9pyweb/mumble/templates/mumble/mumble.html
-
13pyweb/mumble/views.py
@ -0,0 +1,32 @@ |
|||
function renderserverinfos( server ){ |
|||
var buf = []; |
|||
if( server.connecturl ){ |
|||
buf.push( String.format( '{0}: <a href="{1}">{1}</a>', gettext("Server Address"), server.connecturl ) ); |
|||
} |
|||
if( server.url ){ |
|||
buf.push( String.format( '{0}: {1}', gettext("Website"), server.url ) ); |
|||
} |
|||
buf.push( interpolate( "This server is running Murmur version %s.", [server.prettyversion] ) ); |
|||
buf.push( interpolate( |
|||
ngettext( "Currently, %s user is registered.", "Currently, %s users are registered.", server.users_regged ), |
|||
[server.users_regged] ) ); |
|||
buf.push( interpolate( |
|||
ngettext( "Currently, %s user is online.", "Currently, %s users are online.", server.users_online ), |
|||
[server.users_online] ) ); |
|||
buf.push( interpolate( |
|||
ngettext( "Currently, there is %s channel.", "Currently, there are %s channels.", server.channel_cnt ), |
|||
[server.channel_cnt] ) ); |
|||
if( server.uptime ){ |
|||
buf.push( interpolate( "This server is running since %s.", [server.upsince] ) ); |
|||
} |
|||
buf.push( String.format( '<a href="{0}">{1}</a>', server.minurl, gettext( "Switch to minimal view" ) ) ); |
|||
|
|||
res = ['<div class="mumble-ext" id="serverstuffz">', '<ul>']; |
|||
for( var i = 0; i < buf.length; i++ ) |
|||
res.push( '<li>'+buf[i]+'</li>' ); |
|||
res.push( '</ul><br /><br />' ); |
|||
res.push( String.format( '<b>{0}:</b><br />', gettext("Welcome message") ) ); |
|||
res.push( String.format( '<div style="padding: 10px">{0}</div>', server.motd ) ); |
|||
res.push( '</div>' ); |
|||
return res.join(''); |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue