Merge pull request #1329 from normanjaeckel/fixes-for-1.6.1

Fixes for 1.6.1
This commit is contained in:
Norman Jäckel 2014-07-15 00:43:45 +02:00
commit c6586c2c70
15 changed files with 210 additions and 55 deletions

View File

@ -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)
========================

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

@ -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).

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

@ -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']}

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

@ -55,6 +55,17 @@
-
{% 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 %}
</p>
{% endif %}
{% endwith %}
<!-- Category -->
{% if motion.category %}
<h4>{% trans "Category" %}:</h4>

View File

@ -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

View File

@ -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')