Commit 7ba6d389 authored by Florian Fuchs's avatar Florian Fuchs

- added site settings page

- added domain list/add
- modified user nav
parent d270b730
......@@ -28,10 +28,10 @@
</li>
{% if user.is_authenticated %}
<li>
<a class="mm_todos" href="#">Todos</a>
<a class="mm_todos" href="{% url user_todos %}">Todos</a>
</li>
<li>
<a class="mm_settings" href="#">Settings</a>
<a class="mm_settings" href="{% url site_settings %}">Settings</a>
</li>
{% endif %}
<li>
......
{% extends "mailmanweb/base.html" %}
{% load i18n %}
{% block heading %}
{% trans "Domain Index" %}
{% endblock %}
{% block main %}
{% include 'mailmanweb/menu/settings_nav.html' %}
<h1>{% trans "Domain Index" %}</h1>
{% block header %}
<div class="mm_box mm_clear">
<div class="mm_boxHeader">{% trans "About" %}</div>
Register new Domains.
</p>
</div>
{% endblock %}
{% block actionButtonsList %}
<ul class="mm_actionButtons">
<li class="mm_new_domain"><a href="{% url domain_new %}">{% trans "New Domain" %}</a></li>
{% if not domain == "unregistered Domain" %}
<li class="mm_delete_domain">
<a href="#missing_REST_function">{% trans "Delete Domain" %}</br>
{{domain}}
</a>
</li>
{% endif %}
</ul>
{% endblock %}
{% block smallBoxLeft %}
{% for domain in domains %}
<div class="mm_box mm_smallBox {% cycle 'mm_clear' '' %}">
<div class="mm_boxHeader">{{ domain.contact_address }} (<a href="http://{{ domain.base_url }}">{{ domain.base_url }}</a>)</div>
{% if domain.description %}
{{ domain.description }}
{% endif %}
</div>
{% endfor %}
{% endblock %}
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Mail Host</th>
<th>URL Host</th>
<th>Contact Address</th>
<th>Description</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{% for domain in domains %}
<tr>
<td>{{ domain.mail_host }}</td>
<td>{{ domain.url_host }}</td>
<td>{{ domain.contact_address }}</td>
<td>{{ domain.description }}</td>
<td><a href="#" class="btn btn-mini btn-danger">{% trans 'Delete' %}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock main %}
{% extends extend_template %}
{% load i18n %}
{% block heading %}
{% trans "Add a new Domain" %}
{% endblock %}
{% block header %}
<!--<div class="mm_box mm_clear">
<div class="mm_boxHeader">{% trans "New Domain" %}</div> -->
<form action="{% url domain_new %}" method="post" class="newdomain mm_clear">
{{ form.as_div }}
<div class="field">
<button type="submit">{% trans "Create Domain" %}</button>
</div>
</form>
<!--</div>-->
{% endblock %}
{% block main %}
{% include 'mailmanweb/menu/settings_nav.html' %}
<h1>{% trans "Add a new Domain" %}</h1>
<form action="{% url domain_new %}" method="post" class="well">
{{ form.as_p }}
<div class="field">
<button class="btn btn-primary" type="submit">{% trans "Create Domain" %}</button>
</div>
</form>
{% endblock main %}
{% load i18n %}
<ul class="mm_nav">
<li><a href="{% url site_settings %}">{% trans "General" %}</a></li>
<li><a href="{% url domain_index %}">{% trans "Domains" %}</a></li>
<li><a class="btn btn-mini btn-success" href="{% url domain_new %}">{% trans "New Domain" %}</a></li>
</ul>
{% load i18n %}
<ul class="mm_nav">
<li><a href="#">{% trans "Account" %}</a></li>
<li><a href="#">{% trans "Profile" %}</a></li>
<li><a href="#">{% trans "Memberships" %}</a></li>
<li><a href="{% url user_profile %}">{% trans "Profile" %}</a></li>
<li><a href="{% url user_profile %}">{% trans "Account" %}</a></li>
<li><a href="{% url membership_settings %}">{% trans "Memberships" %}</a></li>
</ul>
{% extends extend_template %}
{% load i18n %}
{% block main %}
{% include 'mailmanweb/menu/settings_nav.html' %}
<h1>General Settings</h1>
{% endblock main %}
......@@ -3,6 +3,8 @@
{% block main %}
{% include 'mailmanweb/menu/user_nav.html' %}
<h1>Membership</h1>
{% ifequal tab "membership"%}
{% trans "Membership Settings" %}
{% if list %}<span>{% trans "for"%}{% endif %} {{ list.fqdn_listname }}</span>
......
{% extends extend_template %}
{% load i18n %}
{% block main %}
{% include 'mailmanweb/menu/user_nav.html' %}
<h1>Your Todos</h1>
{% endblock main %}
......@@ -23,12 +23,19 @@ from django.conf.urls.static import static
urlpatterns = patterns('mailmanweb.views',
(r'^$', 'user_profile'),
# /account/
url(r'^accounts/login/$', 'user_login', name='user_login'),
url(r'^accounts/logout/$', 'user_logout', name='user_logout'),
url(r'^accounts/profile/$', 'user_profile', name='user_profile'),
url(r'^administration/$', 'administration', name='administration'),
url(r'^domains/$', 'domain_index', name='domain_index'),
url(r'^domains/new/$', 'domain_new', name='domain_new'),
url(r'^accounts/todos/$', 'user_todos', name='user_todos'),
url(r'^accounts/membership/(?:(?P<fqdn_listname>[^/]+)/)?$',
'user_settings', kwargs={"tab": "membership"},
name='membership_settings'),
# /settings/
url(r'^settings/$', 'site_settings', name="site_settings"),
url(r'^settings/domains/$', 'domain_index', name='domain_index'),
url(r'^settings/domains/new/$', 'domain_new', name='domain_new'),
# /lists/
url(r'^lists/$', 'list_index', name='list_index'),
url(r'^lists/new/$', 'list_new', name='list_new'),
url(r'^lists/(?P<fqdn_listname>[^/]+)/metrics$', 'list_metrics',
......@@ -39,16 +46,13 @@ urlpatterns = patterns('mailmanweb.views',
'list_subscribe', name='list_subscribe'),
url(r'^lists/(?P<fqdn_listname>[^/]+)/subscriptions$',
'list_subscriptions', name='list_subscriptions'),
url(r'^subscriptions/(?P<fqdn_listname>[^/]+)/mass_subscribe/$',
url(r'^lists/(?P<fqdn_listname>[^/]+)/mass_subscribe/$',
'mass_subscribe', name='mass_subscribe'),
url(r'^delete_list/(?P<fqdn_listname>[^/]+)/$', 'list_delete',
url(r'^lists/(?P<fqdn_listname>[^/]+)/delete$', 'list_delete',
name='list_delete'),
url(r'^user_settings/$', 'user_settings', kwargs={"tab": "user"},
name='user_settings'),
url(r'^membership_settings/(?:(?P<fqdn_listname>[^/]+)/)?$',
'user_settings', kwargs={"tab": "membership"},
name='membership_settings'),
url(r'^settings/(?P<fqdn_listname>[^/]+)/(?P<visible_section>[^/]+)?(?:/(?P<visible_option>.*))?$',
url(r'^lists/(?P<fqdn_listname>[^/]+)/settings/(?P<visible_section>[^/]+)?(?:/(?P<visible_option>.*))?$',
'list_settings', name='list_settings'),
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
......
......@@ -43,18 +43,24 @@ logger = logging.getLogger(__name__)
@login_required
@permission_required('server_admin')
def domain_index(request, template = 'mailmanweb/domain_index.html'):
def site_settings(request):
return render_to_response('mailmanweb/site_settings.html',
context_instance=RequestContext(request))
@login_required
@permission_required('server_admin')
def domain_index(request):
try:
existing_domains = Domain.objects.all()
logger.debug(Domain.objects)
except MailmanApiError:
return utils.render_api_error(request)
return render_to_response(template, {'domains':existing_domains,},
return render_to_response('mailmanweb/domain_index.html', {'domains':existing_domains,},
context_instance=RequestContext(request))
@login_required
@permission_required('server_admin')
def domain_new(request, template = 'mailmanweb/domain_new.html'):
def domain_new(request):
message = None
if request.method == 'POST':
form = DomainNew(request.POST)
......@@ -71,19 +77,10 @@ def domain_new(request, template = 'mailmanweb/domain_new.html'):
return redirect("domain_index")
else:
form = DomainNew()
return render_to_response(template,
return render_to_response('mailmanweb/domain_new.html',
{'form': form,'message': message},
context_instance=RequestContext(request))
@login_required
def administration(request):
"""
Administration dashboard used for Menu navigation
"""
return render_to_response('mailmanweb/errors/generic.html',
{'message': "This Site is in preperation."})
@login_required
def list_new(request, template = 'mailmanweb/lists/new.html'):
"""
......@@ -454,14 +451,12 @@ def user_settings(request, tab = "membership",
user_object = the_list.get_member(member)
else:
message = ("Using a workaround to replace missing Client functionality → LP:820827")
#### BEGIN workaround
for mlist in Lists.objects.all():
for mlist in List.objects.all():
try:
mlist.get_member(member)
membership_lists.append(mlist)
except: # if user is not subscribed to this list
except:
pass
#### END workaround
else:
# address_choices for the 'address' field must be a list of
# tuples of length 2
......@@ -567,3 +562,7 @@ def user_profile(request):
return render_to_response('mailmanweb/user_profile.html',
context_instance=RequestContext(request))
def user_todos(request):
return render_to_response('mailmanweb/user_todos.html',
context_instance=RequestContext(request))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment