Merge branch 'stable/1.7.x'

Conflicts:
	openslides/__init__.py
	openslides/assignment/views.py
	openslides/motion/pdf.py
	openslides/users/pdf.py
This commit is contained in:
Oskar Hahn 2015-01-23 02:33:17 +01:00
commit 8b88d38ac5
18 changed files with 1982 additions and 1733 deletions

View File

@ -27,12 +27,18 @@ Core:
- New feature to tag motions, agenda and assignments.
- Fixed search index problem to index contents of many-to-many tables
(e. g. tags of a motion).
- Fixed AttributeError in chatbox on_open method.
Motions:
- New Feature to create amendments, which are related to a parent motion.
- Added possibility to hide motions from non staff users in some states.
Other:
- Cleaned up utils.views to increase performance when fetching single objects
from the database for a view (#1378).
- Fixed bug on projector which was not updated when an object was deleted.
- Fixed bug and show special characters in PDF like ampersand (#1415).
- Updated pdf.js to 1.0.907.
- Improve the usage of bsmselect jquery plugin.
- Updated translations.
Version 1.6.1 (2014-12-08)

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2011-2014 OpenSlides Team
Copyright (c) 2011-2015 OpenSlides Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -634,7 +634,7 @@ class MainWindow(wx.Frame):
"assembly system.\n"
"OpenSlides is free software; licensed under the MIT license."
).replace(u" ", u"\u00a0"))
info.SetCopyright(_(u"\u00a9 2011-2014 by OpenSlides team"))
info.SetCopyright(_(u"\u00a9 2011-2015 by OpenSlides team"))
info.SetWebSite(("http://www.openslides.org/", "www.openslides.org"))
# XXX: at least on wxgtk this has no effect

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2011-2014 OpenSlides Team
Copyright (c) 2011-2015 OpenSlides Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -196,7 +196,7 @@ VS_VERSION_INFO VERSIONINFO
VALUE "FileDescription", "OpenSlides\\0"
VALUE "FileVersion", "{version_str}\\0"
VALUE "InternalName", "OpenSlides\\0"
VALUE "LegalCopyright", "Copyright \\251 2011-2014\\0"
VALUE "LegalCopyright", "Copyright \\251 2011-2015\\0"
VALUE "OriginalFilename", "openslides.exe\\0"
VALUE "ProductName", "OpenSlides\\0"
VALUE "ProductVersion", "{version_str}\\0"
@ -377,7 +377,7 @@ def openslides_launcher_update_version_resource():
"FileDescription": "OpenSlides",
"FileVersion": version_str,
"InternalName": "OpenSlides",
"LegalCopyright": u"Copyright \xa9 2011-2014",
"LegalCopyright": u"Copyright \xa9 2011-2015",
"OriginalFilename": "openslides.exe",
"ProductName": "OpenSlides",
"ProductVersion": version_str,

View File

@ -1,5 +1,6 @@
# TODO: Rename all views and template names
from cgi import escape
from datetime import datetime, timedelta
from json import dumps
@ -363,10 +364,10 @@ class AgendaPDF(PDFView):
if ancestors:
space = " " * 6 * ancestors.count()
story.append(Paragraph(
"%s%s" % (space, item.get_title()),
"%s%s" % (space, escape(item.get_title())),
stylesheet['Subitem']))
else:
story.append(Paragraph(item.get_title(), stylesheet['Item']))
story.append(Paragraph(escape(item.get_title()), stylesheet['Item']))
class SpeakerAppendView(SingleObjectMixin, RedirectView):

View File

@ -1,3 +1,5 @@
from cgi import escape
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
@ -338,9 +340,9 @@ class AssignmentPDF(PDFView):
except KeyError:
assignment_id = None
if assignment_id is None: # print all assignments
title = config["assignment_pdf_title"]
title = escape(config["assignment_pdf_title"])
story.append(Paragraph(title, stylesheet['Heading1']))
preamble = config["assignment_pdf_preamble"]
preamble = escape(config["assignment_pdf_preamble"])
if preamble:
story.append(Paragraph(
"%s" % preamble.replace('\r\n', '<br/>'),
@ -354,7 +356,7 @@ class AssignmentPDF(PDFView):
# List of assignments
for assignment in assignments:
story.append(Paragraph(
assignment.name, stylesheet['Heading3']))
escape(assignment.name), stylesheet['Heading3']))
# Assignment details (each assignment on single page)
for assignment in assignments:
story.append(PageBreak())
@ -368,7 +370,7 @@ class AssignmentPDF(PDFView):
def get_assignment(self, assignment, story):
# title
story.append(Paragraph(
_("Election: %s") % assignment.name, stylesheet['Heading1']))
_("Election: %s") % escape(assignment.name), stylesheet['Heading1']))
story.append(Spacer(0, 0.5 * cm))
# Filling table rows...
@ -503,7 +505,7 @@ class AssignmentPDF(PDFView):
# election description
story.append(
Paragraph("%s" % assignment.description.replace('\r\n', '<br/>'),
Paragraph("%s" % escape(assignment.description).replace('\r\n', '<br/>'),
stylesheet['Paragraph']))

View File

@ -23,13 +23,13 @@ class ChatboxSocketHandler(SockJSConnection):
engine = import_module(settings.SESSION_ENGINE)
try:
session_key = info.get_cookie(settings.SESSION_COOKIE_NAME).value
session = engine.SessionStore(session_key)
pk = session.get_decoded().get('_auth_user_id')
session_store = engine.SessionStore(session_key)
pk = session_store.get('_auth_user_id')
except AttributeError:
return False
try:
self.user = User.objects.get(pk)
self.user = User.objects.get(pk=pk)
except User.DoesNotExist:
return False

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,5 @@
from cgi import escape
from operator import attrgetter
import random
@ -36,7 +38,7 @@ def motion_to_pdf(pdf, motion):
identifier = ''
if motion.identifier:
identifier = ' %s' % motion.identifier
pdf.append(Paragraph('%s%s: %s' % (_('Motion'), identifier, motion.title), stylesheet['Heading1']))
pdf.append(Paragraph('%s%s: %s' % (_('Motion'), identifier, escape(motion.title)), stylesheet['Heading1']))
motion_data = []
@ -138,7 +140,7 @@ def motion_to_pdf(pdf, motion):
pdf.append(Spacer(0, 1 * cm))
# motion title
pdf.append(Paragraph(motion.title, stylesheet['Heading3']))
pdf.append(Paragraph(escape(motion.title), stylesheet['Heading3']))
# motion text
convert_html_to_reportlab(pdf, motion.text)
@ -230,9 +232,9 @@ def all_motion_cover(pdf, motions):
"""
Create a coverpage for all motions.
"""
pdf.append(Paragraph(config["motion_pdf_title"], stylesheet['Heading1']))
pdf.append(Paragraph(escape(config["motion_pdf_title"]), stylesheet['Heading1']))
preamble = config["motion_pdf_preamble"]
preamble = escape(config["motion_pdf_preamble"])
if preamble:
pdf.append(Paragraph("%s" % preamble.replace('\r\n', '<br/>'), stylesheet['Paragraph']))
@ -244,7 +246,7 @@ def all_motion_cover(pdf, motions):
categories = True
if i == 0:
pdf.append(Paragraph(_("Categories"), stylesheet['Heading2']))
pdf.append(Paragraph("%s &nbsp;&nbsp; %s" % (category.prefix, category.name), stylesheet['Paragraph']))
pdf.append(Paragraph("%s &nbsp;&nbsp; %s" % (escape(category.prefix), escape(category.name)), stylesheet['Paragraph']))
if categories:
pdf.append(PageBreak())
@ -256,7 +258,7 @@ def all_motion_cover(pdf, motions):
identifier = ''
if motion.identifier:
identifier = ' %s' % motion.identifier
pdf.append(Paragraph('%s%s: %s' % (_('Motion'), identifier, motion.title), stylesheet['Heading3']))
pdf.append(Paragraph('%s%s: %s' % (_('Motion'), identifier, escape(motion.title)), stylesheet['Heading3']))
def motion_poll_to_pdf(pdf, poll):

View File

@ -1,3 +1,5 @@
from cgi import escape
from django.utils.translation import ugettext as _
from reportlab.graphics.barcode.qr import QrCodeWidget
from reportlab.graphics.shapes import Drawing
@ -28,13 +30,13 @@ def users_to_pdf(pdf):
groups = ''
for group in user.groups.all():
if group.pk != 2:
groups += "%s<br/>" % _(group.name)
groups += "%s<br/>" % escape(_(group.name))
data.append([
counter,
Paragraph(user.title, stylesheet['Tablecell']),
Paragraph(user.last_name, stylesheet['Tablecell']),
Paragraph(user.first_name, stylesheet['Tablecell']),
Paragraph(user.structure_level, stylesheet['Tablecell']),
Paragraph(escape(user.last_name), stylesheet['Tablecell']),
Paragraph(escape(user.first_name), stylesheet['Tablecell']),
Paragraph(escape(user.structure_level), stylesheet['Tablecell']),
Paragraph(groups, stylesheet['Tablecell'])])
t = LongTable(data, style=[
('VALIGN', (0, 0), (-1, -1), 'TOP'),
@ -80,7 +82,7 @@ def users_passwords_to_pdf(pdf):
qrcode_wlan_draw.add(qrcode_wlan)
for user in User.objects.all().order_by(sort):
pdf.append(Paragraph(user, stylesheet['h1']))
pdf.append(Paragraph(escape(user), stylesheet['h1']))
pdf.append(Spacer(0, 1 * cm))
data = []
# WLAN access data
@ -89,15 +91,15 @@ def users_passwords_to_pdf(pdf):
stylesheet['h2']))
cell.append(Paragraph("%s:" % _("WLAN name (SSID)"),
stylesheet['formfield']))
cell.append(Paragraph(users_pdf_wlan_ssid,
cell.append(Paragraph(escape(users_pdf_wlan_ssid),
stylesheet['formfield_value']))
cell.append(Paragraph("%s:" % _("WLAN password"),
stylesheet['formfield']))
cell.append(Paragraph(users_pdf_wlan_password,
cell.append(Paragraph(escape(users_pdf_wlan_password),
stylesheet['formfield_value']))
cell.append(Paragraph("%s:" % _("WLAN encryption"),
stylesheet['formfield']))
cell.append(Paragraph(users_pdf_wlan_encryption,
cell.append(Paragraph(escape(users_pdf_wlan_encryption),
stylesheet['formfield_value']))
cell.append(Spacer(0, 0.5 * cm))
# OpenSlides access data
@ -106,15 +108,15 @@ def users_passwords_to_pdf(pdf):
stylesheet['h2']))
cell2.append(Paragraph("%s:" % _("Username"),
stylesheet['formfield']))
cell2.append(Paragraph(user.username,
cell2.append(Paragraph(escape(user.username),
stylesheet['formfield_value']))
cell2.append(Paragraph("%s:" % _("Password"),
stylesheet['formfield']))
cell2.append(Paragraph(user.default_password,
cell2.append(Paragraph(escape(user.default_password),
stylesheet['formfield_value']))
cell2.append(Paragraph("URL:",
stylesheet['formfield']))
cell2.append(Paragraph(users_pdf_url,
cell2.append(Paragraph(escape(users_pdf_url),
stylesheet['formfield_value']))
data.append([cell, cell2])
# QRCodes
@ -138,8 +140,8 @@ def users_passwords_to_pdf(pdf):
pdf.append(Spacer(0, 2 * cm))
# welcome title and text
pdf.append(Paragraph(users_pdf_welcometitle, stylesheet['h2']))
pdf.append(Paragraph(users_pdf_welcometext.replace('\r\n', '<br/>'),
pdf.append(Paragraph(escape(users_pdf_welcometitle), stylesheet['h2']))
pdf.append(Paragraph(escape(users_pdf_welcometext).replace('\r\n', '<br/>'),
stylesheet['Paragraph12']))
pdf.append(PageBreak())
return pdf