Browse Source

only display connect URLs if a sensible address is known

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
97baf5cc60
  1. 2
      pyweb/mumble/models.py
  2. 6
      pyweb/mumble/templates/mumble/channel.html
  3. 2
      pyweb/mumble/templates/mumble/mumble.html

2
pyweb/mumble/models.py

@ -414,6 +414,8 @@ class Mumble( models.Model ):
def getURL( self, forUser = None ): def getURL( self, forUser = None ):
""" Create an URL of the form mumble://username@host:port/ for this server. """ """ Create an URL of the form mumble://username@host:port/ for this server. """
if not self.netloc:
return None
from urlparse import urlunsplit from urlparse import urlunsplit
versionstr = "version=%d.%d.%d" % tuple(self.version[:3]); versionstr = "version=%d.%d.%d" % tuple(self.version[:3]);
if forUser is not None: if forUser is not None:

6
pyweb/mumble/templates/mumble/channel.html

@ -6,9 +6,15 @@
{% else %} {% else %}
<img src="{{ MEDIA_URL }}/mumble/channel.png" alt="channel" /> <img src="{{ MEDIA_URL }}/mumble/channel.png" alt="channel" />
{% endif %} {% endif %}
{% if Channel.server.netloc %}
<a href="{{ Channel|chanurl:MumbleAccount }}" class="mumble" id="link_{{ Channel.id }}" title="{{ Channel.name }}"> <a href="{{ Channel|chanurl:MumbleAccount }}" class="mumble" id="link_{{ Channel.id }}" title="{{ Channel.name }}">
{{ Channel.name|trunc:30 }} {{ Channel.name|trunc:30 }}
</a> </a>
{% else %}
<a class="mumble" id="link_{{ Channel.id }}" title="{{ Channel.name }}">
{{ Channel.name|trunc:30 }}
</a>
{% endif %}
{% for sub in Channel.subchans %} {% for sub in Channel.subchans %}
{% if sub.show %} {% if sub.show %}
{{ sub|chanview:MumbleAccount }} {{ sub|chanview:MumbleAccount }}

2
pyweb/mumble/templates/mumble/mumble.html

@ -21,7 +21,9 @@
<div id="mumble_ext_container"></div> <div id="mumble_ext_container"></div>
<div id="mumble_motd" class="mumble-ext x-hide-display"> <div id="mumble_motd" class="mumble-ext x-hide-display">
<ul> <ul>
{% if DBaseObject.connecturl %}
<li>{% trans "Server Address" %}: <a href="{{ DBaseObject.connecturl }}">{{ DBaseObject.connecturl }}</a></li> <li>{% trans "Server Address" %}: <a href="{{ DBaseObject.connecturl }}">{{ DBaseObject.connecturl }}</a></li>
{% endif %}
{% if DBaseObject.url %} {% if DBaseObject.url %}
<li>{% trans "Website" %}: {{ DBaseObject.url|urlize }}</li> <li>{% trans "Website" %}: {{ DBaseObject.url|urlize }}</li>
{% endif %} {% endif %}

Loading…
Cancel
Save