From c3b8da05612f8f4dc5bc197aaa23e5d6d7922ae9 Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Sat, 18 Apr 2009 14:04:04 +0200 Subject: [PATCH] implemented detail views --- pyweb/mumble/mmobjects.py | 14 +++++++------- template/mumble/content.htm | 34 ++++++++++++++++----------------- template/mumble/mumble.htm | 38 ++++++++++++++++++++++++++++++++++++- 3 files changed, 61 insertions(+), 25 deletions(-) diff --git a/pyweb/mumble/mmobjects.py b/pyweb/mumble/mmobjects.py index 947fb9c..e8e4b62 100644 --- a/pyweb/mumble/mmobjects.py +++ b/pyweb/mumble/mmobjects.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """ This file is part of the mumble-django application. Copyright (C) 2009, Michael "Svedrin" Ziegler @@ -116,7 +117,7 @@ class mmServer( object ): class mmChannel( object ): # channels = list(); # subchans = list(); - # id = int(); + # chanid = int(); # name = str(); # parent = mmChannel(); # linked = list(); @@ -127,7 +128,7 @@ class mmChannel( object ): self.subchans = list(); self.linked = list(); - (self.id, self.name, parent, self.linkedIDs ) = channelObj; + (self.chanid, self.name, parent, self.linkedIDs ) = channelObj; self.parent = parentChan; if self.parent is not None: @@ -150,9 +151,10 @@ class mmChannel( object ): lambda self: len( self.players ) + sum( [ chan.playerCount for chan in self.subchans ] ), None ); + id = property( lambda self: "channel_%d"%self.chanid, None ); def __str__( self ): - return '' % ( self.name, self.id ); + return '' % ( self.name, self.chanid ); def visit( self, callback, lvl = 0 ): # call callback on myself, then visit my subchans, then my players @@ -210,10 +212,8 @@ class mmPlayer( object ): return True; # kept for compatibility to mmChannel (useful for traversal funcs) - playerCount = property( - lambda self: -1, - None - ); + playerCount = property( lambda self: -1, None ); + id = property( lambda self: "player_%d"%self.id, None ); def visit( self, callback, lvl = 0 ): callback( self, lvl ); diff --git a/template/mumble/content.htm b/template/mumble/content.htm index 9e55f54..2a0f712 100644 --- a/template/mumble/content.htm +++ b/template/mumble/content.htm @@ -1,24 +1,24 @@ {% load mumble_extras %}
- - - - - {% for item in ChannelTable %} - + + + {% for item in ChannelTable %} + + @@ -59,6 +59,6 @@ {% endif %} - {% endfor %} + {% endfor %}
- mumble - {{ ServerObject.rootName }} -
+ + mumble + + {{ ServerObject.rootName }} + +
{% spaceless %} {% for num in item.0|mrange %} @@ -26,7 +26,7 @@ {% endfor %} +- {% endspaceless %} - {% if item.1.userid %} + {% if item.1.is_player %} player {{ item.1.name }} {% else %} @@ -35,7 +35,7 @@ {% else %} channel {% endif %} - {{ item.1.name }} + {{ item.1.name }} {% endif %}
diff --git a/template/mumble/mumble.htm b/template/mumble/mumble.htm index 8195475..8c5dd84 100644 --- a/template/mumble/mumble.htm +++ b/template/mumble/mumble.htm @@ -27,6 +27,12 @@ {% else %}

You need to be logged in to be able to register an account.

+ {% endif %} {% if CurrentUserIsAdmin %} @@ -45,6 +51,20 @@ {% endif %} + {% for item in ChannelTable %} + {% if item.1.is_player %} +
+ Player {{ item.1.name }} + Online since {{item.1.onlinesince|time:"H:i"}}
+ {{item.1.mumbleuser.owner}} +
+ {% else %} +
+ Channel {{ item.1.name }}
+ Connect +
+ {% endif %} + {% endfor %} {% endblock %} {% block HeadTag %} @@ -57,10 +77,12 @@ var cardpanel = new Ext.Panel({ renderTo: 'col3_content', layout: 'card', + id: 'mumble_container', height: 400, activeItem: 0, border: false, items: [ { + id: 'mumble_tabpanel', xtype: 'tabpanel', defaults: { autoheight: true }, activeTab: {{ DisplayTab }}, @@ -68,9 +90,23 @@ { contentEl: 'mumble_registration', title: 'Registration' }, { contentEl: 'mumble_admin', title: 'Administration' }, ] - } ], + }, + {% for item in ChannelTable %} + { contentEl: 'mumble_{{ item.1.id }}', id: 'carditem_{{ item.1.id }}' }, + {% endfor %} + ], }); + Ext.get( 'link_server' ).on( 'click', function( event, target ){ + cardpanel.layout.setActiveItem( 'mumble_tabpanel' ); + event.preventDefault(); + }); + {% for item in ChannelTable %} + Ext.get( 'link_{{ item.1.id }}' ).on( 'click', function( event, target ){ + cardpanel.layout.setActiveItem( 'carditem_{{ item.1.id }}' ); + event.preventDefault(); + }); + {% endfor %} } ); {% endif %}