diff --git a/openslides/participant/templates/participant/base_participant.html b/openslides/participant/templates/participant/base_participant.html
index 764562e37..d1bdf68c2 100644
--- a/openslides/participant/templates/participant/base_participant.html
+++ b/openslides/participant/templates/participant/base_participant.html
@@ -15,6 +15,7 @@
{%trans 'Print participant list' %}
{%trans 'Import' %}
{% trans 'Generate first passwords' %}
+ {% trans 'Print password list' %}
{% endif %}
{% endblock %}
diff --git a/openslides/participant/urls.py b/openslides/participant/urls.py
index 3e201f397..430390cb1 100644
--- a/openslides/participant/urls.py
+++ b/openslides/participant/urls.py
@@ -29,6 +29,7 @@ urlpatterns = patterns('participant.views',
url(r'^user/settings$', 'user_settings', name='user_settings'),
url(r'^participant/genpasswords$', 'gen_passwords', name='user_gen_passwords'),
url(r'^participant/resetpassword/(?P\d+)$', 'reset_password', name='user_reset_passwords'),
+ url(r'^participant/passwords/print$', 'print_passwords', name='print_passwords'),
)
urlpatterns += patterns('django.contrib.auth.views',
diff --git a/openslides/participant/views.py b/openslides/participant/views.py
index bfde71082..a9fba59b7 100644
--- a/openslides/participant/views.py
+++ b/openslides/participant/views.py
@@ -25,7 +25,7 @@ from participant.models import Profile, set_first_user_passwords
from participant.api import gen_username
from participant.forms import UserForm, UsernameForm, ProfileForm, UsersettingsForm, UserImportForm, GroupForm, AdminPasswordChangeForm
from utils.utils import template, permission_required, gen_confirm_form
-from utils.pdf import print_userlist
+from utils.pdf import print_userlist, print_passwords
from django.db.models import Avg, Max, Min, Count
diff --git a/openslides/system/forms.py b/openslides/system/forms.py
index 01ed97088..def96b1cd 100644
--- a/openslides/system/forms.py
+++ b/openslides/system/forms.py
@@ -10,7 +10,7 @@
:license: GNU GPL, see LICENSE for more details.
"""
-from django.forms import Form, CharField, TextInput, BooleanField, IntegerField
+from django.forms import Form, CharField, TextInput, BooleanField, IntegerField, Textarea
from django.utils.translation import ugettext as _
from system.api import config_get
@@ -18,8 +18,11 @@ class SystemConfigForm(Form):
error_css_class = 'error'
required_css_class = 'required'
- user_registration = BooleanField(label=_("User registration"), required=False)
-
+ #user_registration = BooleanField(label=_("User registration"), required=False)
+ system_url = CharField(widget=TextInput(), required=False, label=_("System URL"))
+ system_welcometext = CharField(widget=Textarea(), required=False, label=_("Welcome text (for password PDF)"))
+
+
class EventConfigForm(Form):
error_css_class = 'error'
required_css_class = 'required'
@@ -36,4 +39,6 @@ class ApplicationConfigForm(Form):
application_min_supporters = IntegerField(widget=TextInput(attrs={'class':'small-input'}),label=_("Number of (minimum) required supporters for a application"),initial=4, min_value=0, max_value=8)
application_preamble = CharField(widget=TextInput(), required=False, label=_("Application preamble"))
+
+
\ No newline at end of file
diff --git a/openslides/system/models.py b/openslides/system/models.py
index fa2f5934c..849b88776 100644
--- a/openslides/system/models.py
+++ b/openslides/system/models.py
@@ -17,7 +17,7 @@ DEFAULT_DATA = {
'event_description': 'Presentation and voting system',
'application_min_supporters': 4,
'application_preamble': 'Die Versammlung möge beschließen,',
- 'user_registration': True,
+ 'sysem_url': 'http://openslides:8000',
}
class Config(models.Model):
diff --git a/openslides/system/templates/system/base_system.html b/openslides/system/templates/system/base_system.html
index d1dd838d3..32b3e695b 100644
--- a/openslides/system/templates/system/base_system.html
+++ b/openslides/system/templates/system/base_system.html
@@ -7,6 +7,6 @@
{%trans "Configuration" %}
{% endblock %}
diff --git a/openslides/system/views.py b/openslides/system/views.py
index 8d9f51646..522ee2204 100644
--- a/openslides/system/views.py
+++ b/openslides/system/views.py
@@ -25,14 +25,16 @@ def get_system_config(request):
if request.method == 'POST':
form = SystemConfigForm(request.POST)
if form.is_valid():
- config_set('user_registration', form.cleaned_data['user_registration'])
+ config_set('system_url', form.cleaned_data['system_url'])
+ config_set('system_welcometext', form.cleaned_data['system_welcometext'])
messages.success(request, _('System settings successfully saved.'))
else:
messages.error(request, _('Please check the form for errors.'))
else:
form = SystemConfigForm(initial={
- 'user_registration': config_get('user_registration'),
+ 'system_url': config_get('system_url'),
+ 'system_welcometext': config_get('system_welcometext'),
})
return {
'form': form,
diff --git a/openslides/utils/pdf.py b/openslides/utils/pdf.py
index 1179d08f0..d6d529494 100755
--- a/openslides/utils/pdf.py
+++ b/openslides/utils/pdf.py
@@ -259,6 +259,47 @@ def print_userlist(request):
doc.build(story, onFirstPage=firstPage, onLaterPages=laterPages)
return response
+def print_passwords(request):
+ response = HttpResponse(mimetype='application/pdf')
+ filename = u'filename=%s.pdf;' % _("passwords")
+ response['Content-Disposition'] = filename.encode('utf-8')
+ doc = SimpleDocTemplate(response, pagesize=A4, topMargin=-6, bottomMargin=-6, leftMargin=0, rightMargin=0, showBoundary=False)
+ story = [Spacer(0,0*cm)]
+
+ data= []
+ system_url = config_get("system_url")
+ system_welcometext = config_get("system_welcometext")
+ for user in User.objects.all().order_by('last_name'):
+ try:
+ user.get_profile()
+ cell = []
+ cell.append(Spacer(0,0.8*cm))
+ cell.append(Paragraph(_("Your Password for OpenSlides"), stylesheet['Ballot_title']))
+ cell.append(Paragraph("%s %s %s" % (_("for"), user.first_name, user.last_name), stylesheet['Ballot_subtitle']))
+ cell.append(Spacer(0,0.5*cm))
+ cell.append(Paragraph("%s: %s" % (_("Username"), user.username), stylesheet['Ballot_option']))
+ cell.append(Paragraph("%s: %s" % (_("Password"), user.profile.firstpassword), stylesheet['Ballot_option']))
+ cell.append(Spacer(0,0.5*cm))
+ cell.append(Paragraph("%s: %s" % (_("URL"), system_url), stylesheet['Ballot_option']))
+ cell.append(Spacer(0,0.5*cm))
+ cell2 = []
+ cell2.append(Spacer(0,0.8*cm))
+ cell2.append(Paragraph(system_welcometext.replace('\r\n','
'), stylesheet['Ballot_subtitle']))
+
+ data.append([cell,cell2])
+ except Profile.DoesNotExist:
+ pass
+
+ t=Table(data, 10.5*cm, 7.42*cm)
+ t.setStyle(TableStyle([ ('LINEBELOW', (0,0), (-1,0), 0.25, colors.grey),
+ ('LINEBELOW', (0,1), (-1,1), 0.25, colors.grey),
+ ('LINEBELOW', (0,1), (-1,-1), 0.25, colors.grey),
+ ('VALIGN', (0,0), (-1,-1), 'TOP'),
+ ]))
+ story.append(t)
+ doc.build(story)
+ return response
+
def get_application(application, story):
if application.number is None:
story.append(Paragraph(_("Application")+" #[-]", stylesheet['Heading1']))