Some last (template) improvements for next release

- Added dataTable function for group overview table.
- Added default form help text for groups and an explanation for group overview table.
- Updated translation.
- Translate group name in form.
- Username: FirstName instead of First_Name
- Hide group 'registered' from UserForm
- Linked persons/candidates/submitter etc. to UserView
- Fixed permissions in template

Translation
This commit is contained in:
Emanuel Schuetze 2013-05-15 23:26:24 +02:00
parent e76aa499f3
commit b5a5acbf2c
18 changed files with 483 additions and 483 deletions

View File

@ -2,6 +2,7 @@
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load staticfiles %}
{% load tags %}
{% block title %}{{ block.super }} {% trans "Election" %} "{{ assignment }}"{% endblock %} {% block title %}{{ block.super }} {% trans "Election" %} "{{ assignment }}"{% endblock %}
@ -18,36 +19,32 @@
{{ assignment }} {{ assignment }}
<small class="pull-right"> <small class="pull-right">
<a href="{% url 'assignment_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a> <a href="{% url 'assignment_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
<a href="{% url 'print_assignment' assignment.id %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print election as PDF' %}"><i class="icon-print"></i> PDF</a>
<!-- activate projector --> <!-- activate projector -->
{% if perms.projector.can_manage_projector %} {% if perms.projector.can_manage_projector %}
<a href="{% url 'projector_activate_slide' assignment.sid %}" class="activate_link btn {% if assignment.active %}btn-primary{% endif %} btn-mini" rel="tooltip" data-original-title="{% trans 'Show election' %}"> <a href="{% url 'projector_activate_slide' assignment.sid %}" class="activate_link btn {% if assignment.active %}btn-primary{% endif %} btn-mini" rel="tooltip" data-original-title="{% trans 'Show election' %}">
<i class="icon-facetime-video {% if assignment.active %}icon-white{% endif %}"></i> <i class="icon-facetime-video {% if assignment.active %}icon-white{% endif %}"></i>
</a> </a>
{% endif %} {% endif %}
{% if perms.assignment.can_manage_assignment or perms.agenda.can_manage_agenda %}
<div class="btn-group"> <div class="btn-group">
<a data-toggle="dropdown" href="#" class="btn btn-mini dropdown-toggle"> <a data-toggle="dropdown" class="btn btn-mini dropdown-toggle">
{% trans 'More actions' %} {% trans 'More actions' %} <span class="caret"></span>
<span class="caret"></span>
</a> </a>
<ul class="dropdown-menu pull-right"> <ul class="dropdown-menu pull-right">
<!-- edit -->
<li><a href="{% url 'assignment_edit' assignment.id %}"><i class="icon-pencil"></i> {% trans 'Edit election' %}</a></li>
<!-- delete -->
<li><a href="{% url 'assignment_delete' assignment.id %}"><i class="icon-remove"></i> {% trans 'Delete election' %}</a></li>
<!-- edit poll -->
{% if perms.assignment.can_manage_assignment %} {% if perms.assignment.can_manage_assignment %}
{% for poll in motion.polls %} <!-- edit -->
<li><a href="{% url 'assignment_poll_view' poll.id %}"><i class="icon-edit"></i> {{ forloop.counter }}. {% trans "Ballot" %}</a></li> <li><a href="{% url 'assignment_edit' assignment.id %}"><i class="icon-pencil"></i> {% trans 'Edit election' %}</a></li>
{% endfor %} <!-- delete -->
<li><a href="{% url 'assignment_delete' assignment.id %}"><i class="icon-remove"></i> {% trans 'Delete election' %}</a></li>
{% endif %} {% endif %}
<!-- create agenda item --> <!-- create agenda item -->
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage_agenda %}
<li> <li><a href="{% url 'assignment_create_agenda' assignment.id %}"><i class="icon-plus"></i> {% trans 'New agenda item' %}</a></li>
<a href="{% url 'assignment_create_agenda' assignment.id %}"><i class="icon-plus"></i> {% trans 'New agenda item' %}</a>
</li>
{% endif %} {% endif %}
</ul> </ul>
</div> </div>
{% endif %}
</small> </small>
</h1> </h1>
@ -67,7 +64,7 @@
<ol> <ol>
{% for person in assignment.get_participants %} {% for person in assignment.get_participants %}
<li> <li>
{{ person }} <a href="{% model_url person 'view' %}">{{ person }}</a>
{% if perms.assignment.can_manage_assignment %} {% if perms.assignment.can_manage_assignment %}
{% if assignment.status == "sea" or assignment.status == "vot" %} {% if assignment.status == "sea" or assignment.status == "vot" %}
<a href="{% url 'assignment_delother' assignment.id person.person_id %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Remove candidate' %}"><i class="icon-remove"></i></a> <a href="{% url 'assignment_delother' assignment.id person.person_id %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Remove candidate' %}"><i class="icon-remove"></i></a>
@ -126,7 +123,7 @@
<ul> <ul>
{% for person in blocked_candidates %} {% for person in blocked_candidates %}
<li> <li>
{{ person }} <a href="{% model_url person 'view' %}">{{ person }}</a>
<a class="btn btn-mini" href="{% url 'assignment_delother' assignment.id person.person_id %}" title="{% trans 'Remove candidate' %}"> <a class="btn btn-mini" href="{% url 'assignment_delother' assignment.id person.person_id %}" title="{% trans 'Remove candidate' %}">
<i class="icon-ban-circle"></i> <i class="icon-ban-circle"></i>
</a> </a>
@ -196,7 +193,7 @@
<a class="election_link" href="{% url 'assignment_user_elected' assignment.id candidate.person_id %}"></a> <a class="election_link" href="{% url 'assignment_user_elected' assignment.id candidate.person_id %}"></a>
{% endif %} {% endif %}
{% endif %} {% endif %}
{{ candidate }} <a href="{% model_url candidate 'view' %}">{{ candidate }}</a>
</td> </td>
{% for vote in poll_list %} {% for vote in poll_list %}
<td style="white-space:nowrap;"> <td style="white-space:nowrap;">

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: OpenSlides 1.3\n" "Project-Id-Version: OpenSlides 1.3\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-04-23 16:17+0200\n" "POT-Creation-Date: 2013-05-16 00:15+0200\n"
"PO-Revision-Date: 2012-07-28 11:07+0200\n" "PO-Revision-Date: 2012-07-28 11:07+0200\n"
"Last-Translator: Emanuel Schütze <emanuel@intevation.de>\n" "Last-Translator: Emanuel Schütze <emanuel@intevation.de>\n"
"Language: de\n" "Language: de\n"
@ -205,26 +205,26 @@ msgstr "Aktuelle Zeit"
msgid "Close" msgid "Close"
msgstr "Schließen" msgstr "Schließen"
#: agenda/static/javascript/agenda.js:27 #: agenda/static/javascript/agenda.js:17
#, c-format #, c-format
msgid ", of which %s are hidden." msgid ", of which %s are hidden."
msgstr ", davon %s verborgen." msgstr ", davon %s verborgen."
#: static/javascript/dataTables.bootstrap.js:19 #: static/javascript/dataTables.bootstrap.js:19
msgid "_MENU_ participants per page" msgid "_MENU_ entries per page"
msgstr "_MENU_ Teilnehmer/innen pro Seite" msgstr "_MENU_ Einträge pro Seite"
#: static/javascript/dataTables.bootstrap.js:20 #: static/javascript/dataTables.bootstrap.js:20
msgid "Search:" msgid "Search:"
msgstr "Suche:" msgstr "Suche:"
#: static/javascript/dataTables.bootstrap.js:21 #: static/javascript/dataTables.bootstrap.js:21
msgid "Showing _START_ to _END_ of _TOTAL_ participants" msgid "Showing _START_ to _END_ of _TOTAL_ entries"
msgstr "_START_ bis _END_ von _TOTAL_ Teilnehmer/innen" msgstr "_START_ bis _END_ von _TOTAL_ Einträgen"
#: static/javascript/dataTables.bootstrap.js:22 #: static/javascript/dataTables.bootstrap.js:22
msgid "Showing 0 participants" msgid "Showing 0 entries"
msgstr "0 Teilnehmer/innen" msgstr "0 Einträge"
#: static/javascript/dataTables.bootstrap.js:23 #: static/javascript/dataTables.bootstrap.js:23
msgid "(filtered from _MAX_ total entries)" msgid "(filtered from _MAX_ total entries)"
@ -234,18 +234,18 @@ msgstr "(gefiltert von _MAX_ Einträgen)"
msgid "No matching records found" msgid "No matching records found"
msgstr "Keine passenden Einträge gefunden" msgstr "Keine passenden Einträge gefunden"
#: static/javascript/dataTables.bootstrap.js:25 #: static/javascript/dataTables.bootstrap.js:26
msgid "First" msgid "First"
msgstr "Erster" msgstr "Erster"
#: static/javascript/dataTables.bootstrap.js:26 #: static/javascript/dataTables.bootstrap.js:27
msgid "Last" msgid "Last"
msgstr "Letzter" msgstr "Letzter"
#: static/javascript/dataTables.bootstrap.js:27 #: static/javascript/dataTables.bootstrap.js:28
msgid "Next" msgid "Next"
msgstr "Weiter" msgstr "Weiter"
#: static/javascript/dataTables.bootstrap.js:28 #: static/javascript/dataTables.bootstrap.js:29
msgid "Previous" msgid "Previous"
msgstr "Zurück" msgstr "Zurück"

View File

@ -30,7 +30,7 @@
<td>{{ mediafile.filetype }}</td> <td>{{ mediafile.filetype }}</td>
<td>{{ mediafile.get_filesize }}</td> <td>{{ mediafile.get_filesize }}</td>
<td>{{ mediafile.timestamp }}</td> <td>{{ mediafile.timestamp }}</td>
<td>{{ mediafile.uploader }}</td> <td><a href="{% model_url mediafile.uploader 'view' %}">{{ mediafile.uploader }}</a></td>
{% if perms.mediafile.can_manage %} {% if perms.mediafile.can_manage %}
<td> <td>
<span style="width: 1px; white-space: nowrap;"> <span style="width: 1px; white-space: nowrap;">

View File

@ -20,38 +20,37 @@
{% trans "Version" %} {{ motion.version.version_number }} {% trans "Version" %} {{ motion.version.version_number }}
</small> </small>
<small class="pull-right"> <small class="pull-right">
<div class="btn-toolbar">
<a href="{% url 'motion_list' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a> <a href="{% url 'motion_list' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
<a href="{% url 'motion_detail_pdf' motion.id %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print this motion as PDF' %}"><i class="icon-print"></i> PDF</a> <a href="{% url 'motion_detail_pdf' motion.id %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print motion as PDF' %}"><i class="icon-print"></i> PDF</a>
<!-- activate projector --> <!-- activate projector -->
{% if perms.projector.can_manage_projector %} {% if perms.projector.can_manage_projector %}
<a href="{% url 'projector_activate_slide' motion.sid %}" class="activate_link btn {% if motion.active %}btn-primary{% endif %} btn-mini" rel="tooltip" data-original-title="{% trans 'Show motion' %}"> <a href="{% url 'projector_activate_slide' motion.sid %}" class="activate_link btn {% if motion.active %}btn-primary{% endif %} btn-mini" rel="tooltip" data-original-title="{% trans 'Show motion' %}">
<i class="icon-facetime-video {% if motion.active %}icon-white{% endif %}"></i> <i class="icon-facetime-video {% if motion.active %}icon-white{% endif %}"></i>
</a> </a>
{% endif %} {% endif %}
{% if perms.motion.can_manage_motion or perms.agenda.can_manage_agenda %}
<div class="btn-group"> <div class="btn-group">
<a data-toggle="dropdown" href="#" class="btn btn-mini dropdown-toggle"> <a data-toggle="dropdown" class="btn btn-mini dropdown-toggle">
{% trans 'More actions' %} {% trans 'More actions' %} <span class="caret"></span>
<span class="caret"></span>
</a> </a>
<ul class="dropdown-menu pull-right"> <ul class="dropdown-menu pull-right">
<!-- edit --> {% if perms.motion.can_manage_motion %}
{% if allowed_actions.edit %} <!-- edit -->
<li><a href="{% model_url motion 'edit' %}"><i class="icon-pencil"></i> {% trans 'Edit motion' %}</a></li> {% if allowed_actions.edit %}
{% endif %} <li><a href="{% model_url motion 'edit' %}"><i class="icon-pencil"></i> {% trans 'Edit motion' %}</a></li>
<!-- delete --> {% endif %}
{% if allowed_actions.delete %} <!-- delete -->
<li><a href="{% model_url motion 'delete' %}"><i class="icon-remove"></i> {% trans 'Delete motion' %}</a></li> {% if allowed_actions.delete %}
<li><a href="{% model_url motion 'delete' %}"><i class="icon-remove"></i> {% trans 'Delete motion' %}</a></li>
{% endif %}
{% endif %} {% endif %}
<!-- create agenda item --> <!-- create agenda item -->
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage_agenda %}
<li> <li><a href="{% url 'motion_create_agenda' motion.id %}"><i class="icon-plus"></i> {% trans 'New agenda item' %}</a></li>
<a href="{% url 'motion_create_agenda' motion.id %}"><i class="icon-plus"></i> {% trans 'New agenda item' %}</a>
</li>
{% endif %} {% endif %}
</ul> </ul>
</div> </div>
</div> {% endif %}
</small> </small>
</h1> </h1>
@ -166,7 +165,7 @@
<!-- Submitter --> <!-- Submitter -->
<h5>{% trans "Submitter" %}:</h5> <h5>{% trans "Submitter" %}:</h5>
{% for submitter in motion.submitter.all %} {% for submitter in motion.submitter.all %}
{{ submitter.person }}{% if not forloop.last %}, {% endif %} <a href="{% model_url submitter.person 'view' %}">{{ submitter }}</a>{% if not forloop.last %}, {% endif %}
{% endfor %} {% endfor %}
<!-- Supporters --> <!-- Supporters -->
@ -177,7 +176,7 @@
{% else %} {% else %}
<ol> <ol>
{% for supporter in motion.supporter.all %} {% for supporter in motion.supporter.all %}
<li>{{ supporter }}</li> <li><a href="{% model_url supporter.person 'view' %}">{{ supporter }}</a></li>
{% endfor %} {% endfor %}
</ol> </ol>
{% endif %} {% endif %}

View File

@ -35,7 +35,7 @@ def gen_username(first_name, last_name):
""" """
generates the username for new users. generates the username for new users.
""" """
testname = "%s_%s" % (first_name.strip(), last_name.strip()) testname = "%s%s" % (first_name.strip(), last_name.strip())
try: try:
User.objects.get(username=testname) User.objects.get(username=testname)
except User.DoesNotExist: except User.DoesNotExist:
@ -43,7 +43,7 @@ def gen_username(first_name, last_name):
i = 0 i = 0
while True: while True:
i += 1 i += 1
testname = "%s_%s_%s" % (first_name, last_name, i) testname = "%s%s%s" % (first_name, last_name, i)
try: try:
User.objects.get(username=testname) User.objects.get(username=testname)
except User.DoesNotExist: except User.DoesNotExist:
@ -110,6 +110,6 @@ def import_users(csv_file):
def get_registered_group(): def get_registered_group():
""" """
Returns the Group 'Registered'. Upper and lower case is possible. Returns the group 'Registered' (pk=2).
""" """
return Group.objects.get(name__iexact='Registered') return Group.objects.get(pk=2)

View File

@ -22,17 +22,12 @@ from openslides.participant.models import User, Group
from openslides.participant.api import get_registered_group from openslides.participant.api import get_registered_group
class UserCreateForm(forms.ModelForm, CssClassMixin): class UserCreateForm(CssClassMixin, forms.ModelForm):
groups = forms.ModelMultipleChoiceField( groups = LocalizedModelMultipleChoiceField(
queryset=Group.objects.exclude(name__iexact='anonymous'), # Hide the built-in groups 'Anonymous' (pk=1) and 'Registered' (pk=2)
label=ugettext_lazy('Groups'), required=False) queryset=Group.objects.exclude(pk=1).exclude(pk=2),
label=ugettext_lazy('Groups'), required=False,
def __init__(self, *args, **kwargs): help_text=ugettext_lazy('Hold down "Control", or "Command" on a Mac, to select more than one.'))
if kwargs.get('instance', None) is None:
initial = kwargs.setdefault('initial', {})
registered = get_registered_group()
initial['groups'] = [registered.pk]
super(UserCreateForm, self).__init__(*args, **kwargs)
class Meta: class Meta:
model = User model = User
@ -109,21 +104,6 @@ class GroupForm(forms.ModelForm, CssClassMixin):
return instance return instance
def clean_name(self):
# Do not allow to change the name "anonymous" or give another group
# this name
data = self.cleaned_data['name']
if self.instance.name.lower() in ['anonymous', 'registered']:
# Editing the anonymous-user
if self.instance.name.lower() != data.lower():
raise forms.ValidationError(
_('You can not edit the name for this group.'))
else:
if data.lower() in ['anonymous', 'registered']:
raise forms.ValidationError(
_('Group name "%s" is reserved for internal use.') % data)
return data
class Meta: class Meta:
model = Group model = Group

View File

@ -9,7 +9,26 @@
<h1>{% trans group.name %} <h1>{% trans group.name %}
<small class="pull-right"> <small class="pull-right">
<a href="{% url 'user_group_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a> <a href="{% url 'user_group_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
<!-- activate projector -->
{% if perms.projector.can_manage_projector %}
<a href="{% url 'projector_activate_slide' group.sid %}" class="activate_link btn {% if group.active %}btn-primary{% endif %} btn-mini" rel="tooltip" data-original-title="{% trans 'Show group' %}">
<i class="icon-facetime-video {% if group.active %}icon-white{% endif %}"></i>
</a>
{% endif %}
{% if perms.participant.can_manage_participant and group.pk != 1 and group.pk != 2 %}
<div class="btn-group">
<a data-toggle="dropdown" class="btn btn-mini dropdown-toggle">
{% trans 'More actions' %} <span class="caret"></span>
</a>
<ul class="dropdown-menu pull-right">
<!-- edit -->
<li><a href="{% url 'user_group_edit' group.id %}"><i class="icon-pencil"></i> {% trans 'Edit group' %}</a></li>
<!-- delete -->
<li><a href="{% url 'user_group_delete' group.id %}"><i class="icon-remove"></i> {% trans 'Delete group' %}</a></li>
</ul>
</div>
{% endif %}
</small> </small>
</h1> </h1>
@ -19,7 +38,7 @@
<ol> <ol>
{% for member in group_members %} {% for member in group_members %}
<li>{{ member }}</li> <li><a href="{% model_url member 'view' %}">{{ member }}</a></li>
{% empty %} {% empty %}
<p>{% trans "No members available." %}</p> <p>{% trans "No members available." %}</p>
{% endfor %} {% endfor %}

View File

@ -1,25 +1,44 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %}
{% load tags %} {% load tags %}
{% block title %}{{ block.super }} {% trans "Groups" %}{% endblock %} {% block title %}{{ block.super }} {% trans "Groups" %}{% endblock %}
{% block header %}
<link href="{% static 'styles/dataTables/dataTables.bootstrap.css' %}" type="text/css" rel="stylesheet">
{% endblock %}
{% block javascript %}
<script src="{% static 'javascript/jquery.dataTables.min.js' %}" type="text/javascript"></script>
<script src="{% static 'javascript/dataTables.bootstrap.js' %}" type="text/javascript"></script>
{% endblock %}
{% block content %} {% block content %}
<h1>{% trans "Groups" %} <h1>
{% trans "Groups" %}
<small class="pull-right"> <small class="pull-right">
<a href="{% url 'user_group_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New group' %}"><i class="icon-plus icon-white"></i> {% trans "New" %}</a> <a href="{% url 'user_group_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New group' %}"><i class="icon-plus icon-white"></i> {% trans "New" %}</a>
<a href="{% url 'user_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to participants overview" %}</a> <a href="{% url 'user_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to participants overview" %}</a>
</small> </small>
</h1> </h1>
<table class="table table-striped table-bordered"> <table id="dataTable" class="table table-striped table-bordered">
<thead>
<tr> <tr>
<th class="mini_width">{% trans "ID" %}</th>
<th>{% trans "Group" %}</th> <th>{% trans "Group" %}</th>
<th style="width: 1px;">{% trans "Actions" %}</th> <th class="mini_width">{% trans "Actions" %}</th>
</tr> </tr>
</thead>
{% for group in groups %} {% for group in groups %}
<tr class="{% if group.active %}activeline{% endif %}"> <tr class="{% if group.active %}activeline{% endif %}">
<td class="nobr">{{ group.pk }}
{% if group.pk == 1 or group.pk == 2 %}
<a title="{% blocktrans %}The groups 1 ('Anonymous') and 2 ('Registered') are fixed default groups which can not be deleted. Each created or imported participant is a member of group 2. Use custom groups to set additional permissions for a subset of participants.{% endblocktrans %}"><i class="icon-info-sign"></i></a>
{% endif %}
</td>
<td> <td>
<a href="{% model_url group 'view' %}">{% trans group.name %}</a> <a href="{% model_url group 'view' %}">{% trans group.name %}</a>
</td> </td>
@ -33,7 +52,7 @@
<a href="{% url 'user_group_edit' group.id %}" title="{% trans 'Edit' %}" class="btn btn-mini"> <a href="{% url 'user_group_edit' group.id %}" title="{% trans 'Edit' %}" class="btn btn-mini">
<i class="icon-pencil"></i> <i class="icon-pencil"></i>
</a> </a>
{% if group.name|lower != 'anonymous' and group.name|lower != 'registered' %} {% if group.pk != 1 and group.pk != 2 %}
<a href="{% url 'user_group_delete' group.id %}" title="{% trans 'Delete' %}" class="btn btn-mini"> <a href="{% url 'user_group_delete' group.id %}" title="{% trans 'Delete' %}" class="btn btn-mini">
<i class="icon-remove"></i> <i class="icon-remove"></i>
</a> </a>

View File

@ -3,7 +3,7 @@
<ul style="line-height: 180%"> <ul style="line-height: 180%">
{% for group in groups %} {% for group in groups %}
{% if group.name != 'Anonymous' and group.name != 'Registered' %} {% if group.pk != 1 and group.pk != 2 %}
<li class="{% if group.active %}activeline{% endif %}"> <li class="{% if group.active %}activeline{% endif %}">
<a href="{% url 'projector_activate_slide' group.sid %}" class="activate_link btn {% if group.active %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}"> <a href="{% url 'projector_activate_slide' group.sid %}" class="activate_link btn {% if group.active %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<i class="icon-facetime-video {% if group.active %}icon-white{% endif %}"></i> <i class="icon-facetime-video {% if group.active %}icon-white{% endif %}"></i>

View File

@ -22,7 +22,6 @@
</li> </li>
<li> <li>
{% trans 'Default groups' %}: {% trans 'Default groups' %}:
{% trans 'Anonymous' %} (<code>1</code>), {% trans 'Registered' %} (<code>2</code>),
{% trans 'Delegate' %} (<code>3</code>), {% trans 'Staff' %} (<code>4</code>) {% trans 'Delegate' %} (<code>3</code>), {% trans 'Staff' %} (<code>4</code>)
</li> </li>
<li>{% trans 'Required CSV file encoding: UTF-8 (Unicode).' %}</li> <li>{% trans 'Required CSV file encoding: UTF-8 (Unicode).' %}</li>

View File

@ -16,39 +16,28 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h1>{% trans "Participants" %} <h1>
{% trans "Participants" %}
<small class="pull-right"> <small class="pull-right">
<div class="btn-toolbar"> {% if perms.participant.can_manage_participant %}
{% if perms.participant.can_manage_participant %} <a href="{% url 'user_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New participant' %}"><i class="icon-plus icon-white"></i> {% trans "New" %}</a>
<a href="{% url 'user_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New participant' %}"><i class="icon-plus icon-white"></i> {% trans "New" %}</a> <a href="{% url 'user_group_overview' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'All groups' %}"><i class="icon-group"></i> {% trans "Groups" %}</a>
<a href="{% url 'user_group_overview' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'All groups' %}"><i class="icon-group"></i> {% trans "Groups" %}</a> <a href="{% url 'user_import' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Import participants' %}"><i class="icon-import"></i> {% trans 'Import' %}</a>
<a href="{% url 'user_import' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Import participants' %}"><i class="icon-import"></i> {% trans 'Import' %}</a> {% endif %}
{% endif %} {% if perms.participant.can_see_participant and perms.participant.can_manage_participant %}
{% if perms.participant.can_see_participant and perms.participant.can_manage_participant %} <div class="btn-group">
<div class="btn-group pull-right"> <a data-toggle="dropdown" class="btn btn-mini dropdown-toggle">
{% if user.is_authenticated %} <i class="icon-print"></i> PDF <span class="caret"></span>
<a href="#" data-toggle="dropdown" class="btn btn-mini dropdown-toggle"> </a>
<i class="icon-print"></i> PDF <ul class="dropdown-menu pull-right">
<span class="caret"></span> {% url 'user_settings' as url_usersettings %}
</a> <li><a href="{% url 'user_print' %}"><i class="icon-list"></i> {% trans 'List of participants' %}</a></li>
<ul class="dropdown-menu"> <li><a href="{% url 'print_passwords' %}"><i class="icon-th-large"></i> {% trans 'First time passwords' %}</a></li>
{% url 'user_settings' as url_usersettings %} </ul>
<li><a href="{% url 'user_print' %}"><i class="icon-list"></i> {% trans 'List of participants' %}</a></li> </div>
<li><a href="{% url 'print_passwords' %}"><i class="icon-th-large"></i> {% trans 'First time passwords' %}</a></li> {% else %}
</ul> <a href="{% url 'user_print' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print list of participants as PDF' %}"><i class="icon-print"></i> PDF</a>
{% else %} {% endif %}
<a href="{% url 'user_login' %}" class="btn">{% trans "Login" %}</a>
{% endif %}
</div>
{% else %}
{% if perms.participant.can_see_participant %}
<a href="{% url 'user_print' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print list of participants as PDF' %}"><i class="icon-print"></i> PDF</a>
{% endif %}
{% if perms.participant.can_manage_participant %}
<a href="{% url 'print_passwords' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print first time passwords as PDF' %}"><i class="icon-print"></i> PDF</a>
{% endif %}
{% endif %}
</div>
</small> </small>
</h1> </h1>
@ -92,7 +81,7 @@
<td class="optional">{{ user.structure_level }}</td> <td class="optional">{{ user.structure_level }}</td>
<td class="optional"> <td class="optional">
{% for group in user.groups.all %} {% for group in user.groups.all %}
{% if group.name != 'Registered' %} {% if group.pk != 2 %}
{% trans group.name %} {% trans group.name %}
{% if not forloop.last %}<br>{% endif %} {% if not forloop.last %}<br>{% endif %}
{% endif %} {% endif %}

View File

@ -7,9 +7,29 @@
{% block content %} {% block content %}
<h1>{{ shown_user.clean_name }} <h1>
{{ shown_user.clean_name }}
<small class="pull-right"> <small class="pull-right">
<a href="{% url 'user_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a> <a href="{% url 'user_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
<!-- activate projector -->
{% if perms.projector.can_manage_projector %}
<a href="{% url 'projector_activate_slide' shown_user.sid %}" class="activate_link btn {% if shown_user.active %}btn-primary{% endif %} btn-mini" rel="tooltip" data-original-title="{% trans 'Show participant' %}">
<i class="icon-facetime-video {% if shown_user.active %}icon-white{% endif %}"></i>
</a>
{% endif %}
{% if perms.participant.can_manage_participant %}
<div class="btn-group">
<a data-toggle="dropdown" class="btn btn-mini dropdown-toggle">
{% trans 'More actions' %} <span class="caret"></span>
</a>
<ul class="dropdown-menu pull-right">
<!-- edit -->
<li><a href="{% url 'user_edit' shown_user.id %}"><i class="icon-pencil"></i> {% trans 'Edit participant' %}</a></li>
<!-- delete -->
<li><a href="{% url 'user_delete' shown_user.id %}"><i class="icon-remove"></i> {% trans 'Delete participant' %}</a></li>
</ul>
</div>
{% endif %}
</small> </small>
</h1> </h1>

View File

@ -104,6 +104,17 @@ class UserCreateView(CreateView):
self.object.default_password = gen_password() self.object.default_password = gen_password()
self.object.set_password(self.object.default_password) self.object.set_password(self.object.default_password)
def post_save(self, form):
super(UserCreateView, self).post_save(form)
# TODO: find a better solution that makes the following lines obsolete
# Background: motion.models.use_post_save adds already the registerd group
# to new user but super(..).post_save(form) removes it and sets only the
# groups selected in the form (without 'registered')
# workaround: add registered group again manually
from openslides.participant.api import get_registered_group # TODO: Test, if global import is possible
registered = get_registered_group()
self.object.groups.add(registered)
class UserUpdateView(UpdateView): class UserUpdateView(UpdateView):
""" """
@ -190,7 +201,7 @@ class ParticipantsListPDF(PDFView):
counter += 1 counter += 1
groups = '' groups = ''
for group in user.groups.all(): for group in user.groups.all():
if unicode(group) != "Registered": if group.pk != 2:
groups += "%s<br/>" % unicode(group) groups += "%s<br/>" % unicode(group)
data.append([ data.append([
counter, counter,
@ -400,7 +411,7 @@ class GroupDeleteView(DeleteView):
success_url_name = 'user_group_overview' success_url_name = 'user_group_overview'
def pre_redirect(self, request, *args, **kwargs): def pre_redirect(self, request, *args, **kwargs):
if self.get_object().name.lower() in ['anonymous', 'registered']: if self.get_object().pk in [1, 2]:
messages.error(request, _("You can not delete this Group.")) messages.error(request, _("You can not delete this Group."))
else: else:
super(GroupDeleteView, self).pre_redirect(request, *args, **kwargs) super(GroupDeleteView, self).pre_redirect(request, *args, **kwargs)

View File

@ -19,7 +19,7 @@ $(document).ready(function() {
"sLengthMenu": gettext("_MENU_ entries per page"), "sLengthMenu": gettext("_MENU_ entries per page"),
"sSearch": gettext("Search:"), "sSearch": gettext("Search:"),
"sInfo": gettext("Showing _START_ to _END_ of _TOTAL_ entries"), "sInfo": gettext("Showing _START_ to _END_ of _TOTAL_ entries"),
"sInfoEmpty": gettext("Showing 0 participants"), "sInfoEmpty": gettext("Showing 0 entries"),
"sInfoFiltered": gettext("(filtered from _MAX_ total entries)"), "sInfoFiltered": gettext("(filtered from _MAX_ total entries)"),
"sZeroRecords": gettext("No matching records found"), "sZeroRecords": gettext("No matching records found"),
"oPaginate": { "oPaginate": {

View File

@ -27,7 +27,7 @@ class AnonymousAuth(object):
""" """
Authenticate a user based in username / password. Authenticate a user based in username / password.
- always return None as anonymous can't login.. - always return None as anonymous can't login.
""" """
return None return None
@ -35,13 +35,13 @@ class AnonymousAuth(object):
""" """
Return the permissions a user is graneted by his group membership(s). Return the permissions a user is graneted by his group membership(s).
- try to return the permissions for the 'Anonymous' group - try to return the permissions for the 'Anonymous' group (pk=1).
""" """
if (not user_obj.is_anonymous() or obj is not None or if (not user_obj.is_anonymous() or obj is not None or
not config['system_enable_anonymous']): not config['system_enable_anonymous']):
return set() return set()
perms = Permission.objects.filter(group__name='Anonymous') perms = Permission.objects.filter(group__pk=1)
if perms is None: if perms is None:
return set() return set()
perms = perms.values_list('content_type__app_label', 'codename') \ perms = perms.values_list('content_type__app_label', 'codename') \