diff --git a/htdocs/js/rendermumbleserver.js b/htdocs/js/rendermumbleserver.js
new file mode 100644
index 0000000..fc0f932
--- /dev/null
+++ b/htdocs/js/rendermumbleserver.js
@@ -0,0 +1,32 @@
+function renderserverinfos( server ){
+ var buf = [];
+ if( server.connecturl ){
+ buf.push( String.format( '{0}: {1}', 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( '{1}', server.minurl, gettext( "Switch to minimal view" ) ) );
+
+ res = ['
', '
'];
+ for( var i = 0; i < buf.length; i++ )
+ res.push( '- '+buf[i]+'
' );
+ res.push( '
' );
+ res.push( String.format( '
{0}:', gettext("Welcome message") ) );
+ res.push( String.format( '
{0}
', server.motd ) );
+ res.push( '
' );
+ return res.join('');
+}
diff --git a/pyweb/mumble/models.py b/pyweb/mumble/models.py
index 4a95ac5..e82df86 100644
--- a/pyweb/mumble/models.py
+++ b/pyweb/mumble/models.py
@@ -16,6 +16,8 @@
"""
import re
+import datetime
+from time import time
from sys import stderr
from urllib import urlopen
from StringIO import StringIO
@@ -293,9 +295,11 @@ class Mumble( models.Model ):
users_online = property( lambda self: len(self.ctl.getPlayers(self.srvid)), doc="Number of online users." )
channel_cnt = property( lambda self: len(self.ctl.getChannels(self.srvid)), doc="Number of channels." )
is_public = property( lambda self: not self.passwd,
- doc="False if a password is needed to join this server." )
+ doc="False if a password is needed to join this server." )
uptime = property( lambda self: self.ctl.getUptime(self.srvid),
- doc="Number of seconds this instance has been running." )
+ doc="Number of seconds this instance has been running." )
+ upsince = property( lambda self: datetime.datetime.fromtimestamp( float( time() - self.uptime ) ),
+ doc="Datetime since when the server is running." )
is_server = True
is_channel = False
diff --git a/pyweb/mumble/templates/mumble/list.html b/pyweb/mumble/templates/mumble/list.html
index 634a227..55fafc7 100644
--- a/pyweb/mumble/templates/mumble/list.html
+++ b/pyweb/mumble/templates/mumble/list.html
@@ -9,6 +9,7 @@
{% block HeadTag %}
+
+
@@ -64,13 +65,7 @@
activeTab: 0,
items: [{
title: gettext("Server info"),
- html: String.format(
- "- Serveradresse: {0}
- Version: {1}
"+
- "
",
- "{{ MumbleServer.connecturl }}",
- "{{ MumbleServer.prettyversion }}",
- "{{ MumbleServer.motd }}"
- ),
+ html: renderserverinfos( {{ ServerDict|safe }} ),
}, {
title: gettext("Registration"),
xtype: "{{ RegForm|lower }}",
diff --git a/pyweb/mumble/views.py b/pyweb/mumble/views.py
index 2f0f657..0368e72 100644
--- a/pyweb/mumble/views.py
+++ b/pyweb/mumble/views.py
@@ -116,12 +116,20 @@ def servers( request ):
@EXT_DIRECT_PROVIDER.register_method( "MumbleList" )
def serverinfo( request, server ):
srv = Mumble.objects.get( id=int(server) )
+ # users_regged users_online channel_cnt uptime upsince minurl
return {
- 'id': srv.id,
- 'name': srv.name,
- 'motd': srv.motd,
- 'connurl': srv.connecturl,
- 'version': srv.prettyversion
+ 'id': srv.id,
+ 'name': srv.name,
+ 'motd': srv.motd,
+ 'connecturl': srv.connecturl,
+ 'prettyversion': srv.prettyversion,
+ 'url': srv.url,
+ 'users_regged': srv.users_regged,
+ 'users_online': srv.users_online,
+ 'channel_cnt': srv.channel_cnt,
+ 'uptime': srv.uptime,
+ 'upsince': unicode(srv.upsince),
+ 'minurl': reverse( mobile_show, args=(server,) )
}
@EXT_DIRECT_PROVIDER.register_method( "MumbleList" )
@@ -170,6 +178,7 @@ def show( request, server ):
return render_to_response( 'mumble/mumble.html', {
'MumbleServer': srv,
+ 'ServerDict': simplejson.dumps(serverinfo(request, server)),
'RegForm': regformname,
'MumbleActive': True,
'MumbleAccount':user,