Browse Source

add version info to the mumble app, and display the current and newest available version on the imprint page.

Natenom/support-murmur-13-1446181288462
Michael Ziegler 14 years ago
parent
commit
bc13f136f0
  1. 30
      pyweb/mumble/__init__.py
  2. 4
      pyweb/processors.py
  3. 1
      pyweb/settings.py
  4. 2
      pyweb/templates/index.html
  5. 2
      pyweb/templates/mobile_index.html
  6. 14
      pyweb/templates/registration/imprint.html
  7. 2
      pyweb/views.py

30
pyweb/mumble/__init__.py

@ -12,3 +12,33 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
"""
version = { 'major': 2, 'minor': 2, 'beta': None }
if version['beta']:
version_str = "v%(major)d.%(minor)dbeta%(beta)d" % version
else:
version_str = "v%(major)d.%(minor)d" % version
def getVersions():
""" Generator that yields all available upstream versions. """
url = 'http://bitbucket.org/Svedrin/mumble-django/raw/tip/.hgtags'
from urllib2 import urlopen
webtags = urlopen(url)
try:
while True:
line = webtags.readline().strip()
if not line:
raise StopIteration
_, version = line.split(' ')
yield version
finally:
webtags.close()
def getLatestUpstreamVersion():
""" Return the latest version available upstream. """
return max(getVersions())
def isUptodate():
""" Check if this version of Mumble-Django is the latest available. """
return version_str >= getLatestUpstreamVersion()

4
pyweb/processors.py

@ -17,3 +17,7 @@
def installed_apps(request):
from django.conf import settings
return { 'ROSETTA_INSTALLED': "rosetta" in settings.INSTALLED_APPS }
def mumble_version(request):
from mumble import version_str
return { 'CURRENTVERSION': version_str }

1
pyweb/settings.py

@ -206,6 +206,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
"django.core.context_processors.i18n",
"django.core.context_processors.media",
'processors.installed_apps',
'processors.mumble_version',
)
TEST_RUNNER = 'mumble.testrunner.run_tests'

2
pyweb/templates/index.html

@ -67,7 +67,7 @@
</div>
<!-- footer -->
<div id="footerpanel">
You are using <a href="http://bitbucket.org/Svedrin/mumble-django" target="_blank">Mumble-Django</a> --
You are using <a href="http://bitbucket.org/Svedrin/mumble-django" target="_blank">Mumble-Django {{ CURRENTVERSION }}</a> --
interface built using <a href="http://extjs.com/" target="_blank">ExtJS</a>
</div>
</div>

2
pyweb/templates/mobile_index.html

@ -26,7 +26,7 @@
<div id="footerpanel" style="color:white">
<ul>
<li><a href="{% url mumble.views.redir %}" style="color:white">Home</a></li>
<li><a href="http://bitbucket.org/Svedrin/mumble-django" style="color:white" target="_blank">Mumble-Django</a></li>
<li><a href="http://bitbucket.org/Svedrin/mumble-django" style="color:white" target="_blank">Mumble-Django {{ CURRENTVERSION }}</a></li>
</ul>
</div>
</body>

14
pyweb/templates/registration/imprint.html

@ -11,8 +11,18 @@
<br />
Furthermore, registered Django users can sign up for user accounts on the configured vservers and change their registration names and passwords, and Django admins can manage server admins through the webinterface.<br />
<br />
It is being developed by Michael "Svedrin" Ziegler.
It is being developed by Michael "Svedrin" Ziegler. See the attached AUTHORS and COPYRIGHT files for details.<br />
<br />
</p>
<p>
<table>
<caption>Version information</caption>
<tr><th>Running version</th><td>{{ CURRENTVERSION }}</td></tr>
<tr><th>Newest available version</th><td>{{ upstreamversion }}</td></tr>
</table><br />
</p>
<p>
All JavaScript elements were implemented using <a href="http://www.extjs.com/" target="_blank">the ExtJS JavaScript library.</a>
</p>
<p>All JavaScript elements were implemented using <a href="http://www.extjs.com/" target="_blank">the ExtJS JavaScript library.</a></p>
</div>
{% endblock %}

2
pyweb/views.py

@ -35,6 +35,8 @@ def profile( request ):
def imprint( request ):
import mumble
return render_to_response(
'registration/imprint.html',
{ 'upstreamversion': mumble.getLatestUpstreamVersion() },
context_instance = RequestContext(request) );
Loading…
Cancel
Save