diff --git a/openslides/participant/templates/participant/overview.html b/openslides/participant/templates/participant/overview.html
index 73d517799..a8011bd8f 100644
--- a/openslides/participant/templates/participant/overview.html
+++ b/openslides/participant/templates/participant/overview.html
@@ -1,6 +1,13 @@
{% extends "participant/base_participant.html" %}
{% block title %}{{ block.super }} - {%trans "Participants" %}{% endblock %}
+{% block header %}
+ {% if perms.agenda.can_manage_agenda %}
+
+
+ {% endif %}
+{% endblock %}
+
{% block content %}
{% trans "Participants" %}
@@ -73,16 +80,16 @@
- {% if user.is_active %}
-
- {% else %}
-
- {% endif %}
- {% if user.is_superuser %}
-
- {% else %}
-
- {% endif %}
+
+
+
+
+
+
|
{% endif %}
diff --git a/openslides/participant/urls.py b/openslides/participant/urls.py
index a665202a6..e7665dd69 100644
--- a/openslides/participant/urls.py
+++ b/openslides/participant/urls.py
@@ -19,8 +19,11 @@ urlpatterns = patterns('participant.views',
url(r'^participant/(?P\d+)/edit$', 'edit', name='user_edit'),
url(r'^participant/print$', 'print_userlist', name='user_print'),
url(r'^participant/(?P\d+)/del$', 'user_delete', name='user_delete'),
- url(r'^participant/(?P\d+)/admin$', 'user_set_superuser', name='user_set_superuser'),
- url(r'^participant/(?P\d+)/active$', 'user_set_active', name='user_set_active'),
+ url(r'^participant/(?P\d+)/active/$', 'user_set_active', {'active': True}, name='user_active'),
+ url(r'^participant/(?P\d+)/inactive/$', 'user_set_active', {'active': False}, name='user_inactive'),
+ url(r'^participant/(?P\d+)/superuser/$', 'user_set_superuser', {'superuser': True}, name='user_superuser'),
+ url(r'^participant/(?P\d+)/normaluser/$', 'user_set_superuser', {'superuser': False}, name='user_normaluser'),
+
url(r'^participant/import$', 'user_import', name='user_import'),
url(r'^participant/group/$', 'get_group_overview', name='user_group_overview'),
url(r'^participant/group/new$', 'group_edit', name='user_group_new'),
diff --git a/openslides/participant/views.py b/openslides/participant/views.py
index a0a8bed7f..b82ccdf39 100644
--- a/openslides/participant/views.py
+++ b/openslides/participant/views.py
@@ -34,7 +34,7 @@ from django.db import transaction
from participant.models import Profile
from participant.api import gen_username, gen_password
from participant.forms import UserNewForm, UserEditForm, ProfileForm, UsersettingsForm, UserImportForm, GroupForm, AdminPasswordChangeForm
-from utils.utils import template, permission_required, gen_confirm_form
+from utils.utils import template, permission_required, gen_confirm_form, ajax_request
from utils.pdf import print_userlist, print_passwords
from system.api import config_get
@@ -176,30 +176,40 @@ def user_delete(request, user_id):
@permission_required('participant.can_manage_participant')
@template('confirm.html')
-def user_set_superuser(request, user_id):
- user = User.objects.get(pk=user_id)
- if user.is_superuser:
- user.is_superuser = False
+def user_set_superuser(request, user_id, superuser=True):
+ try:
+ user = User.objects.get(pk=user_id)
+ user.is_superuser = superuser
user.save()
- messages.success(request, _('Participant %s is now a normal user.') % user)
- else:
- user.is_superuser = True
- user.save()
- messages.success(request, _('Participant %s is now administrator.') % user)
+ except User.DoesNotExist:
+ messages.error(request, _('Participant %d does not exist.') % int(user_id))
+
+ if request.is_ajax():
+ if superuser:
+ link = reverse('user_normaluser', args=[user.id])
+ else:
+ link = reverse('user_superuser', args=[user.id])
+ return ajax_request({'superuser': superuser,
+ 'link': link})
return redirect(reverse('user_overview'))
@permission_required('participant.can_manage_participant')
@template('confirm.html')
-def user_set_active(request, user_id):
- user = User.objects.get(pk=user_id)
- if user.is_active:
- user.is_active = False
+def user_set_active(request, user_id, active=True):
+ try:
+ user = User.objects.get(pk=user_id)
+ user.is_active = active
user.save()
- messages.success(request, _('Participant %s was successfully deactivated.') % user)
- else:
- user.is_active = True
- user.save()
- messages.success(request, _('Participant %s was successfully activated.') % user)
+ except User.DoesNotExist:
+ messages.error(request, _('Participant %d does not exist.') % int(user_id))
+
+ if request.is_ajax():
+ if active:
+ link = reverse('user_inactive', args=[user.id])
+ else:
+ link = reverse('user_active', args=[user.id])
+ return ajax_request({'active': active,
+ 'link': link})
return redirect(reverse('user_overview'))
@permission_required('participant.can_manage_participant')
diff --git a/openslides/static/javascript/participant.js b/openslides/static/javascript/participant.js
new file mode 100644
index 000000000..895456830
--- /dev/null
+++ b/openslides/static/javascript/participant.js
@@ -0,0 +1,39 @@
+$(function() {
+ $('.status_link').click(function(event) {
+ event.preventDefault();
+ link = $(this);
+ $.ajax({
+ type: 'GET',
+ url: link.attr('href'),
+ dataType: 'json',
+ success: function(data) {
+ if (data.active) {
+ newclass = 'active';
+ } else {
+ newclass = 'inactive';
+ }
+ link.removeClass('active inactive').addClass(newclass);
+ link.attr('href', data.link);
+ }
+ });
+ });
+
+ $('.superuser_link').click(function(event) {
+ event.preventDefault();
+ link = $(this);
+ $.ajax({
+ type: 'GET',
+ url: link.attr('href'),
+ dataType: 'json',
+ success: function(data) {
+ if (data.superuser) {
+ newclass = 'superuser';
+ } else {
+ newclass = 'normaluser';
+ }
+ link.removeClass('superuser normaluser').addClass(newclass);
+ link.attr('href', data.link);
+ }
+ });
+ });
+});
\ No newline at end of file
diff --git a/openslides/static/styles/participant.css b/openslides/static/styles/participant.css
new file mode 100644
index 000000000..5355ec87f
--- /dev/null
+++ b/openslides/static/styles/participant.css
@@ -0,0 +1,33 @@
+a.status_link.active span {
+ background-image: url(/static/images/icons/user-online.png);
+ background-repeat: no-repeat;
+ background-position: center;
+ width: 16px;
+ height: 16px;
+ display: inline-block;
+}
+a.status_link.inactive span {
+ background-image: url(/static/images/icons/user-offline.png);
+ background-repeat: no-repeat;
+ background-position: center;
+ width: 16px;
+ height: 16px;
+ display: inline-block;
+}
+
+a.superuser_link.superuser span {
+ background-image: url(/static/images/icons/meeting-chair.png);
+ background-repeat: no-repeat;
+ background-position: center;
+ width: 16px;
+ height: 16px;
+ display: inline-block;
+}
+a.superuser_link.normaluser span {
+ background-image: url(/static/images/icons/im-user.png);
+ background-repeat: no-repeat;
+ background-position: center;
+ width: 16px;
+ height: 16px;
+ display: inline-block;
+}
\ No newline at end of file