Browse Source

implemented detail views

Natenom/support-murmur-13-1446181288462
Michael Ziegler 16 years ago
parent
commit
c3b8da0561
  1. 14
      pyweb/mumble/mmobjects.py
  2. 34
      template/mumble/content.htm
  3. 38
      template/mumble/mumble.htm

14
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 <diese-addy@funzt-halt.net>
@ -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 '<Channel "%s" (%d)>' % ( self.name, self.id );
return '<Channel "%s" (%d)>' % ( 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 );

34
template/mumble/content.htm

@ -1,24 +1,24 @@
{% load mumble_extras %}
<div class="mumble">
<table cellspacing="0" cellpadding="0" style="width:100%; border:none">
<tr>
<td class="mumble">
<img src="/static/mumble/mumble.16x16.png" alt="mumble" />
{{ ServerObject.rootName }}
</td>
<td class="mumble"> </td>
</tr>
{% for item in ChannelTable %}
<tr>
<td class="mumble mm-left" {% if item.1.is_player %} id="{{ mm_item.1.userid }}" {% endif %}>
<td class="mumble" id="server">
<img src="/static/mumble/mumble.16x16.png" alt="mumble" />
<a href="mumble://{% if mumbleAccount %}{{ mumbleAccount.name }}@{% endif %}{{ DBaseObject.addr }}/" class="dingen" id="link_server">
{{ ServerObject.rootName }}
</a>
</td>
<td class="mumble"> </td>
</tr>
{% for item in ChannelTable %}
<tr>
<td class="mumble mm-left" id="{{ item.1.id }}">
<span {% spaceless %}
{% if item.1.is_channel %}
class="mumble_channel"
{% else %}
{% if item.1.is_player %}
{% if item.1.is_channel %}
class="mumble_channel"
{% else %}
class="mumble_player"
{% endif %}
{% endif %}
{% endspaceless %} title="{{ item.1.name }}">
{% spaceless %}
{% for num in item.0|mrange %}
@ -26,7 +26,7 @@
{% endfor %}
<img src="/static/mumble/knoten_v_trans.png" alt="+-" />
{% endspaceless %}
{% if item.1.userid %}
{% if item.1.is_player %}
<img src="/static/mumble/talking_off.png" alt="player" />
{{ item.1.name }}
{% else %}
@ -35,7 +35,7 @@
{% else %}
<img src="/static/mumble/channel.png" alt="channel"/>
{% endif %}
<a href="mumble://{% if mumbleAccount %}{{ mumbleAccount.name }}@{% endif %}{{ DBaseObject.addr }}/{% for chan in item.2 %}{{ chan|urlencode }}/{% endfor %}{{ item.1.name|urlencode }}" class="dingen">{{ item.1.name }}</a>
<a href="mumble://{% if mumbleAccount %}{{ mumbleAccount.name }}@{% endif %}{{ DBaseObject.addr }}/{% for chan in item.2 %}{{ chan|urlencode }}/{% endfor %}{{ item.1.name|urlencode }}" class="dingen" id="link_{{ item.1.id }}">{{ item.1.name }}</a>
{% endif %}
</span>
</td>
@ -59,6 +59,6 @@
{% endif %}
</td>
</tr>
{% endfor %}
{% endfor %}
</table>
</div>

38
template/mumble/mumble.htm

@ -27,6 +27,12 @@
</div>
{% else %}
<p>You need to be <a href="/accounts/login">logged in</a> to be able to register an account.</p>
<noscript>
<p>
This area is used to display additional information for each channel and player, but requires JavaScript to be
enabled in order to work correctly.
</p>
</noscript>
{% endif %}
{% if CurrentUserIsAdmin %}
@ -45,6 +51,20 @@
</noscript>
{% endif %}
{% for item in ChannelTable %}
{% if item.1.is_player %}
<div id="mumble_{{ item.1.id }}" class="x-hide-display">
Player {{ item.1.name }}
Online since {{item.1.onlinesince|time:"H:i"}}<br />
<a href="/accounts/profiles/{{item.1.mumbleuser.owner.id}}">{{item.1.mumbleuser.owner}}</a>
</div>
{% else %}
<div id="mumble_{{ item.1.id }}" class="x-hide-display">
Channel {{ item.1.name }}<br />
<a href="mumble://{% if mumbleAccount %}{{ mumbleAccount.name }}@{% endif %}{{ DBaseObject.addr }}/{% for chan in item.2 %}{{ chan|urlencode }}/{% endfor %}{{ item.1.name|urlencode }}" class="dingen">Connect</a>
</div>
{% 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 %}
} );
</script>
{% endif %}

Loading…
Cancel
Save