Renamed logo files (typo).
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
@ -62,7 +62,7 @@ USE_L10N = True
|
|||||||
|
|
||||||
# Absolute path to the directory that holds media.
|
# Absolute path to the directory that holds media.
|
||||||
# Example: "/home/media/media.lawrence.com/"
|
# Example: "/home/media/media.lawrence.com/"
|
||||||
MEDIA_ROOT = ''
|
MEDIA_ROOT = os.path.join(SITE_ROOT, './static/')
|
||||||
|
|
||||||
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
|
# 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).
|
# trailing slash if there is a path component (optional in other cases).
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% if perms.participant.can_manage_participant %}
|
{% if perms.participant.can_manage_participant %}
|
||||||
<li><a href="{% url print_passwords %}"><img src="{% static 'images/icons/pdf.png' %}"> {% trans 'First time passwords as PDF' %}</a></li>
|
<li><a href="{% url print_passwords %}"><img src="{% static 'images/icons/pdf.png' %}"> {% trans 'First time passwords as PDF' %}</a></li>
|
||||||
|
<li><a href="{% url print_badges %}"><img src="{% static 'images/icons/pdf.png' %}"> Namenskarten als PDF</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
from django.conf.urls.defaults import *
|
from django.conf.urls.defaults import *
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
|
||||||
from participant.views import ParticipantsListPDF, ParticipantsPasswordsPDF
|
from participant.views import ParticipantsListPDF, ParticipantsPasswordsPDF, ParticipantsBadgePDF
|
||||||
|
|
||||||
urlpatterns = patterns('participant.views',
|
urlpatterns = patterns('participant.views',
|
||||||
url(r'^$',
|
url(r'^$',
|
||||||
@ -80,4 +80,10 @@ urlpatterns = patterns('participant.views',
|
|||||||
ParticipantsPasswordsPDF.as_view(),
|
ParticipantsPasswordsPDF.as_view(),
|
||||||
name='print_passwords',
|
name='print_passwords',
|
||||||
),
|
),
|
||||||
|
|
||||||
|
url(r'^badges/print$',
|
||||||
|
ParticipantsBadgePDF.as_view(),
|
||||||
|
name='print_badges',
|
||||||
|
),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
@ -53,6 +53,8 @@ from utils.template import Tab
|
|||||||
from utils.views import (FormView, PDFView)
|
from utils.views import (FormView, PDFView)
|
||||||
from utils.utils import delete_default_permissions
|
from utils.utils import delete_default_permissions
|
||||||
|
|
||||||
|
from openslides import settings
|
||||||
|
import qrcode
|
||||||
|
|
||||||
@permission_required('participant.can_see_participant')
|
@permission_required('participant.can_see_participant')
|
||||||
@template('participant/overview.html')
|
@template('participant/overview.html')
|
||||||
@ -551,6 +553,10 @@ class ParticipantsPasswordsPDF(PDFView):
|
|||||||
for user in User.objects.all().order_by('last_name'):
|
for user in User.objects.all().order_by('last_name'):
|
||||||
try:
|
try:
|
||||||
user.get_profile()
|
user.get_profile()
|
||||||
|
qrcode_img = qrcode.make(participant_pdf_system_url)
|
||||||
|
qrcode_img.save( settings.MEDIA_ROOT + 'qr-code_systemurl.png', 'PNG')
|
||||||
|
imgfile = settings.MEDIA_ROOT + 'qr-code_systemurl.png';
|
||||||
|
qrcode_systemurl = "<img src='%s' width='50' height='50'/>" % imgfile
|
||||||
cell = []
|
cell = []
|
||||||
cell.append(Spacer(0,0.8*cm))
|
cell.append(Spacer(0,0.8*cm))
|
||||||
cell.append(Paragraph(_("Account for OpenSlides"), stylesheet['Ballot_title']))
|
cell.append(Paragraph(_("Account for OpenSlides"), stylesheet['Ballot_title']))
|
||||||
@ -560,7 +566,8 @@ class ParticipantsPasswordsPDF(PDFView):
|
|||||||
cell.append(Paragraph(_("Password: %s") % (user.profile.firstpassword), stylesheet['Monotype']))
|
cell.append(Paragraph(_("Password: %s") % (user.profile.firstpassword), stylesheet['Monotype']))
|
||||||
cell.append(Spacer(0,0.5*cm))
|
cell.append(Spacer(0,0.5*cm))
|
||||||
cell.append(Paragraph(_("URL: %s") % (participant_pdf_system_url), stylesheet['Ballot_option']))
|
cell.append(Paragraph(_("URL: %s") % (participant_pdf_system_url), stylesheet['Ballot_option']))
|
||||||
cell.append(Spacer(0,0.5*cm))
|
cell.append(Spacer(0,1*cm))
|
||||||
|
cell.append(Paragraph(qrcode_systemurl, stylesheet['Ballot_option']))
|
||||||
cell2 = []
|
cell2 = []
|
||||||
cell2.append(Spacer(0,0.8*cm))
|
cell2.append(Spacer(0,0.8*cm))
|
||||||
if participant_pdf_welcometext is not None:
|
if participant_pdf_welcometext is not None:
|
||||||
@ -578,7 +585,44 @@ class ParticipantsPasswordsPDF(PDFView):
|
|||||||
]))
|
]))
|
||||||
story.append(t)
|
story.append(t)
|
||||||
|
|
||||||
|
class ParticipantsBadgePDF(PDFView):
|
||||||
|
permission_required = 'participant.can_manage_participant'
|
||||||
|
filename = _("participant-badges")
|
||||||
|
top_space = 0
|
||||||
|
|
||||||
|
def get_template(self, buffer):
|
||||||
|
return SimpleDocTemplate(buffer, topMargin=-6, bottomMargin=-6, leftMargin=0, rightMargin=0, showBoundary=False)
|
||||||
|
|
||||||
|
def build_document(self, pdf_document, story):
|
||||||
|
pdf_document.build(story)
|
||||||
|
|
||||||
|
def append_to_pdf(self, story):
|
||||||
|
data= []
|
||||||
|
for user in User.objects.all().order_by('last_name'):
|
||||||
|
try:
|
||||||
|
user.get_profile()
|
||||||
|
qrcode_img = qrcode.make( "%s%s" % (config['participant_pdf_system_url'], reverse('user_status', args=[user.id])) )
|
||||||
|
qrcode_img.save( settings.MEDIA_ROOT + 'qr-code_statusurl.png', 'PNG')
|
||||||
|
imgfile = settings.MEDIA_ROOT + 'qr-code_statusurl.png';
|
||||||
|
qrcode_statusurl = "<img src='%s' width='80' height='80'/>" % imgfile
|
||||||
|
cell = []
|
||||||
|
cell.append(Spacer(0,0.8*cm))
|
||||||
|
cell.append(Paragraph("%s %s" % (user.first_name, user.last_name), stylesheet['Badge_title']))
|
||||||
|
cell.append(Spacer(0,0.5*cm))
|
||||||
|
cell.append(Paragraph("%s" % (user.profile.group), stylesheet['Badge_subtitle']))
|
||||||
|
cell.append(Paragraph("%s" % (user.profile.committee), stylesheet['Badge_italic']))
|
||||||
|
cell.append(Spacer(0,2.25*cm))
|
||||||
|
cell.append(Paragraph(qrcode_statusurl, stylesheet['Badge_qrcode']))
|
||||||
|
# print cards
|
||||||
|
data.append([cell,cell])
|
||||||
|
except Profile.DoesNotExist:
|
||||||
|
pass
|
||||||
|
|
||||||
|
t=Table(data, 10.5*cm, 7.42*cm)
|
||||||
|
t.setStyle(TableStyle([ ('GRID', (0,0), (-1,-1), 0.25, colors.grey),
|
||||||
|
('VALIGN', (0,0), (-1,-1), 'TOP'),
|
||||||
|
]))
|
||||||
|
story.append(t)
|
||||||
|
|
||||||
class Config(FormView):
|
class Config(FormView):
|
||||||
permission_required = 'config.can_manage_config'
|
permission_required = 'config.can_manage_config'
|
||||||
|
@ -181,7 +181,29 @@ stylesheet.add(ParagraphStyle(name = 'Ballot_option_group_right',
|
|||||||
leading = 16,
|
leading = 16,
|
||||||
leftIndent = 49),
|
leftIndent = 49),
|
||||||
)
|
)
|
||||||
|
stylesheet.add(ParagraphStyle(name = 'Badge_title',
|
||||||
|
parent = stylesheet['Bold'],
|
||||||
|
fontSize = 16,
|
||||||
|
leading = 22,
|
||||||
|
leftIndent = 30),
|
||||||
|
)
|
||||||
|
stylesheet.add(ParagraphStyle(name = 'Badge_subtitle',
|
||||||
|
parent = stylesheet['Normal'],
|
||||||
|
fontSize = 12,
|
||||||
|
leading = 24,
|
||||||
|
leftIndent = 30),
|
||||||
|
)
|
||||||
|
stylesheet.add(ParagraphStyle(name = 'Badge_italic',
|
||||||
|
parent = stylesheet['Italic'],
|
||||||
|
fontSize = 12,
|
||||||
|
leading = 24,
|
||||||
|
leftIndent = 30),
|
||||||
|
)
|
||||||
|
|
||||||
|
stylesheet.add(ParagraphStyle(name = 'Badge_qrcode',
|
||||||
|
fontSize = 12,
|
||||||
|
leftIndent = 190),
|
||||||
|
)
|
||||||
|
|
||||||
def firstPage(canvas, doc):
|
def firstPage(canvas, doc):
|
||||||
canvas.saveState()
|
canvas.saveState()
|
||||||
|