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. 12
      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. """ This file is part of the mumble-django application.
Copyright (C) 2009, Michael "Svedrin" Ziegler <diese-addy@funzt-halt.net> Copyright (C) 2009, Michael "Svedrin" Ziegler <diese-addy@funzt-halt.net>
@ -116,7 +117,7 @@ class mmServer( object ):
class mmChannel( object ): class mmChannel( object ):
# channels = list(); # channels = list();
# subchans = list(); # subchans = list();
# id = int();
# chanid = int();
# name = str(); # name = str();
# parent = mmChannel(); # parent = mmChannel();
# linked = list(); # linked = list();
@ -127,7 +128,7 @@ class mmChannel( object ):
self.subchans = list(); self.subchans = list();
self.linked = list(); self.linked = list();
(self.id, self.name, parent, self.linkedIDs ) = channelObj;
(self.chanid, self.name, parent, self.linkedIDs ) = channelObj;
self.parent = parentChan; self.parent = parentChan;
if self.parent is not None: 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 ] ), lambda self: len( self.players ) + sum( [ chan.playerCount for chan in self.subchans ] ),
None None
); );
id = property( lambda self: "channel_%d"%self.chanid, None );
def __str__( self ): 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 ): def visit( self, callback, lvl = 0 ):
# call callback on myself, then visit my subchans, then my players # call callback on myself, then visit my subchans, then my players
@ -210,10 +212,8 @@ class mmPlayer( object ):
return True; return True;
# kept for compatibility to mmChannel (useful for traversal funcs) # 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 ): def visit( self, callback, lvl = 0 ):
callback( self, lvl ); callback( self, lvl );

12
template/mumble/content.htm

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

38
template/mumble/mumble.htm

@ -27,6 +27,12 @@
</div> </div>
{% else %} {% else %}
<p>You need to be <a href="/accounts/login">logged in</a> to be able to register an account.</p> <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 %} {% endif %}
{% if CurrentUserIsAdmin %} {% if CurrentUserIsAdmin %}
@ -45,6 +51,20 @@
</noscript> </noscript>
{% endif %} {% 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 %} {% endblock %}
{% block HeadTag %} {% block HeadTag %}
@ -57,10 +77,12 @@
var cardpanel = new Ext.Panel({ var cardpanel = new Ext.Panel({
renderTo: 'col3_content', renderTo: 'col3_content',
layout: 'card', layout: 'card',
id: 'mumble_container',
height: 400, height: 400,
activeItem: 0, activeItem: 0,
border: false, border: false,
items: [ { items: [ {
id: 'mumble_tabpanel',
xtype: 'tabpanel', xtype: 'tabpanel',
defaults: { autoheight: true }, defaults: { autoheight: true },
activeTab: {{ DisplayTab }}, activeTab: {{ DisplayTab }},
@ -68,9 +90,23 @@
{ contentEl: 'mumble_registration', title: 'Registration' }, { contentEl: 'mumble_registration', title: 'Registration' },
{ contentEl: 'mumble_admin', title: 'Administration' }, { 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> </script>
{% endif %} {% endif %}

Loading…
Cancel
Save