Browse Source

Created a complete Django application wrapping around the Mumble app to make usage for Django inexperienced users easier

Natenom/support-murmur-13-1446181288462
mistagee 15 years ago
parent
commit
f7f7e3c4ff
  1. BIN
      htdocs/grafs/bg.jpg
  2. BIN
      htdocs/grafs/feue3.jpg
  3. BIN
      htdocs/grafs/lin1.jpg
  4. BIN
      htdocs/grafs/lin10.jpg
  5. BIN
      htdocs/grafs/lin11.jpg
  6. BIN
      htdocs/grafs/lin2.jpg
  7. BIN
      htdocs/grafs/lin3.jpg
  8. BIN
      htdocs/grafs/lin4.jpg
  9. BIN
      htdocs/grafs/lin5.jpg
  10. BIN
      htdocs/grafs/lin6.jpg
  11. BIN
      htdocs/grafs/lin7.jpg
  12. BIN
      htdocs/grafs/lin8.jpg
  13. BIN
      htdocs/grafs/lin9.jpg
  14. BIN
      htdocs/grafs/shadow.png
  15. BIN
      htdocs/grafs/srs.gif
  16. 119
      htdocs/layout.css
  17. 9
      mumble-django.wsgi
  18. 0
      pyweb/__init__.py
  19. 11
      pyweb/manage.py
  20. BIN
      pyweb/mumble/templatetags/__init__.pyc
  21. BIN
      pyweb/mumble/templatetags/mumble_extras.pyc
  22. 1
      pyweb/mumble/urls.py
  23. 8
      pyweb/mumble/views.py
  24. 83
      pyweb/settings.py
  25. 31
      pyweb/urls.py
  26. 26
      pyweb/views.py
  27. 34
      template/base.htm
  28. 13
      template/mumble/content.htm
  29. 12
      template/mumble/list.htm
  30. 10
      template/mumble/reg.htm
  31. 20
      template/registration/activate.html
  32. 11
      template/registration/activation_email.txt
  33. 1
      template/registration/activation_email_subject.txt
  34. 28
      template/registration/login.html
  35. 10
      template/registration/logout.html
  36. 38
      template/registration/profile.html
  37. 14
      template/registration/registration_complete.html
  38. 51
      template/registration/registration_form.html

BIN
htdocs/grafs/bg.jpg

After

Width: 140  |  Height: 1000  |  Size: 24 KiB

BIN
htdocs/grafs/feue3.jpg

After

Width: 445  |  Height: 465  |  Size: 49 KiB

BIN
htdocs/grafs/lin1.jpg

After

Width: 445  |  Height: 44  |  Size: 6.6 KiB

BIN
htdocs/grafs/lin10.jpg

After

Width: 445  |  Height: 163  |  Size: 2.0 KiB

BIN
htdocs/grafs/lin11.jpg

After

Width: 445  |  Height: 14  |  Size: 1.0 KiB

BIN
htdocs/grafs/lin2.jpg

After

Width: 445  |  Height: 50  |  Size: 7.5 KiB

BIN
htdocs/grafs/lin3.jpg

After

Width: 445  |  Height: 42  |  Size: 7.9 KiB

BIN
htdocs/grafs/lin4.jpg

After

Width: 445  |  Height: 22  |  Size: 5.2 KiB

BIN
htdocs/grafs/lin5.jpg

After

Width: 445  |  Height: 22  |  Size: 3.1 KiB

BIN
htdocs/grafs/lin6.jpg

After

Width: 445  |  Height: 43  |  Size: 7.9 KiB

BIN
htdocs/grafs/lin7.jpg

After

Width: 445  |  Height: 43  |  Size: 7.9 KiB

BIN
htdocs/grafs/lin8.jpg

After

Width: 445  |  Height: 41  |  Size: 6.6 KiB

BIN
htdocs/grafs/lin9.jpg

After

Width: 445  |  Height: 24  |  Size: 5.5 KiB

BIN
htdocs/grafs/shadow.png

After

Width: 250  |  Height: 175  |  Size: 4.5 KiB

BIN
htdocs/grafs/srs.gif

After

Width: 80  |  Height: 80  |  Size: 935 B

119
htdocs/layout.css

@ -0,0 +1,119 @@
body {
font-family: "Trebuchet MS, Verdana, Arial";
font-size: 9pt;
background-image: url(/static/grafs/bg.jpg);
margin: 0px;
background-attachment: fixed;
background-position: 0px 0px;
}
#mm {
background: url(/static/grafs/lin10.jpg);
background-repeat: repeat-y;
/* Im naechsten stand mal Center, FireFox verpeilt dann aber die Linien... */
background-position: left top;
text-align: left;
margin: 0px auto auto;
width: 444px;
}
#cont {
background-image: url(/static/grafs/lin10.jpg);
background-repeat: repeat-y;
background-position: left top;
min-height: 60%;
width: 444px;
color: #FFFFFF;
text-align: left;
}
.conx {
position: relative;
width: 430px;
left: 7px;
text-align: justify;
}
h1 {
font-size: 14pt;
color: #C60307;
}
img {
border-style: none;
}
a.navi:link, a.navi:visited, a.navi:active, a.navi:hover {
font-weight: bold;
font-family: "Trebuchet MS";
font-size: 9pt;
color: #283E53;
text-decoration: none;
}
a:link, a:visited, a:hover, a:active {
font-weight: normal;
font-family: "Trebuchet MS";
font-size: 9pt;
color: #FFFFFF;
text-decoration: underline;
}
a.navi:hover, a:hover {
color: #A31313;
}
.navibg {
background:url(/static/grafs/lin5.jpg);
width:444px;
height:22px;
}
.navipos {
font-weight: bold;
color: #283E53;
width: 430px;
position: relative;
height: 18px;
top: 3px;
text-align: right;
left: 9px;
}
.footerbg {
background:url(/static/grafs/lin11.jpg);
width:444px;
height:14px;
text-align:center
}
.footer {
font-size: 7pt;
color: #283E53;
}
/* shamelessly stolen from http://jquery.bassistance.de/tooltip/demo/ */
#tooltip.pretty {
font-family: Arial;
border: none;
width: 210px;
padding:20px;
height: 135px;
opacity: 0.8;
background: url('/static/grafs/shadow.png');
}
#tooltip.pretty h3 {
margin-bottom: 0.75em;
font-size: 12pt;
width: 220px;
text-align: center;
}
#tooltip.pretty div {
width: 220px;
text-align: left;
}
#tooltip.pretty a {
color: darkblue;
}

9
mumble-django.wsgi

@ -0,0 +1,9 @@
import os, sys
sys.path.append( '/usr/share/mumble-django' )
sys.path.append( '/usr/share/mumble-django/pyweb' )
os.environ['DJANGO_SETTINGS_MODULE'] = 'pyweb.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

0
pyweb/__init__.py

11
pyweb/manage.py

@ -0,0 +1,11 @@
#!/usr/bin/python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
sys.exit(1)
if __name__ == "__main__":
execute_manager(settings)

BIN
pyweb/mumble/templatetags/__init__.pyc

BIN
pyweb/mumble/templatetags/mumble_extras.pyc

1
pyweb/mumble/urls.py

@ -5,4 +5,5 @@ urlpatterns = patterns(
( r'savereg', 'mumble.views.savereg' ),
( r'reg/(?P<server>\d+)', 'mumble.views.register' ),
( r'(?P<server>\d+)', 'mumble.views.show' ),
( r'$', 'mumble.views.mumbles' ),
)

8
pyweb/mumble/views.py

@ -44,6 +44,14 @@ class Storage( object ):
r = None;
def mumbles( request ):
"Displays a list of all configured Mumble servers."
return render_to_response(
'mumble/list.htm',
{ 'MumbleObjects': get_list_or_404( Mumble ) },
context_instance = RequestContext(request)
);
def show( request, server ):
"Displays the channel list for the given Server ID."
srv, o = createChannelList( server );

83
pyweb/settings.py

@ -0,0 +1,83 @@
# Django settings for mumble_django project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = '/tmp/mumble-django.db3' # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'Europe/Berlin'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = '/usr/share/mumble-django/htdocs'
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = ''
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'u-mp185msk#z4%s(do2^5405)y5d!9adbn92)apu_p^qvqh10v'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
)
ROOT_URLCONF = 'pyweb.urls'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
'/home/mistagee/mumble-django/hgrep/template',
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'registration',
'mumble',
)

31
pyweb/urls.py

@ -0,0 +1,31 @@
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
import settings
urlpatterns = patterns('',
# Example:
# (r'^mumble_django/', include('mumble_django.foo.urls')),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^accounts/profile/', 'views.profile' ),
(r'^accounts/', include('registration.urls')),
(r'^mumble/', include('mumble.urls')),
# Uncomment the next line to enable the admin:
(r'^admin/(.*)', admin.site.root),
)
# Development stuff
if settings.DEBUG:
urlpatterns += patterns('',
(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
)

26
pyweb/views.py

@ -0,0 +1,26 @@
from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404
from django.template import RequestContext
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from mumble.models import Mumble, MumbleUser
#from guestbook.models import Entry, Comment
#from forum.models import Post
@login_required
def profile( request ):
userdata = {
"mumbleaccs": MumbleUser.objects.filter( owner = request.user ),
# "gbposts": Entry.objects.filter( author = request.user ).count(),
# "gbcomments": Comment.objects.filter( author = request.user ).count(),
# "forumposts": Post.objects.filter( author = request.user ).count(),
};
return render_to_response(
'registration/profile.html',
userdata,
context_instance = RequestContext(request)
);

34
template/base.htm

@ -0,0 +1,34 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{% block title %}Dingenskirchen{% endblock %}</title>
<link rel="stylesheet" media="screen" type="text/css" href="/static/layout.css" />
<link rel="stylesheet" media="screen" type="text/css" href="/static/mumble/style.css" />
<style type="text/css" media="screen">
{% block modelstyle %}{% endblock %}
</style>
{% block headtags %}{% endblock %}
</head>
<body>
<div id="mm">
<div class="navibg">
<div class="navipos">
.
<a href="/accounts/login/" class="navi">Login</a> .
<a href="/admin/" class="navi">Admin</a> .
<a href="/accounts/profile/" class="navi">Profile</a> .
</div>
</div>
<div id="cont">
<div class="conx" style="min-height:400px">
{% block content %}
<p>No content found :(</p>
{% endblock %}
</div>
</div>
<div class="footerbg">
<div class="footer">template by www.madart25.com</div>
</div>
</div>
</body>
</html>

13
template/mumble/content.htm

@ -57,16 +57,3 @@
</table>
<p><a href="/mumble/reg/{{DBaseObject.id}}" class="dingen">Mumble-Account verwalten</a></p>
</div>
<script type="text/javascript">
$( "span.mumble_player" ).tooltip({
track: false,
delay: 0,
showURL: false,
opacity: 1,
fixPNG: true,
showBody: " - ",
extraClass: "pretty",
top: -15,
left: 5
});
</script>

12
template/mumble/list.htm

@ -0,0 +1,12 @@
{% extends "base.htm" %}
{% load mumble_extras %}
{% block content %}
<div class="rahmen">
<h1>Configured Mumble Servers</h1>
<ul>
{% for mumble in MumbleObjects %}
<li><a href="/mumble/{{mumble.id}}/">{{mumble.name}}</a></li>
{% endfor %}
</ul>
</div>
{% endblock %}

10
template/mumble/reg.htm

@ -1,8 +1,8 @@
{% extends "base.htm" %}
{% block content %}
{% if user.is_authenticated %}
<h2>Mumble-Benutzerdaten festlegen</h2>
<p>Diese Logindaten musst du angeben, um als authentifizierter Benutzer zu Mumble zu verbinden. Gib hier bitte deinen gewünschten Benutzernamen und dein gewünschtes Passwort an.</p>
<h2>Set credentials for Mumble</h2>
<p>Here you can set the credentials that you want to use to login to Mumble.</p>
<form action="/mumble/savereg" method="post">
<input type="hidden" name="id" value="{{Mumble.id}}" />
<table>
@ -11,11 +11,11 @@
<td>{{Mumble.name}}</td>
</tr>
<tr>
<td>Benutzername/Login</td>
<td>Username/Login</td>
<td><input name="username" {% if Reg %}value="{{Reg.name}}"{% endif %} /></td>
</tr>
<tr>
<td>Passwort</td>
<td>Password</td>
<td><input name="password" type="password" /></td>
</tr>
<tr>
@ -24,6 +24,6 @@
</table>
</form>
{% else %}
<p>Dieses Privileg steht nur den Mitgliedern des Hohen Rates zu.</p>
<p>Only registered users can use this feature.</p>
{% endif %}
{% endblock %}

20
template/registration/activate.html

@ -0,0 +1,20 @@
{% extends "base.htm" %}
{% load i18n %}
{% block title %}{% endblock %}
{% block content %}
<h2>Account successfully activated</h2>
{% if account %}
<p>{% with account.username as username %}
Thank you for registering!<br />
From now on, you can login with your username ({{ username }}).
{% endwith %}
</p>
{% else %}
<p>Either the link was invalid, or you didn't activate your account within {{ expiration_days }} days after the registration. Please register again.</p>
{% endif %}
{% endblock %}

11
template/registration/activation_email.txt

@ -0,0 +1,11 @@
{% load i18n %}
Hello,
someone registered to {{ site }} and specified this EMail address. If this is correct, please follow this link to activate the account:
http://{{ site|slice:":-1" }}{% url registration_activate activation_key=activation_key %}
In case you didn't register, please ignore this Mail. The account will be deleted in {{ expiration_days }} days and you will not receive any more mail from us.
Regards,
someone running a mumble-django Site.

1
template/registration/activation_email_subject.txt

@ -0,0 +1 @@
Account verification

28
template/registration/login.html

@ -0,0 +1,28 @@
{% extends "base.htm" %}
{% load i18n %}
{% block title %}Login{% endblock %}
{% block content %}
<h2>Login</h2>
{% if form.errors %}
<p>Username or password don't exist or are not correct. Please try again.</p>
{% endif %}
<form method="post" action=".">
<table>
<tr><td>{{ form.username.label_tag }}</td><td>{{ form.username }}</td></tr>
<tr><td>{{ form.password.label_tag }}</td><td>{{ form.password }}</td></tr>
</table>
<input type="submit" value="login" />
<input type="hidden" name="next" value="{{ next }}" />
</form>
<ul>
<li>No Login? You can <a href="/accounts/register/">sign up!</a></li>
<li>Forgot the password? You can <a href="/accounts/password/reset/">reset it!</a></li>
</ul>
{% endblock %}

10
template/registration/logout.html

@ -0,0 +1,10 @@
{% extends "base.htm" %}
{% load i18n %}
{% block title %}You have been logged out{% endblock %}
{% block content %}
<h2>You have been logged out.</h2>
<p>Thank you for visiting.
</p>
{% endblock %}

38
template/registration/profile.html

@ -0,0 +1,38 @@
{% extends "base.htm" %}
{% load i18n %}
{% block title %}Profil{% endblock %}
{% block content %}
<h2>Profil von {{user|capfirst}}</h2>
<div>
<h4>Statistics</h4>
<ul>
{% if mumbleaccs %}
<li>Mumble Accounts:
<ul>
{% for mm in mumbleaccs %}
<li>
{{ mm.name }} auf <a href="/mumble/{{mm.server.id}}">{{ mm.server.name }}</a><br />
<a href="/mumble/reg/{{mm.server.id}}">Set Password</a>
</li>
{% endfor %}
</ul>
</li>
{% endif %}
</ul>
</div>
<div>
<h4>Account</h4>
<ul>
<li>Full Name: {{ user.first_name }} {{ user.last_name }}</li>
<li>E-Mail Adress: {{ user.email }}</li>
<li>Staff: {% if user.is_staff %} yes <a href="/admin">(admin area)</a> {% else %} no {% endif %}</li>
<li>Sign-up date: {{ user.date_joined }}</li>
<li>Last login: {{ user.last_login }}</li>
<li><a href="/accounts/password/change">Change Password</a></li>
<li><a href="/accounts/logout">Logout</a></li>
</ul>
</div>
{% endblock %}

14
template/registration/registration_complete.html

@ -0,0 +1,14 @@
{% extends "base.htm" %}
{% load i18n %}
{% block title %}Activate account{% endblock %}
{% block content %}
<h2>Activate your account</h2>
<p>Thank you for registering.
{% if verify %}
In order to prohibit misuse, you need to activate your account before you can use it. We sent an EMail with further instructions to the address you specified, please follow the link in that email to activate your account.
{% endif %}
</p>
{% endblock %}

51
template/registration/registration_form.html

@ -0,0 +1,51 @@
{% extends "base.htm" %}
{% load i18n %}
{% block title %}Create Account{% endblock %}
{% block content %}
<h2>Create Account</h2>
<p>Please fill in the following form.</p>
<form method="post" action=".">
{% if form.non_field_errors %}
<div class="errorbox">
<p>Error:</p>
{{ form.non_field_errors }}
</div>
{% endif %}
<dl>
<dt>{{ form.username.label_tag }}<span style="color:red">*</span></dt>
<dd>{{ form.username }}</dd>
{% if form.username.help_text %}<dd>{{ form.username.help_text }}</dd>{% endif %}
{% if form.username.errors %}<dd class="myerrors">{{ form.username.errors }}</dd>{% endif %}
<dt>{{ form.email.label_tag }}<span style="color:red">*</span></dt>
<dd>{{ form.email }}</dd>
{% if form.email.help_text %}<dd>{{ form.email.help_text }}</dd>{% endif %}
{% if form.email.errors %}<dd class="myerrors">{{ form.email.errors }}</dd>{% endif %}
<dt>{{ form.first_name.label_tag }}<span style="color:red">*</span></dt>
<dd>{{ form.first_name }}</dd>
{% if form.first_name.help_text %}<dd>{{ form.first_name.help_text }}</dd>{% endif %}
{% if form.first_name.errors %}<dd class="myerrors">{{ form.first_name.errors }}</dd>{% endif %}
<dt>{{ form.last_name.label_tag }}<span style="color:red">*</span></dt>
<dd>{{ form.last_name }}</dd>
{% if form.last_name.help_text %}<dd>{{ form.last_name.help_text }}</dd>{% endif %}
{% if form.last_name.errors %}<dd class="myerrors">{{ form.last_name.errors }}</dd>{% endif %}
<dt>{{ form.password1.label_tag }}<span style="color:red">*</span></dt>
<dd>{{ form.password1 }}</dd>
{% if form.password1.help_text %}<dd>{{ form.password1.help_text }}</dd>{% endif %}
{% if form.password1.errors %}<dd class="myerrors">{{ form.password1.errors }}</dd>{% endif %}
<dt>{{ form.password2.label_tag }}<span style="color:red">*</span></dt>
<dd>{{ form.password2 }}</dd>
{% if form.password2.help_text %}<dd>{{ form.password2.help_text }}</dd>{% endif %}
{% if form.password2.errors %}<dd class="myerrors">{{ form.password2.errors }}</dd>{% endif %}
</dl>
<input type="submit" value="{% trans "Create Account" %}" />
</form>
{% endblock %}
Loading…
Cancel
Save