From db20ed3895c0c083ba74fab422fd3863be01b2d8 Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Mon, 2 Aug 2010 20:11:04 +0200 Subject: [PATCH] Extify the server list, resize the main panels when the size of the browser window changes --- pyweb/mumble/templates/mumble/list.html | 117 ++++++++++++++++++---- pyweb/mumble/templates/mumble/mumble.html | 51 ++++++++-- pyweb/mumble/views.py | 20 ++++ 3 files changed, 161 insertions(+), 27 deletions(-) diff --git a/pyweb/mumble/templates/mumble/list.html b/pyweb/mumble/templates/mumble/list.html index b82bd74..634a227 100644 --- a/pyweb/mumble/templates/mumble/list.html +++ b/pyweb/mumble/templates/mumble/list.html @@ -1,24 +1,105 @@ {% extends "index.html" %} {% comment %} - + {% endcomment %} -{% load i18n %} {% load mumble_extras %} -{% block Headline %} -Configured Mumble Servers +{% load i18n %} +{% block body %} {% endblock %} -{% block Content %} -
- -
+{% block HeadTag %} + + + + + + {% endblock %} diff --git a/pyweb/mumble/templates/mumble/mumble.html b/pyweb/mumble/templates/mumble/mumble.html index d348f78..41ae685 100644 --- a/pyweb/mumble/templates/mumble/mumble.html +++ b/pyweb/mumble/templates/mumble/mumble.html @@ -4,7 +4,8 @@ {% endcomment %} {% load mumble_extras %} {% load i18n %} -{% block body %}{% endblock %} +{% block body %} +{% endblock %} {% block HeadTag %} @@ -17,24 +18,32 @@ + {% endblock %} diff --git a/pyweb/mumble/views.py b/pyweb/mumble/views.py index f5f153d..2f0f657 100644 --- a/pyweb/mumble/views.py +++ b/pyweb/mumble/views.py @@ -107,6 +107,26 @@ def mumbles( request, mobile=False ): context_instance = RequestContext(request) ) +@EXT_DIRECT_PROVIDER.register_method( "MumbleList" ) +def servers( request ): + mms = Mumble.objects.all().order_by( "name" ).values( "id", "name" ) + + return [{ 'id': mm['id'], 'name': mm['name'] } for mm in mms] + +@EXT_DIRECT_PROVIDER.register_method( "MumbleList" ) +def serverinfo( request, server ): + srv = Mumble.objects.get( id=int(server) ) + return { + 'id': srv.id, + 'name': srv.name, + 'motd': srv.motd, + 'connurl': srv.connecturl, + 'version': srv.prettyversion + } + +@EXT_DIRECT_PROVIDER.register_method( "MumbleList" ) +def serverurl( request, server ): + return reverse( show, args=(int(server),) ); def show( request, server ): """ Display the channel list for the given Server ID.