diff --git a/pyweb/mumble/templates/mumble/mumble.html b/pyweb/mumble/templates/mumble/mumble.html index bfd03de..c6a2bdc 100644 --- a/pyweb/mumble/templates/mumble/mumble.html +++ b/pyweb/mumble/templates/mumble/mumble.html @@ -62,30 +62,38 @@ {% if Registered %}

{% trans "User Texture" %}

-

- {% blocktrans with DBaseObject.id as serverid %} - You can upload an image that you would like to use as your user texture here. - {% endblocktrans %}
-
- {% if MumbleAccount.hasTexture %} - {% trans "Your current texture is" %}:
- user texture
- {% else %} - {% trans "You don't currently have a texture set" %}.
- {% endif %} -
- {% blocktrans with DBaseObject.id as serverid %} - Hint: The texture image needs to be 600x60 in size. If you upload an image with - a different size, it will be resized accordingly.
+ {% 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 %} -

-
- - {{ TextureForm }} -
- - -
+ {% else %} +

+ {% blocktrans with DBaseObject.id as serverid %} + You can upload an image that you would like to use as your user texture here. + {% endblocktrans %}
+
+ {% if MumbleAccount.hasTexture %} + {% trans "Your current texture is" %}:
+ user texture
+ {% else %} + {% trans "You don't currently have a texture set" %}.
+ {% endif %} +
+ {% if DBaseObject|mmversion_lt:"1.2.3" %} + {% blocktrans with DBaseObject.id as serverid %} + Hint: The texture image needs to be 600x60 in size. If you upload an image with + a different size, it will be resized accordingly.
+ {% endblocktrans %} + {% endif %} +

+
+ + {{ TextureForm }} +
+ + +
+ {% endif %}
{% endif %} diff --git a/pyweb/mumble/templatetags/mumble_extras.py b/pyweb/mumble/templatetags/mumble_extras.py index ae67b6e..b4fe7b9 100644 --- a/pyweb/mumble/templatetags/mumble_extras.py +++ b/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('.')])