Merge branch 'stable/1.6.x'

Conflicts:
	tests/assignment/test_views.py
This commit is contained in:
Oskar Hahn 2014-10-18 08:53:51 +02:00
commit 5c6f7a41a8
25 changed files with 374 additions and 174 deletions

View File

@ -15,6 +15,27 @@ Version 1.6.1 (unreleased)
==========================
[https://github.com/OpenSlides/OpenSlides/issues?milestone=16]
Agenda:
- Fixed error in item numbers.
Motions:
- Show supporters on motion slide if available.
- Fixed motion detail view template. Added block to enable extra content via
plugins.
Assignments:
- Fixed PDF when an assignment has a lot of posts. Used only 7 signature
lines.
Participants:
- Fixed participant csv import with group ids:
* Allowed to add multiple groups in csv group id field, e. g. "3,4".
* Fixed bug that group ids greater than 9 can not be imported.
* Updated error message if group id does not exists.
Other:
- Fixed CKEditor stuff (added insertpre plugin and removed unused code).
Version 1.6 (2014-06-02)
========================

View File

@ -13,7 +13,7 @@ Teilnehmer/innen-Namen aus http://de.wikipedia.org/wiki/Otto_Normalverbraucher";
;"Tädi";"Maali";"female";;3;"Estland";;;;1
;"Maija";"Maikäläinen";"female";;3;"Finnland";;;;1
;"Jean";"Dupont";"male";;3;"Frankreich";;;;1
;"Paul";"Martin";"female";;4;"Frankreich";"Versammlungsleitung";;;1
;"Paul";"Martin";"male";;"3,4";"Frankreich";"Versammlungsleitung";;;1
;"Fred";"Bloggs";"male";;3;"Großbritanien";;;;0
;"John";"Smith";"male";;4;"Großbritanien";"Versammlungsleitung";;;1
;"Ashok";"Kumar";"male";;3;"Indien";;;;1

1 Titel Vorname Nachname Geschlecht E-Mail Gruppen-ID Gliederungsebene Amt Über mich Kommentar Aktiviert
13 Paul Martin female male 4 3,4 Frankreich Versammlungsleitung 1
14 Fred Bloggs male 3 Großbritanien 0
15 John Smith male 4 Großbritanien Versammlungsleitung 1
16 Ashok Kumar male 3 Indien 1
17 Si Polan male Indonesien 1
18 Seán Citizen male 3 Irland 1
19 Jóna Jónsson female 3 Island 1

View File

@ -161,11 +161,12 @@ class Item(SlideMixin, AbsoluteUrlMixin, MPTTModel):
"""
Return the title of this item.
"""
item_no = self.item_no
if not self.content_object:
item_no = self.item_no
return '%s %s' % (item_no, self.title) if item_no else self.title
try:
return self.content_object.get_agenda_title()
agenda_title = self.content_object.get_agenda_title()
return '%s %s' % (item_no, agenda_title) if item_no else agenda_title
except AttributeError:
raise NotImplementedError('You have to provide a get_agenda_title method on your related model.')
@ -302,10 +303,12 @@ class Item(SlideMixin, AbsoluteUrlMixin, MPTTModel):
@property
def item_no(self):
item_no = None
if self.item_number:
item_no = '%s %s' % (config['agenda_number_prefix'], self.item_number)
else:
item_no = None
if config['agenda_number_prefix']:
item_no = '%s %s' % (config['agenda_number_prefix'], self.item_number)
else:
item_no = str(self.item_number)
return item_no
def calc_item_no(self):

View File

@ -363,7 +363,7 @@ class AssignmentPDF(PDFView):
"<seq id='counter'/>.&nbsp; %s" % candidate,
stylesheet['Signaturefield']))
if assignment.status == "sea":
for x in range(0, 2 * assignment.posts):
for x in range(0, 7):
cell2b.append(
Paragraph(
"<seq id='counter'/>.&nbsp; "

View File

@ -0,0 +1,27 @@
CKEditor Insert &lt;pre&gt; Plugin
===============================
This plugin makes it easier to insert a &lt;pre&gt; tag in CKEditor.
Installation
------------
1. Clone/copy this repository contents in a new "plugins/insertpre" folder in your CKEditor installation.
2. Enable the "insertpre" plugin in the CKEditor configuration file (config.js):
config.extraPlugins = 'insertpre';
That's all. "InsertPre" button will appear on the editor toolbar and will be ready to use.
3. Optionally, you may specify which class should be added to the &lt;pre&gt; element:
CKEDITOR.config.insertpre_class = 'prettyprint';
As well as specify how the &lt;pre&gt; tag should be rendered inside CKEditor:
CKEDITOR.config.insertpre_style = 'background-color:#F8F8F8;border:1px solid #DDD;padding:10px;';
License
-------
Licensed under the terms of any of the following licenses at your choice: [GPL](http://www.gnu.org/licenses/gpl.html), [LGPL](http://www.gnu.org/licenses/lgpl.html) and [MPL](http://www.mozilla.org/MPL/MPL-1.1.html).

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

View File

@ -0,0 +1,6 @@
CKEDITOR.plugins.setLang( 'insertpre', 'en', {
title : 'Insert code snippet',
code : 'Code',
edit : 'Edit code',
notEmpty : 'The code field cannot be empty.'
});

View File

@ -0,0 +1,6 @@
CKEDITOR.plugins.setLang( 'insertpre', 'pl', {
title : 'Wstaw kod',
code : 'Kod',
edit : 'Edytuj',
notEmpty: 'Pole z kodem nie może być puste.'
});

View File

@ -0,0 +1,131 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.add( 'insertpre',
{
requires: 'dialog',
lang : 'en,pl', // %REMOVE_LINE_CORE%
icons: 'insertpre', // %REMOVE_LINE_CORE%
onLoad : function()
{
if ( CKEDITOR.config.insertpre_class )
{
CKEDITOR.addCss(
'pre.' + CKEDITOR.config.insertpre_class + ' {' +
CKEDITOR.config.insertpre_style +
'}'
);
}
},
init : function( editor )
{
// allowed and required content is the same for this plugin
var required = CKEDITOR.config.insertpre_class ? ( 'pre( ' + CKEDITOR.config.insertpre_class + ' )' ) : 'pre';
editor.addCommand( 'insertpre', new CKEDITOR.dialogCommand( 'insertpre', {
allowedContent : required,
requiredContent : required
} ) );
editor.ui.addButton && editor.ui.addButton( 'InsertPre',
{
label : editor.lang.insertpre.title,
icon : this.path + 'icons/insertpre.png',
command : 'insertpre',
toolbar: 'insert,99'
} );
if ( editor.contextMenu )
{
editor.addMenuGroup( 'code' );
editor.addMenuItem( 'insertpre',
{
label : editor.lang.insertpre.edit,
icon : this.path + 'icons/insertpre.png',
command : 'insertpre',
group : 'code'
});
editor.contextMenu.addListener( function( element )
{
if ( element )
element = element.getAscendant( 'pre', true );
if ( element && !element.isReadOnly() && element.hasClass( editor.config.insertpre_class ) )
return { insertpre : CKEDITOR.TRISTATE_OFF };
return null;
});
}
CKEDITOR.dialog.add( 'insertpre', function( editor )
{
return {
title : editor.lang.insertpre.title,
minWidth : 540,
minHeight : 380,
contents : [
{
id : 'general',
label : editor.lang.insertpre.code,
elements : [
{
type : 'textarea',
id : 'contents',
label : editor.lang.insertpre.code,
cols: 140,
rows: 22,
validate : CKEDITOR.dialog.validate.notEmpty( editor.lang.insertpre.notEmpty ),
required : true,
setup : function( element )
{
var html = element.getHtml();
if ( html )
{
var div = document.createElement( 'div' );
div.innerHTML = html;
this.setValue( div.firstChild.nodeValue );
}
},
commit : function( element )
{
element.setHtml( CKEDITOR.tools.htmlEncode( this.getValue() ) );
}
}
]
}
],
onShow : function()
{
var sel = editor.getSelection(),
element = sel.getStartElement();
if ( element )
element = element.getAscendant( 'pre', true );
if ( !element || element.getName() != 'pre' || !element.hasClass( editor.config.insertpre_class ) )
{
element = editor.document.createElement( 'pre' );
this.insertMode = true;
}
else
this.insertMode = false;
this.pre = element;
this.setupContent( this.pre );
},
onOk : function()
{
if ( editor.config.insertpre_class )
this.pre.setAttribute( 'class', editor.config.insertpre_class );
if ( this.insertMode )
editor.insertElement( this.pre );
this.commitContent( this.pre );
}
};
} );
}
} );
if (typeof(CKEDITOR.config.insertpre_style) == 'undefined')
CKEDITOR.config.insertpre_style = 'background-color:#F8F8F8;border:1px solid #DDD;padding:10px;';
if (typeof(CKEDITOR.config.insertpre_class) == 'undefined')
CKEDITOR.config.insertpre_class = 'prettyprint';

View File

@ -194,6 +194,12 @@ legend + .control-group {
font-weight: bold;
}
/* ckeditor plugin insertpre: textarea style */
table.cke_dialog_contents textarea {
font-family: monospace !important;
}
/** Left sidebar navigation **/
.leftmenu ul {
margin: 0;

View File

@ -1,43 +0,0 @@
/*
* Configuration file for the CKeditor
*/
var ck_options = {
// Using a custom CSS file allows us to specifically style elements entered
// using the editor. Using the CSS prefix class .ckeditor_html prevents these
// styles from meddling with the main layout
contentsCss: "/static/css/ckeditor.css",
bodyClass: "ckeditor_html",
allowedContent:
'h1 h2 h3 pre b i u strike em;' +
// A workaround for the problem described in http://dev.ckeditor.com/ticket/10192
// Hopefully, the problem will be solved in the final version of CKEditor 4.1
// If so, then {margin-left} can be removed
'p{margin-left};' +
'a[!href];' +
'ol ul{list-style};' +
'li;' +
'span{color,background-color};',
removePlugins: "save, print, preview, pagebreak, templates, showblocks, magicline",
// Not part of the standard package of CKEditor
// http://ckeditor.com/addon/insertpre
extraPlugins: "insertpre",
toolbar_Full: [
{ name: 'document', items : [ 'Source','-','Save','DocProps','Preview','Print','-','Templates' ] },
{ name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
{ name: 'editing', items : [ 'Find','Replace','-','SpellChecker', 'Scayt' ] },
{ name: 'forms', items : [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
{ name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] },
{ name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Pre','InsertPre','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] },
{ name: 'links', items : [ 'Link','Unlink','Anchor' ] },
{ name: 'styles', items : [ 'Format','FontSize','TextColor','BGColor' ] },
{ name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] }
],
toolbar: 'Full'
};

View File

@ -134,7 +134,6 @@ INSTALLED_PLUGINS = collect_plugins()
# CKeditor settings
CKEDITOR_DEFAULT_CONFIG = {'toolbar': 'Full',
'contentsCss': '/static/css/ckeditor.css',
'bodyClass': 'ckeditor_html',
'allowedContent':
'h1 h2 h3 pre b i u strike em; '
@ -147,14 +146,16 @@ CKEDITOR_DEFAULT_CONFIG = {'toolbar': 'Full',
'a[!href]; '
'ol ul{list-style}; '
'li; '
'pre; '
'span{color,background-color}; ',
'removePlugins': 'save, print, preview, pagebreak, templates, showblocks, magicline',
'extraPlugins': 'insertpre', # see http://ckeditor.com/addon/insertpre
'toolbar_Full': [
{'name': 'document', 'items': ['Source', '-', 'Save', 'DocProps', 'Preview', 'Print', '-', 'Templates']},
{'name': 'clipboard', 'items': ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo']},
{'name': 'editing', 'items': ['Find', 'Replace', '-', 'SpellChecker', 'Scayt']},
{'name': 'basicstyles', 'items': ['Bold', 'Italic', 'Underline', 'Strike', '-', 'RemoveFormat']},
{'name': 'paragraph', 'items': ['NumberedList', 'BulletedList', '-', 'Pre', 'InsertPre']},
{'name': 'paragraph', 'items': ['NumberedList', 'BulletedList', '-', 'InsertPre']},
{'name': 'links', 'items': ['Link', 'Unlink']},
{'name': 'styles', 'items': ['Format', 'TextColor', 'BGColor']},
{'name': 'tools', 'items': ['Maximize', 'ShowBlocks', '-', 'About']}

View File

@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-05-20 12:31+0200\n"
"POT-Creation-Date: 2014-10-16 23:25+0200\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -40,7 +40,7 @@ msgid "None"
msgstr ""
#: agenda/csv_import.py:22 motion/csv_import.py:37
#: participant/csv_import.py:72
#: participant/csv_import.py:70
msgid "Import file has wrong character encoding, only UTF-8 is supported!"
msgstr ""
@ -62,7 +62,7 @@ msgstr ""
msgid "Invalid format. Hours from 0 to 99 and minutes from 00 to 59"
msgstr ""
#: agenda/forms.py:30 agenda/templates/agenda/overview.html:88
#: agenda/forms.py:30 agenda/templates/agenda/overview.html:89
msgid "Duration"
msgstr ""
@ -84,7 +84,7 @@ msgstr ""
#: agenda/templates/agenda/item_slide_summary.html:7
#: agenda/templates/agenda/overview.html:7
#: agenda/templates/agenda/overview.html:34
#: agenda/templates/agenda/overview.html:96
#: agenda/templates/agenda/overview.html:97
#: agenda/templates/agenda/widget_item.html:18
#: agenda/templates/search/agenda-results.html:7
#: agenda/templates/search/agenda-results.html:13
@ -115,7 +115,7 @@ msgstr ""
msgid "Text"
msgstr ""
#: agenda/models.py:56 agenda/templates/agenda/overview.html:85
#: agenda/models.py:56 agenda/templates/agenda/overview.html:86
#: agenda/templates/agenda/view.html:54 participant/models.py:46
#: participant/templates/participant/overview.html:55
#: participant/templates/participant/user_detail.html:71
@ -158,16 +158,16 @@ msgstr ""
msgid "Organizational items can not have agenda items as child elements."
msgstr ""
#: agenda/models.py:345
#: agenda/models.py:348
#, python-format
msgid "%(person)s is already on the list of speakers of item %(id)s."
msgstr ""
#: agenda/models.py:349
#: agenda/models.py:352
msgid "An anonymous user can not be on lists of speakers."
msgstr ""
#: agenda/models.py:389
#: agenda/models.py:392
msgid "Can put oneself on the list of speakers"
msgstr ""
@ -294,7 +294,7 @@ msgstr ""
#: agenda/views.py:648
#: agenda/templates/agenda/item_slide_list_of_speaker.html:26
#: agenda/templates/agenda/overlay_speaker_projector.html:17
#: agenda/templates/agenda/overlay_speaker_projector.html:20
msgid "The list of speakers is empty."
msgstr ""
@ -310,7 +310,7 @@ msgstr ""
#: agenda/views.py:716 agenda/widgets.py:44
#: agenda/templates/agenda/current_list_of_speakers_projector.html:4
#: agenda/templates/agenda/item_slide_list_of_speaker.html:9
#: agenda/templates/agenda/overlay_speaker_projector.html:4
#: agenda/templates/agenda/overlay_speaker_projector.html:7
#: agenda/templates/agenda/overlay_speaker_widget.html:4
#: agenda/templates/agenda/overview.html:43
#: agenda/templates/agenda/view.html:60
@ -341,7 +341,7 @@ msgstr ""
#: mediafile/templates/mediafile/mediafile_form.html:22
#: motion/templates/motion/category_list.html:15
#: motion/templates/motion/motion_detail.html:35
#: motion/templates/motion/motion_form.html:51
#: motion/templates/motion/motion_form.html:50
#: motion/templates/motion/motion_form_csv_import.html:11
#: participant/templates/participant/edit.html:42
#: participant/templates/participant/group_detail.html:12
@ -364,7 +364,7 @@ msgstr ""
#: config/templates/config/config_form.html:47
#: mediafile/templates/mediafile/mediafile_form.html:33
#: motion/templates/motion/category_form.html:27
#: motion/templates/motion/motion_form.html:60
#: motion/templates/motion/motion_form.html:59
#: motion/templates/motion/motion_form_csv_import.html:42
#: motion/templates/motion/motionpoll_form.html:84
#: participant/templates/participant/edit.html:56
@ -381,7 +381,7 @@ msgstr ""
#: core/templates/core/customslide_update.html:18
#: mediafile/templates/mediafile/mediafile_form.html:35
#: motion/templates/motion/category_form.html:30
#: motion/templates/motion/motion_form.html:63
#: motion/templates/motion/motion_form.html:62
#: motion/templates/motion/motion_form_csv_import.html:45
#: participant/templates/participant/edit.html:59
#: participant/templates/participant/group_edit.html:34
@ -460,12 +460,12 @@ msgstr ""
#: agenda/templates/agenda/item_row.html:22
#: agenda/templates/agenda/widget_item.html:32
#: assignment/templates/assignment/assignment_detail.html:173
#: assignment/templates/assignment/assignment_list.html:65
#: assignment/templates/assignment/assignment_list.html:68
#: assignment/templates/assignment/widget_assignment.html:16
#: core/templates/core/widget_customslide.html:34
#: mediafile/templates/mediafile/mediafile_list.html:38
#: motion/templates/motion/category_list.html:30
#: motion/templates/motion/motion_list.html:100
#: motion/templates/motion/motion_list.html:103
#: motion/templates/motion/widget_motion.html:16
#: participant/templates/participant/group_overview.html:58
#: participant/templates/participant/overview.html:117
@ -477,12 +477,12 @@ msgstr ""
#: agenda/templates/agenda/item_row.html:25
#: agenda/templates/agenda/view.html:128
#: assignment/templates/assignment/assignment_detail.html:175
#: assignment/templates/assignment/assignment_list.html:69
#: assignment/templates/assignment/assignment_list.html:72
#: core/templates/core/widget_customslide.html:30
#: mediafile/templates/mediafile/mediafile_list.html:39
#: motion/templates/motion/category_list.html:33
#: motion/templates/motion/motion_detail.html:146
#: motion/templates/motion/motion_list.html:103
#: motion/templates/motion/motion_list.html:106
#: participant/templates/participant/group_overview.html:62
#: participant/templates/participant/overview.html:122
msgid "Delete"
@ -514,7 +514,7 @@ msgid "Item closed"
msgstr ""
#: agenda/templates/agenda/item_slide_list_of_speaker.html:10
#: agenda/templates/agenda/overlay_speaker_projector.html:4
#: agenda/templates/agenda/overlay_speaker_projector.html:7
#: agenda/templates/agenda/view.html:60
msgid "closed"
msgstr ""
@ -534,7 +534,7 @@ msgstr ""
#: assignment/templates/assignment/assignment_detail.html:215
#: assignment/templates/assignment/assignmentpoll_slide.html:24
#: motion/models.py:712 motion/pdf.py:129 motion/pdf.py:274
#: motion/templates/motion/motion_detail.html:228
#: motion/templates/motion/motion_detail.html:230
#: motion/templates/motion/motionpoll_slide.html:20
#: motion/templates/motion/slide.html:23 utils/views.py:330
msgid "Yes"
@ -546,7 +546,7 @@ msgstr ""
#: assignment/templates/assignment/assignment_detail.html:212
#: assignment/templates/assignment/assignmentpoll_slide.html:26
#: motion/models.py:712 motion/pdf.py:129 motion/pdf.py:276
#: motion/templates/motion/motion_detail.html:229
#: motion/templates/motion/motion_detail.html:231
#: motion/templates/motion/motionpoll_slide.html:24
#: motion/templates/motion/slide.html:24 utils/views.py:330
msgid "No"
@ -571,52 +571,52 @@ msgstr ""
msgid "Current list of speakers"
msgstr ""
#: agenda/templates/agenda/overview.html:51
#: agenda/templates/agenda/overview.html:52
msgid "Number agenda items"
msgstr ""
#: agenda/templates/agenda/overview.html:57
msgid "Hide closed items"
msgstr ""
#: agenda/templates/agenda/overview.html:54
#: agenda/templates/agenda/overview.html:60
msgid "item"
msgid_plural "items"
msgstr[0] ""
msgstr[1] ""
#: agenda/templates/agenda/overview.html:62
#: agenda/templates/agenda/overview.html:68
msgid "Start of event"
msgstr ""
#: agenda/templates/agenda/overview.html:66
#: agenda/templates/agenda/overview.html:72
msgid "Estimated end"
msgstr ""
#: agenda/templates/agenda/overview.html:71
#: agenda/templates/agenda/overview.html:77
msgid "Set start time of event"
msgstr ""
#: agenda/templates/agenda/overview.html:75
msgid "Number agenda items"
msgstr ""
#: agenda/templates/agenda/overview.html:83
#: agenda/templates/agenda/overview.html:84
msgid "Item"
msgstr ""
#: agenda/templates/agenda/overview.html:91
#: assignment/templates/assignment/assignment_list.html:36
#: agenda/templates/agenda/overview.html:92
#: assignment/templates/assignment/assignment_list.html:37
#: mediafile/templates/mediafile/mediafile_list.html:24
#: motion/templates/motion/category_list.html:23
#: motion/templates/motion/motion_detail.html:122
#: motion/templates/motion/motion_list.html:59
#: motion/templates/motion/motion_list.html:60
#: participant/templates/participant/group_overview.html:33
#: participant/templates/participant/overview.html:57
msgid "Actions"
msgstr ""
#: agenda/templates/agenda/overview.html:110
#: agenda/templates/agenda/overview.html:111
msgid "Show agenda"
msgstr ""
#: agenda/templates/agenda/overview.html:133
#: agenda/templates/agenda/overview.html:134
#: agenda/templates/agenda/widget_item.html:59
#: core/templates/core/widget_customslide.html:43
msgid "No items available."
@ -1001,7 +1001,7 @@ msgstr ""
#: assignment/templates/assignment/assignment_detail.html:65
#: assignment/templates/assignment/assignment_detail.html:149
#: assignment/templates/assignment/assignment_list.html:34
#: assignment/templates/assignment/assignment_list.html:48
#: assignment/templates/assignment/assignment_list.html:50
#: assignment/templates/assignment/assignmentpoll_form.html:44
#: assignment/templates/assignment/slide.html:29
msgid "Candidates"
@ -1038,7 +1038,7 @@ msgstr ""
#: assignment/templates/assignment/assignment_detail.html:234
#: assignment/templates/assignment/assignmentpoll_form.html:61
#: assignment/templates/assignment/assignmentpoll_slide.html:39
#: motion/pdf.py:119 motion/templates/motion/motion_detail.html:234
#: motion/pdf.py:119 motion/templates/motion/motion_detail.html:236
#: motion/templates/motion/motionpoll_form.html:54
#: motion/templates/motion/motionpoll_slide.html:33
#: motion/templates/motion/slide.html:29 poll/models.py:84
@ -1050,7 +1050,7 @@ msgstr ""
#: assignment/templates/assignment/assignment_detail.html:250
#: assignment/templates/assignment/assignmentpoll_form.html:71
#: assignment/templates/assignment/assignmentpoll_slide.html:45
#: motion/pdf.py:121 motion/templates/motion/motion_detail.html:237
#: motion/pdf.py:121 motion/templates/motion/motion_detail.html:239
#: motion/templates/motion/motionpoll_form.html:58
#: motion/templates/motion/motionpoll_slide.html:39
#: motion/templates/motion/slide.html:32 poll/models.py:86
@ -1062,7 +1062,7 @@ msgstr ""
#: assignment/templates/assignment/assignment_detail.html:266
#: assignment/templates/assignment/assignmentpoll_form.html:81
#: assignment/templates/assignment/assignmentpoll_slide.html:51
#: motion/pdf.py:123 motion/templates/motion/motion_detail.html:242
#: motion/pdf.py:123 motion/templates/motion/motion_detail.html:244
#: motion/templates/motion/motionpoll_form.html:62
#: motion/templates/motion/motionpoll_slide.html:45
#: motion/templates/motion/slide.html:37 poll/models.py:88
@ -1092,19 +1092,18 @@ msgstr[1] ""
#: assignment/templates/assignment/assignment_detail.html:213
#: assignment/templates/assignment/assignmentpoll_slide.html:28
#: motion/pdf.py:129 motion/pdf.py:278
#: motion/templates/motion/motion_detail.html:230
#: motion/templates/motion/motion_detail.html:232
#: motion/templates/motion/motionpoll_slide.html:28
#: motion/templates/motion/slide.html:25
msgid "Abstention"
msgstr ""
#: assignment/templates/assignment/assignment_detail.html:22
#: assignment/templates/assignment/assignment_list.html:74
msgid "Print election as PDF"
msgstr ""
#: assignment/templates/assignment/assignment_detail.html:27
#: assignment/templates/assignment/assignment_list.html:59
#: assignment/templates/assignment/assignment_list.html:62
#: assignment/templates/assignment/assignmentpoll_form.html:21
msgid "Show election"
msgstr ""
@ -1165,7 +1164,7 @@ msgstr ""
#: assignment/templates/assignment/assignment_detail.html:171
#: assignment/templates/assignment/assignmentpoll_form.html:96
#: motion/templates/motion/motion_detail.html:218
#: motion/templates/motion/motion_detail.html:221
#: motion/templates/motion/motionpoll_form.html:72
msgid "Ballot paper as PDF"
msgstr ""
@ -1220,12 +1219,12 @@ msgstr ""
msgid "Print all elections as PDF"
msgstr ""
#: assignment/templates/assignment/assignment_list.html:44
#: assignment/templates/assignment/assignment_list.html:46
msgctxt "Number of searched candidates for an election"
msgid "Posts"
msgstr ""
#: assignment/templates/assignment/assignment_list.html:51
#: assignment/templates/assignment/assignment_list.html:53
msgid "Elected"
msgstr ""
@ -1516,7 +1515,7 @@ msgstr ""
#: motion/templates/motion/motion_diff.html:35
#: motion/templates/motion/motion_diff.html:39
#: motion/templates/motion/motionpoll_slide.html:10
#: motion/templates/motion/slide.html:70
#: motion/templates/motion/slide.html:80
msgid "Version"
msgstr ""
@ -1657,7 +1656,7 @@ msgstr ""
msgid "Motion imported"
msgstr ""
#: motion/csv_import.py:123 participant/csv_import.py:83
#: motion/csv_import.py:123 participant/csv_import.py:81
msgid "Errors"
msgstr ""
@ -1677,7 +1676,7 @@ msgstr ""
#: motion/forms.py:39 motion/models.py:542 motion/pdf.py:152
#: motion/templates/motion/motion_detail.html:94
#: motion/templates/motion/motion_diff.html:54
#: motion/templates/motion/slide.html:77
#: motion/templates/motion/slide.html:91
msgid "Reason"
msgstr ""
@ -1695,6 +1694,7 @@ msgstr ""
#: motion/forms.py:92 motion/pdf.py:74 motion/signals.py:86
#: motion/templates/motion/motion_detail.html:190
#: motion/templates/motion/motion_list.html:56
#: motion/templates/motion/slide.html:61
msgid "Supporters"
msgstr ""
@ -1706,9 +1706,9 @@ msgstr ""
msgid "Don't create a new version. Useful e.g. for trivial changes."
msgstr ""
#: motion/forms.py:121 motion/templates/motion/motion_detail.html:265
#: motion/forms.py:121 motion/templates/motion/motion_detail.html:266
#: motion/templates/motion/motion_list.html:52
#: motion/templates/motion/slide.html:60
#: motion/templates/motion/slide.html:70
msgid "Category"
msgstr ""
@ -1778,7 +1778,7 @@ msgstr ""
#: motion/templates/motion/motionpoll_form.html:7
#: motion/templates/motion/motionpoll_form.html:15
#: motion/templates/motion/motionpoll_slide.html:9
#: motion/templates/motion/slide.html:69
#: motion/templates/motion/slide.html:79
#: motion/templates/search/motion-results.html:7
msgid "Motion"
msgstr ""
@ -2152,14 +2152,14 @@ msgid "Print motion as PDF"
msgstr ""
#: motion/templates/motion/motion_detail.html:41
#: motion/templates/motion/motion_list.html:95
#: motion/templates/motion/motion_list.html:98
#: motion/templates/motion/motionpoll_form.html:22
msgid "Show motion"
msgstr ""
#: motion/templates/motion/motion_detail.html:53
#: motion/templates/motion/motion_form.html:33
#: motion/templates/motion/motion_form.html:43
#: motion/templates/motion/motion_form.html:32
#: motion/templates/motion/motion_form.html:42
msgid "Edit motion"
msgstr ""
@ -2199,69 +2199,65 @@ msgstr ""
msgid "Show log"
msgstr ""
#: motion/templates/motion/motion_detail.html:212
#: motion/templates/motion/motion_detail.html:213
#: motion/templates/motion/motionpoll_slide.html:11
msgid "vote"
msgstr ""
#: motion/templates/motion/motion_detail.html:215
#: motion/templates/motion/motion_detail.html:218
#: motion/templates/motion/motionpoll_form.html:26
msgid "Show vote result"
msgstr ""
#: motion/templates/motion/motion_detail.html:220
#: motion/templates/motion/motion_detail.html:223
msgid "Edit Vote"
msgstr ""
#: motion/templates/motion/motion_detail.html:222
#: motion/templates/motion/motion_detail.html:225
#: motion/templates/motion/motionpoll_form.html:31
msgid "Delete Vote"
msgstr ""
#: motion/templates/motion/motion_detail.html:248
#: motion/templates/motion/motion_detail.html:249
msgid "No result"
msgstr ""
#: motion/templates/motion/motion_detail.html:258
#: motion/templates/motion/motion_detail.html:259
msgid "New vote"
msgstr ""
#: motion/templates/motion/motion_detail.html:275
#: motion/templates/motion/motion_detail.html:276
msgid "Last changes (of this version)"
msgstr ""
#: motion/templates/motion/motion_detail.html:277
#: motion/templates/motion/motion_detail.html:278
#: motion/templates/motion/motion_diff.html:36
#: motion/templates/motion/motion_diff.html:40
#: motion/templates/motion/motion_list.html:58
msgid "Last changes"
msgstr ""
#: motion/templates/motion/motion_detail.html:287
msgid "Withdraw motion"
msgstr ""
#: motion/templates/motion/motion_detail.html:296
#: motion/templates/motion/motion_detail.html:288
msgid "Unsupport"
msgstr ""
#: motion/templates/motion/motion_detail.html:302
#: motion/templates/motion/motion_detail.html:294
msgid "Support"
msgstr ""
#: motion/templates/motion/motion_detail.html:310
#: motion/templates/motion/motion_detail.html:302
msgid "minimum required supporters"
msgstr ""
#: motion/templates/motion/motion_detail.html:317
#: motion/templates/motion/motion_detail.html:309
msgid "Manage motion"
msgstr ""
#: motion/templates/motion/motion_detail.html:327
#: motion/templates/motion/motion_detail.html:319
msgid "For administration only:"
msgstr ""
#: motion/templates/motion/motion_detail.html:329
#: motion/templates/motion/motion_detail.html:321
msgid "Reset state"
msgstr ""
@ -2274,13 +2270,13 @@ msgid "Diff view"
msgstr ""
#: motion/templates/motion/motion_diff.html:27
#: motion/templates/motion/motion_form.html:49
#: motion/templates/motion/motion_form.html:48
#: motion/templates/motion/motionpoll_form.html:18
msgid "Back to motion"
msgstr ""
#: motion/templates/motion/motion_form.html:35
#: motion/templates/motion/motion_form.html:45
#: motion/templates/motion/motion_form.html:34
#: motion/templates/motion/motion_form.html:44
#: motion/templates/motion/motion_list.html:36
msgid "New motion"
msgstr ""
@ -2320,15 +2316,15 @@ msgstr ""
msgid "Motion title"
msgstr ""
#: motion/templates/motion/motion_list.html:77
#: motion/templates/motion/motion_list.html:79
msgid "Enough supporters"
msgstr ""
#: motion/templates/motion/motion_list.html:80
#: motion/templates/motion/motion_list.html:82
msgid "Needs supporters"
msgstr ""
#: motion/templates/motion/motion_list.html:87
#: motion/templates/motion/motion_list.html:89
msgid "There is a newer (unauthorized) version."
msgstr ""
@ -2352,19 +2348,14 @@ msgstr ""
#: participant/csv_import.py:62
#, python-format
msgid "Ignoring malformed group id in line %d."
msgid "Ignoring group id \"%(id)s\" in line %(line)d which does not exist."
msgstr ""
#: participant/csv_import.py:65
#, python-format
msgid "Group id %(id)s does not exists (line %(line)d)."
msgstr ""
#: participant/csv_import.py:70
#: participant/csv_import.py:68
msgid "Import aborted because of severe errors in the input file."
msgstr ""
#: participant/csv_import.py:76
#: participant/csv_import.py:74
#, python-format
msgid "%d new participants were successfully imported."
msgstr ""
@ -2951,11 +2942,11 @@ msgstr ""
msgid "Scroll level"
msgstr ""
#: utils/forms.py:111
#: utils/forms.py:112
msgid "CSV File"
msgstr ""
#: utils/forms.py:112
#: utils/forms.py:113
msgid "The file has to be encoded in UTF-8."
msgstr ""

View File

@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-05-05 20:29+0200\n"
"POT-Creation-Date: 2014-10-16 23:27+0200\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"

View File

@ -92,7 +92,7 @@
<!-- Reason -->
<h4>{% trans "Reason" %}:</h4>
{{ reason|safe|default:'' }}
{{ reason|safe|default:'' }}
<br>
<!-- Attachments -->
@ -208,9 +208,12 @@
<h5>{% trans "Vote result" %}:</h5>
{% with motion.polls.all as polls %}
{% for poll in polls %}
{% if perms.motion.can_manage_motion or poll.has_votes %}
<p>{{ poll.poll_number|ordinal|safe }} {% trans "vote" %}:<br>
<p>
{% if polls.count > 1 %}
{{ poll.poll_number|ordinal|safe }} {% trans "vote" %}:
{% endif %}
{% if perms.motion.can_manage_motion %}
{% if polls.count > 1 %}<br>{% endif %}
<a class="btn btn-mini activate_link {% if poll.is_active_slide %}btn-primary{% endif %}" href="{{ poll|absolute_url:'projector' }}"
rel="tooltip" data-original-title="{% trans 'Show vote result' %}">
<i class="icon-facetime-video {% if poll.is_active_slide %}icon-white{% endif %}"></i></a>
@ -220,7 +223,6 @@
rel="tooltip" data-original-title="{% trans 'Edit Vote' %}"><i class="icon-pencil"></i></a>
<a class="btn btn-mini" href="{{ poll|absolute_url:'delete' }}"
rel="tooltip" data-original-title="{% trans 'Delete Vote' %}"><i class="icon-remove"></i></a>
</p>
{% endif %}
{% if poll.has_votes %}
<div class="result">
@ -244,11 +246,10 @@
{% endwith %}
</div>
{% else %}
{% if perms.motion.can_manage_motion %}
<p><span class="label label-info">{% trans 'No result' %}</span></p>
{% endif %}
<p><span class="label label-info">{% trans 'No result' %}</span></p>
{% endif %}
{% endif %}
{% block meta_box_poll_extras %}{% endblock %}
</p>
{% empty %}
{% endfor %}
@ -279,15 +280,6 @@
</h5>
{{ version.creation_time }}
<!-- Widthdraw button -->
{# TODO: Check this button #}
{% if allowed_actions.wit and user in motion.submitters %}
<br><br>
<a href="{% url 'motion_set_state' motion.id 'wit' %}" class="btn">
<span class="icon revert">{% trans 'Withdraw motion' %}</span>
</a>
{% endif %}
<!-- Support/Unsupport button -->
{% if perms.motion.can_support_motion and 'motion_min_supporters'|get_config > 0 %}
{% if allowed_actions.unsupport %}

View File

@ -7,7 +7,6 @@
{% block header %}
{{ block.super }}
<link type="text/css" rel="stylesheet" media="all" href="{% static 'css/motion.css' %}" />
<link type="text/css" rel="stylesheet" media="all" href="{% static 'css/ckeditor.css' %}" />
<link href="{% static 'css/jquery.bsmselect.css' %}" type="text/css" rel="stylesheet" />
{% endblock %}

View File

@ -50,11 +50,21 @@
<!-- Submitter -->
<h4>{% trans "Submitter" %}:</h4>
{% for submitter in motion.submitter.all %}
{{ submitter.person }}{% if not forloop.last %},<br> {% endif %}
{{ submitter.person }}{% if not forloop.last %},<br>{% endif %}
{% empty %}
-
{% endfor %}
<!-- Supporters -->
{% with motion.supporter.all as supporters %}
{% if supporters|length > 0 %}
<h4>{% trans "Supporters" %}:</h4>
{% for supporter in supporters %}
{{ supporter.person }}{% if not forloop.last %},<br>{% endif %}
{% endfor %}
{% endif %}
{% endwith %}
<!-- Category -->
{% if motion.category %}
<h4>{% trans "Category" %}:</h4>
@ -71,9 +81,14 @@
</small>
</h1>
<div class="text">{{ motion.active_version.text|safe }}</div>
<div class="text">
{{ motion.active_version.text|safe }}
</div>
{% if motion.active_version.reason %}
<br>
<div class="reason"><p><b>{% trans "Reason" %}:</b></p>
{{ motion.active_version.reason|safe }}</div>
<div class="reason">
<p><b>{% trans "Reason" %}:</b></p>
{{ motion.active_version.reason|safe }}
</div>
{% endif %}

View File

@ -5,6 +5,7 @@ from django.utils.text import slugify
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy, ugettext_noop
from reportlab.platypus import SimpleDocTemplate
from django.shortcuts import get_object_or_404
from openslides.agenda.views import CreateRelatedAgendaItemView as _CreateRelatedAgendaItemView
from openslides.config.api import config
@ -522,9 +523,10 @@ class PollMixin(object):
Use the motion id and the poll_number from the url kwargs to get the
object.
"""
return MotionPoll.objects.filter(
queryset = MotionPoll.objects.filter(
motion=self.kwargs['pk'],
poll_number=self.kwargs['poll_number']).get()
poll_number=self.kwargs['poll_number'])
return get_object_or_404(queryset)
def get_url_name_args(self):
"""

View File

@ -1,5 +1,6 @@
from django.forms.models import modelform_factory
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from openslides.utils.views import TemplateView, FormMixin
@ -51,7 +52,11 @@ class PollFormView(FormMixin, TemplateView):
'a get_poll_class method.')
def get_object(self):
return self.get_poll_class().objects.get(pk=self.kwargs['poll_id'])
"""
Returns the poll object. Raises Http404 if the poll does not exist.
"""
queryset = self.get_poll_class().objects.filter(pk=self.kwargs['poll_id'])
return get_object_or_404(queryset)
def get_context_data(self, **kwargs):
context = super(PollFormView, self).get_context_data(**kwargs)

View File

@ -52,15 +52,13 @@ def import_users(csvfile):
user.is_active = False
user.default_password = gen_password()
user.save()
for groupid in groups:
for groupid in groups.split(','):
try:
if groupid != ",":
if groupid and int(groupid):
Group.objects.get(pk=groupid).user_set.add(user)
except ValueError:
error_messages.append(_('Ignoring malformed group id in line %d.') % (line_no + 1))
continue
except Group.DoesNotExist:
error_messages.append(_('Group id %(id)s does not exists (line %(line)d).') % {'id': groupid, 'line': line_no + 1})
except (Group.DoesNotExist, ValueError):
error_messages.append(_('Ignoring group id "%(id)s" in line %(line)d which does not exist.') %
{'id': groupid, 'line': line_no + 1})
continue
user.reset_password()
user.save()

View File

@ -27,7 +27,8 @@ HTML_TAG_WHITELIST = ('a',
HTML_ATTRIBUTES_WHITELIST = {
'a': ['href'],
'*': ['style'],
'img': ['src'],
'pre': ['class'],
'img': ['src', 'width', 'height'],
}
HTML_STYLES_WHITELIST = ('color', 'background-color', 'list-style', 'width', 'height')

View File

@ -19,3 +19,8 @@ class AssignmentPDFTest(TestCase):
Assignment.objects.create(name='assignment_name_ith8qua1Eiferoqu5ju2', description="test", posts=1)
response = self.admin_client.get('/assignment/print/')
self.assertEqual(response.status_code, 200)
def test_render_many_posts(self):
Assignment.objects.create(name='assignment_name_cohZ9shaipee3Phaing4', description="test", posts=20)
response = self.admin_client.get('/assignment/print/')
self.assertEqual(response.status_code, 200)

View File

@ -129,3 +129,20 @@ class TestAssignmentPollPdfView(TestCase):
# test the response
self.assertEqual(response.status_code, 200)
class TestPollUpdateView(TestCase):
def setUp(self):
self.admin_client = Client()
self.admin_client.login(username='admin', password='admin')
def test_not_existing_poll(self):
"""
Tests that a 404 is returned, when a non existing poll is requested.
"""
Assignment.objects.create(name='test assignment', posts=1)
url = '/assignment/poll/1/edit/'
response = self.admin_client.get(url)
self.assertTrue(response.status_code, '404')

View File

@ -526,3 +526,20 @@ class CategoryViewsTest(TestCase):
response = self.admin_client.post(url, {'yes': 'true'})
self.assertRedirects(response, '/motion/category/')
self.assertFalse(Category.objects.exists())
class PollUpdateViewTest(TestCase):
def setUp(self):
self.admin_client = Client()
self.admin_client.login(username='admin', password='admin')
def test_not_existing_poll(self):
"""
Tests that a 404 is returned, when a non existing poll is requested
"""
Motion.objects.create(title='test_motion')
url = '/motion/1/poll/1/edit/'
response = self.admin_client.get(url)
self.assertTrue(response.status_code, '404')