diff --git a/CHANGELOG b/CHANGELOG index fc619bbd0..a8a2bd2c3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,18 @@ Version 1.6.1 (unreleased) ========================== [https://github.com/OpenSlides/OpenSlides/issues?milestone=16] +Motions: +- Show supporters on motion slide if available. + +Participants: +- Fixed participant csv import for group id: + * Allowed to add multiple groups in csv group id field, e.g. "3,4". + * Fixed bug that group ids > 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) ======================== diff --git a/extras/csv-examples/participants-demo_de.csv b/extras/csv-examples/participants-demo_de.csv index 6b05c0562..d50b9fdc1 100644 --- a/extras/csv-examples/participants-demo_de.csv +++ b/extras/csv-examples/participants-demo_de.csv @@ -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 diff --git a/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/README.md b/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/README.md new file mode 100644 index 000000000..5bf8edb2f --- /dev/null +++ b/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/README.md @@ -0,0 +1,27 @@ +CKEditor Insert <pre> Plugin +=============================== + +This plugin makes it easier to insert a <pre> 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 <pre> element: + + CKEDITOR.config.insertpre_class = 'prettyprint'; + + As well as specify how the <pre> 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). diff --git a/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/icons/insertpre-color.png b/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/icons/insertpre-color.png new file mode 100644 index 000000000..0c76bd129 Binary files /dev/null and b/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/icons/insertpre-color.png differ diff --git a/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/icons/insertpre.png b/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/icons/insertpre.png new file mode 100644 index 000000000..756a4906f Binary files /dev/null and b/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/icons/insertpre.png differ diff --git a/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/lang/en.js b/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/lang/en.js new file mode 100644 index 000000000..661f139c4 --- /dev/null +++ b/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/lang/en.js @@ -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.' +}); diff --git a/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/lang/pl.js b/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/lang/pl.js new file mode 100644 index 000000000..f8ec4eda2 --- /dev/null +++ b/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/lang/pl.js @@ -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.' +}); \ No newline at end of file diff --git a/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/plugin.js b/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/plugin.js new file mode 100644 index 000000000..b4a1d835f --- /dev/null +++ b/openslides/core/static/ckeditor/ckeditor/plugins/insertpre/plugin.js @@ -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'; \ No newline at end of file diff --git a/openslides/core/static/css/base.css b/openslides/core/static/css/base.css index 869401b25..bb622b5d1 100644 --- a/openslides/core/static/css/base.css +++ b/openslides/core/static/css/base.css @@ -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; diff --git a/openslides/core/static/js/ckeditor-config.js b/openslides/core/static/js/ckeditor-config.js deleted file mode 100644 index 5d4831802..000000000 --- a/openslides/core/static/js/ckeditor-config.js +++ /dev/null @@ -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' -}; diff --git a/openslides/global_settings.py b/openslides/global_settings.py index c52421340..cd105bfcf 100644 --- a/openslides/global_settings.py +++ b/openslides/global_settings.py @@ -135,7 +135,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; ' @@ -148,14 +147,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']} diff --git a/openslides/motion/templates/motion/motion_form.html b/openslides/motion/templates/motion/motion_form.html index 9a8fe9c15..e6831009f 100644 --- a/openslides/motion/templates/motion/motion_form.html +++ b/openslides/motion/templates/motion/motion_form.html @@ -7,7 +7,6 @@ {% block header %} {{ block.super }} - {% endblock %} diff --git a/openslides/motion/templates/motion/slide.html b/openslides/motion/templates/motion/slide.html index bd8804385..2a6c97f03 100644 --- a/openslides/motion/templates/motion/slide.html +++ b/openslides/motion/templates/motion/slide.html @@ -55,6 +55,17 @@ - {% endfor %} + + {% with motion.supporter.all as supporters %} + {% if supporters|length > 0 %} +

{% trans "Supporters" %}:

+ {% for supporter in supporters %} + {{ supporter.person }}{% if not forloop.last %},
{% endif %} + {% endfor %} +

+ {% endif %} + {% endwith %} + {% if motion.category %}

{% trans "Category" %}:

diff --git a/openslides/participant/csv_import.py b/openslides/participant/csv_import.py index 55c16c2c4..73bf403c0 100644 --- a/openslides/participant/csv_import.py +++ b/openslides/participant/csv_import.py @@ -54,15 +54,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() count_success += 1 diff --git a/openslides/utils/forms.py b/openslides/utils/forms.py index 1dfe2404c..ca4db1a7c 100644 --- a/openslides/utils/forms.py +++ b/openslides/utils/forms.py @@ -29,7 +29,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')