Browse Source

disable the texture stuff for Murmur 1.2.2, and remove the 600x60 hint for >=1.2.3.

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
0b6acafc09
  1. 8
      pyweb/mumble/templates/mumble/mumble.html
  2. 21
      pyweb/mumble/templatetags/mumble_extras.py

8
pyweb/mumble/templates/mumble/mumble.html

@ -62,6 +62,11 @@
{% if Registered %}
<div id="mumble_texture" class="mumble-ext">
<h2>{% trans "User Texture" %}</h2>
{% if DBaseObject|mmversion_eq:"1.2.2" %}
{% blocktrans %}
Sorry, due to a bug in Murmur 1.2.2, displaying and setting the Texture is disabled.
{% endblocktrans %}
{% else %}
<p>
{% blocktrans with DBaseObject.id as serverid %}
You can upload an image that you would like to use as your user texture here.
@ -74,10 +79,12 @@
{% trans "You don't currently have a texture set" %}.<br />
{% endif %}
<br />
{% if DBaseObject|mmversion_lt:"1.2.3" %}
{% blocktrans with DBaseObject.id as serverid %}
Hint: The texture image <b>needs</b> to be 600x60 in size. If you upload an image with
a different size, it will be resized accordingly.<br />
{% endblocktrans %}
{% endif %}
</p>
<form action="{% url mumble.views.show DBaseObject.id %}" method="post" enctype="multipart/form-data">
<table>
@ -86,6 +93,7 @@
<input type="hidden" name="mode" value="texture" />
<input type="submit" />
</form>
{% endif %}
</div>
{% endif %}

21
pyweb/mumble/templatetags/mumble_extras.py

@ -22,17 +22,17 @@ from django.conf import settings
register = template.Library();
### FILTER: trunc -- converts "a very very extaordinary long text" to "a very very extra..."
@register.filter
def trunc( string, maxlen = 50 ):
""" converts "a very very extaordinary long text" to "a very very extra... """
if len(string) < maxlen:
return string;
return string[:(maxlen - 3)] + "...";
### FILTER: chanview -- renders an mmChannel / mmPlayer object with the correct template.
@register.filter
def chanview( obj, user = None ):
""" renders an mmChannel / mmPlayer object with the correct template """
if obj.is_server:
return render_to_string( 'mumble/server.html', { 'Server': obj, 'MumbleAccount': user, 'MEDIA_URL': settings.MEDIA_URL } );
elif obj.is_channel:
@ -41,7 +41,22 @@ def chanview( obj, user = None ):
return render_to_string( 'mumble/player.html', { 'Player': obj, 'MumbleAccount': user, 'MEDIA_URL': settings.MEDIA_URL } );
### FILTER: chanurl -- creates a connection URL and takes the user's login into account
@register.filter
def chanurl( obj, user ):
""" create a connection URL and takes the user's login into account """
return obj.getURL( user );
@register.filter
def mmversion_lt( obj, version ):
""" return True if the given Server's version is less than the given version. """
return tuple(obj.version[:3]) < tuple([int(v) for v in version.split('.')])
@register.filter
def mmversion_eq( obj, version ):
""" return True if the given Server's version equals the given version. """
return tuple(obj.version[:3]) == tuple([int(v) for v in version.split('.')])
@register.filter
def mmversion_gt( obj, version ):
""" return True if the given Server's version is greater than the given version. """
return tuple(obj.version[:3]) > tuple([int(v) for v in version.split('.')])
Loading…
Cancel
Save