Merge branch 'master' into tornado

This commit is contained in:
Oskar Hahn 2013-02-18 19:08:58 +01:00
commit 2822c39f8a
244 changed files with 8805 additions and 6826 deletions

View File

@ -8,4 +8,4 @@ install:
- python extras/scripts/create_local_settings.py - python extras/scripts/create_local_settings.py
script: script:
- coverage run ./manage.py test tests && coverage report -m - coverage run ./manage.py test tests && coverage report -m
- pep8 --max-line-length=150 --exclude="urls.py,motion/" --statistics openslides - pep8 --max-line-length=150 --exclude="urls.py," --statistics openslides

View File

@ -7,3 +7,4 @@ Authors of OpenSlides in chronological order of first contribution:
Andy Kittner <andkit@gmx.net> Andy Kittner <andkit@gmx.net>
Moira Brülisauer <moira.bruelisauer@piratenpartei.ch> (French translation) Moira Brülisauer <moira.bruelisauer@piratenpartei.ch> (French translation)
Alexis Roussel <alexis.roussel@partipirate.ch> (French translation) Alexis Roussel <alexis.roussel@partipirate.ch> (French translation)
Stefan Frauenknecht <stefan@frauenknecht.net>

10
THANKS
View File

@ -8,9 +8,16 @@ OpenSlides uses parts of the following projects:
* jQuery * jQuery
<http://www.jquery.com/> <http://www.jquery.com/>
and some addons: cookie, form, once, templating
* jQuery UI * jQuery UI
<http://jqueryui.com/> <http://jqueryui.com/>
custom ui components: core, widget, mouse, sortable, datepicker, slider
with css theme 'smoothness'
and some addons: slider access, timepicker
* Twitter Bootstrap
<http://twitter.github.com/bootstrap/>
* ReportLab * ReportLab
<http://www.reportlab.com/software/opensource/rl-toolkit/> <http://www.reportlab.com/software/opensource/rl-toolkit/>
@ -18,8 +25,5 @@ OpenSlides uses parts of the following projects:
* Drupal (tabledrag function) * Drupal (tabledrag function)
<http://www.drupal.org/> <http://www.drupal.org/>
* Oxygen-Icons
<http://www.oxygen-icons.org/>
* Ubuntu TrueType Font * Ubuntu TrueType Font
<http://font.ubuntu.com/> <http://font.ubuntu.com/>

View File

@ -31,12 +31,8 @@ URL_SETS = {
"/jsi18n/", "/jsi18n/",
"/static/styles/base.css", "/static/styles/base.css",
"/static/javascript/utils.js", "/static/javascript/utils.js",
"/static/javascript/jquery.js", "/static/javascript/jquery.min.js",
"/static/images/bg-submenu.gif", "/static/img/logo.png",
"/static/images/bg-header.gif",
"/static/images/logo.png",
"/static/images/icons/dialog-information.png",
"/static/images/icons/cross.png",
], ],
"agenda": [ "agenda": [
"/agenda/", "/agenda/",
@ -44,25 +40,15 @@ URL_SETS = {
"/static/styles/tabledrag.css", "/static/styles/tabledrag.css",
"/static/javascript/utils.js", "/static/javascript/utils.js",
"/static/styles/agenda.css", "/static/styles/agenda.css",
"/static/javascript/jquery.js", "/static/javascript/jquery.min.js",
"/jsi18n/", "/jsi18n/",
"/static/images/bg-header.gif",
"/static/images/bg-submenu.gif",
"/static/images/logo.png",
"/static/images/icons/application-pdf.png",
"/static/images/icons/cross.png",
], ],
"application": [ "application": [
"/application/", "/application/",
"/static/styles/base.css", "/static/styles/base.css",
"/static/javascript/utils.js", "/static/javascript/utils.js",
"/static/javascript/jquery.js", "/static/javascript/jquery.min.js",
"/jsi18n/", "/jsi18n/",
"/static/images/bg-header.gif",
"/static/images/bg-submenu.gif",
"/static/images/icons/cross.png",
"/static/images/logo.png",
"/static/images/icons/application-pdf.png",
] ]
} }

View File

@ -10,14 +10,14 @@
:license: GNU GPL, see LICENSE for more details. :license: GNU GPL, see LICENSE for more details.
""" """
import re
from django import forms from django import forms
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from mptt.forms import TreeNodeChoiceField from mptt.forms import TreeNodeChoiceField
from openslides.utils.forms import CssClassMixin from openslides.utils.forms import CssClassMixin
from .models import Item
from openslides.agenda.models import Item
class ItemForm(forms.ModelForm, CssClassMixin): class ItemForm(forms.ModelForm, CssClassMixin):
@ -27,6 +27,13 @@ class ItemForm(forms.ModelForm, CssClassMixin):
parent = TreeNodeChoiceField( parent = TreeNodeChoiceField(
queryset=Item.objects.all(), label=_("Parent item"), required=False) queryset=Item.objects.all(), label=_("Parent item"), required=False)
duration = forms.RegexField(
regex=re.compile('[0-99]:[0-5][0-9]'),
error_message=_("Invalid format. Hours from 0 to 99 and minutes from 00 to 59"),
max_length=5,
required=False,
label=_("Duration (hh:mm)"))
class Meta: class Meta:
model = Item model = Item
exclude = ('closed', 'weight', 'related_sid') exclude = ('closed', 'weight', 'related_sid')
@ -45,11 +52,15 @@ class ItemOrderForm(forms.Form, CssClassMixin):
""" """
weight = forms.ChoiceField( weight = forms.ChoiceField(
choices=gen_weight_choices(), choices=gen_weight_choices(),
widget=forms.Select(attrs={'class': 'menu-weight'}), widget=forms.Select(attrs={'class': 'menu-weight'}))
)
self = forms.IntegerField( self = forms.IntegerField(
widget=forms.HiddenInput(attrs={'class': 'menu-mlid'}), widget=forms.HiddenInput(attrs={'class': 'menu-mlid'}))
)
parent = forms.IntegerField( parent = forms.IntegerField(
widget=forms.HiddenInput(attrs={'class': 'menu-plid'}), widget=forms.HiddenInput(attrs={'class': 'menu-plid'}))
)
class ConfigForm(CssClassMixin, forms.Form):
agenda_start_event_date_time = forms.CharField(
widget=forms.DateTimeInput(format='%d.%m.%Y %H:%M'),
required=False,
label=_("Begin of event"))

View File

@ -20,7 +20,7 @@ from openslides.config.models import config
from openslides.projector.projector import SlideMixin from openslides.projector.projector import SlideMixin
from openslides.projector.api import ( from openslides.projector.api import (
register_slidemodel, get_slide_from_sid, register_slidefunc) register_slidemodel, get_slide_from_sid, register_slidefunc)
from openslides.agenda.slides import agenda_show from .slides import agenda_show
class Item(MPTTModel, SlideMixin): class Item(MPTTModel, SlideMixin):
@ -31,6 +31,13 @@ class Item(MPTTModel, SlideMixin):
""" """
prefix = 'item' prefix = 'item'
AGENDA_ITEM = 1
ORGANIZATIONAL_ITEM = 2
ITEM_TYPE = (
(AGENDA_ITEM, _('Agenda item')),
(ORGANIZATIONAL_ITEM, _('Organizational item')))
title = models.CharField(null=True, max_length=255, verbose_name=_("Title")) title = models.CharField(null=True, max_length=255, verbose_name=_("Title"))
text = models.TextField(null=True, blank=True, verbose_name=_("Text")) text = models.TextField(null=True, blank=True, verbose_name=_("Text"))
comment = models.TextField(null=True, blank=True, verbose_name=_("Comment")) comment = models.TextField(null=True, blank=True, verbose_name=_("Comment"))
@ -38,6 +45,8 @@ class Item(MPTTModel, SlideMixin):
weight = models.IntegerField(default=0, verbose_name=_("Weight")) weight = models.IntegerField(default=0, verbose_name=_("Weight"))
parent = TreeForeignKey('self', null=True, blank=True, parent = TreeForeignKey('self', null=True, blank=True,
related_name='children') related_name='children')
type = models.IntegerField(max_length=1, choices=ITEM_TYPE, default=AGENDA_ITEM, verbose_name=_("Type"))
duration = models.CharField(null=True, blank=True, max_length=5, verbose_name=_("Duration (hh:mm)"))
related_sid = models.CharField(null=True, blank=True, max_length=63) related_sid = models.CharField(null=True, blank=True, max_length=63)
def get_related_slide(self): def get_related_slide(self):
@ -170,6 +179,7 @@ class Item(MPTTModel, SlideMixin):
permissions = ( permissions = (
('can_see_agenda', ugettext_noop("Can see agenda")), ('can_see_agenda', ugettext_noop("Can see agenda")),
('can_manage_agenda', ugettext_noop("Can manage agenda")), ('can_manage_agenda', ugettext_noop("Can manage agenda")),
('can_see_orga_items', ugettext_noop("Can see orga items and time scheduling of agenda")),
) )
class MPTTMeta: class MPTTMeta:

View File

@ -16,7 +16,7 @@ from django.utils.translation import ugettext as _
def agenda_show(): def agenda_show():
from openslides.agenda.models import Item from openslides.agenda.models import Item
data = {} data = {}
items = Item.objects.filter(parent=None) items = Item.objects.filter(parent=None, type__exact=Item.AGENDA_ITEM)
data['title'] = _("Agenda") data['title'] = _("Agenda")
data['items'] = items data['items'] = items
data['template'] = 'projector/AgendaSummary.html' data['template'] = 'projector/AgendaSummary.html'

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 B

View File

@ -20,7 +20,7 @@ function hideClosedSlides(hide) {
if (hide) { if (hide) {
$('#hidelink').attr('title', 'show'); $('#hidelink').attr('title', 'show');
$('#hidelink').removeClass('hide').addClass('show'); $('#hidelink').removeClass('hide').addClass('show');
$('.close_link.closed').parent().parent().each(function() { $('.close_link .icon-checked-new').parent().parent().parent().each(function() {
hideLine($(this)); hideLine($(this));
}); });
hidden = $('#menu-overview tr:hidden').size(); hidden = $('#menu-overview tr:hidden').size();
@ -35,21 +35,26 @@ function hideClosedSlides(hide) {
} }
$(function() { $(function() {
$('.close_link a').click(function(event) { // change participant status (on/off)
$('.close_link').click(function(event) {
event.preventDefault(); event.preventDefault();
slide = $(this); var link = $(this);
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: slide.attr('href'), url: $(this).attr('href'),
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
if (data.closed) { if (data.closed) {
newclass = 'closed'; newclass = 'icon-checked-new';
link.parent().parent().addClass('offline');
link.addClass('btn-success');
} else { } else {
newclass = 'open'; newclass = 'icon-unchecked-new';
link.parent().parent().removeClass('offline');
link.removeClass('btn-success');
} }
slide.parent().removeClass('closed open').addClass(newclass); link.children('i').removeClass('icon-checked-new icon-unchecked-new').addClass(newclass);
slide.attr('href', data.link); link.attr('href', data.link);
} }
}); });
}); });

View File

@ -0,0 +1,89 @@
/*
* jQuery UI Slider Access
* By: Trent Richardson [http://trentrichardson.com]
* Version 0.3
* Last Modified: 10/20/2012
*
* Copyright 2011 Trent Richardson
* Dual licensed under the MIT and GPL licenses.
* http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
* http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
*
*/
(function($){
$.fn.extend({
sliderAccess: function(options){
options = options || {};
options.touchonly = options.touchonly !== undefined? options.touchonly : true; // by default only show it if touch device
if(options.touchonly === true && !("ontouchend" in document))
return $(this);
return $(this).each(function(i,obj){
var $t = $(this),
o = $.extend({},{
where: 'after',
step: $t.slider('option','step'),
upIcon: 'ui-icon-plus',
downIcon: 'ui-icon-minus',
text: false,
upText: '+',
downText: '-',
buttonset: true,
buttonsetTag: 'span',
isRTL: false
}, options),
$buttons = $('<'+ o.buttonsetTag +' class="ui-slider-access">'+
'<button data-icon="'+ o.downIcon +'" data-step="'+ (o.isRTL? o.step : o.step*-1) +'">'+ o.downText +'</button>'+
'<button data-icon="'+ o.upIcon +'" data-step="'+ (o.isRTL? o.step*-1 : o.step) +'">'+ o.upText +'</button>'+
'</'+ o.buttonsetTag +'>');
$buttons.children('button').each(function(j, jobj){
var $jt = $(this);
$jt.button({
text: o.text,
icons: { primary: $jt.data('icon') }
})
.click(function(e){
var step = $jt.data('step'),
curr = $t.slider('value'),
newval = curr += step*1,
minval = $t.slider('option','min'),
maxval = $t.slider('option','max'),
slidee = $t.slider("option", "slide") || function(){},
stope = $t.slider("option", "stop") || function(){};
e.preventDefault();
if(newval < minval || newval > maxval)
return;
$t.slider('value', newval);
slidee.call($t, null, { value: newval });
stope.call($t, null, { value: newval });
});
});
// before or after
$t[o.where]($buttons);
if(o.buttonset){
$buttons.removeClass('ui-corner-right').removeClass('ui-corner-left').buttonset();
$buttons.eq(0).addClass('ui-corner-left');
$buttons.eq(1).addClass('ui-corner-right');
}
// adjust the width so we don't break the original layout
var bOuterWidth = $buttons.css({
marginLeft: ((o.where == 'after' && !o.isRTL) || (o.where == 'before' && o.isRTL)? 10:0),
marginRight: ((o.where == 'before' && !o.isRTL) || (o.where == 'after' && o.isRTL)? 10:0)
}).outerWidth(true) + 5;
var tOuterWidth = $t.outerWidth(true);
$t.css('display','inline-block').width(tOuterWidth-bOuterWidth);
});
}
});
})(jQuery);

File diff suppressed because it is too large Load Diff

View File

@ -5,20 +5,19 @@
* :license: GNU GPL, see LICENSE for more details. * :license: GNU GPL, see LICENSE for more details.
*/ */
/* agenda item open/closed */ tr.topline td {
.close_link span { border-bottom: 1px solid #333333;
background-image: url(../images/icons/close-grey.png); background-color: #CDCDCD;
background-repeat: no-repeat;
background-position: center;
width: 16px;
height: 16px;
display: inline-block;
} }
.close_link.closed span { table#agendatime {
background-image: url(../images/icons/close.png); float: right;
width: auto;
margin-bottom: 1em;
font-size: 12px;
} }
table#menu-overview { table#agendatime td {
padding: 3px;
white-space: nowrap; white-space: nowrap;
} }

View File

@ -0,0 +1,46 @@
/**
* OpenSlides timepicker style
*
* :copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
* :license: GNU GPL, see LICENSE for more details.
*/
.ui-timepicker-div .ui-widget-header {
margin-bottom: 8px;
}
.ui-timepicker-div dl {
text-align: left;
}
.ui-timepicker-div dl dt {
height: 25px;
margin-bottom: -25px;
}
.ui-timepicker-div dl dd {
margin: 0 10px 10px 65px;
}
.ui-timepicker-div td {
font-size: 90%;
}
.ui-tpicker-grid-label {
background: none;
border: none;
margin: 0;
padding: 0;
}
.ui-timepicker-rtl{
direction: rtl;
}
.ui-timepicker-rtl dl {
text-align: right;
}
.ui-timepicker-rtl dl dd {
margin: 0 65px 10px 10px;
}

View File

@ -1,43 +0,0 @@
{% extends "base.html" %}
{% load tags %}
{% load i18n %}
{% load staticfiles %}
{% block submenu %}
{% url 'item_overview' as url_itemoverview %}
{% url 'item_new' as url_itemnew %}
<h4 class="sectiontitle">{% trans "Agenda" %}</h4>
<ul>
<li class="{% if request.path == url_itemoverview %}selected{% endif %}"><a href="{% url 'item_overview' %}">{% trans "All items" %}</a></li>
{% if perms.agenda.can_manage_agenda %}
<li class="{% active request '/agenda/new/' %}"><a href="{% url 'item_new' %}">{% trans "New item" %}</a></li>
{% endif %}
<li><a href="{% url 'print_agenda' %}"><img src="{% static 'images/icons/pdf.png' %}"> {% trans 'Agenda as PDF' %}</a></li>
</ul>
{# second submenu #}
{% if item %}
<br>
<h3>{{ item.title }}</h3>
<ul>
{# view item #}
{% url 'item_view' item.id as url_itemview %}
<li class="{% if request.path == url_itemview %}selected{% endif %}"><a href="{% url 'item_view' item.id %}">{% trans 'View item' %}</a></li>
{% if perms.agenda.can_manage_agenda %}
{# edit item #}
{% url 'item_edit' item.id as url_itemedit %}
<li class="{% if request.path == url_itemedit %}selected{% endif %}"><a href="{% url 'item_edit' item.id %}"><img src="{% static 'images/icons/edit.png' %}"> {% trans 'Edit item' %}</a></li>
{# delete item #}
<li><a href="{% url 'item_delete' item.id %}"><img src="{% static 'images/icons/delete.png' %}"> {% trans 'Delete item' %}</a></li>
{% endif %}
{# activate item #}
{% if perms.projector.can_manage_projector %}
<li><a href="{% url 'projector_activate_slide' item.sid %}"><img src="{% static 'images/icons/projector.png' %}"> {% trans 'Show item' %}</a></li>
{% endif %}
</ul>
{% endif %}
{% endblock %}

View File

@ -1,22 +1,85 @@
{% extends "config/base_config.html" %} {% extends "config/base_config.html" %}
{% load i18n %} {% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
{% load staticfiles %}
{% block header %}
<link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/jquery-ui/jquery-ui.custom.min.css' %}" />
<link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/timepicker.css' %}" />
{% endblock %}
{% block javascript %}
<script type="text/javascript" src="{% static 'javascript/jquery-ui.custom.min.js' %}"></script>
<script type="text/javascript" src="{% static 'javascript/jquery-ui-timepicker-addon.js' %}"></script>
<script type="text/javascript" src="{% static 'javascript/jquery-ui-sliderAccess.js' %}"></script>
<script type="text/javascript">
$(function() {
$.datepicker.regional['{{ LANGUAGE_CODE }}'] = {
prevText: 'previous month',
nextText: 'next month',
monthNames: [
'{% trans 'January' %}', '{% trans 'February' %}', '{% trans 'March' %}',
'{% trans 'April' %}', '{% trans 'May' %}', '{% trans 'June' %}',
'{% trans 'July' %}', '{% trans 'August' %}', '{% trans 'September' %}',
'{% trans 'October' %}', '{% trans 'November' %}', '{% trans 'December' %}'
],
monthNamesShort: [
'{% trans 'Jan' %}', '{% trans 'Feb' %}', '{% trans 'Mar' %}',
'{% trans 'Apr' %}', '{% trans 'May' %}', '{% trans 'Jun' %}',
'{% trans 'Jul' %}', '{% trans 'Aug' %}', '{% trans 'Sep' %}',
'{% trans 'Oct' %}', '{% trans 'Nov' %}', '{% trans 'Dec' %}'
],
dayNames: [
'{% trans 'Sunday' %}', '{% trans 'Monday' %}', '{% trans 'Tuesdey' %}', '{% trans 'Wednesday' %}',
'{% trans 'Thursday' %}', '{% trans 'Friday' %}', '{% trans 'Saturday' %}'
],
dayNamesMin: [
'{% trans 'Su' %}', '{% trans 'Mo' %}', '{% trans 'Tu' %}', '{% trans 'We' %}',
'{% trans 'Th' %}', '{% trans 'Fr' %}', '{% trans 'Sa' %}'
],
dayNamesShort: [
'{% trans 'Su' %}', '{% trans 'Mo' %}', '{% trans 'Tu' %}', '{% trans 'We' %}',
'{% trans 'Th' %}', '{% trans 'Fr' %}', '{% trans 'Sa' %}'
],
dateFormat: 'dd.mm.yy', firstDay: 1, isRTL: false
};
$.datepicker.setDefaults($.datepicker.regional['{{ LANGUAGE_CODE }}']);
$("#id_agenda_start_event_date_time").datetimepicker (
{
hour: 12,
timeFormat: "HH:mm",
timeText: '{% trans 'Time' %}',
hourText: '{% trans 'Hour' %}',
minuteText: '{% trans 'Minute' %}',
currentText: '{% trans 'current time' %}',
closeText: '{% trans 'close' %}'
}
);
});
</script>
{% endblock %}
{% block title %}{{ block.super }} {% trans "Agenda settings" %}{% endblock %} {% block title %}{{ block.super }} {% trans "Agenda settings" %}{% endblock %}
{% block content %} {% block content %}
<h1>{% trans "Agenda settings" %}</h1> <h1>
{% trans "Configuration" %}
<small>{% trans "Agenda" %}</small>
{% block config_submenu %}{{ block.super }}{% endblock %}
</h1>
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{{ form.as_p }} {% include "form.html" %}
<p> <p>
<button class="button" type="submit"> {% include "formbuttons_save.html" %}
<span class="icon ok">{% trans 'Save' %}</span> <a href="{% url 'config_agenda' %}" class="btn">
</button> {% trans 'Cancel' %}
<a href="{% url 'config_agenda' %}"> </a>
<button class="button" type="button" onclick="window.location='{% url 'config_agenda' %}'"> </p>
<span class="icon cancel">{% trans 'Cancel' %}</span> <small>* {% trans "required" %}</small>
</button>
</a>
</p>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "agenda/base_agenda.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
@ -12,24 +12,22 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% if item %} <h1>
<h1>{% trans "Edit item" %}</h1> {% if item %}
{% else %} {% trans "Edit item" %}
<h1>{% trans "New item" %}</h1> {% else %}
{% endif %} {% trans "New item" %}
{% endif %}
<small class="pull-right">
<a href="{% url 'item_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
</small>
</h1>
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{{ form.as_p }} {% include "form.html" %}
<p> <p>
<button class="button" type="submit"> {% include "formbuttons_saveapply.html" %}
<span class="icon ok">{% trans 'Save' %}</span> <a href='{% url 'item_overview' %}' class="btn">
</button> {% trans 'Cancel' %}
<button class="button" type="submit" name="apply">
<span class="icon apply">{% trans 'Apply' %}</span>
</button>
<a href="{% url 'item_overview' %}">
<button class="button" type="button" onclick="window.location='{% url 'item_overview' %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
</a> </a>
</p> </p>
<small>* {% trans "required" %}</small> <small>* {% trans "required" %}</small>

View File

@ -1,17 +1,17 @@
{% load i18n %} {% load i18n %}
{% load staticfiles %}
{% load tags %} {% load tags %}
<td> <td>
<span class="close_link{% if item.closed %} closed{% endif %}"> {% if perms.agenda.can_manage_agenda %}
{% if perms.agenda.can_manage_agenda %} <a href="{% if item.closed %}{% url 'item_open' item.id %}{% else %}{% url 'item_close' item.id %}{% endif %}"
<a href="{% if item.closed %}{% url 'item_open' item.id %}{% else %}{% url 'item_close' item.id %}{% endif %}" title="{% trans 'Mark item as done' %}"> class="close_link btn btn-mini {% if item.closed %}btn-success{% endif %}" title="{% trans 'Change status (open/closed)' %}">
<span></span> <i class="{% if item.closed %}icon-checked-new{% else %}icon-unchecked-new{% endif %}"></i>
</a> </a>
{% elif item.closed %} {% else %}
<img src="{% static 'images/icons/close.png' %}" title="{% trans 'Item closed' %}"> <span class="close_link">
{% endif %} <i class="{% if item.closed %}icon-checked-new{% else %}icon-unchecked-new{% endif %}"></i>
</span> </span>
{% endif %}
</td> </td>
<td> <td>
{% for p in item.get_ancestors %} {% for p in item.get_ancestors %}
@ -20,40 +20,51 @@
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage_agenda %}
<div class="dragcell"></div> <div class="dragcell"></div>
{% endif %} {% endif %}
<a href="{% model_url item 'view' %}">{{ item }}</a> <a href="{% model_url item 'view' %}">{% if item.type == item.ORGANIZATIONAL_ITEM %}<i>[{% endif %}{{ item }}{% if item.type == item.ORGANIZATIONAL_ITEM %}]</i>{% endif %}</a>
{{ item.get_title_supplement|safe }} {{ item.get_title_supplement|safe }}
</td> </td>
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage_agenda %}
<td> <td class="optional">
{{ item.comment|first_line }} {{ item.comment|first_line }}
</td> </td>
{% endif %} {% endif %}
{% if perms.agenda.can_see_orga_items %}
<td>
{% if item.duration %}
{{ item.duration }}h <a {% if item.tooltip %}rel="tooltip" data-original-title="{% trans 'End' %}: {{ item.tooltip|date:"DATETIME_FORMAT" }}"{% endif %}><i class="icon-clock"></i></a>
{% endif %}
</td>
{% endif %}
{% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %} {% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %}
<td> <td>
<span style="width: 1px; white-space: nowrap;"> <span style="width: 1px; white-space: nowrap;">
{% if perms.projector.can_manage_projector %} {% if perms.projector.can_manage_projector %}
<a class="activate_link {% if item.active %}active{% endif %}" href="{% url 'projector_activate_slide' item.sid %}" title="{% trans 'Activate item' %}"> <a href="{% url 'projector_activate_slide' item.sid %}" class="activate_link btn {% if item.active %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<span></span> <i class="icon-facetime-video {% if item.active %}icon-white{% endif %}"></i>
</a> </a>
{% endif %} {% endif %}
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage_agenda %}
<a href="{% model_url item 'edit' %}"><img src="{% static 'images/icons/edit.png' %}" title="{% trans 'Edit item' %}"></a> <a href="{% model_url item 'edit' %}" title="{% trans 'Edit' %}" class="btn btn-mini">
<a href="{% model_url item 'delete' %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Delete item' %}"></a> <i class="icon-pencil"></i>
</a>
<a href="{% model_url item 'delete' %}" title="{% trans 'Delete' %}" class="btn btn-mini">
<i class="icon-remove"></i>
</a>
{% if not item.is_leaf_node %} {% if not item.is_leaf_node %}
<a class="activate_link" href="{% url 'projector_activate_slide' item.sid 'summary' %}"> <a href="{% url 'projector_activate_slide' item.sid 'summary' %}" class="activate_link btn btn-mini" title="{% trans 'Show summary for this item' %}">
<img src="{% static 'images/icons/summary.png' %}" title="{% trans 'Activate summary for this item' %}"> <i class="icon-summary"></i>
</a> </a>
{% endif %} {% endif %}
{% endif %} {% endif %}
</span> </span>
</td> </td>
{% endif %} {% endif %}
{% if perms.agenda.can_manage_agenda %} <td class="tabledrag-hide" style="display: none;">
<td class="tabledrag-hide">
{% with form=item.weight_form %} {% with form=item.weight_form %}
{{ form.weight }} {{ form.weight }}
{{ form.self }} {{ form.self }}
{{ form.parent }} {{ form.parent }}
{% endwith %} {% endwith %}
</td> </td>
{% endif %}

View File

@ -1,4 +1,4 @@
{% extends "agenda/base_agenda.html" %} {% extends "base.html" %}
{% load tags %} {% load tags %}
{% load i18n %} {% load i18n %}
@ -10,11 +10,13 @@
{% block header %} {% block header %}
<link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/tabledrag.css' %}" /> <link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/tabledrag.css' %}" />
<link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/agenda.css' %}" /> <link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/agenda.css' %}" />
{% endblock %}
{% block javascript %}
<script type="text/javascript" src="{% static 'javascript/agenda.js' %}"></script> <script type="text/javascript" src="{% static 'javascript/agenda.js' %}"></script>
<script type="text/javascript" src="{% static 'javascript/jquery.cookie.js' %}"></script> <script type="text/javascript" src="{% static 'javascript/jquery.cookie.js' %}"></script>
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage_agenda %}
<script type="text/javascript" src="{% static 'javascript/jquery.once.js' %}"></script> <script type="text/javascript" src="{% static 'javascript/jquery.once.js' %}"></script>
<script type="text/javascript" src="{% static 'javascript/jquery.tmpl.js' %}"></script> <script type="text/javascript" src="{% static 'javascript/jquery.tmpl.js' %}"></script>
<script type="text/javascript" src="{% static 'javascript/tabledrag.js' %}"></script> <script type="text/javascript" src="{% static 'javascript/tabledrag.js' %}"></script>
<script type="text/javascript"> <script type="text/javascript">
@ -37,69 +39,98 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage_agenda %}
<div id="changed-order-message" style="display:none" class="notification warning"> <div id="changed-order-message" style="display:none" class="alert alert-warning">
<em>{% trans "Do you want to save the changed order of agenda items?" %}<br> <button type="button" class="close" data-dismiss="alert">×</button>
<input type="submit" value="{% trans 'Yes' %}"> <p>{% trans "Do you want to save the changed order of agenda items?" %}</p>
<input type="button" onclick="window.location.href='{% url 'item_overview' %}';" value="{% trans 'No' %}"> <p>
</em> <button class="btn" type="submit">{% trans 'Yes' %}</button>
<a href="{% url 'item_overview' %}" class="btn">{% trans 'No' %}</a>
</p>
</div> </div>
{% endif %} {% endif %}
<h1>{% trans "Agenda" %}</h1> <h1>{% trans "Agenda" %}
<small class="pull-right">
{% if perms.agenda.can_manage_agenda %}
<a href="{% url 'item_new' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'New item' %}"><i class="icon-plus"></i> {% trans "New" %}</a>
{% endif %}
<a href="{% url 'print_agenda' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print agenda as PDF' %}"><i class="icon-print"></i> PDF</a>
</small>
</h1>
<p> {% if perms.agenda.can_see_orga_items %}
{% trans "Filter" %}: {% if start and end %}
<input type="checkbox" id="hide_closed_items"> {% trans "Hide closed items" %} <table id="agendatime" class="table table-bordered">
</p> <tr>
{{ items|length }} <td>{% trans "Start of event" %}:</td>
<td>{{ start|date:"DATETIME_FORMAT" }}</td>
</tr>
<tr>
<td>{% trans "Estimated end" %}:</td>
<td>{{ end|date:"DATETIME_FORMAT" }}</td>
</tr>
</table>
{% endif %}
{% endif %}
<label class="checkbox">
<input type="checkbox" id="hide_closed_items"> {% trans "Hide closed items" %}
</label>
<small><i>{{ items|length }}
{% blocktrans count counter=items|length %}item{% plural %}items{% endblocktrans %}<span id="hiddencount"></span> {% blocktrans count counter=items|length %}item{% plural %}items{% endblocktrans %}<span id="hiddencount"></span>
<table id="menu-overview" class="agendatable"> </i></small>
<table id="menu-overview" class="table table-striped table-bordered">
<tr> <tr>
<th width="50">{% trans "Done" %}</th> <th class="mini_width"></th>
<th>{% trans "Item" %}</th> <th>{% trans "Item" %}</th>
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage_agenda %}
<th width="200">{% trans "Comment" %}</th> <th width="200" class="optional">{% trans "Comment" %}</th>
{% endif %}
{% if perms.agenda.can_see_orga_items %}
<th width="50">{% trans "Duration" %}</th>
{% endif %} {% endif %}
{% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %} {% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %}
<th width="50">{% trans "Actions" %}</th> <th class="mini_width">{% trans "Actions" %}</th>
{% endif %}
{% if perms.agenda.can_manage_agenda %}
<th class="tabledrag-hide">{% trans "Weight" %}</th>
{% endif %} {% endif %}
<th class="tabledrag-hide" style="display: none;">
{% trans "Weight" %}
</th>
</tr> </tr>
<tr class="topline{% if active_sid == 'agenda' %} activeline{% endif %}"> <tr class="topline{% if active_sid == 'agenda' %} activeline{% endif %}">
<td></td> <td></td>
<td> <td>
<strong>{% trans "Agenda" %}</strong> {% trans "Agenda" %}
</td> </td>
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage_agenda %}
<td></td> <td class="optional"></td>
{% endif %}
{% if perms.agenda.can_see_orga_items %}
<td>{{ duration }}h</td>
{% endif %} {% endif %}
{% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %} {% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %}
<td> <td>
{% if perms.projector.can_manage_projector %} {% if perms.projector.can_manage_projector %}
<span> <span>
<a class="activate_link{% if active_sid == 'agenda' %} active{% endif %}" href="{% url 'projector_activate_slide' 'agenda' %}" title="{% trans 'Activate item' %}"> <a href="{% url 'projector_activate_slide' 'agenda' %}" class="activate_link btn {% if active_sid == 'agenda' %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<span></span> <i class="icon-facetime-video {% if active_sid == 'agenda' %}icon-white{% endif %}"></i>
</a> </a>
</span> <span>
{% endif %} {% endif %}
</td> </td>
{% endif %} {% endif %}
</tr> </tr>
{% if items %} {% if items %}
{% for item in items %} {% for item in items %}
<tr class="itemline draggable{% cycle ' odd' '' %}{% if item.active %} activeline{% endif %}"> <tr class="draggable{% if item.active %} activeline{% endif %}{% if item.closed %} offline{% endif %}">
{% include "agenda/item_row.html" %} {% include "agenda/item_row.html" %}
</tr> </tr>
{% endfor %} {% endfor %}
{% else %} {% else %}
<tr> <tr>
<td colspan="4"><i>{% trans "No items available." %}</i></td> <td colspan="5"><i>{% trans "No items available." %}</i></td>
</tr> </tr>
{% endif %} {% endif %}
</table> </table>

View File

@ -1,11 +1,35 @@
{% extends "agenda/base_agenda.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% block title %}{{ block.super }} {{ item.title }}{% endblock %} {% block title %}{{ block.super }} {{ item.title }}{% endblock %}
{% block content %} {% block content %}
<h1>{{ item }}</h1> <h1>
{{ item }}
<small class="pull-right">
<div class="btn-toolbar">
<a href="{% url 'item_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
<div class="btn-group">
<a data-toggle="dropdown" href="#" class="btn btn-mini dropdown-toggle">
{% trans 'More actions' %}
<span class="caret"></span>
</a>
{% if perms.agenda.can_manage_agenda %}
<ul class="dropdown-menu pull-right">
<li><a href="{% url 'item_edit' item.id %}"><i class="icon-edit"></i> {% trans 'Edit item' %}</a></li>
<li><a href="{% url 'item_delete' item.id %}"><i class="icon-remove"></i> {% trans 'Delete item' %}</a></li>
</ul>
{% endif %}
</div>
{% if perms.projector.can_manage_projector %}
<a href="{% url 'projector_activate_slide' item.sid %}" class="activate_link btn btn-mini {% if item.active %}btn-primary{% endif %}" rel="tooltip" data-original-title="{% trans 'Show' %}">
<i class="icon icon-facetime-video {% if item.active %}icon-white{% endif %}"></i>
</a>
{% endif %}
</div>
</small>
</h1>
<p>{{ item.text|safe|linebreaks }}</p> <p>{{ item.text|safe|linebreaks }}</p>
{% if perms.agenda.can_manage_agenda %} {% if perms.agenda.can_manage_agenda %}

View File

@ -1,12 +1,11 @@
{% load staticfiles %}
{% load i18n %} {% load i18n %}
{% load tags %} {% load tags %}
<ul style="line-height: 180%"> <ul style="line-height: 180%">
<li class="{% if agenda.active %}activeline{% endif %}"> <li class="{% if agenda.active %}activeline{% endif %}">
<a href="{% url 'projector_activate_slide' agenda.key %}" class="activate_link {% if agenda.active %}active{% endif %}"> <a href="{% url 'projector_activate_slide' agenda.key %}" class="activate_link btn {% if agenda.active %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<div></div> <i class="icon-facetime-video {% if agenda.active %}icon-white{% endif %}"></i>
</a> </a>&nbsp;
<a href="{% url 'projctor_preview_slide' agenda.key %}" title="{% trans 'Preview' %}" class="icon preview right"> <a href="{% url 'projctor_preview_slide' agenda.key %}" title="{% trans 'Preview' %}" class="icon preview right">
<span></span> <span></span>
</a> </a>
@ -17,29 +16,24 @@
<ul style="line-height: 180%"> <ul style="line-height: 180%">
{% for item in items %} {% for item in items %}
<li class="{% if item.active %}activeline{% endif %}"> <li class="{% if item.active %}activeline{% endif %}">
<a href="{% url 'projector_activate_slide' item.sid %}" class="activate_link {% if item.active %}active{% endif %}"> <a href="{% url 'projector_activate_slide' item.sid %}" class="activate_link btn {% if item.active %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<div></div> <i class="icon-facetime-video {% if item.active %}icon-white{% endif %}"></i>
</a>&nbsp;
<a href="{% model_url item 'edit' %}" title="{% trans 'Edit' %}" class="btn btn-mini right">
<i class="icon-pencil"></i>
</a> </a>
<a href="{% model_url item 'delete' %}" title="{% trans 'Delete' %}" class="icon delete right"> <a href="{% url 'projctor_preview_slide' item.sid %}" title="{% trans 'Preview' %}" class="btn btn-mini right">
<span></span> <i class="icon-search"></i>
</a>
<a href="{% model_url item 'edit' %}" title="{% trans 'Edit' %}" class="icon edit right">
<span></span>
</a>
<a href="{% url 'projctor_preview_slide' item.sid %}" title="{% trans 'Preview' %}" class="icon preview right">
<span></span>
</a> </a>
{% if not item.is_leaf_node %} {% if not item.is_leaf_node %}
<a class="activate_link right" href="{% url 'projector_activate_slide' item.sid 'summary' %}"> <a class="activate_link btn btn-mini {% if item.active %}btn-primary{% endif %} right" href="{% url 'projector_activate_slide' item.sid 'summary' %}" title="{% trans 'Show summary for this item' %}">
<img src="{% static 'images/icons/summary.png' %}" <i class="icon-summary {% if item.active %}icon-white{% endif %}"></i>
title="{% trans 'Activate summary for this item' %}"
style="padding-right: 2px;">
</a> </a>
{% endif %} {% endif %}
{% for p in item.get_ancestors %} {% for p in item.get_ancestors %}
<span class="indentation">&nbsp;</span> <span class="indentation"></span>
{% endfor %} {% endfor %}
<a href="{% model_url item 'view' %}">{{ item }}</a> <a href="{% model_url item 'view' %}">{% if item.type == item.ORGANIZATIONAL_ITEM %}<i>[{% endif %}{{ item }}{% if item.type == item.ORGANIZATIONAL_ITEM %}]</i>{% endif %}</a>
{{ item.get_title_supplement|safe }} {{ item.get_title_supplement|safe }}
</li> </li>
{% empty %} {% empty %}

View File

@ -11,10 +11,12 @@
""" """
from django.conf.urls import url, patterns from django.conf.urls import url, patterns
from openslides.agenda.views import (Overview, View, SetClosed, ItemUpdate, from openslides.agenda.views import (
Overview, View, SetClosed, ItemUpdate,
ItemCreate, ItemDelete, AgendaPDF) ItemCreate, ItemDelete, AgendaPDF)
urlpatterns = patterns('', urlpatterns = patterns(
'',
url(r'^$', url(r'^$',
Overview.as_view(), Overview.as_view(),
name='item_overview', name='item_overview',

View File

@ -9,7 +9,9 @@
:copyright: 2011, 2012 by the OpenSlides team, see AUTHORS. :copyright: 2011, 2012 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details. :license: GNU GPL, see LICENSE for more details.
""" """
from reportlab.platypus import Paragraph from reportlab.platypus import Paragraph
from datetime import datetime, timedelta
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.contrib import messages from django.contrib import messages
@ -18,10 +20,12 @@ from django.db.models import Model
from django.utils.translation import ugettext as _, ugettext_lazy from django.utils.translation import ugettext as _, ugettext_lazy
from django.views.generic.detail import SingleObjectMixin from django.views.generic.detail import SingleObjectMixin
from openslides.config.models import config
from openslides.agenda.forms import ConfigForm
from openslides.utils.pdf import stylesheet from openslides.utils.pdf import stylesheet
from openslides.utils.views import ( from openslides.utils.views import (
TemplateView, RedirectView, UpdateView, CreateView, DeleteView, PDFView, TemplateView, RedirectView, UpdateView, CreateView, DeleteView, PDFView,
DetailView) DetailView, FormView)
from openslides.utils.template import Tab from openslides.utils.template import Tab
from openslides.utils.utils import html_strong from openslides.utils.utils import html_strong
from openslides.projector.api import get_active_slide from openslides.projector.api import get_active_slide
@ -39,10 +43,44 @@ class Overview(TemplateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(Overview, self).get_context_data(**kwargs) context = super(Overview, self).get_context_data(**kwargs)
if self.request.user.has_perm('agenda.can_see_orga_items'):
items = Item.objects.all()
else:
items = Item.objects.filter(type__exact=Item.AGENDA_ITEM)
start = config['agenda_start_event_date_time']
if start is None or len(start) == 0:
start = None
else:
start = datetime.strptime(start, '%d.%m.%Y %H:%M')
duration = timedelta()
for item in items:
if not item.closed and (item.duration is not None
and len(item.duration) > 0):
duration_list = item.duration.split(':')
duration += timedelta(hours=int(duration_list[0]),
minutes=int(duration_list[1]))
if not start is None:
item.tooltip = start + duration
if start is None:
end = None
else:
end = start + duration
duration = u'%d:%02d' % (
(duration.days * 24 + duration.seconds / 3600.0),
(duration.seconds / 60.0 % 60))
context.update({ context.update({
'items': Item.objects.all(), 'items': items,
'active_sid': get_active_slide(only_sid=True), 'active_sid': get_active_slide(only_sid=True),
}) 'duration': duration,
'start': start,
'end': end})
return context return context
@transaction.commit_manually @transaction.commit_manually
@ -91,7 +129,7 @@ class SetClosed(RedirectView, SingleObjectMixin):
""" """
permission_required = 'agenda.can_manage_agenda' permission_required = 'agenda.can_manage_agenda'
allow_ajax = True allow_ajax = True
url = 'item_overview' url_name = 'item_overview'
model = Item model = Item
def get_ajax_context(self, **kwargs): def get_ajax_context(self, **kwargs):
@ -103,8 +141,7 @@ class SetClosed(RedirectView, SingleObjectMixin):
link = reverse('item_close', args=[self.object.id]) link = reverse('item_close', args=[self.object.id])
context.update({ context.update({
'closed': kwargs['closed'], 'closed': kwargs['closed'],
'link': link, 'link': link})
})
return context return context
def pre_redirect(self, request, *args, **kwargs): def pre_redirect(self, request, *args, **kwargs):
@ -123,16 +160,7 @@ class ItemUpdate(UpdateView):
model = Item model = Item
context_object_name = 'item' context_object_name = 'item'
form_class = ItemForm form_class = ItemForm
success_url = 'item_overview' success_url_name = 'item_overview'
apply_url = 'item_edit'
def get_success_url(self):
messages.success(
self.request, _("Item %s was successfully modified.")
% html_strong(self.request.POST['title']))
if 'apply' in self.request.POST:
return ''
return reverse(super(UpdateView, self).get_success_url())
class ItemCreate(CreateView): class ItemCreate(CreateView):
@ -144,16 +172,7 @@ class ItemCreate(CreateView):
model = Item model = Item
context_object_name = 'item' context_object_name = 'item'
form_class = ItemForm form_class = ItemForm
success_url = 'item_overview' success_url_name = 'item_overview'
apply_url = 'item_edit'
def get_success_url(self):
messages.success(
self.request, _("Item %s was successfully created.")
% html_strong(self.request.POST['title']))
if 'apply' in self.request.POST:
return reverse(self.get_apply_url(), args=[self.object.id])
return reverse(super(CreateView, self).get_success_url())
class ItemDelete(DeleteView): class ItemDelete(DeleteView):
@ -162,7 +181,8 @@ class ItemDelete(DeleteView):
""" """
permission_required = 'agenda.can_manage_agenda' permission_required = 'agenda.can_manage_agenda'
model = Item model = Item
url = 'item_overview' question_url_name = 'item_overview'
success_url_name = 'item_overview'
def get_answer_options(self): def get_answer_options(self):
if self.object.children.exists(): if self.object.children.exists():
@ -174,12 +194,14 @@ class ItemDelete(DeleteView):
if self.get_answer() == 'all': if self.get_answer() == 'all':
self.object.delete(with_children=True) self.object.delete(with_children=True)
messages.success( messages.success(
request, _("Item %s and his children were successfully deleted.") request,
_("Item %s and his children were successfully deleted.")
% html_strong(self.object)) % html_strong(self.object))
elif self.get_answer() == 'yes': elif self.get_answer() == 'yes':
self.object.delete(with_children=False) self.object.delete(with_children=False)
messages.success( messages.success(
request, _("Item %s was successfully deleted.") request,
_("Item %s was successfully deleted.")
% html_strong(self.object)) % html_strong(self.object))
@ -192,7 +214,7 @@ class AgendaPDF(PDFView):
document_title = ugettext_lazy('Agenda') document_title = ugettext_lazy('Agenda')
def append_to_pdf(self, story): def append_to_pdf(self, story):
for item in Item.objects.all(): for item in Item.objects.filter(type__exact=Item.AGENDA_ITEM):
ancestors = item.get_ancestors() ancestors = item.get_ancestors()
if ancestors: if ancestors:
space = "&nbsp;" * 6 * ancestors.count() space = "&nbsp;" * 6 * ancestors.count()
@ -203,6 +225,26 @@ class AgendaPDF(PDFView):
story.append(Paragraph(item.get_title(), stylesheet['Item'])) story.append(Paragraph(item.get_title(), stylesheet['Item']))
class Config(FormView):
"""
Config page for the agenda app.
"""
permission_required = 'config.can_manage_config'
form_class = ConfigForm
template_name = 'agenda/config.html'
success_url_name = 'config_agenda'
def get_initial(self):
return {
'agenda_start_event_date_time': config['agenda_start_event_date_time'],
}
def form_valid(self, form):
config['agenda_start_event_date_time'] = form.cleaned_data['agenda_start_event_date_time']
messages.success(self.request, _('Agenda settings successfully saved.'))
return super(Config, self).form_valid(form)
def register_tab(request): def register_tab(request):
""" """
register the agenda tab. register the agenda tab.
@ -210,6 +252,7 @@ def register_tab(request):
selected = request.path.startswith('/agenda/') selected = request.path.startswith('/agenda/')
return Tab( return Tab(
title=_('Agenda'), title=_('Agenda'),
app='agenda',
url=reverse('item_overview'), url=reverse('item_overview'),
permission=(request.user.has_perm('agenda.can_see_agenda') or permission=(request.user.has_perm('agenda.can_see_agenda') or
request.user.has_perm('agenda.can_manage_agenda')), request.user.has_perm('agenda.can_manage_agenda')),
@ -220,12 +263,11 @@ def get_widgets(request):
""" """
return the agenda widget for the projector-tab. return the agenda widget for the projector-tab.
""" """
return [ return [Widget(
Widget( name='agenda',
name='agenda', display_name=_('Agenda'),
display_name=_('Agenda'), template='agenda/widget.html',
template='agenda/widget.html', context={
context={ 'agenda': SLIDE['agenda'],
'agenda': SLIDE['agenda'], 'items': Item.objects.all()},
'items': Item.objects.all()}, permission_required='projector.can_manage_projector')]
permission_required='projector.can_manage_projector')]

View File

@ -24,9 +24,6 @@ $(function() {
line.parent().parent().children('td').addClass('elected') line.parent().parent().children('td').addClass('elected')
} }
line.attr('href', data.link); line.attr('href', data.link);
},
error: function () {
alert("Ajax Error");
} }
}); });
}); });
@ -48,22 +45,24 @@ $(function() {
} }
}); });
}); });
// change publish status of ballot
$('.publish_link').click(function(event) { $('.publish_link').click(function(event) {
event.preventDefault(); event.preventDefault();
link = $(this); var link = $(this);
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: link.attr('href'), url: $(this).attr('href'),
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
if (data.published) { if (data.published) {
link.addClass('published'); newclass = 'icon-checked-new_white';
//link.attr('title', gettext('Unpublish ballot')) link.addClass('btn-primary');
} else { } else {
link.removeClass('published'); newclass = 'icon-unchecked-new';
//link.attr('title', 'Publish ballot') link.removeClass('btn-primary');
} }
link.children('i').removeClass('icon-checked-new_white icon-unchecked-new').addClass(newclass);
link.attr('href', data.link);
} }
}); });
}); });});
});

View File

@ -10,7 +10,7 @@ td.elected {
} }
td.elected a.election_link { td.elected a.election_link {
background-image: url(../images/icons/voting-yes.png); background-image: url(../img/voting-yes.png);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
width: 16px; width: 16px;
@ -21,7 +21,7 @@ td.elected a.election_link {
} }
td a.election_link { td a.election_link {
background-image: url(../images/icons/voting-yes-grey.png); background-image: url(../img/voting-yes-grey.png);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
width: 16px; width: 16px;
@ -30,15 +30,3 @@ td a.election_link {
margin-right: 5px; margin-right: 5px;
float: left; float: left;
} }
a.publish_link span {
background-image: url(../images/icons/off.png);
background-repeat: no-repeat;
background-position: center;
width: 16px;
height: 16px;
display: inline-block;
}
a.publish_link.published span {
background-image: url(../images/icons/on.png);
}

View File

@ -1,76 +0,0 @@
{% extends "base.html" %}
{% load tags %}
{% load i18n %}
{% load staticfiles %}
{% block header %}
<link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/assignment.css' %}" />
<script type="text/javascript" src="{% static 'javascript/assignment.js' %}"></script>
{% endblock %}
{% block submenu %}
{% url 'assignment_overview' as url_assignment_overview %}
<h4 class="sectiontitle">{% trans "Elections" %}</h4>
<ul>
<li class="{% if request.path == url_assignment_overview %}selected{% endif %}"><a href="{% url 'assignment_overview' %}">{% trans "All elections" %}</a></li>
{% if perms.assignment.can_manage_assignment %}
<li class="{% active request '/assignment/new' %}"><a href="{% url 'assignment_new' %}">{% trans "New election" %}</a></li>
{% endif %}
<li><a href="{% url 'print_assignment' %}"><img src="{% static 'images/icons/pdf.png' %}"> {% trans 'All elections as PDF' %}</a></li>
</ul>
{# second submenu #}
{% if assignment %}
<br>
<h3>{{assignment}}</h3>
<ul>
{# view assignemnt #}
{% url 'assignment_view' assignment.id as url_assignmentview %}
<li class="{% if request.path == url_assignmentview %}selected{% endif %}">
<a href="{% url 'assignment_view' assignment.id %}">{% trans 'View election' %}</a>
</li>
{% if perms.assignment.can_manage_assignment %}
{# edit assignemnt #}
{% url 'assignment_edit' assignment.id as url_assignmentedit %}
<li class="{% if request.path == url_assignmentedit %}selected{% endif %}">
<a href="{% url 'assignment_edit' assignment.id %}"><img src="{% static 'images/icons/edit.png' %}"> {% trans 'Edit election' %}</a>
</li>
{# delete assignment #}
<li>
<a href="{% url 'assignment_delete' assignment.id %}"><img src="{% static 'images/icons/delete.png' %}"> {% trans 'Delete election' %}</a>
</li>
{% endif %}
{# PDF #}
<li>
<a href="{% url 'print_assignment' assignment.id %}"><img src="{% static 'images/icons/pdf.png' %}"> {% trans 'Election as PDF' %}</a>
</li>
{# activate #}
{% if perms.projector.can_manage_projector %}
<li>
<a class="activate_link {% if item.active %}active{% endif %}" href="{% url 'projector_activate_slide' assignment.sid %}"><img src="{% static 'images/icons/projector.png' %}"> {% trans 'Show election' %}</a>
</li>
{% endif %}
{# agenda #}
{% if perms.agenda.can_manage_agenda %}
<li>
<a href="{% url 'assignment_create_agenda' assignment.id %}">{% trans 'New agenda item' %}</a>
</li>
{% endif %}
{# polls #}
{% if perms.assignment.can_manage_assignment %}
{% for poll in polls %}
{% url 'assignment_poll_view' poll.id as url_assignmentpollview %}
<li class="{% if request.path == url_assignmentpollview %}selected{% endif %}"><a href="{% url 'assignment_poll_view' poll.id %}"><img src="{% static 'images/icons/edit.png' %}"> {{ forloop.counter }}. {% trans "ballot" %}</a></li>
{% endfor %}
{% endif %}
</ul>
{% endif %}
{% endblock %}

View File

@ -5,18 +5,19 @@
{% block title %}{{ block.super }} {% trans "Election settings" %}{% endblock %} {% block title %}{{ block.super }} {% trans "Election settings" %}{% endblock %}
{% block content %} {% block content %}
<h1>{% trans "Election settings" %}</h1> <h1>
{% trans "Configuration" %}
<small>{% trans "Elections" %}</small>
{% block config_submenu %}{{ block.super }}{% endblock %}
</h1>
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{{ form.as_p }} {% include "form.html" %}
<p> <p>
<button class="button" type="submit"> {% include "formbuttons_save.html" %}
<span class="icon ok">{% trans 'Save' %}</span> <a href="{% url 'config_assignment' %}" class="btn">
</button> {% trans 'Cancel' %}
<a href="{% url 'config_assignment' %}"> </a>
<button class="button" type="button" onclick="window.location='{% url 'config_assignment' %}'"> </p>
<span class="icon cancel">{% trans 'Cancel' %}</span> <small>* {% trans "required" %}</small>
</button>
</a>
</p>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "assignment/base_assignment.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
@ -11,27 +11,24 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% if assignment %} <h1>
<h1>{% trans "Edit election" %}</h1> {% if assignment %}
{% else %} {% trans "Edit election" %}
<h1>{% trans "New election" %}</h1> {% else %}
{% endif %} {% trans "New election" %}
{% endif %}
<small class="pull-right">
<a href="{% url 'assignment_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
</small>
</h1>
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{{ form.as_p }} {% include "form.html" %}
<p> <p>
<button class="button" type="submit"> {% include "formbuttons_saveapply.html" %}
<span class="icon ok">{% trans 'Save' %}</span> <a href='{% url 'assignment_overview' %}' class="btn">
</button> {% trans 'Cancel' %}
<button class="button" type="submit" name="apply">
<span class="icon apply">{% trans 'Apply' %}</span>
</button>
<a href="{% url 'assignment_overview' %}">
<button class="button" type="button" onclick="window.location='{% url 'assignment_overview' %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
</a> </a>
</p> </p>
<small>* {% trans "required" %}</small> <small>* {% trans "required" %}</small>

View File

@ -1,35 +1,44 @@
{% extends "assignment/base_assignment.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %}
{% block title %}{{ block.super }} {% trans "Elections" %}{% endblock %} {% block title %}{{ block.super }} {% trans "Elections" %}{% endblock %}
{% block content %}
<h1>{% trans "Elections" %}</h1>
<p><form action="{{request.url}}" name="filter" method="get"> {% block content %}
<h1>{% trans "Elections" %}
<small class="pull-right">
{% if perms.assignment.can_manage_assignment %}
<a href="{% url 'assignment_new' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'New election' %}"><i class="icon-plus"></i> {% trans "New" %}</a>
{% endif %}
{% if perms.assignment.can_see_assignment %}
<a href="{% url 'print_assignment' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print all elections as PDF' %}"><i class="icon-print"></i> PDF</a>
{% endif %}
</small>
</h1>
<form action="{{request.url}}" name="filter" method="get">
{% trans "Filter" %}: {% trans "Filter" %}:
<select class="default-input" name="status" onchange="document.forms['filter'].submit()"> <select class="span3" name="status" onchange="document.forms['filter'].submit()">
<option value="---">-- {% trans "Status" %}--</option> <option value="---">-- {% trans "Status" %}--</option>
<option value="sea" {% if 'sea' in request.GET.status %}selected{% endif %}>{% trans "Searching for candidates" %}</option> <option value="sea" {% if 'sea' in request.GET.status %}selected{% endif %}>{% trans "Searching for candidates" %}</option>
<option value="vot" {% if 'vot' in request.GET.status %}selected{% endif %}>{% trans "Voting" %}</option> <option value="vot" {% if 'vot' in request.GET.status %}selected{% endif %}>{% trans "Voting" %}</option>
<option value="fin" {% if 'fin' in request.GET.status %}selected{% endif %}>{% trans "Finished" %}</option> <option value="fin" {% if 'fin' in request.GET.status %}selected{% endif %}>{% trans "Finished" %}</option>
</select> </select>
</form> </form>
</p>
{{ assignments|length }} <small><i>{{ assignments|length }}
{% blocktrans count counter=assignments|length %}election{% plural %}elections{% endblocktrans %} {% blocktrans count counter=assignments|length %}election{% plural %}elections{% endblocktrans %}
<table> </i></small>
<table class="table table-striped table-bordered">
<tr> <tr>
<th><a href="?sort=name{% if 'name' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Election" %}</a></th> <th><a href="?sort=name{% if 'name' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Election" %}</a></th>
<th>{% trans "Candidates" %}</th> <th>{% trans "Candidates" %}</th>
<th><a href="?sort=status{% if 'status' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Status" %}</a></th> <th class="optional"><a href="?sort=status{% if 'status' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Status" %}</a></th>
<th style="width: 1px;">{% trans "Actions" %}</th> <th class="mini_width">{% trans "Actions" %}</th>
</tr> </tr>
{% for assignment in assignments %} {% for assignment in assignments %}
<tr class="{% cycle '' 'odd' %} <tr {% if assignment.active %}activeline{% endif %}">
{% if assignment.active %}activeline{% endif %}">
<td><a href="{% url 'assignment_view' assignment.id %}">{{ assignment }}</a></td> <td><a href="{% url 'assignment_view' assignment.id %}">{{ assignment }}</a></td>
<td> <td>
{% blocktrans with posts=assignment.posts context "Number of searched candidates for an election"%}posts: {{ posts }}{% endblocktrans %} {% blocktrans with posts=assignment.posts context "Number of searched candidates for an election"%}posts: {{ posts }}{% endblocktrans %}
@ -38,19 +47,25 @@
{% endif %} {% endif %}
| {% blocktrans with elected=assignment.elected|length %}elected: {{ elected }}{% endblocktrans %} | {% blocktrans with elected=assignment.elected|length %}elected: {{ elected }}{% endblocktrans %}
</td> </td>
<td>{{ assignment.get_status_display }}</td> <td class="optional">{{ assignment.get_status_display }}</td>
<td> <td>
<span style="width: 1px; white-space: nowrap;"> <span style="width: 1px; white-space: nowrap;">
{% if perms.projector.can_manage_projector %} {% if perms.projector.can_manage_projector %}
<a class="activate_link {% if assignment.active %}active{% endif %}" href="{% url 'projector_activate_slide' assignment.sid %}" title="{% trans 'Activate election' %}"> <a href="{% url 'projector_activate_slide' assignment.sid %}" class="activate_link btn {% if assignment.active %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<span></span> <i class="icon-facetime-video {% if assignment.active %}icon-white{% endif %}"></i>
</a> </a>
{% endif %} {% endif %}
{% if perms.assignment.can_manage_assignment %} {% if perms.assignment.can_manage_assignment %}
<a href="{% url 'assignment_edit' assignment.id %}"><img src="{% static 'images/icons/edit.png' %}" title="{% trans 'Edit election' %}"></a> <a href="{% url 'assignment_edit' assignment.id %}" title="{% trans 'Edit' %}" class="btn btn-mini">
<a href="{% url 'assignment_delete' assignment.id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Delete election' %}"></a> <i class="icon-pencil"></i>
</a>
<a href="{% url 'assignment_delete' assignment.id %}" title="{% trans 'Delete' %}" class="btn btn-mini">
<i class="icon-remove"></i>
</a>
{% endif %} {% endif %}
<a href="{% url 'print_assignment' assignment.id %}" title="{% trans 'Election as PDF' %}"><img src="{% static 'images/icons/pdf.png' %}"></a> <a href="{% url 'print_assignment' assignment.id %}" class="btn btn-mini" title="{% trans 'Print election as PDF' %}">
<i class="icon-print"></i>
</a>
</span> </span>
</td> </td>
</tr> </tr>

View File

@ -1,19 +1,35 @@
{% extends 'assignment/base_assignment.html' %} {% extends 'base.html' %}
{% load i18n %} {% load i18n %}
{% block title %}{{ block.super }} {% trans "Election" %} "{{ assignment }}" {{ ballotnumber }}. {% trans "ballot" %}{% endblock %} {% block title %}{{ block.super }} {% trans "Election" %} "{{ assignment }}" {{ ballotnumber }}. {% trans "ballot" %}{% endblock %}
{% block content %} {% block content %}
<h1>{{ assignment }} {{ ballotnumber }}. {% trans "ballot" %}</h1> <h1>
{% if assignment.polldescription %} {{ assignment }}
<p><b>{% trans "Short description (for ballot paper)" %}:</b> {{ assignment.polldescription }}</p> <small>
{{ ballotnumber }}. {% trans "ballot" %}
</small>
<small class="pull-right">
<a href="{% url 'assignment_view' assignment.id %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to election" %}</a>
<!-- activate projector -->
{% if perms.projector.can_manage_projector %}
<a href="{% url 'projector_activate_slide' assignment.sid %}" class="activate_link btn {% if assignment.active %}btn-primary{% endif %} btn-mini" rel="tooltip" data-original-title="{% trans 'Show election' %}">
<i class="icon-facetime-video {% if assignment.active %}icon-white{% endif %}"></i>
</a>
{% endif %} {% endif %}
<i class="helptext">{% trans "Special values" %}: -1 = {% trans 'majority' %}; -2 = {% trans 'undocumented' %}</i> </small>
</h1>
<form action="" method="post" class="small-form">{% csrf_token %} {% if assignment.polldescription %}
<p><b>{% trans "Short description (for ballot paper)" %}:</b> {{ assignment.polldescription }}</p>
{% endif %}
<table style="width:auto"> <p>
{% trans "Special values" %}: <span class="badge badge-success">-1</span> = {% trans 'majority' %} | <span class="badge">-2</span> = {% trans 'undocumented' %}
</p>
<form action="" method="post" class="small-form">{% csrf_token %}
<table class="table table-striped table-bordered" style="width: auto;">
<tr> <tr>
<th>{% trans "Candidates" %}</th> <th>{% trans "Candidates" %}</th>
{% for value in poll.get_vote_values %} {% for value in poll.get_vote_values %}
@ -31,7 +47,7 @@
{% endfor %} {% endfor %}
</tr> </tr>
{% endfor %} {% endfor %}
<tr class="total"> <tr>
<td>{% trans "Invalid votes" %}</td> <td>{% trans "Invalid votes" %}</td>
{% for value in poll.get_vote_values %} {% for value in poll.get_vote_values %}
{% if forloop.first %} {% if forloop.first %}
@ -41,7 +57,7 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</tr> </tr>
<tr class="total"> <tr class="total warning">
<td>{% trans "Votes cast" %}</td> <td>{% trans "Votes cast" %}</td>
{% for value in poll.get_vote_values %} {% for value in poll.get_vote_values %}
{% if forloop.first %} {% if forloop.first %}
@ -54,26 +70,21 @@
</table> </table>
<p> <p>
<a href="{% url 'print_assignment_poll' poll.id %}"> <a href="{% url 'print_assignment_poll' poll.id %}" class="btn">
<button class="button" type="button" onclick="window.location='{% url 'print_assignment_poll' poll.id %}'"> <i class="icon-print"></i> {% trans 'Ballot paper as PDF' %}
<span class="icon pdf">{% trans 'Ballot paper as PDF' %}</span>
</button>
</a> </a>
</p> </p>
<!-- Control buttons -->
<p> <div class="control-group">
<button class="button" type="submit"> <button type="submit" class="btn btn-primary">
<span class="icon ok">{% trans 'Save' %}</span> {% trans 'Save' %}
</button> </button>
<button class="button" type="submit" name="apply"> <button type="submit" name="apply" class="btn">
<span class="icon apply">{% trans 'Apply' %}</span> {% trans 'Apply' %}
</button> </button>
<a href="{% url 'assignment_view' poll.assignment.id %}"> <a href="{% url 'assignment_view' poll.assignment.id %}" class="btn">
<button class="button" type="button" onclick="window.location='{% url 'assignment_view' poll.assignment.id %}'"> {% trans 'Cancel' %}
<span class="icon cancel">{% trans 'Cancel' %}</span> </a>
</button> </div>
</a> </form>
</p>
</form>
{% endblock %} {% endblock %}

View File

@ -1,96 +1,121 @@
{% extends "assignment/base_assignment.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load staticfiles %}
{% block title %}{{ block.super }} {% trans "Election" %} "{{ assignment }}"{% endblock %} {% block title %}{{ block.super }} {% trans "Election" %} "{{ assignment }}"{% endblock %}
{% block header %}
<link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/assignment.css' %}" />
{% endblock %}
{% block javascript %}
<script type="text/javascript" src="{% static 'javascript/assignment.js' %}"></script>
{% endblock %}
{% block content %} {% block content %}
<div id="sidebar"> <h1>
<div class="box"> {{ assignment }}
<h4>{% trans "Status" %}:</h4> <small class="pull-right">
{% trans assignment.get_status_display %} <a href="{% url 'assignment_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
<h4>{% trans "Number of available posts" %}:</h4> <!-- activate projector -->
{{ assignment.posts }} {% if perms.projector.can_manage_projector %}
</div> <a href="{% url 'projector_activate_slide' assignment.sid %}" class="activate_link btn {% if assignment.active %}btn-primary{% endif %} btn-mini" rel="tooltip" data-original-title="{% trans 'Show election' %}">
<i class="icon-facetime-video {% if assignment.active %}icon-white{% endif %}"></i>
<br><br> </a>
{% if perms.assignment.can_manage_assignment %}
<div class="box">
<h4>{% trans "Change status" %}:</h4>
<input type="radio" name="status" onclick="window.location.href='{% url 'assignment_set_status' assignment.id 'sea' %}';"
{% if 'sea' in assignment.status %}checked{% endif %}>{% trans 'Searching for candidates' %}<br>
<input type="radio" name="status" onclick="window.location.href='{% url 'assignment_set_status' assignment.id 'vot' %}';"
{% if 'vot' in assignment.status %}checked{% endif %}>{% trans 'Voting' %}<br>
<input type="radio" name="status" onclick="window.location.href='{% url 'assignment_set_status' assignment.id 'fin' %}';"
{% if 'fin' in assignment.status %}checked{% endif %}>{% trans 'Finished' %}
</div>
{% endif %} {% endif %}
</div> <div class="btn-group">
<a data-toggle="dropdown" href="#" class="btn btn-mini dropdown-toggle">
<div style="margin-right: 250px; min-width: 400px;"> {% trans 'More actions' %}
<h1>{{ assignment }}</h1> <span class="caret"></span>
<p>{{ assignment.description|linebreaks }}</p> </a>
<ul class="dropdown-menu pull-right">
<!-- edit -->
<li><a href="{% url 'assignment_edit' assignment.id %}"><i class="icon-pencil"></i> {% trans 'Edit election' %}</a></li>
<!-- delete -->
<li><a href="{% url 'assignment_delete' assignment.id %}"><i class="icon-remove"></i> {% trans 'Delete election' %}</a></li>
<!-- edit poll -->
{% if perms.assignment.can_manage_assignment %}
{% for poll in motion.polls %}
<li><a href="{% url 'assignment_poll_view' poll.id %}"><i class="icon-edit"></i> {{ forloop.counter }}. {% trans "Ballot" %}</a></li>
{% endfor %}
{% endif %}
<!-- create agenda item -->
{% if perms.agenda.can_manage_agenda %}
<li>
<a href="{% url 'assignment_create_agenda' assignment.id %}"><i class="icon-plus"></i> {% trans 'New agenda item' %}</a>
</li>
{% endif %}
</ul>
</div>
</small>
</h1>
<div class="row-fluid">
<div class="span9">
<!-- Description -->
<h4>{% trans "Description" %}</h4>
{% if assignment.description %}
{{ assignment.description|linebreaks }}
{% else %}
{% endif %}
<br>
<!-- Candidates -->
{% if assignment.status != "fin" %} {% if assignment.status != "fin" %}
<h3>{% trans "Candidates" %}</h3> <h4>{% trans "Candidates" %}</h4>
<ol> <ol>
{% for person in assignment.get_participants %} {% for person in assignment.get_participants %}
<li> <li>
{{ person }} {{ person }}
{% if perms.assignment.can_manage_assignment %} {% if perms.assignment.can_manage_assignment %}
{% if assignment.status == "sea" or assignment.status == "vot" %} {% if assignment.status == "sea" or assignment.status == "vot" %}
<a href="{% url 'assignment_delother' assignment.id person.person_id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Remove candidate' %}"></a> <a href="{% url 'assignment_delother' assignment.id person.person_id %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Remove candidate' %}"><i class="icon-remove"></i></a>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if person in assignment.elected %} {% if person in assignment.elected %}
| <b>{% trans "elected" %}</b> | <b>{% trans "elected" %}</b>
{% if perms.assignment.can_manage_assignment %} {% if perms.assignment.can_manage_assignment %}
{% if assignment.status == "sea" or assignment.status == "vot" %} {% if assignment.status == "sea" or assignment.status == "vot" %}
<a href="{% url 'assignment_user_not_elected' assignment.id person.person_id %}"><img src="{% static 'images/icons/dialog-cancel.png' %}" title="{% trans 'Mark candidate as not elected' %}"></a> <a class="btn btn-mini" href="{% url 'assignment_user_not_elected' assignment.id person.person_id %}" rel="tooltip" data-original-title="{% trans 'Mark candidate as not elected' %}">
<i class="icon-ban-circle"></i>
</a>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endif %} {% endif %}
</li> </li>
{% empty %} {% empty %}
<li style="list-style: none outside none;"><i>{% trans "No candidates available." %}</i></li> <li style="list-style: none outside none; margin-left: -25px;"><i>{% trans "No candidates available." %}</i></li>
{% endfor %} {% endfor %}
</ol> </ol>
{% if assignment.status == "sea" or perms.assignment.can_manage_assignment and assignment.status == "vot" %} {% if assignment.status == "sea" or perms.assignment.can_manage_assignment and assignment.status == "vot" %}
{% if perms.assignment.can_nominate_self or perms.assignment.can_nominate_other %} {% if perms.assignment.can_nominate_self or perms.assignment.can_nominate_other %}
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{% if perms.assignment.can_nominate_self %} {% if perms.assignment.can_nominate_self %}
<p> <p>
{% if user_is_candidate %} {% if user_is_candidate %}
<a href="{% url 'assignment_delrun' assignment.id %}"> <a href='{% url 'assignment_delrun' assignment.id %}' class="btn btn-mini">
<span class="button"> <i class="icon-remove"></i> {% trans 'Withdraw self candidature' %}
<span class="icon removeuser">{% trans 'Withdraw self candidature' %}</span>
</span>
</a> </a>
{% else %} {% else %}
<a href="{% url 'assignment_run' assignment.id %}"> <a href='{% url 'assignment_run' assignment.id %}' class="btn btn-mini">
<span class="button"> <i class="icon-plus"></i> {% trans 'Self candidature' %}
<span class="icon adduser">{% trans 'Self candidature' %}</span>
</span>
</a> </a>
{% endif %} {% endif %}
</p> </p>
{% endif %} {% endif %}
{% if perms.assignment.can_nominate_other %} {% if perms.assignment.can_nominate_other %}
{% for field in form %} {% for field in form %}
<label>{{ field.label }}:</label> <label>{{ field.label }}:</label>
<nobr>{{ field }} <div class="input-append">
{% if perms.participant.can_see_participant and perms.participant.can_manage_participant %} {{ field }}
<a href="{% url 'user_new' %}" target="_blank"><img src="{% static 'images/icons/add-user.png' %}" title="{% trans 'Add new participant' %}"></a> <button class="btn btn-primary" type="submit" title="{% trans 'Apply' %}"><i class="icon-ok icon-white"></i></button>
{% endif %} {% if perms.participant.can_see_participant and perms.participant.can_manage_participant %}
</nobr> <a href="{% url 'user_new' %}" target="_blank" class="btn" title="{% trans 'Add new participant' %}"><i class="icon-add-user"></i></a>
{% endif %}
</div>
{% endfor %} {% endfor %}
<p> <p>
<button class="button" type="submit">
<span class="icon ok">{% trans 'Apply' %}</span>
</button>
</p> </p>
{% endif %} {% endif %}
</form> </form>
@ -99,11 +124,14 @@
{% endif %} {% endif %}
{% if perms.assignment.can_manage_assignments and blocked_candidates and assignment.status != "fin" %} {% if perms.assignment.can_manage_assignments and blocked_candidates and assignment.status != "fin" %}
<h3>{% trans "Blocked Candidates" %}</h3> <h4>{% trans "Blocked Candidates" %}</h4>
<ul> <ul>
{% for person in blocked_candidates %} {% for person in blocked_candidates %}
<li> <li>
{{ person }}<a href="{% url 'assignment_delother' assignment.id person.person_id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Remove candidate' %}"></a> {{ person }}
<a class="btn btn-mini" href="{% url 'assignment_delother' assignment.id person.person_id %}" title="{% trans 'Remove candidate' %}">
<i class="icon-ban-circle"></i>
</a>
</li> </li>
{% empty %} {% empty %}
<li>{% trans "No blocked candidates available." %}</li> <li>{% trans "No blocked candidates available." %}</li>
@ -111,120 +139,160 @@
</ul> </ul>
{% endif %} {% endif %}
<!-- Results -->
{% if assignment.status != "sea" or polls.exists %} {% if assignment.status != "sea" or polls.exists %}
<h3>{% trans "Election results" %}</h3> <h4>{% trans "Election results" %}</h4>
{% if polls.exists %} {% if polls.exists %}
<table id="election_table" style="width: auto;"> <table class="table table-striped table-bordered">
<tr> <tr>
<th>{% trans "Candidates" %}</th> <th></th>
{% for poll in polls %} {% with ballotnumber=polls.count %}
<th style="vertical-align: top; white-space:nowrap;"> <th colspan="{{ ballotnumber|add:'1' }}" style="text-align: center;">
{{ poll.get_ballot }}. {% trans 'ballot' %} {% trans "ballot" %}
{% if perms.assignment.can_manage_assignment %}
<br>
<a class="publish_link {% if poll.published %}published{% endif %}"
href="{% url 'assignment_poll_publish_status' poll.id %}"
title="{% trans 'Publish/unpublish results' %}">
<span></span>
</a>
<a href="{% url 'assignment_poll_view' poll.id %}"><img src="{% static 'images/icons/edit.png' %}" title="{% trans 'Edit' %}"></a>
<a href="{% url 'assignment_poll_delete' poll.id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Delete' %}"></a>
{% endif %}
</th> </th>
{% endfor %} {% endwith %}
{% if assignment.candidates and perms.assignment.can_manage_assignment and assignment.status == "vot" %} </tr>
<th> <tr>
<a href="{% url 'assignment_gen_poll' assignment.id %}"> <th>{% trans "Candidates" %}</th>
<span class="button"> {% for poll in polls %}
<span class="icon statistics">{% trans 'New ballot' %}</span> <th style="white-space:nowrap;" class="span1">
</span> {{ poll.get_ballot }}. {% trans 'ballot' %}
</a> {% if perms.assignment.can_manage_assignment %}
</th> <br>
{% endif %} <a class="publish_link btn btn-mini {% if poll.published %}btn-primary{% endif %}"
</tr> href="{% url 'assignment_poll_publish_status' poll.id %}"
rel="tooltip" data-original-title="{% trans 'Publish/unpublish results' %}">
{% for candidate, poll_list in vote_results.items %} {% if poll.published %}
<tr class="{% cycle 'odd' '' as rowcolors %}"> <i class="icon-checked-new_white"></i>
<td class="candidate"> {% else %}
{% if candidate in assignment.elected %} <i class="icon-unchecked-new"></i>
{% if perms.assignment.can_manage_assignment %} {% endif %}
<a class="election_link elected" href="{% url 'assignment_user_not_elected' assignment.id candidate.person_id %}"></a> </a>
{% else %} <a href="{% url 'assignment_poll_view' poll.id %}" class="btn btn-mini" title="{% trans 'Edit' %}"><i class="icon-pencil"></i></a>
<a class="elected"> <a href="{% url 'assignment_poll_delete' poll.id %}" class="btn btn-mini" title="{% trans 'Delete' %}"><i class="icon-remove"></i></a>
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Candidate is elected' %}"> {% endif %}
</th>
{% endfor %}
{% if assignment.candidates and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<th class="span1 nobr">
<a href="{% url 'assignment_gen_poll' assignment.id %}" class="btn btn-mini">
<i class="icon-plus"></i> {% trans 'New ballot' %}
</a> </a>
{% endif %} </th>
{% else %}
{% if perms.assignment.can_manage_assignment %}
<a class="election_link" href="{% url 'assignment_user_elected' assignment.id candidate.person_id %}"></a>
{% endif %}
{% endif %} {% endif %}
{{ candidate }} </tr>
</td> {% for candidate, poll_list in vote_results.items %}
{% for vote in poll_list %} <tr>
<td style="white-space:nowrap;"> <td>
{% if 'Yes' in vote and 'No' in vote and 'Abstain' in vote %} {% if candidate in assignment.elected %}
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Yes }}<br> {% if perms.assignment.can_manage_assignment %}
<img src="{% static 'images/icons/voting-no.png' %}" title="{% trans 'No' %}"> {{ vote.No }}<br> <a class="election_link elected" href="{% url 'assignment_user_not_elected' assignment.id candidate.person_id %}"></a>
<img src="{% static 'images/icons/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {{ vote.Abstain }}<br> {% else %}
{% elif 'Votes' in vote %} <a class="elected">
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Votes }} <img src="{% static 'img/voting-yes.png' %}" title="{% trans 'Candidate is elected' %}">
{% elif vote == None %} </a>
{% trans 'was not a <br> candidate'%} {% endif %}
{% else %} {% else %}
&nbsp; {% if perms.assignment.can_manage_assignment %}
<a class="election_link" href="{% url 'assignment_user_elected' assignment.id candidate.person_id %}"></a>
{% endif %}
{% endif %} {% endif %}
{{ candidate }}
</td> </td>
{% endfor %} {% for vote in poll_list %}
{% if assignment.candidates and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<td></td>
{% endif %}
</tr>
{% endfor %}
<tr class="{% cycle rowcolors %}">
<td>{% trans 'Invalid votes' %}</td>
{% for poll in polls %}
{% if poll.published or perms.assignment.can_manage_assignment %}
<td style="white-space:nowrap;"> <td style="white-space:nowrap;">
{% if poll.has_votes %} {% if 'Yes' in vote and 'No' in vote and 'Abstain' in vote %}
<img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> <img src="{% static 'img/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Yes }}<br>
{{ poll.print_votesinvalid }} <img src="{% static 'img/voting-no.png' %}" title="{% trans 'No' %}"> {{ vote.No }}<br>
<img src="{% static 'img/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {{ vote.Abstain }}<br>
{% elif 'Votes' in vote %}
<img src="{% static 'img/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Votes }}
{% elif vote == None %}
{% trans 'was not a <br> candidate'%}
{% else %}
&nbsp;
{% endif %} {% endif %}
</td> </td>
{% endfor %}
{% if assignment.candidates and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<td></td>
{% endif %} {% endif %}
</tr>
{% endfor %} {% endfor %}
{% if assignment.candidates and perms.assignment.can_manage_assignment and assignment.status == "vot" %} <tr>
<td></td> <td>{% trans 'Invalid votes' %}</td>
{% endif %} {% for poll in polls %}
</tr> {% if poll.published or perms.assignment.can_manage_assignment %}
<tr class="total"> <td style="white-space:nowrap;">
<td><strong>{% trans 'Votes cast' %}</strong></td> {% if poll.has_votes %}
{% for poll in polls %} <img src="{% static 'img/voting-invalid.png' %}" title="{% trans 'Invalid' %}">
{% if poll.published or perms.assignment.can_manage_assignment %} {{ poll.print_votesinvalid }}
<td style="white-space:nowrap;"> {% endif %}
{% if poll.has_votes %} </td>
<img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}"> {% endif %}
<strong>{{ poll.print_votescast }}</strong> {% endfor %}
{% endif %} {% if assignment.candidates and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
</td> <td></td>
{% endif %} {% endif %}
{% endfor %} </tr>
{% if assignment.candidates and perms.assignment.can_manage_assignment and assignment.status == "vot" %} <tr class="info total">
<td></td> <td><strong>{% trans 'Votes cast' %}</strong></td>
{% endif %} {% for poll in polls %}
</tr> {% if poll.published or perms.assignment.can_manage_assignment %}
</table> <td style="white-space:nowrap;">
{% if poll.has_votes %}
<img src="{% static 'img/voting-total.png' %}" title="{% trans 'Votes cast' %}">
<strong>{{ poll.print_votescast }}</strong>
{% endif %}
</td>
{% endif %}
{% endfor %}
{% if assignment.candidates and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<td></td>
{% endif %}
</tr>
</table>
{% else %} {% else %}
<i>{% trans "No results available." %}</i> <i>{% trans "No ballots available." %}</i>
{% if assignment.candidates and perms.assignment.can_manage_assignment and assignment.status == "vot" %} {% if assignment.candidates and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<p><a href="{% url 'assignment_gen_poll' assignment.id %}"> <p>
<span class="button"> <a href='{% url 'assignment_gen_poll' assignment.id %}' class="btn">
<span class="icon statistics">{% trans 'New ballot' %}</span> <i class="icon-plus"></i> {% trans 'New ballot' %}
</span> </a>
</a></p> </p>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endif %} {% endif %}
</div> </div> <!--/span-->
<div class="span3">
<div class="well">
<!-- Text -->
<h5>{% trans "Status" %}:</h5>
{% trans assignment.get_status_display %}
<!-- Posts -->
<h5>{% trans "Number of available posts" %}:</h5>
{{ assignment.posts }}
</div> <!--/well-->
{% if perms.assignment.can_manage_assignment %}
<div class="well">
<h4>{% trans "Change status" %}:</h4>
<label class="radio">
<input type="radio" name="status" onclick="window.location.href='{% url 'assignment_set_status' assignment.id 'sea' %}';"
{% if 'sea' in assignment.status %}checked{% endif %}>{% trans 'Searching for candidates' %}
</label>
<label class="radio">
<input type="radio" name="status" onclick="window.location.href='{% url 'assignment_set_status' assignment.id 'vot' %}';"
{% if 'vot' in assignment.status %}checked{% endif %}>{% trans 'Voting' %}<br>
</label>
<label class="radio">
<input type="radio" name="status" onclick="window.location.href='{% url 'assignment_set_status' assignment.id 'fin' %}';"
{% if 'fin' in assignment.status %}checked{% endif %}>{% trans 'Finished' %}
</label>
</div> <!--/well-->
{% endif %}
</div> <!--/span-->
</div> <!--/row-->
{% endblock %} {% endblock %}

View File

@ -1,21 +1,17 @@
{% load staticfiles %}
{% load i18n %} {% load i18n %}
{% load tags %} {% load tags %}
<ul style="line-height: 180%"> <ul style="line-height: 180%">
{% for assignment in assignments %} {% for assignment in assignments %}
<li class="{% if assignment.active %}activeline{% endif %}"> <li class="{% if assignment.active %}activeline{% endif %}">
<a href="{% url 'projector_activate_slide' assignment.sid %}" class="activate_link {% if assignment.active %}active{% endif %}"> <a href="{% url 'projector_activate_slide' assignment.sid %}" class="activate_link btn {% if assignment.active %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<div></div> <i class="icon-facetime-video {% if assignment.active %}icon-white{% endif %}"></i>
</a>&nbsp;
<a href="{% model_url assignment 'edit' %}" title="{% trans 'Edit' %}" class="btn btn-mini right">
<i class="icon-pencil"></i>
</a> </a>
<a href="{% model_url assignment 'delete' %}" title="{% trans 'Delete' %}" class="icon delete right"> <a href="{% url 'projctor_preview_slide' assignment.sid %}" title="{% trans 'Preview' %}" class="btn btn-mini right">
<span></span> <i class="icon-search"></i>
</a>
<a href="{% model_url assignment 'edit' %}" title="{% trans 'Edit' %}" class="icon edit right">
<span></span>
</a>
<a href="{% url 'projctor_preview_slide' assignment.sid %}" title="{% trans 'Preview' %}" class="icon preview right">
<span></span>
</a> </a>
<a href="{% model_url assignment 'view' %}">{{ assignment }}</a> <a href="{% model_url assignment 'view' %}">{{ assignment }}</a>
</li> </li>

View File

@ -66,7 +66,7 @@
<td class="candidate{% if candidate in assignment.elected %} elected{% endif %}"> <td class="candidate{% if candidate in assignment.elected %} elected{% endif %}">
{% if candidate in assignment.elected %} {% if candidate in assignment.elected %}
<a class="elected"> <a class="elected">
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Candidate is elected' %}"> <img src="{% static 'img/voting-yes.png' %}" title="{% trans 'Candidate is elected' %}">
</a> </a>
{% endif %} {% endif %}
{{ candidate }} {{ candidate }}
@ -75,11 +75,11 @@
<td style="white-space:nowrap;"{% if candidate in assignment.elected %} class="elected"{% endif %}> <td style="white-space:nowrap;"{% if candidate in assignment.elected %} class="elected"{% endif %}>
{% if not assignment_publish_winner_results_only or candidate in assignment.elected %} {% if not assignment_publish_winner_results_only or candidate in assignment.elected %}
{% if 'Yes' in vote and 'No' in vote and 'Abstain' in vote %} {% if 'Yes' in vote and 'No' in vote and 'Abstain' in vote %}
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Yes }}<br> <img src="{% static 'img/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Yes }}<br>
<img src="{% static 'images/icons/voting-no.png' %}" title="{% trans 'No' %}"> {{ vote.No }}<br> <img src="{% static 'img/voting-no.png' %}" title="{% trans 'No' %}"> {{ vote.No }}<br>
<img src="{% static 'images/icons/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {{ vote.Abstain }}<br> <img src="{% static 'img/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {{ vote.Abstain }}<br>
{% elif 'Votes' in vote %} {% elif 'Votes' in vote %}
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Votes }} <img src="{% static 'img/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Votes }}
{% elif vote == None %} {% elif vote == None %}
{% trans 'was not a <br> candidate'%} {% trans 'was not a <br> candidate'%}
{% else %} {% else %}
@ -97,7 +97,7 @@
{% for poll in polls %} {% for poll in polls %}
<td style="white-space:nowrap;"> <td style="white-space:nowrap;">
{% if poll.has_votes %} {% if poll.has_votes %}
<img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> <img src="{% static 'img/voting-invalid.png' %}" title="{% trans 'Invalid' %}">
{{ poll.print_votesinvalid }} {{ poll.print_votesinvalid }}
{% endif %} {% endif %}
</td> </td>
@ -112,7 +112,7 @@
<td style="white-space:nowrap;"> <td style="white-space:nowrap;">
{% if poll.has_votes %} {% if poll.has_votes %}
<img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}"> <img src="{% static 'img/voting-total.png' %}" title="{% trans 'Votes cast' %}">
<strong>{{ poll.print_votescast }}</strong> <strong>{{ poll.print_votescast }}</strong>
{% endif %} {% endif %}
</td> </td>

View File

@ -145,8 +145,9 @@ def edit(request, assignment_id=None):
def delete(request, assignment_id): def delete(request, assignment_id):
assignment = Assignment.objects.get(pk=assignment_id) assignment = Assignment.objects.get(pk=assignment_id)
if request.method == 'POST': if request.method == 'POST':
assignment.delete() if 'submit' in request.POST:
messages.success(request, _('Election <b>%s</b> was successfully deleted.') % assignment) assignment.delete()
messages.success(request, _('Election <b>%s</b> was successfully deleted.') % assignment)
else: else:
del_confirm_form(request, assignment) del_confirm_form(request, assignment)
return redirect(reverse('assignment_overview')) return redirect(reverse('assignment_overview'))
@ -204,16 +205,17 @@ def delother(request, assignment_id, user_id):
is_blocked = assignment.is_blocked(person) is_blocked = assignment.is_blocked(person)
if request.method == 'POST': if request.method == 'POST':
try: if 'submit' in request.POST:
assignment.delrun(person, blocked=False) try:
except Exception, e: assignment.delrun(person, blocked=False)
messages.error(request, e) except Exception, e:
else: messages.error(request, e)
if not is_blocked:
message = _("Candidate <b>%s</b> was withdrawn successfully.") % person
else: else:
message = _("<b>%s</b> was unblocked successfully.") % person if not is_blocked:
messages.success(request, message) message = _("Candidate <b>%s</b> was withdrawn successfully.") % person
else:
message = _("<b>%s</b> was unblocked successfully.") % person
messages.success(request, message)
else: else:
if not is_blocked: if not is_blocked:
message = _("Do you really want to withdraw <b>%s</b> from the election?") % person message = _("Do you really want to withdraw <b>%s</b> from the election?") % person
@ -533,7 +535,7 @@ class AssignmentPollPDF(PDFView):
pdf_document.build(story) pdf_document.build(story)
def append_to_pdf(self, story): def append_to_pdf(self, story):
imgpath = os.path.join(settings.SITE_ROOT, 'static/images/circle.png') imgpath = os.path.join(settings.SITE_ROOT, 'static/img/circle.png')
circle = "<img src='%s' width='15' height='15'/>&nbsp;&nbsp;" % imgpath circle = "<img src='%s' width='15' height='15'/>&nbsp;&nbsp;" % imgpath
cell = [] cell = []
cell.append(Spacer(0, 0.8 * cm)) cell.append(Spacer(0, 0.8 * cm))
@ -635,6 +637,7 @@ class Config(FormView):
permission_required = 'config.can_manage_config' permission_required = 'config.can_manage_config'
form_class = ConfigForm form_class = ConfigForm
template_name = 'assignment/config.html' template_name = 'assignment/config.html'
success_url_name = 'config_assignment'
def get_initial(self): def get_initial(self):
return { return {
@ -673,6 +676,7 @@ def register_tab(request):
selected = request.path.startswith('/assignment/') selected = request.path.startswith('/assignment/')
return Tab( return Tab(
title=_('Elections'), title=_('Elections'),
app='assignment',
url=reverse('assignment_overview'), url=reverse('assignment_overview'),
permission=( permission=(
request.user.has_perm('assignment.can_see_assignment') or request.user.has_perm('assignment.can_see_assignment') or
@ -684,10 +688,9 @@ def register_tab(request):
def get_widgets(request): def get_widgets(request):
return [ return [Widget(
Widget( name='assignments',
name='assignments', display_name=_('Elections'),
display_name=_('Elections'), template='assignment/widget.html',
template='assignment/widget.html', context={'assignments': Assignment.objects.all()},
context={'assignments': Assignment.objects.all()}, permission_required='projector.can_manage_projector')]
permission_required='projector.can_manage_projector')]

View File

@ -1,13 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load tags %}
{% load i18n %} {% load i18n %}
{% block submenu %} {% block config_submenu %}
<h4 class="sectiontitle">{% trans "Configuration" %}</h4> <small class="pull-right">
<ul> <div class="btn-toolbar">
{% for menu_link in menu_links %} <div class="btn-group">
<li{% if menu_link.2 %} class="selected"{% endif %}><a href="{{ menu_link.0 }}">{{ menu_link.1 }}</a></li> {% for menu_link in menu_links %}
{% endfor %} <a href="{{ menu_link.0 }}" class="btn btn-mini {% if menu_link.2 %}active{% endif %}">{{ menu_link.1 }}</a>
</ul> {% endfor %}
</div>
</div>
</small>
{% endblock %} {% endblock %}

View File

@ -5,19 +5,26 @@
{% block title %}{{ block.super }} {% trans "General settings" %}{% endblock %} {% block title %}{{ block.super }} {% trans "General settings" %}{% endblock %}
{% block content %} {% block content %}
<h1>{% trans "General settings" %}</h1> <h1>
{% trans "Configuration" %}
<small>{% trans "General" %}</small>
{% block config_submenu %}{{ block.super }}{% endblock %}
</h1>
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
<fieldset> <fieldset>
<legend>{% trans "Event" %}</legend> <legend>{% trans "Event" %}</legend>
{% for field in form %} {% for field in form %}
{% if "id_event" in field.label_tag %} {% if "id_event" in field.label_tag %}
<p> <div class="control-group{% if field.errors %} error{% endif%}">
{{ field.errors }} <label for="id_{{ field.name }}">{{ field.label }}{% if field.field.required %}<span class="required">*</span>{% endif %}:</label>
{{ field.required }} {{ field }}
{{ field.label_tag }} {% if field.errors %}
{{ field }} <span class="help-inline">{{ field.errors }}</span>
{{ field.help_text }} {% endif %}
</p> {% if field.help_text %}
<span class="help-inline">{{ field.help_text }}</span>
{% endif %}
</div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</fieldset> </fieldset>
@ -26,13 +33,16 @@
<legend>{% trans "Welcome Widget" %}</legend> <legend>{% trans "Welcome Widget" %}</legend>
{% for field in form %} {% for field in form %}
{% if "id_welcome" in field.label_tag %} {% if "id_welcome" in field.label_tag %}
<p> <div class="control-group{% if field.errors %} error{% endif%}">
{{ field.errors }} <label for="id_{{ field.name }}">{{ field.label }}{% if field.field.required %}<span class="required">*</span>{% endif %}:</label>
{{ field.required }} {{ field }}
{{ field.label_tag }} {% if field.errors %}
{{ field }} <span class="help-inline">{{ field.errors }}</span>
{{ field.help_text }} {% endif %}
</p> {% if field.help_text %}
<span class="help-inline">{{ field.help_text }}</span>
{% endif %}
</div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</fieldset> </fieldset>
@ -41,25 +51,25 @@
<legend>{% trans "System" %}</legend> <legend>{% trans "System" %}</legend>
{% for field in form %} {% for field in form %}
{% if "id_system" in field.label_tag %} {% if "id_system" in field.label_tag %}
<p> <div class="control-group{% if field.errors %} error{% endif%}">
{{ field.errors }} <label for="id_{{ field.name }}">{{ field.label }}{% if field.field.required %}<span class="required">*</span>{% endif %}:</label>
{{ field.required }} {{ field }}
{{ field.label_tag }} {% if field.errors %}
{{ field }} <span class="help-inline">{{ field.errors }}</span>
{{ field.help_text }} {% endif %}
</p> {% if field.help_text %}
<span class="help-inline">{{ field.help_text }}</span>
{% endif %}
</div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</fieldset> </fieldset>
<p> <p>
<button class="button" type="submit"> {% include "formbuttons_save.html" %}
<span class="icon ok">{% trans 'Save' %}</span> <a href='{% url 'config_general' %}' class="btn">
</button> {% trans 'Cancel' %}
<a href="{% url 'config_general' %}">
<button class="button" type="button" onclick="window.location='{% url 'config_general' %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
</a> </a>
</p> </p>
<small>* {% trans "required" %}</small>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -5,7 +5,9 @@
{% block title %}{{ block.super }} {% trans "Version" %}{% endblock %} {% block title %}{{ block.super }} {% trans "Version" %}{% endblock %}
{% block content %} {% block content %}
<h1>{% trans "Version" %}</h1> <h1>{% trans "Version" %}
{% block config_submenu %}{{ block.super }}{% endblock %}
</h1>
{% for version in versions %} {% for version in versions %}
<p>{{ version.0 }} {% trans "Version" %}: {{ version.1 }}</p> <p>{{ version.0 }} {% trans "Version" %}: {{ version.1 }}</p>

View File

@ -33,6 +33,7 @@ class GeneralConfig(FormView):
permission_required = 'config.can_manage_config' permission_required = 'config.can_manage_config'
form_class = GeneralConfigForm form_class = GeneralConfigForm
template_name = 'config/general.html' template_name = 'config/general.html'
success_url_name = 'config_general'
def get_initial(self): def get_initial(self):
return { return {
@ -108,6 +109,7 @@ def register_tab(request):
selected = request.path.startswith('/config/') selected = request.path.startswith('/config/')
return Tab( return Tab(
title=_('Configuration'), title=_('Configuration'),
app='config',
url=reverse('config_general'), url=reverse('config_general'),
permission=request.user.has_perm('config.can_manage_config'), permission=request.user.has_perm('config.can_manage_config'),
selected=selected, selected=selected,

View File

@ -26,7 +26,6 @@ LOGIN_REDIRECT_URL = '/'
SESSION_COOKIE_NAME = 'OpenSlidesSessionID' SESSION_COOKIE_NAME = 'OpenSlidesSessionID'
ugettext = lambda s: s ugettext = lambda s: s
LANGUAGES = ( LANGUAGES = (

File diff suppressed because it is too large Load Diff

View File

@ -6,8 +6,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: OpenSlides 1.3\n" "Project-Id-Version: OpenSlides 1.3\n"
"Report-Msgid-Bugs-To: support@openslides.org\n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-12-09 11:12+0100\n" "POT-Creation-Date: 2013-02-05 14:24+0100\n"
"PO-Revision-Date: 2012-07-28 11:07+0200\n" "PO-Revision-Date: 2012-07-28 11:07+0200\n"
"Last-Translator: Oskar Hahn <mail@oshahn.de>\n" "Last-Translator: Oskar Hahn <mail@oshahn.de>\n"
"Language: de\n" "Language: de\n"

File diff suppressed because it is too large Load Diff

View File

@ -97,6 +97,10 @@ def process_options(argv=None, check_args=True):
parser.add_option( parser.add_option(
"--no-reload", action="store_true", "--no-reload", action="store_true",
help="Do not reload the development server.") help="Do not reload the development server.")
parser.add_option(
"--no-browser",
action="store_false", dest="start_browser", default=True,
help="Do not automatically start web browser.")
parser.add_option( parser.add_option(
"--version", action="store_true", "--version", action="store_true",
help="Show version and exit.") help="Show version and exit.")
@ -183,7 +187,11 @@ def _main(opts, database_path=None):
extra_args = ['--noreload'] extra_args = ['--noreload']
else: else:
extra_args = [] extra_args = []
start_openslides(addr, port, start_browser_url=url, extra_args=extra_args)
if opts.start_browser:
start_browser(url)
start_openslides(addr, port, extra_args=extra_args)
def create_settings(settings_path, database_path=None): def create_settings(settings_path, database_path=None):

View File

@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
"""
openslides.motion
~~~~~~~~~~~~~~~~~
The OpenSlides motion app appends the functionality to OpenSlides to
manage motions.
:copyright: (c) 2011-2013 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
import openslides.motion.signals
import openslides.motion.slides

View File

@ -0,0 +1,23 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
openslides.motion.exceptions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Exceptions for the motion app.
:copyright: (c) 2011-2013 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
from openslides.utils.exceptions import OpenSlidesError
class MotionError(OpenSlidesError):
"""Exception raised when errors in the motion accure."""
pass
class WorkflowError(OpenSlidesError):
"""Exception raised when errors in a workflow or state accure."""
pass

View File

@ -0,0 +1,280 @@
[
{
"pk":1,
"model":"motion.workflow",
"fields":{
"name":"Simple Workflow",
"first_state":1
}
},
{
"pk":2,
"model":"motion.workflow",
"fields":{
"name":"Complex Workflow",
"first_state":5
}
},
{
"pk":1,
"model":"motion.state",
"fields":{
"name":"submitted",
"workflow":1,
"dont_set_new_version_active":false,
"allow_submitter_edit":true,
"next_states":[
2,
3,
4
],
"allow_support":true,
"action_word":"",
"icon":"",
"versioning":false,
"allow_create_poll":true
}
},
{
"pk":2,
"model":"motion.state",
"fields":{
"name":"accepted",
"workflow":1,
"dont_set_new_version_active":false,
"allow_submitter_edit":false,
"next_states":[
],
"allow_support":false,
"action_word":"accept",
"icon":"",
"versioning":false,
"allow_create_poll":false
}
},
{
"pk":3,
"model":"motion.state",
"fields":{
"name":"rejected",
"workflow":1,
"dont_set_new_version_active":false,
"allow_submitter_edit":false,
"next_states":[
],
"allow_support":false,
"action_word":"reject",
"icon":"",
"versioning":false,
"allow_create_poll":false
}
},
{
"pk":4,
"model":"motion.state",
"fields":{
"name":"not decided",
"workflow":1,
"dont_set_new_version_active":false,
"allow_submitter_edit":false,
"next_states":[
],
"allow_support":false,
"action_word":"do not decide",
"icon":"",
"versioning":false,
"allow_create_poll":false
}
},
{
"pk":5,
"model":"motion.state",
"fields":{
"name":"published",
"workflow":2,
"dont_set_new_version_active":false,
"allow_submitter_edit":true,
"next_states":[
6,
9,
14
],
"allow_support":true,
"action_word":"",
"icon":"",
"versioning":false,
"allow_create_poll":false
}
},
{
"pk":6,
"model":"motion.state",
"fields":{
"name":"permitted",
"workflow":2,
"dont_set_new_version_active":true,
"allow_submitter_edit":true,
"next_states":[
7,
8,
9,
10,
11,
12,
13
],
"allow_support":false,
"action_word":"permit",
"icon":"",
"versioning":true,
"allow_create_poll":true
}
},
{
"pk":7,
"model":"motion.state",
"fields":{
"name":"accepted",
"workflow":2,
"dont_set_new_version_active":false,
"allow_submitter_edit":false,
"next_states":[
],
"allow_support":false,
"action_word":"accept",
"icon":"",
"versioning":true,
"allow_create_poll":false
}
},
{
"pk":8,
"model":"motion.state",
"fields":{
"name":"rejected",
"workflow":2,
"dont_set_new_version_active":false,
"allow_submitter_edit":false,
"next_states":[
],
"allow_support":false,
"action_word":"reject",
"icon":"",
"versioning":true,
"allow_create_poll":false
}
},
{
"pk":9,
"model":"motion.state",
"fields":{
"name":"withdrawed",
"workflow":2,
"dont_set_new_version_active":false,
"allow_submitter_edit":false,
"next_states":[
],
"allow_support":false,
"action_word":"withdraw",
"icon":"",
"versioning":true,
"allow_create_poll":false
}
},
{
"pk":10,
"model":"motion.state",
"fields":{
"name":"adjourned",
"workflow":2,
"dont_set_new_version_active":false,
"allow_submitter_edit":false,
"next_states":[
],
"allow_support":false,
"action_word":"adjourn",
"icon":"",
"versioning":true,
"allow_create_poll":false
}
},
{
"pk":11,
"model":"motion.state",
"fields":{
"name":"not concerned",
"workflow":2,
"dont_set_new_version_active":false,
"allow_submitter_edit":false,
"next_states":[
],
"allow_support":false,
"action_word":"",
"icon":"",
"versioning":true,
"allow_create_poll":false
}
},
{
"pk":12,
"model":"motion.state",
"fields":{
"name":"commited a bill",
"workflow":2,
"dont_set_new_version_active":false,
"allow_submitter_edit":false,
"next_states":[
],
"allow_support":false,
"action_word":"commit a bill",
"icon":"",
"versioning":true,
"allow_create_poll":false
}
},
{
"pk":13,
"model":"motion.state",
"fields":{
"name":"needs review",
"workflow":2,
"dont_set_new_version_active":false,
"allow_submitter_edit":false,
"next_states":[
],
"allow_support":false,
"action_word":"",
"icon":"",
"versioning":true,
"allow_create_poll":false
}
},
{
"pk":14,
"model":"motion.state",
"fields":{
"name":"rejected (not authorized)",
"workflow":2,
"dont_set_new_version_active":false,
"allow_submitter_edit":false,
"next_states":[
],
"allow_support":false,
"action_word":"reject (not authorized)",
"icon":"",
"versioning":true,
"allow_create_poll":false
}
}
]

View File

@ -2,68 +2,100 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
openslides.motion.forms openslides.motion.forms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
Forms for the motion app. Defines the DjangoForms for the motion app.
:copyright: 2011, 2012 by OpenSlides team, see AUTHORS. :copyright: (c) 2011-2013 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details. :license: GNU GPL, see LICENSE for more details.
""" """
from django import forms from django import forms
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext as _
from openslides.utils.forms import CssClassMixin from openslides.utils.forms import CssClassMixin
from openslides.utils.person import PersonFormField, MultiplePersonFormField from openslides.utils.person import PersonFormField, MultiplePersonFormField
from openslides.motion.models import Motion from .models import Motion, Workflow
class MotionForm(forms.Form, CssClassMixin): class BaseMotionForm(forms.ModelForm, CssClassMixin):
"""Base FormClass for a Motion.
For it's own, it append the version data to the fields.
The class can be mixed with the following mixins to add fields for the
submitter, supporters etc.
"""
title = forms.CharField(widget=forms.TextInput(), label=_("Title")) title = forms.CharField(widget=forms.TextInput(), label=_("Title"))
"""Title of the motion. Will be saved in a MotionVersion object."""
text = forms.CharField(widget=forms.Textarea(), label=_("Text")) text = forms.CharField(widget=forms.Textarea(), label=_("Text"))
"""Text of the motion. Will be saved in a MotionVersion object."""
reason = forms.CharField( reason = forms.CharField(
widget=forms.Textarea(), required=False, label=_("Reason")) widget=forms.Textarea(), required=False, label=_("Reason"))
"""Reason of the motion. will be saved in a MotionVersion object."""
class MotionFormTrivialChanges(MotionForm):
trivial_change = forms.BooleanField(
required=False, label=_("Trivial change"),
help_text=_("Trivial changes don't create a new version."))
class MotionManagerForm(forms.ModelForm, CssClassMixin):
submitter = PersonFormField(label=_("Submitter"))
class Meta: class Meta:
model = Motion model = Motion
exclude = ('number', 'status', 'permitted', 'log', 'supporter') fields = ()
def __init__(self, *args, **kwargs):
"""Fill the FormFields releated to the version data with initial data."""
self.motion = kwargs.get('instance', None)
self.initial = kwargs.setdefault('initial', {})
if self.motion is not None:
self.initial['title'] = self.motion.title
self.initial['text'] = self.motion.text
self.initial['reason'] = self.motion.reason
super(BaseMotionForm, self).__init__(*args, **kwargs)
class MotionManagerFormSupporter(MotionManagerForm): class MotionSubmitterMixin(forms.ModelForm):
# TODO: Do not show the submitter in the user-list """Mixin to append the submitter field to a MotionForm."""
submitter = MultiplePersonFormField(label=_("Submitter"))
"""Submitter of the motion. Can be one or more persons."""
def __init__(self, *args, **kwargs):
"""Fill in the submitter of the motion as default value."""
if self.motion is not None:
submitter = [submitter.person.person_id for submitter in self.motion.submitter.all()]
self.initial['submitter'] = submitter
super(MotionSubmitterMixin, self).__init__(*args, **kwargs)
class MotionSupporterMixin(forms.ModelForm):
"""Mixin to append the supporter field to a Motionform."""
supporter = MultiplePersonFormField(required=False, label=_("Supporters")) supporter = MultiplePersonFormField(required=False, label=_("Supporters"))
"""Supporter of the motion. Can be one or more persons."""
def __init__(self, *args, **kwargs):
"""Fill in the supporter of the motions as default value."""
if self.motion is not None:
supporter = [supporter.person.person_id for supporter in self.motion.supporter.all()]
self.initial['supporter'] = supporter
super(MotionSupporterMixin, self).__init__(*args, **kwargs)
class MotionImportForm(forms.Form, CssClassMixin): class MotionDisableVersioningMixin(forms.ModelForm):
csvfile = forms.FileField( """Mixin to add the option to the form to choose to disable versioning."""
widget=forms.FileInput(attrs={'size': '50'}),
label=_("CSV File"), disable_versioning = forms.BooleanField(
) required=False, label=_("Don't create a new version"),
import_permitted = forms.BooleanField( help_text=_("Don't create a new version. Useful e. g. for trivial changes."))
required=False, """BooleanField to decide, if a new version will be created, or the
label=_("Import motions with status \"authorized\""), last_version will be used."""
help_text=_('Set the initial status for each motion to '
'"authorized"'),
)
class ConfigForm(forms.Form, CssClassMixin): class ConfigForm(CssClassMixin, forms.Form):
"""Form for the configuration tab of OpenSlides."""
motion_min_supporters = forms.IntegerField( motion_min_supporters = forms.IntegerField(
widget=forms.TextInput(attrs={'class': 'small-input'}), widget=forms.TextInput(attrs={'class': 'small-input'}),
label=_("Number of (minimum) required supporters for a motion"), label=_("Number of (minimum) required supporters for a motion"),
initial=4, initial=4, min_value=0, max_value=8,
min_value=0,
max_value=8,
help_text=_("Choose 0 to disable the supporting system"), help_text=_("Choose 0 to disable the supporting system"),
) )
motion_preamble = forms.CharField( motion_preamble = forms.CharField(
@ -98,9 +130,13 @@ class ConfigForm(forms.Form, CssClassMixin):
label=_("Preamble text for PDF document (all motions)") label=_("Preamble text for PDF document (all motions)")
) )
motion_allow_trivial_change = forms.BooleanField( motion_allow_disable_versioning = forms.BooleanField(
label=_("Allow trivial changes"), label=_("Allow to disable versioning"),
help_text=_('Warning: Trivial changes undermine the motions '
'autorisation system.'),
required=False, required=False,
) )
motion_workflow = forms.ChoiceField(
widget=forms.Select(),
label=_("Workflow of new motions"),
required=True,
choices=[(workflow.pk, workflow.name) for workflow in Workflow.objects.all()])

File diff suppressed because it is too large Load Diff

173
openslides/motion/pdf.py Normal file
View File

@ -0,0 +1,173 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
openslides.motion.pdf
~~~~~~~~~~~~~~~~~~~~~
Functions to generate the PDFs for the motion app.
:copyright: (c) 2011-2013 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
from reportlab.lib import colors
from reportlab.lib.units import cm
from reportlab.platypus import (
SimpleDocTemplate, PageBreak, Paragraph, Spacer, Table, TableStyle)
from django.utils.translation import ugettext as _
from openslides.config.models import config
from openslides.utils.pdf import stylesheet
from .models import Motion
def motions_to_pdf(pdf):
"""Create a PDF with all motions."""
motions = Motion.objects.all()
all_motion_cover(pdf, motions)
for motion in motions:
pdf.append(PageBreak())
motion_to_pdf(pdf, motion)
def motion_to_pdf(pdf, motion):
"""Create a PDF for one motion."""
pdf.append(Paragraph(_("Motion: %s") % motion.title, stylesheet['Heading1']))
motion_data = []
# submitter
cell1a = []
cell1a.append(Spacer(0, 0.2 * cm))
cell1a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("Submitter"),
stylesheet['Heading4']))
cell1b = []
cell1b.append(Spacer(0, 0.2 * cm))
cell1b.append(Paragraph(unicode(motion.submitter), stylesheet['Normal']))
motion_data.append([cell1a, cell1b])
# TODO: choose this in workflow
if motion.state.edit_as_submitter:
# Cell for the signature
cell2a = []
cell2b = []
cell2a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" %
_("Signature"), stylesheet['Heading4']))
cell2b.append(Paragraph(42 * "_", stylesheet['Signaturefield']))
cell2b.append(Spacer(0, 0.1 * cm))
cell2b.append(Spacer(0, 0.2 * cm))
motion_data.append([cell2a, cell2b])
# supporters
if config['motion_min_supporters']:
cell3a = []
cell3b = []
cell3a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font><seqreset id='counter'>"
% _("Supporters"), stylesheet['Heading4']))
supporters = motion.supporter.all()
for supporter in supporters:
cell3b.append(Paragraph("<seq id='counter'/>.&nbsp; %s" % unicode(supporter),
stylesheet['Signaturefield']))
if motion.state.support:
for count in range(config['motion_min_supporters'] - supporters.count()):
cell3b.append(Paragraph("<seq id='counter'/>.&nbsp;" + 42 * "_",
stylesheet['Signaturefield']))
cell3b.append(Spacer(0, 0.2 * cm))
motion_data.append([cell3a, cell3b])
## # status
## cell4a = []
## cell4b = []
## note = " ".join(motion.notes)
## cell4a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("Status"), stylesheet['Heading4']))
## if note != "":
## if motion.status == "pub":
## cell4b.append(Paragraph(note, stylesheet['Normal']))
## else:
## cell4b.append(Paragraph("%s | %s" % (motion.get_status_display(), note), stylesheet['Normal']))
## else:
## cell4b.append(Paragraph("%s" % motion.get_status_display(), stylesheet['Normal']))
## data.append([cell4a, cell4b])
# Motion state
cell4a = []
cell4b = []
cell4a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("State"),
stylesheet['Heading4']))
cell4b.append(Paragraph(motion.state.name, stylesheet['Normal']))
motion_data.append([cell4a, cell4b])
# Version number (aid)
if motion.versions.count() > 1:
cell5a = []
cell5b = []
cell5a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("Version"),
stylesheet['Heading4']))
cell5b.append(Paragraph("%s" % motion.version.version_number, stylesheet['Normal']))
motion_data.append([cell5a, cell5b])
# voting results
polls = []
for poll in motion.polls.all():
if not poll.has_votes():
continue
polls.append(poll)
if polls:
cell6a = []
cell6b = []
cell6a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" %
_("Vote results"), stylesheet['Heading4']))
ballotcounter = 0
for poll in polls:
ballotcounter += 1
option = poll.get_options()[0]
yes, no, abstain, invalid, votecast = (
option['Yes'], option['No'], option['Abstain'],
poll.print_voteinvalid(), poll.print_votecast())
if len(polls) > 1:
cell6b.append(Paragraph("%s. %s" % (ballotcounter, _("Vote")),
stylesheet['Bold']))
cell6b.append(Paragraph(
"%s: %s <br/> %s: %s <br/> %s: %s <br/> %s: %s <br/> %s: %s" %
(_("Yes"), yes, _("No"), no, _("Abstention"), abstain, _("Invalid"),
invalid, _("Votes cast"), votecast), stylesheet['Normal']))
cell6b.append(Spacer(0, 0.2 * cm))
motion_data.append([cell6a, cell6b])
# Creating Table
table = Table(motion_data)
table._argW[0] = 4.5 * cm
table._argW[1] = 11 * cm
table.setStyle(TableStyle([('BOX', (0, 0), (-1, -1), 1, colors.black),
('VALIGN', (0, 0), (-1, -1), 'TOP')]))
pdf.append(table)
pdf.append(Spacer(0, 1 * cm))
pdf.append(Paragraph(motion.title, stylesheet['Heading3']))
pdf.append(Paragraph(motion.text.replace('\r\n', '<br/>'), stylesheet['Paragraph']))
if motion.reason:
pdf.append(Paragraph(_("Reason:"), stylesheet['Heading3']))
pdf.append(Paragraph(motion.reason.replace('\r\n', '<br/>'), stylesheet['Paragraph']))
return pdf
def all_motion_cover(pdf, motions):
"""Create a coverpage for all motions."""
pdf.append(Paragraph(config["motion_pdf_title"], stylesheet['Heading1']))
preamble = config["motion_pdf_preamble"]
if preamble:
pdf.append(Paragraph("%s" % preamble.replace('\r\n', '<br/>'), stylesheet['Paragraph']))
pdf.append(Spacer(0, 0.75 * cm))
if not motions:
pdf.append(Paragraph(_("No motions available."), stylesheet['Heading3']))
else:
for motion in motions:
pdf.append(Paragraph(motion.title, stylesheet['Heading3']))

View File

@ -0,0 +1,30 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
openslides.motion.signals
~~~~~~~~~~~~~~~~~~~~~~~~~
Signals for the motion app.
:copyright: (c) 2011-2013 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
from django.dispatch import receiver
from django.utils.translation import ugettext as _
from openslides.config.signals import default_config_value
@receiver(default_config_value, dispatch_uid="motion_default_config")
def default_config(sender, key, **kwargs):
"""Return the default config values for the motion app."""
return {
'motion_min_supporters': 0,
'motion_preamble': _('The assembly may decide,'),
'motion_pdf_ballot_papers_selection': 'CUSTOM_NUMBER',
'motion_pdf_ballot_papers_number': '8',
'motion_pdf_title': _('Motions'),
'motion_pdf_preamble': '',
'motion_allow_disable_versioning': False,
'motion_workflow': 1}.get(key)

View File

@ -0,0 +1,16 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
openslides.motion.slides
~~~~~~~~~~~~~~~~~~~~~~~~
Defines the slides for the motion app.
:copyright: (c) 2011-2013 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
from openslides.projector.api import register_slidemodel
from .models import Motion
register_slidemodel(Motion)

View File

@ -1,66 +0,0 @@
{% extends "base.html" %}
{% load tags %}
{% load i18n %}
{% load staticfiles %}
{% block submenu %}
{% url 'motion_overview' as url_motionoverview %}
<h4>{% trans "Motions" %}</h4>
<ul>
<li class="{% if request.path == url_motionoverview %}selected{% endif %}"><a href="{% url 'motion_overview' %}">{% trans "All motions" %}</a></li>
{% if perms.motion.can_create_motion or perms.motion.can_manage_motion %}
<li class="{% active request '/motion/new' %}"><a href="{% url 'motion_new' %}">{% trans "New motion" %}</a></li>
{% endif %}
{% if perms.motion.can_manage_motion %}
<li class="{% active request '/motion/import' %}"><a href="{% url 'motion_import' %}">{% trans 'Import motions' %}</a></li>
{% endif %}
<li><a href="{% url 'print_motions' %}"><img src="{% static 'images/icons/pdf.png' %}"> {% trans 'All motions as PDF' %}</a></li>
</ul>
{# second submenu #}
{% if motion %}
<br>
<h3>{% trans "Motion No." %}
{% if motion.number != None %}
{{ motion.number }}
{% else %}
<i>[-]</i>
{% endif %}
</h3>
<ul>
{# view motion #}
{% url 'motion_view' motion.id as url_motionview %}
<li class="{% if request.path == url_motionview %}selected{% endif %}"><a href="{% url 'motion_view' motion.id %}">{% trans 'View motion' %}</a></li>
{# edit motion #}
{% if "edit" in actions %}
{% url 'motion_edit' motion.id as url_motionedit %}
<li class="{% if request.path == url_motionedit %}selected{% endif %}"><a href="{% url 'motion_edit' motion.id %}"><img src="{% static 'images/icons/edit.png' %}"> {% trans 'Edit motion' %}</a></li>
{% endif %}
{# delete motion #}
{% if "delete" in actions %}
<li><a href="{% url 'motion_delete' motion.id %}"><img src="{% static 'images/icons/delete.png' %}"> {% trans 'Delete motion' %}</a></li>
{% endif %}
{# PDF #}
<li><a href="{% url 'print_motion' motion.id %}"><img src="{% static 'images/icons/pdf.png' %}"> {% trans 'Motion as PDF' %}</a></li>
{# activate and polls #}
{% if perms.projector.can_manage_projector %}
<li>
<a class="activate_link {% if item.active %}active{% endif %}" href="{% url 'projector_activate_slide' motion.sid %}"><img src="{% static 'images/icons/projector.png' %}"> {% trans 'Show Motion' %}</a>
</li>
{% endif %}
{% if perms.motion.can_manage_motion %}
{% for poll in motion.polls %}
{% url 'motion_poll_view' poll.id as url_motionpollview %}
<li class="{% if request.path == url_motionpollview %}selected{% endif %}"><a href="{% url 'motion_poll_view' poll.id %}"><img src="{% static 'images/icons/edit.png' %}"> {{ forloop.counter }}. {% trans "Vote" %}</a></li>
{% endfor %}
{% endif %}
{# Agenda Item #}
{% if perms.agenda.can_manage_agenda %}
<li>
<a href="{% url 'motion_create_agenda' motion.id %}">{% trans 'New agenda item' %}</a>
</li>
{% endif %}
</ul>
{% endif %}
{% endblock %}

View File

@ -5,18 +5,19 @@
{% block title %}{{ block.super }} {% trans "Motion settings" %}{% endblock %} {% block title %}{{ block.super }} {% trans "Motion settings" %}{% endblock %}
{% block content %} {% block content %}
<h1>{% trans "Motion settings" %}</h1> <h1>
{% trans "Configuration" %}
<small>{% trans "Motions" %}</small>
{% block config_submenu %}{{ block.super }}{% endblock %}
</h1>
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{{ form.as_p }} {% include "form.html" %}
<p> <p>
<button class="button" type="submit"> {% include "formbuttons_save.html" %}
<span class="icon ok">{% trans 'Save' %}</span> <a href="{% url 'config_motion' %}" class="btn">
</button> {% trans 'Cancel' %}
<a href="{% url 'config_motion' %}"> </a>
<button class="button" type="button" onclick="window.location='{% url 'config_motion' %}'"> </p>
<span class="icon cancel">{% trans 'Cancel' %}</span> <small>* {% trans "required" %}</small>
</button>
</a>
</p>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -1,40 +0,0 @@
{% extends "motion/base_motion.html" %}
{% load i18n %}
{% block title %}
{{ block.super }}
{% if motion %}
{% trans "Edit motion" %}
{% else %}
{% trans "New motion" %}
{% endif %}
{% endblock %}
{% block content %}
{% if motion %}
<h1>{% trans "Edit motion" %}</h1>
{% else %}
<h1>{% trans "New motion" %}</h1>
{% endif %}
<form action="" method="post">{% csrf_token %}
{{ form.as_p }}
{{ managerform.as_p }}
<p>
<button class="button" type="submit">
<span class="icon ok">{% trans 'Save' %}</span>
</button>
<button class="button" type="submit" name="apply">
<span class="icon apply">{% trans 'Apply' %}</span>
</button>
<a href="{% url 'motion_overview' %}">
<button class="button" type="button" onclick="window.location='{% url 'motion_overview' %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
</a>
</p>
<small>* {% trans "required" %}</small>
</form>
{% endblock %}

View File

@ -1,36 +0,0 @@
{% extends "motion/base_motion.html" %}
{% load i18n %}
{% block title %}{{ block.super }} {% trans "Import motions" %} {% endblock %}
{% block content %}
<h1>{% trans "Import motions" %}</h1>
<p>{% trans 'Select a CSV file to import motions!' %}</p>
<p>{% trans 'Required comma separated values' %}:
<code>({% trans 'number, title, text, reason, first_name, last_name, is_group' %})</code>
<br>
{% trans '<code>number</code>, <code>reason</code> and <code>is_group</code> are optional and may be empty' %}.
<br>
{% trans 'Required CSV file encoding: UTF-8 (Unicode).' %}
</p>
<p><a href="http://dev.openslides.org/wiki/CSVImport" target="_blank">{% trans 'A CSV example file is available in OpenSlides Wiki.' %}</a>
</p>
<form enctype="multipart/form-data" action="" method="post">{% csrf_token %}
{{ form.as_p }}
<p>
<button class="button" type="submit">
<span class="icon import">{% trans 'Import' %}</span>
</button>
<a href="{% url 'motion_overview' %}">
<button class="button" type="button" onclick="window.location='{% url 'motion_overview' %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
</a>
</p>
<small>* {% trans "required" %}</small>
</form>
{% endblock %}

View File

@ -0,0 +1,100 @@
{% extends "base.html" %}
{% load tags %}
{% load i18n %}
{% load staticfiles %}
{% block title %}{{ block.super }} {% trans "Motion" %} "{{ motion.title }}"{% endblock %}
{% block content %}
<p>Titel: {{ motion.title }} </p>
<p>Text: {{ motion.text }}</p>
<p>Reason: {{ motion.reason }}</p>
<p>Submitter: {% for submitter in motion.submitter.all %}{{ submitter.person }} {% endfor %}</p>
<p>Supporter: {% for supporter in motion.supporter.all %}{{ supporter.person }} {% endfor %}</p>
<p>Active Version: {{ motion.active_version }}</p>
<p>State: {{ motion.state }}</p>
<h4>possible stats:</h4>
<ul>
{% for state in motion.state.next_states.all %}
<li><a href="{% url 'motion_set_state' motion.pk state.pk %}">{{ state }}</a></li>
{% endfor %}
<li><a href="{% url 'motion_reset_state' motion.pk %}">Reset State</a></li>
</ul>
<h4>Versions</h4>
<ol>
{% for motion_version in motion.versions.all %}
<li>
{% if motion_version.id == motion.version.id %}
<strong><a href="{% model_url motion_version %}">{{ motion_version }}</a></strong>
{% else %}
<a href="{% model_url motion_version %}">{{ motion_version }}</a>
{% endif %}
{% if motion_version.active %}
(active)
{% endif %}
{% if motion_version.rejected %}
(rejected)
{% endif %}
</li>
{% endfor %}
</ol>
<h4>{% trans "Vote results" %}:</h4>
{% with motion.polls.all as polls %}
<ul class="results">
{% for poll in polls %}
{% if perms.motion.can_manage_motion or poll.has_votes %}
<li>
{% if perms.motion.can_manage_motion %}
<strong>{{ forloop.counter }}. {% trans "Vote" %} </strong>
<a class="icon edit" href="{% model_url poll 'edit' %}" title="{% trans 'Edit Vote' %}">
<span></span>
</a>
<a class="icon delete" href="{% model_url poll 'delete' %}" title="{% trans 'Delete Vote' %}">
<span></span>
</a>
{% elif poll.has_votes %}
<strong>{{ forloop.counter }}. {% trans "Vote" %}:</strong>
{% endif %}
<br>
{% if poll.has_votes %}
{% with poll.get_options.0 as option %}
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ option.Yes }}<br>
<img src="{% static 'images/icons/voting-no.png' %}" title="{% trans 'No' %}"> {{ option.No }}<br>
<img src="{% static 'images/icons/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {{ option.Abstain }}<br>
<img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> {{ poll.print_votesinvalid }}<br>
<div style="border-top: 1px solid; padding-top: 5px; margin: 5px 0; width: 10em;">
<img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}"> {{ poll.print_votescast }}
</div>
{% endwith %}
{% else %}
{% if perms.motion.can_manage_motion %}
<a href="{% model_url poll %}">
<span class="button"><span class="icon statistics">{% trans 'Enter result' %}</span></span>
</a>
{% endif %}
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
{% if allowed_actions.create_poll %}
<a href="{% url 'motion_poll_create' motion.pk %}">
<span class="button"><span class="icon statistics">{% trans 'New vote' %}</span></span>
</a>
{% endif %}
{% endwith %}
<h4>log</h4>
<ul>
{% for message in motion.log_messages.all %}
<li>{{ message }}</li>
{% endfor %}
</ul>
{% endblock %}

View File

@ -0,0 +1,26 @@
{% extends "base.html" %}
{% load tags %}
{% load i18n %}
{% load staticfiles %}
{% block title %}{{ block.super }} {% trans "Motion Form" %}{% endblock %}
{% block content %}
<h1>{% trans "Motions Forms" %}</h1>
<form action="" method="post">{% csrf_token %}
{{ form.as_p }}
<button class="button" type="submit">
<span class="icon ok">{% trans 'Save' %}</span>
</button>
<button class="button" type="submit" name="apply">
<span class="icon apply">{% trans 'Apply' %}</span>
</button>
<a href="{% url 'motion_list' %}">
<button class="button" type="button" onclick="window.location='{% url 'motion_list' %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
</a>
<small>* {% trans "required" %}</small>
</form>
{% endblock %}

View File

@ -0,0 +1,16 @@
{% extends "base.html" %}
{% load tags %}
{% load i18n %}
{% load staticfiles %}
{% block title %}{{ block.super }} {% trans "Motions" %}{% endblock %}
{% block content %}
<h1>{% trans "Motions" %}</h1>
<ol>
{% for motion in motion_list %}
<li><a href="{% model_url motion %}">{{ motion }}</a></li>
{% endfor %}
</ol>
{% endblock %}

View File

@ -1,88 +0,0 @@
{% extends "motion/base_motion.html" %}
{% load tags %}
{% load i18n %}
{% load staticfiles %}
{% block title %}{{ block.super }} {% trans "Motions" %}{% endblock %}
{% block content %}
<h1>{% trans "Motions" %}</h1>
<p><form action="{{ request.url }}" name="filter" method="get">
{% trans "Filter" %}:
{% if min_supporters > 0 %}
<input type="checkbox" name="needsup" onchange="document.forms['filter'].submit()"
{% if 'on' in request.GET.needsup %}checked{% endif %}> {% trans "Need supporters" %} &nbsp;
{% endif %}
<input type="checkbox" name="number" onchange="document.forms['filter'].submit()"
{% if 'on' in request.GET.number %}checked{% endif %}> {% trans "Without number" %} &nbsp;
<input type="checkbox" name="status" onchange="document.forms['filter'].submit()"
{% if 'on' in request.GET.status %}checked{% endif %}> {% trans "Status" %}:
<select class="default-input" name="statusvalue" onchange="{% if 'on' in request.GET.status %}document.forms['filter'].submit(){% endif %}">
<option value="pub" {% if 'pub' in request.GET.statusvalue %}selected{% endif %}>{% trans "Not yet authorized" %}</option>
<option value="per" {% if 'on' in request.GET.status and 'per' in request.GET.statusvalue %}selected{% endif %}>{% trans "Authorized" %}</option>
<option value="acc" {% if 'on' in request.GET.status and 'acc' in request.GET.statusvalue %}selected{% endif %}>{% trans "Accepted" %}</option>
<option value="rej" {% if 'on' in request.GET.status and 'rej' in request.GET.statusvalue %}selected{% endif %}>{% trans "Rejected" %}</option>
<option value="wit" {% if 'on' in request.GET.status and 'wit' in request.GET.statusvalue %}selected{% endif %}>{% trans "Withdrawen (by submitter)" %}</option>
<option value="rev" {% if 'rev' in request.GET.statusvalue %}selected{% endif %}>{% trans "Needs Review" %}</option>
</select>
</form>
</p>
{{ motions|length }}
{% blocktrans count counter=motions|length context "number of motions"%}motion{% plural %}motions{% endblocktrans %}
<table>
<tr>
<th><a href="?sort=number{% if 'number' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Number" %}</a></th>
<th><a href="?sort=title{% if 'title' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Motion title" %}</a></th>
{% if min_supporters > 0 %}
<th><a href="?sort=supporter{% if 'supporter' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Number of supporters" %}</a></th>
{% endif %}
<th><a href="?sort=status{% if 'status' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Status" %}</a></th>
<th><a href="?sort=submitter{% if 'submitter' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Submitter" %}</a></th>
<th><a href="?sort=time{% if 'time' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{% trans "Creation Time" %}<a></th>
<th style="width: 1px;">{% trans "Actions" %}</th>
</tr>
{% for app_info in motions %}
{% with motion=app_info.motion useractions=app_info.actions %}
<tr class="{% cycle '' 'odd' %}
{% if motion.active %}activeline{% endif %}">
<td>{% if motion.number %}{{ motion.number }}{% else %}-{% endif %}</td>
<td><a href="{% url 'motion_view' motion.id %}">{{ motion.public_version.title }}</a></td>
{% if min_supporters > 0 %}
<td>{{ motion.count_supporters }}</td>
{% endif %}
<td>{% if motion.status != "pub" %}
{{ motion.get_status_display }}<br>
{% endif %}
{% for note in motion.notes %}
{{ note }}
{% if not forloop.last %}<br>{%endif%}
{% endfor %}
</td>
<td>{{ motion.submitter }}</td>
<td>{{ motion.creation_time }}</td>
<td>
<span style="width: 1px; white-space: nowrap;">
{% if perms.projector.can_manage_projector %}
<a class="activate_link {% if motion.active %}active{% endif %}" href="{% url 'projector_activate_slide' motion.sid %}" title="{% trans 'Activate motion' %}">
<span></span>
</a>
{% endif %}
{% if perms.motion.can_manage_motion %}
<a href="{% url 'motion_edit' motion.id %}"><img src="{% static 'images/icons/edit.png' %}" title="{% trans 'Edit motion' %}"></a>
{% if "delete" in useractions %}
<a href="{% url 'motion_delete' motion.id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Delete motion' %}"></a>
{% endif %}
{% endif %}
<a href="{% url 'print_motion' motion.id %}" title="{% trans 'Motion as PDF' %}"><img src="{% static 'images/icons/pdf.png' %}"></a>
</span>
</td>
</tr>
{% endwith %}
{% empty %}
<tr>
<td colspan="7"><i>{% trans "No motions available." %}</i></td>
</tr>
{% endfor %}
</table>
{% endblock %}

View File

@ -0,0 +1,48 @@
{% extends 'base.html' %}
{% load i18n %}
{% load staticfiles %}
{% load tags %}
{% block content %}
<h1>{{ motion }}</h1>
<i class="helptext">{% trans "Special values" %}: -1 = {% trans 'majority' %}; -2 = {% trans 'undocumented' %}</i>
<form action="" method="post" class="small-form">{% csrf_token %}
{{ pre_form }}
<span id="poll_id" style="display:none">{{ object.pk }}</span>
<table class="table" style="width: auto;">
<tr>
<th>{% trans "Option" %}</th>
<th>{% trans "Votes" %}</th>
</tr>
{% for value in forms.0 %}
<tr>
<td>{{ value.label }}</td>
<td>{{ value.errors }}{{ value }}</td>
</tr>
{% endfor %}
<tr class="total">
<td>{% trans "Invalid votes" %}</td>
<td>{{ pollform.votesinvalid.errors }}{{ pollform.votesinvalid }}</td>
</tr>
<tr class="total">
<td>{% trans "Votes cast" %}</td>
<td>{{ pollform.votescast.errors }}{{ pollform.votescast }}</td>
</tr>
</table>
{{ post_form }}
<p>
<button class="button" type="submit">
<span class="icon ok">{% trans 'Save' %}</span>
</button>
<button class="button" type="submit" name="apply">
<span class="icon apply">{% trans 'Apply' %}</span>
</button>
<a href="{% model_url motion %}">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</a>
</p>
</form>
{% endblock %}

View File

@ -1,64 +0,0 @@
{% extends 'motion/base_motion.html' %}
{% load i18n %}
{% load staticfiles %}
{% block title %}
{{ block.super }} {% trans "Motion" %} "{{ motion.public_version.title }}"
{{ ballot }}. {% trans "Vote" %}
{% endblock %}
{% block content %}
<h1>{{ motion.public_version.title }} ({% trans "Motion" %}
{{ motion.number }}) {{ ballot }}. {% trans "Vote" %}</h1>
<i class="helptext">{% trans "Special values" %}: -1 = {% trans 'majority' %}; -2 = {% trans 'undocumented' %}</i>
<form action="" method="post" class="small-form">{% csrf_token %}
{{ pre_form }}
<span id="poll_id" style="display:none">{{ poll.id }}</span>
<table class="table" style="width: auto;">
<tr>
<th>{% trans "Option" %}</th>
<th>{% trans "Votes" %}</th>
</tr>
{% for value in forms.0 %}
<tr>
<td>{{ value.label }}</td>
<td>{{ value.errors }}{{ value }}</td>
</tr>
{% endfor %}
<tr class="total">
<td>{% trans "Invalid votes" %}</td>
<td>{{ pollform.votesinvalid.errors }}{{ pollform.votesinvalid }}</td>
</tr>
<tr class="total">
<td>{% trans "Votes cast" %}</td>
<td>{{ pollform.votescast.errors }}{{ pollform.votescast }}</td>
</tr>
</table>
{{ post_form }}
<p>
<a href="{% url 'print_motion_poll' poll.id %}">
<button class="button" type="button" onclick="window.location='{% url 'print_motion_poll' poll.id %}'">
<span class="icon pdf">{% trans 'Ballot paper as PDF' %}</span>
</button>
</a>
</p>
<p>
<button class="button" type="submit">
<span class="icon ok">{% trans 'Save' %}</span>
</button>
<button class="button" type="submit" name="apply">
<span class="icon apply">{% trans 'Apply' %}</span>
</button>
<a href="{% url 'motion_view' motion.id %}">
<button class="button" type="button" onclick="window.location='{% url 'motion_view' motion.id %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
</a>
</p>
</form>
{% endblock %}

View File

@ -1,303 +0,0 @@
{% extends "motion/base_motion.html" %}
{% load tags %}
{% load i18n %}
{% load staticfiles %}
{% block title %}{{ block.super }} {% trans "Motion" %} "{{ version.title }}"{% endblock %}
{% block submenu %}
{{ block.super }}
{% endblock %}
{% block content %}
<div id="sidebar">
<div class="box">
<h4>{% trans "Submitter" %}:</h4>
{{ motion.submitter }}
{% if min_supporters > 0 %}
<h4>{% trans "Supporters" %}: *</h4>
{% if not motion.supporters %}
-
{% else %}
<ol>
{% for supporter in motion.supporters %}
<li> {{ supporter }}</li>
{% endfor %}
</ol>
{% endif %}
{% endif %}
<h4>{% trans "Status" %}:</h4>
{% if motion.status != "pub" %}
{% trans motion.get_status_display %}
<br>
{% endif %}
{% for note in motion.notes %}
{{ note }}
{% if not forloop.last %}<br>{% endif %}
{% endfor %}
<h4>{% trans "Vote results" %}:</h4>
{% with motion.polls as polls %}
{% if not polls.exists %}
{% if perms.motion.can_manage_motion %}
{% if "genpoll" in actions %}
<a href="{% url 'motion_gen_poll' motion.id %}">
<span class="button">
<span class="icon statistics">{% trans 'New vote' %}</span>
</span>
</a>
{% else %}
-
{% endif %}
{% else %}
-
{% endif %}
{% endif %}
<ul class="results">
{% for poll in polls %}
{% if perms.motion.can_manage_motion or poll.has_votes %}
<li>
{% if perms.motion.can_manage_motion %}
<strong>{{ forloop.counter }}. {% trans "Vote" %} </strong>
<a class="icon edit" href="{% url 'motion_poll_view' poll.id %}" title="{% trans 'Edit Vote' %}">
<span></span>
</a>
<a class="icon delete" href="{% url 'motion_poll_delete' poll.id %}" title="{% trans 'Delete Vote' %}">
<span></span>
</a>
{% elif poll.has_votes %}
<strong>{{ forloop.counter }}. {% trans "Vote" %}:</strong>
{% endif %}
<br>
{% if poll.has_votes %}
{% with poll.get_options.0 as option %}
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ option.Yes }}<br>
<img src="{% static 'images/icons/voting-no.png' %}" title="{% trans 'No' %}"> {{ option.No }}<br>
<img src="{% static 'images/icons/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {{ option.Abstain }}<br>
<img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> {{ poll.print_votesinvalid }}<br>
<div style="border-top: 1px solid; padding-top: 5px; margin: 5px 0; width: 10em;">
<img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}"> {{ poll.print_votescast }}
</div>
{% endwith %}
{% if perms.motion.can_manage_motion %}
{% if forloop.last %}
{% if "genpoll" in actions %}
<a href="{% url 'motion_gen_poll' motion.id %}">
<span class="button"><span class="icon statistics">{% trans 'New vote' %}</span></span>
</a>
{% endif %}
{% endif %}
{% endif %}
{% else %}
{% if perms.motion.can_manage_motion %}
<a href="{% url 'motion_poll_view' poll.id %}">
<span class="button"><span class="icon statistics">{% trans 'Enter result' %}</span></span>
</a>
{% endif %}
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
{% endwith %}
<h4>{% trans "Creation Time" %}:</h4>
{{ motion.creation_time }}
<p></p>
{% if "wit" in actions and user == motion.submitter.user %}
<p></p>
<a href="{% url 'motion_set_status' motion.id 'wit' %}">
<span class="button"><span class="icon revert">{% trans 'Withdraw' %}</span></span>
</a>
{% endif %}
{% if perms.motion.can_support_motion and min_supporters > 0 %}
{% if "unsupport" in actions %}
<p></p>
<a href="{% url 'motion_unsupport' motion.id %}">
<span class="button"><span class="icon remove">{% trans 'Unsupport' %}</span></span>
</a>
{% endif %}
{% if "support" in actions %}
<p></p>
<a href="{% url 'motion_support' motion.id %}">
<span class="button"><span class="icon add">{% trans 'Support' %}</span></span>
</a>
{% endif %}
{% endif %}
</div>
{% if min_supporters > 0 %}
<small>* {% trans "minimum required supporters" %}: {{ min_supporters }}</small>
{% endif %}
<br><br>
{% if perms.motion.can_manage_motion %}
<div class="box">
<h4><b>{% trans "Manage motion" %}</b></h4>
{% if "pub" in actions or "per" in actions or "nop" in actions or "setnumber" in actions %}
<h4>{% trans "Formal validation" %}:</h4>
{% if "pub" in actions %}
<a href="{% url 'motion_set_status' motion.id 'pub' %}"><span class="button"><span class="icon ok-blue">{% trans 'Publish' %}</span></span></a>
{% endif %}
{% if "per" in actions %}
<a href="{% url 'motion_permit' motion.id %}"><span class="button"><span class="icon ok-blue">{% trans 'Permit' %}</span></span></a>
{% endif %}
{% if "nop" in actions %}
<a href="{% url 'motion_notpermit' motion.id %}"><span class="button"><span class="icon reject">{% trans 'Not permit (reject)' %}</span></span></a>
{% endif %}
{% if "setnumber" in actions %}
<a href="{% url 'motion_set_number' motion.id %}"><span class="button"><span class="icon number">{% trans 'Set number' %}</span></span></a>
{% endif %}
</p>
{% endif %}
<h4></h4>
{% if "acc" in actions or "rej" in actions %}
<h4>{% trans "Result after vote" %}:</h4>
{% if "acc" in actions %}
<a href="{% url 'motion_set_status' motion.id 'acc' %}">
<span class="button"><span class="icon done">{% trans 'Accepted' %}</span></span>
</a>
{% endif %}
{% if "rej" in actions %}
<a href="{% url 'motion_set_status' motion.id 'rej' %}">
<span class="button"><span class="icon reject">{% trans 'Rejected' %}</span></span>
</a>
{% endif %}
{% endif %}
{% if "adj" in actions or "noc" in actions or "com" in actions or "wit" in actions %}
<h4>{% trans 'Result after debate' %}:</h4>
{% if "adj" in actions %}
<a href="{% url 'motion_set_status' motion.id 'adj' %}"><span class="button">{% trans 'Adjourned' %}</span></a><br>
{% endif %}
{% if "noc" in actions %}
<a href="{% url 'motion_set_status' motion.id 'noc' %}"><span class="button">{% trans 'Not Concerned' %}</span></a><br>
{% endif %}
{% if "com" in actions %}
<a href="{% url 'motion_set_status' motion.id 'com' %}"><span class="button">{% trans 'Commited a bill' %}</span></a><br>
{% endif %}
{% if "wit" in actions %}
<a href="{% url 'motion_set_status' motion.id 'wit' %}"><span class="button">{% trans 'Withdrawed by submitter' %}</span></a>
{% endif %}
{% endif %}
<p></p>
<hr>
<h4>{% trans "For Administration only:" %}</h4>
<a href="{% url 'motion_reset' motion.id %}">
<span class="button"><span class="icon undo">{% trans 'Reset' %}</span></span>
</a>
</div>
{% endif %} {# end perms.motion.can_support_motion #}
</div> <!-- end sidebar -->
<div id="main">
<h1>
{{ version.title }}
({% trans "Motion" %}
{% if motion.number != None %}
{{ motion.number }})
{% else %}
<i>[{% trans "no number" %}]</i>)
{% endif %}
</h1>
{% trans "Version" %} {{ version.aid }}
{% if motion.public_version != motion.last_version %}
&#8901;
{% if version == motion.public_version %}
{% trans "This is not the newest version." %} <a href="{% url 'motion_view_newest' motion.id %}">{% trans "Go to version" %} {{ motion.last_version.aid }}.</a>
{% else %}
{% trans "This is not the authorized version." %} <a href="{% url 'motion_view' motion.id %}">{% trans "Go to version" %} {{ motion.public_version.aid }}.</a>
{% endif %}
{% endif %}
<h2>{% trans "Motion" %}:</h2>
{{ version.text|linebreaks }}
<h2>{% trans "Reason" %}:</h2>
{% if version.reason %}
{{ version.reason|linebreaks }}
{% else %}
{% endif %}
{% if motion.versions|length > 1 %}
<h2>{% trans "Version History" %}:</h2>
<table class="table valigntop" style="width: auto;">
<tr>
<th></th>
<th>{% trans "Version" %}</th>
<th>{% trans "Time" %}</th>
<th>{% trans "Title" %}</th>
<th>{% trans "Text" %}</th>
<th>{% trans "Reason" %}</th>
</tr>
{% for revision in motion.versions %}
<tr class="{% cycle 'odd' '' %}">
<td style="white-space:nowrap;">
{% if motion.status != "pub" %}
{% if revision == motion.permitted %}
<img title="{% trans 'Version authorized' %}" src="{% static 'images/icons/accept.png' %}">
{% else %}
{% if perms.motion.can_manage_motion %}
<a href="{% url 'motion_version_permit' revision.id %}"><img title="{% trans 'Permit Version' %}" src="{% static 'images/icons/accept-grey.png' %}"></a>
{% endif %}
{% if not revision.rejected and revision.id > motion.permitted.id and perms.motion.can_manage_motion %}
<a href="{% url 'motion_version_reject' revision.id %}"><img title="{% trans 'Reject Version' %}" src="{% static 'images/icons/reject-grey.png' %}"></a>
{% endif %}
{% endif %}
{% if revision.rejected %}
<img title="{% trans 'Version rejected' %}" src="{% static 'images/icons/reject.png' %}">
{% endif %}
{% endif %}
</td>
<td>{{ revision.aid }}</td>
<td><i>{{ revision.time }}</i></td>
<td>
{% ifchanged %}
<b>{{ revision.title }}</b>
{% else %}
<i>[{% trans "unchanged" %}]</i>
{% endifchanged %}
</td>
<td>
{% ifchanged %}
{{ revision.text|linebreaks }}
{% else %}
<i>[{% trans "unchanged" %}]</i>
{% endifchanged %}
</td>
<td>
{% ifchanged %}
{{ revision.reason|linebreaks }}
{% else %}
<i>[{% trans "unchanged" %}]</i>
{% endifchanged %}
</td>
</tr>
{% endfor %}
</table>
{% endif %}
{% if perms.motion.can_manage_motion %}
<h2>{% trans "Log" %}:</h2>
{{ motion.log|linebreaks }}
{% endif %}
</div>
{% endblock %}

View File

@ -1,21 +1,17 @@
{% load staticfiles %}
{% load i18n %} {% load i18n %}
{% load tags %} {% load tags %}
<ul style="line-height: 180%"> <ul style="line-height: 180%">
{% for motion in motions %} {% for motion in motions %}
<li class="{% if motion.active %}activeline{% endif %}"> <li class="{% if motion.active %}activeline{% endif %}">
<a href="{% url 'projector_activate_slide' motion.sid %}" class="activate_link {% if motion.active %}active{% endif %}"> <a href="{% url 'projector_activate_slide' motion.sid %}" class="activate_link btn {% if motion.active %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<div></div> <i class="icon-facetime-video {% if motion.active %}icon-white{% endif %}"></i>
</a>&nbsp;
<a href="{% model_url motion 'edit' %}" title="{% trans 'Edit' %}" class="btn btn-mini right">
<i class="icon-pencil"></i>
</a> </a>
<a href="{% model_url motion 'delete' %}" title="{% trans 'Delete' %}" class="icon delete right"> <a href="{% url 'projctor_preview_slide' motion.sid %}" title="{% trans 'Preview' %}" class="btn btn-mini right">
<span></span> <i class="icon-search"></i>
</a>
<a href="{% model_url motion 'edit' %}" title="{% trans 'Edit' %}" class="icon edit right">
<span></span>
</a>
<a href="{% url 'projctor_preview_slide' motion.sid %}" title="{% trans 'Preview' %}" class="icon preview right">
<span></span>
</a> </a>
<a href="{% model_url motion 'view' %}"> <a href="{% model_url motion 'view' %}">
{{ motion.public_version.title }} {{ motion.public_version.title }}

View File

@ -11,15 +11,15 @@
<p><b>{% trans "Status" %}:</b><br> <p><b>{% trans "Status" %}:</b><br>
{% if motion.status != "pub" %} {% if motion.status != "pub" %}
{% if motion.status == "acc" %} {% if motion.status == "acc" %}
<img src="{% static 'images/icons/voting-yes.png' %}"> <img src="{% static 'img/voting-yes.png' %}">
{% endif %} {% endif %}
{% if motion.status == "rej" %} {% if motion.status == "rej" %}
<img src="{% static 'images/icons/voting-no.png' %}"> <img src="{% static 'img/voting-no.png' %}">
{% endif %} {% endif %}
{% trans motion.get_status_display %} {% trans motion.status %}
{% else %} {% else %}
{% for note in motion.notes %} {% for note in motion.notes %}
{{ note }} {{ note }}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</p> </p>
@ -34,12 +34,12 @@
{% endif %} {% endif %}
{% with poll.get_options.0 as option %} {% with poll.get_options.0 as option %}
<div class="results"> <div class="results">
<img src="{% static 'images/icons/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ option.Yes }} <br> <img src="{% static 'img/voting-yes.png' %}" title="{% trans 'Yes' %}"> {{ option.Yes }} <br>
<img src="{% static 'images/icons/voting-no.png' %}" title="{% trans 'No' %}"> {{ option.No }} <br> <img src="{% static 'img/voting-no.png' %}" title="{% trans 'No' %}"> {{ option.No }} <br>
<img src="{% static 'images/icons/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {{ option.Abstain }}<br> <img src="{% static 'img/voting-abstention.png' %}" title="{% trans 'Abstention' %}"> {{ option.Abstain }}<br>
<img src="{% static 'images/icons/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> {{ poll.print_votesinvalid }}<br> <img src="{% static 'img/voting-invalid.png' %}" title="{% trans 'Invalid' %}"> {{ poll.print_votesinvalid }}<br>
<hr> <hr>
<img src="{% static 'images/icons/voting-total.png' %}" title="{% trans 'Votes cast' %}"> {{ poll.print_votescast }} <img src="{% static 'img/voting-total.png' %}" title="{% trans 'Votes cast' %}"> {{ poll.print_votescast }}
</div> </div>
{% endwith %} {% endwith %}
{% else %} {% else %}
@ -53,7 +53,7 @@
{% endwith %} {% endwith %}
<p><b>{% trans "Submitter" %}:</b><br> <p><b>{% trans "Submitter" %}:</b><br>
{{ motion.submitter }} {{ motion.submitter.person }}
</p> </p>
</div> </div>
</div> </div>
@ -65,7 +65,7 @@
{% trans "Motion" %} <i>[{% trans "no number" %}]</i> {% trans "Motion" %} <i>[{% trans "no number" %}]</i>
{% endif %} {% endif %}
</h1> </h1>
<b>{{ motion.public_version.title }}</b> <b>{{ motion.title }}</b>
<hr> <hr>
{% endblock %} {% endblock %}

View File

@ -2,140 +2,105 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
openslides.motion.urls openslides.motion.urls
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
URL list for the motion app. Defines the URL patterns for the motion app.
:copyright: 2011, 2012 by OpenSlides team, see AUTHORS. :copyright: (c) 2011-2013 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details. :license: GNU GPL, see LICENSE for more details.
""" """
from django.conf.urls import url, patterns from django.conf.urls import url, patterns
from openslides.motion.views import (MotionDelete, ViewPoll,
MotionPDF, MotionPollPDF, CreateAgendaItem, SupportView)
urlpatterns = patterns('openslides.motion.views', urlpatterns = patterns('openslides.motion.views',
url(r'^$', url(r'^$',
'overview', 'motion_list',
name='motion_overview', name='motion_list',
), ),
url(r'^(?P<motion_id>\d+)/$', url(r'^create/$',
'view', 'motion_create',
name='motion_view',
),
url(r'^(?P<motion_id>\d+)/agenda/$',
CreateAgendaItem.as_view(),
name='motion_create_agenda',
),
url(r'^(?P<motion_id>\d+)/newest/$',
'view',
{'newest': True},
name='motion_view_newest',
),
url(r'^new/$',
'edit',
name='motion_new', name='motion_new',
), ),
url(r'^import/$', url(r'^(?P<pk>\d+)/$',
'motion_import', 'motion_detail',
name='motion_import', name='motion_detail',
), ),
url(r'^(?P<motion_id>\d+)/edit/$', url(r'^(?P<pk>\d+)/edit/$',
'edit', 'motion_edit',
name='motion_edit', name='motion_edit',
), ),
url(r'^(?P<motion_id>\d+)/del/$', url(r'^(?P<pk>\d+)/del/$',
MotionDelete.as_view(), 'motion_delete',
name='motion_delete', name='motion_delete',
), ),
url(r'^del/$', url(r'^(?P<pk>\d+)/version/(?P<version_number>\d+)/$',
MotionDelete.as_view(), 'motion_detail',
{ 'motion_id' : None , 'motion_ids' : None }, name='motion_version_detail',
name='motion_delete',
), ),
url(r'^(?P<motion_id>\d+)/setnumber/$', url(r'^(?P<pk>\d+)/version/(?P<version_number>\d+)/permit/$',
'set_number', 'version_permit',
name='motion_set_number',
),
url(r'^(?P<motion_id>\d+)/setstatus/(?P<status>[a-z]{3})/$',
'set_status',
name='motion_set_status',
),
url(r'^(?P<motion_id>\d+)/permit/$',
'permit',
name='motion_permit',
),
url(r'^version/(?P<aversion_id>\d+)/permit/$',
'permit_version',
name='motion_version_permit', name='motion_version_permit',
), ),
url(r'^version/(?P<aversion_id>\d+)/reject/$', url(r'^(?P<pk>\d+)/version/(?P<version_number>\d+)/reject/$',
'reject_version', 'version_reject',
name='motion_version_reject', name='motion_version_reject',
), ),
url(r'^(?P<motion_id>\d+)/notpermit/$', url(r'^(?P<pk>\d+)/support/$',
'notpermit', 'motion_support',
name='motion_notpermit',
),
url(r'^(?P<motion_id>\d+)/reset/$',
'reset',
name='motion_reset',
),
url(r'^(?P<motion_id>\d+)/support/$',
SupportView.as_view(support=True),
name='motion_support', name='motion_support',
), ),
url(r'^(?P<motion_id>\d+)/unsupport/$', url(r'^(?P<pk>\d+)/unsupport/$',
SupportView.as_view(support=False), 'motion_unsupport',
name='motion_unsupport', name='motion_unsupport',
), ),
url(r'^(?P<motion_id>\d+)/gen_poll/$', url(r'^(?P<pk>\d+)/create_poll/$',
'gen_poll', 'poll_create',
name='motion_gen_poll', name='motion_poll_create',
), ),
url(r'^print/$', url(r'^(?P<pk>\d+)/poll/(?P<poll_number>\d+)/edit/$',
MotionPDF.as_view(), 'poll_edit',
{'motion_id': None}, name='motion_poll_edit',
name='print_motions',
), ),
url(r'^(?P<motion_id>\d+)/print/$', url(r'^(?P<pk>\d+)/poll/(?P<poll_number>\d+)/del/$',
MotionPDF.as_view(), 'poll_delete',
name='print_motion',
),
url(r'^poll/(?P<poll_id>\d+)/print/$',
MotionPollPDF.as_view(),
name='print_motion_poll',
),
url(r'^poll/(?P<poll_id>\d+)/$',
ViewPoll.as_view(),
name='motion_poll_view',
),
url(r'^poll/(?P<poll_id>\d+)/del/$',
'delete_poll',
name='motion_poll_delete', name='motion_poll_delete',
), ),
url(r'^(?P<pk>\d+)/set_state/(?P<state>\d+)/$',
'set_state',
name='motion_set_state',
),
url(r'^(?P<pk>\d+)/reset_state/$',
'reset_state',
name='motion_reset_state',
),
url(r'^(?P<pk>\d+)/agenda/$',
'create_agenda_item',
name='motion_create_agenda',
),
url(r'^pdf/$',
'motion_list_pdf',
name='motion_list_pdf',
),
url(r'^(?P<pk>\d+)/pdf/$',
'motion_detail_pdf',
name='motion_detail_pdf',
),
) )

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
openslides.motion.workflow
~~~~~~~~~~~~~~~~~~~~~~~~~~
This file is only for development. It will be moved out of
the openslides module before the next release.
:copyright: (c) 2011-2013 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
from django.utils.translation import ugettext_noop
from .models import Workflow, State
def _init_builtin_workflows():
"""
Saves a simple and a complex workflow into the database.
This function is only called manually and lives here only for development.
"""
workflow_1 = Workflow(name=ugettext_noop('Simple Workflow'), id=1)
state_1_1 = State.objects.create(name=ugettext_noop('submitted'), workflow=workflow_1,
allow_create_poll=True, allow_support=True, allow_submitter_edit=True)
state_1_2 = State.objects.create(name=ugettext_noop('accepted'), workflow=workflow_1, action_word=ugettext_noop('accept'))
state_1_3 = State.objects.create(name=ugettext_noop('rejected'), workflow=workflow_1, action_word=ugettext_noop('reject'))
state_1_4 = State.objects.create(name=ugettext_noop('not decided'), workflow=workflow_1, action_word=ugettext_noop('do not decide'))
state_1_1.next_states.add(state_1_2, state_1_3, state_1_4)
state_1_1.save() # Is this neccessary?
workflow_1.first_state = state_1_1
workflow_1.save()
workflow_2 = Workflow(name=ugettext_noop('Complex Workflow'), id=2)
state_2_1 = State.objects.create(name=ugettext_noop('published'), workflow=workflow_2, allow_support=True, allow_submitter_edit=True)
state_2_2 = State.objects.create(name=ugettext_noop('permitted'), workflow=workflow_2, action_word=ugettext_noop('permit'),
allow_create_poll=True, allow_submitter_edit=True, versioning=True, dont_set_new_version_active=True)
state_2_3 = State.objects.create(name=ugettext_noop('accepted'), workflow=workflow_2, action_word=ugettext_noop('accept'), versioning=True)
state_2_4 = State.objects.create(name=ugettext_noop('rejected'), workflow=workflow_2, action_word=ugettext_noop('reject'), versioning=True)
state_2_5 = State.objects.create(name=ugettext_noop('withdrawed'), workflow=workflow_2,
action_word=ugettext_noop('withdraw'), versioning=True)
state_2_6 = State.objects.create(name=ugettext_noop('adjourned'), workflow=workflow_2, action_word=ugettext_noop('adjourn'), versioning=True)
state_2_7 = State.objects.create(name=ugettext_noop('not concerned'), workflow=workflow_2, versioning=True)
state_2_8 = State.objects.create(name=ugettext_noop('commited a bill'), workflow=workflow_2,
action_word=ugettext_noop('commit a bill'), versioning=True)
state_2_9 = State.objects.create(name=ugettext_noop('needs review'), workflow=workflow_2, versioning=True)
state_2_10 = State.objects.create(name=ugettext_noop('rejected (not authorized)'), workflow=workflow_2,
action_word=ugettext_noop('reject (not authorized)'), versioning=True)
state_2_1.next_states.add(state_2_2, state_2_5, state_2_10)
state_2_2.next_states.add(state_2_3, state_2_4, state_2_5, state_2_6, state_2_7, state_2_8, state_2_9)
state_2_1.save() # Is this neccessary?
state_2_2.save() # Is this neccessary?
workflow_2.first_state = state_2_1
workflow_2.save()

View File

@ -6,22 +6,24 @@
*/ */
$(function() { $(function() {
// change participant status (on/off)
$('.status_link').click(function(event) { $('.status_link').click(function(event) {
event.preventDefault(); event.preventDefault();
link = $(this); var link = $(this);
group = $(this).parent();
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: link.attr('href'), url: $(this).attr('href'),
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
if (data.active) { if (data.active) {
group.children('.status_link.deactivate').show(); newclass = 'icon-on';
group.children('.status_link.activate').hide(); link.addClass('btn-success');
} else { } else {
group.children('.status_link.deactivate').hide(); newclass = 'icon-off';
group.children('.status_link.activate').show(); link.removeClass('btn-success');
} }
link.children('i').removeClass('icon-off icon-on').addClass(newclass);
link.attr('href', data.link);
} }
}); });
}); });

View File

@ -1,22 +0,0 @@
/**
* OpenSlides participants style
*
* :copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
* :license: GNU GPL, see LICENSE for more details.
*/
a.status_link span {
background-repeat: no-repeat;
background-position: center;
width: 16px;
height: 16px;
display: inline-block;
}
a.status_link.deactivate span {
background-image: url(../images/icons/on.png);
}
a.status_link.activate span {
background-image: url(../images/icons/off.png);
}

View File

@ -1,77 +0,0 @@
{% extends "base.html" %}
{% load tags %}
{% load i18n %}
{% load staticfiles %}
{% block submenu %}
{% url 'user_overview' as url_users %}
{% url 'user_new' as url_usernew %}
{% url 'user_group_overview' as url_usergroups %}
{% url 'user_import' as url_userimport %}
<h4 class="sectiontitle">{% trans "Participants" %}</h4>
<ul>
{% if perms.participant.can_see_participant %}
<li class="{% if request.path == url_users %}selected{% endif %}"><a href="{% url 'user_overview' %}">{% trans "All participants" %}</a></li>
{% endif %}
{% if perms.participant.can_manage_participant %}
<li class="{% active request url_usernew %}"><a href="{% url 'user_new' %}">{% trans "New participant" %}</a></li>
<li class="{% if request.path == url_usergroups %}selected{% endif %}"><a href="{% url 'user_group_overview' %}">{% trans "All groups" %}</a></li>
<li class="{% active request '/participant/group/new' %}"><a href="{% url 'user_group_new' %}">{% trans "New group" %}</a></li>
<li class="{% if request.path == url_userimport %}selected{% endif %}"><a href="{% url 'user_import' %}"> {% trans 'Import participants' %}</a></li>
{% endif %}
{% if perms.participant.can_see_participant %}
<li><a href="{% url 'user_print' %}"><img src="{% static 'images/icons/pdf.png' %}"> {% trans 'List of participants as PDF' %}</a></li>
{% endif %}
{% 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>
{% endif %}
</ul>
{# second submenu #}
{% if shown_user %}
<br>
<h3>{{ shown_user.clean_name }}</h3>
<ul>
{# view shown_user #}
<li class="{% if request.path == 'foo' %}selected{% endif %}">
<a href="{% model_url shown_user 'view' %}">{% trans 'View participant' %}</a>
</li>
{% if perms.participant.can_manage_participant %}
{# edit shown_user #}
<li class="{% if request.path == 'foo' %}selected{% endif %}">
<a href="{% model_url shown_user 'edit' %}"><img src="{% static 'images/icons/edit.png' %}"> {% trans 'Edit participant' %}</a>
</li>
{# delete shown_user #}
<li>
<a href="{% model_url shown_user 'delete' %}"><img src="{% static 'images/icons/delete.png' %}"> {% trans 'Delete participant' %}</a>
</li>
{% endif %}
</ul>
{% elif group %}
<br>
<h3>{{ group.name }}</h3>
<ul>
{# view group #}
<li class="{% if request.path == 'foo' %}selected{% endif %}">
<a href="{% model_url group 'view' %}">{% trans 'View group' %}</a>
</li>
{# edit group #}
<li class="{% if request.path == 'foo' %}selected{% endif %}">
<a href="{% model_url group 'edit' %}"><img src="{% static 'images/icons/edit.png' %}"> {% trans 'Edit group' %}</a>
</li>
{# delete group #}
{% if group.name|lower != 'anonymous' and group.name|lower != 'registered' %}
<li>
<a href="{% model_url group 'delete' %}"><img src="{% static 'images/icons/delete.png' %}"> {% trans 'Delete group' %}</a>
</li>
{% endif %}
</ul>
{% endif %}
{% endblock %}

View File

@ -5,18 +5,19 @@
{% block title %}{{ block.super }} {% trans "Participant settings" %}{% endblock %} {% block title %}{{ block.super }} {% trans "Participant settings" %}{% endblock %}
{% block content %} {% block content %}
<h1>{% trans "Participant settings" %}</h1> <h1>
{% trans "Configuration" %}
<small>{% trans "Participants" %}</small>
{% block config_submenu %}{{ block.super }}{% endblock %}
</h1>
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{{ form.as_p }} {% include "form.html" %}
<p> <p>
<button class="button" type="submit"> {% include "formbuttons_save.html" %}
<span class="icon ok">{% trans 'Save' %}</span> <a href="{% url 'config_participant' %}" class="btn">
</button> {% trans 'Cancel' %}
<a href="{% url 'config_participant' %}"> </a>
<button class="button" type="button" onclick="window.location='{% url 'config_participant' %}'"> </p>
<span class="icon cancel">{% trans 'Cancel' %}</span> <small>* {% trans "required" %}</small>
</button>
</a>
</p>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "participant/base_participant.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
@ -11,33 +11,30 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% if edit_user %} <h1>
<h1>{% trans "Edit participant" %}</h1> {% if edit_user %}
{% else %} {% trans "Edit participant" %}
<h1>{% trans "New participant" %}</h1> {% else %}
{% endif %} {% trans "New participant" %}
{% endif %}
<small class="pull-right">
<a href="{% url 'user_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
</small>
</h1>
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{{ form.as_p }} {% include "form.html" %}
{% if edit_user %} {% if edit_user %}
<p> <p style="margin: -15px 0 25px 0;">
<a href="{% url 'user_reset_password' edit_user.id %}">{% trans 'Reset to First Password' %}</a> <a class="btn btn-mini" href="{% url 'user_reset_password' edit_user.id %}"><i class="icon-exclamation-sign"></i> {% trans 'Reset to First Password' %}</a>
</p> </p>
{% endif %} {% endif %}
<p> <p>
<button class="button" type="submit"> {% include "formbuttons_saveapply.html" %}
<span class="icon ok">{% trans 'Save' %}</span> <a href="{% url 'user_overview' %}" class="btn">
</button> {% trans 'Cancel' %}
<button class="button" type="submit" name="apply"> </a>
<span class="icon apply">{% trans 'Apply' %}</span>
</button>
<a href='{% url "user_overview" %}'>
<button class="button" type="button" onclick="window.location='{% url 'user_overview' %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
</a>
</p> </p>
<small>* {% trans "required" %}</small> <small>* {% trans "required" %}</small>
</form> </form>

View File

@ -1,4 +1,4 @@
{% extends "participant/base_participant.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load tags %} {% load tags %}
@ -7,16 +7,22 @@
{% block content %} {% block content %}
<h1>{{ group }}</h1> <h1>{{ group }}
<small class="pull-right">
<a href="{% url 'user_group_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
</small>
</h1>
<p>{{ group.description }}</p> <p>{{ group.description }}</p>
<h2>{% trans "Members" %}</h2> <h4>{% trans "Members" %}</h4>
<ol>
{% for member in group.user_set.all %} {% for member in group.user_set.all %}
<p>{{ member }}</p> <li>{{ member }}</li>
{% empty %} {% empty %}
<p>{% trans "No members available." %}</p> <p>{% trans "No members available." %}</p>
{% endfor %} {% endfor %}
</ol>
{% endblock %} {% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "participant/base_participant.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
@ -12,25 +12,23 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h1>
{% if group %} {% if group %}
<h1>{% trans "Edit group" %}</h1> {% trans "Edit group" %}
{% else %} {% else %}
<h1>{% trans "New group" %}</h1> {% trans "New group" %}
{% endif %} {% endif %}
<small class="pull-right">
<a href="{% url 'user_group_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
</small>
</h1>
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{{ form.as_p }} {% include "form.html" %}
<p> <p>
<button class="button" type="submit"> {% include "formbuttons_saveapply.html" %}
<span class="icon ok">{% trans 'Save' %}</span> <a href="{% url 'user_group_overview' %}" class="btn">
</button> {% trans 'Cancel' %}
<button class="button" type="submit" name="apply">
<span class="icon apply">{% trans 'Apply' %}</span>
</button>
<a href='{% url "user_group_overview" %}'>
<button class="button" type="button" onclick="window.location='{% url 'user_group_overview' %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
</a> </a>
</p> </p>
<small>* {% trans "required" %}</small> <small>* {% trans "required" %}</small>

View File

@ -1,30 +1,45 @@
{% extends "participant/base_participant.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %}
{% load tags %} {% load tags %}
{% block title %}{{ block.super }} {% trans "Groups" %}{% endblock %} {% block title %}{{ block.super }} {% trans "Groups" %}{% endblock %}
{% block content %} {% block content %}
<h1>{% trans "Groups" %}</h1> <h1>{% trans "Groups" %}
<table> <small class="pull-right">
<a href="{% url 'user_group_new' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'New group' %}"><i class="icon-plus"></i> {% trans "New" %}</a>
<a href="{% url 'user_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to participants overview" %}</a>
</small>
</h1>
<table class="table table-striped table-bordered">
<tr> <tr>
<th>{% trans "Group" %}</th> <th>{% trans "Group" %}</th>
<th>{% trans "Actions" %}</th> <th style="width: 1px;">{% trans "Actions" %}</th>
</tr> </tr>
{% for group in groups %} {% for group in groups %}
<tr class="{% cycle '' 'odd' %}"> <tr class="{% if group.active %}activeline{% endif %}">
<td><a href="{% model_url group 'view' %}">{{ group.name }}</a></td> <td>
<td><a href="{% url 'user_group_edit' group.id %}"><img src="{% static 'images/icons/edit.png' %}" title="{% trans 'Edit group' %}"></a> <a href="{% model_url group 'view' %}">{{ group.name }}</a>
{% if group.name|lower != 'anonymous' and group.name|lower != 'registered' %} </td>
<a href="{% url 'user_group_delete' group.id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Delete group' %}"></a> <td>
{% endif %} <span style="width: 1px; white-space: nowrap;">
{% if perms.projector.can_manage_projector %}
<a href="{% url 'projector_activate_slide' group.sid %}" class="activate_link btn {% if group.active %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<i class="icon-facetime-video {% if group.active %}icon-white{% endif %}"></i>
</a>
{% endif %}
<a href="{% url 'user_group_edit' group.id %}" title="{% trans 'Edit' %}" class="btn btn-mini">
<i class="icon-pencil"></i>
</a>
{% if group.name|lower != 'anonymous' and group.name|lower != 'registered' %}
<a href="{% url 'user_group_delete' group.id %}" title="{% trans 'Delete' %}" class="btn btn-mini">
<i class="icon-remove"></i>
</a>
{% endif %}
</span>
</td> </td>
</tr>
{% empty %}
<tr>
<td colspan="5"><i>{% trans "No groups available." %}</i></td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View File

@ -5,17 +5,14 @@
{% for group in groups %} {% for group in groups %}
{% if group.name != 'Anonymous' and group.name != 'Registered' %} {% if group.name != 'Anonymous' and group.name != 'Registered' %}
<li class="{% if group.active %}activeline{% endif %}"> <li class="{% if group.active %}activeline{% endif %}">
<a href="{% url 'projector_activate_slide' group.sid %}" class="activate_link {% if group.active %}active{% endif %}"> <a href="{% url 'projector_activate_slide' group.sid %}" class="activate_link btn {% if group.active %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<div></div> <i class="icon-facetime-video {% if group.active %}icon-white{% endif %}"></i>
</a>&nbsp;
<a href="{% model_url group 'edit' %}" title="{% trans 'Edit' %}" class="btn btn-mini right">
<i class="icon-pencil"></i>
</a> </a>
<a href="{% model_url group 'delete' %}" title="{% trans 'Delete' %}" class="icon delete right"> <a href="{% url 'projctor_preview_slide' group.sid %}" title="{% trans 'Preview' %}" class="btn btn-mini right">
<span></span> <i class="icon-search"></i>
</a>
<a href="{% model_url group 'edit' %}" title="{% trans 'Edit' %}" class="icon edit right">
<span></span>
</a>
<a href="{% url 'projctor_preview_slide' group.sid %}" title="{% trans 'Preview' %}" class="icon preview right">
<span></span>
</a> </a>
<a href="{% model_url group 'view' %}">{{ group }}</a> <a href="{% model_url group 'view' %}">{{ group }}</a>
</li> </li>

View File

@ -1,11 +1,17 @@
{% extends "participant/base_participant.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% block title %}{{ block.super }} {% trans "Import participants" %} {% endblock %} {% block title %}{{ block.super }} {% trans "Import participants" %} {% endblock %}
{% block content %} {% block content %}
<h1>{% trans 'Import participants' %}</h1> <h1>
{% trans 'Import participants' %}
<small class="pull-right">
<a href="{% url 'user_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
</small>
</h1>
<p>{% trans 'Select a CSV file to import participants!' %}</p> <p>{% trans 'Select a CSV file to import participants!' %}</p>
<p>{% trans 'Required comma separated values' %}: <p>{% trans 'Required comma separated values' %}:
@ -18,15 +24,13 @@
</p> </p>
<form enctype="multipart/form-data" action="" method="post">{% csrf_token %} <form enctype="multipart/form-data" action="" method="post">{% csrf_token %}
{{ form.as_p }} {% include "form.html" %}
<p> <p>
<button class="button" type="submit"> <button class="btn btn-primary" type="submit">
<span class="icon import">{% trans 'Import' %}</span> <span class="icon import">{% trans 'Import' %}</span>
</button> </button>
<a href="{% url 'user_overview' %}"> <a href="{% url 'user_overview' %}" class="btn">
<button class="button" type="button" onclick="window.location='{% url 'user_overview' %}'"> {% trans 'Cancel' %}
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
</a> </a>
</p> </p>
<small>* {% trans "required" %}</small> <small>* {% trans "required" %}</small>

View File

@ -1,25 +1,17 @@
{% extends "participant/base_participant.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load staticfiles %}
{% block mainmenu %} {% block loginbutton %}
<ul>
<li class="selected"><a href="{% url 'user_login' %}" title="">{% trans "Login" %}</a></li>
</ul>
{% endblock %} {% endblock %}
{% block submenu %} {% block body %}
{% endblock %} <div id="login-page" class="container">
<h2><img src="{% static '/static/img/logo-login.png' %}"></h2>
{% block content %}
<h1>{% trans "Login" %}</h1>
{% if form.errors %} {% if form.errors %}
<div class="notification error"> <div class="alert alert-error">
<a class="close" href="#">
<img alt="close" title="{% trans 'Close this notification' %}" src="{% static 'images/icons/cross.png' %}">
</a>
{% for msg in form.non_field_errors %} {% for msg in form.non_field_errors %}
<em>{{ msg }}</em> <em>{{ msg }}</em>
{% if not forloop.last %}<br />{% endif %} {% if not forloop.last %}<br />{% endif %}
@ -29,48 +21,37 @@
</div> </div>
{% endif %} {% endif %}
{% if first_time_message %} {% if first_time_message %}
<div class="notification info"> <div class="alert alert-info">
<a class="close" href="#">
<img alt="close" title="{% trans 'Close this notification' %}" src="{% static 'images/icons/cross.png' %}">
</a>
<em>{{ first_time_message|safe }}</em> <em>{{ first_time_message|safe }}</em>
</div> </div>
{% endif %} {% endif %}
<script> <script>
$("div.notification").click(function () { $("div.notification").click(function () {
$(this).hide("fast"); $(this).hide("fast");
}); });
</script> </script>
<form method="post" action="{% url 'user_login' %}{% if next %}?next={{ next }}{% endif %}"> <form method="post" action="{% url 'user_login' %}{% if next %}?next={{ next }}{% endif %}" class="well">
{% csrf_token %} {% csrf_token %}
<table> <div class="input-prepend">
<tr> <span class="add-on"><i class="icon-user"></i></span>
<td>{{ form.username.label_tag }}</td> <input type="text" maxlength="30" name="username" id="id_username" placeholder="{% trans 'Username' %}">
<td>{{ form.username }}</td> </div>
</tr> <div class="input-prepend">
<tr> <span class="add-on"><i class="icon-lock"></i></span>
<td>{{ form.password.label_tag }}</td> <input type="password" maxlength="30" name="password" id="id_password" placeholder="{% trans 'Password' %}">
<td>{{ form.password }}</td> </div>
</tr>
</table>
<p> <p>
<button class="button" type="submit"> <button type="submit" class="btn btn-primary">
<span class="icon ok">{% trans 'Login' %}</span> {% trans 'Login' %}
</button> </button>
{% if os_enable_anonymous_login %} {% if os_enable_anonymous_login %}
<button class="button" id="anonymous_login"> <a id="anonymous_login" class="btn" href="{% url 'dashboard' %}">
<span class="icon guest">{% trans 'Continue as guest' %}</span> {% trans 'Continue as guest' %}
</button> </a>
{% endif %} {% endif %}
<input type="hidden" name="next" value="{{ next }}" /> <input type="hidden" name="next" value="{{ next }}" />
</p> </p>
</form> </form>
{% if os_enable_anonymous_login %}
<script>
$("#anonymous_login").live('click', function () {
window.location.href = "{% url 'item_overview' %}";
return false;
});
</script>
{% endif %}
{% endblock %} {% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "participant/base_participant.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %} {% load staticfiles %}
@ -6,104 +6,142 @@
{% block title %}{{ block.super }} {% trans "Participants" %}{% endblock %} {% block title %}{{ block.super }} {% trans "Participants" %}{% endblock %}
{% block header %} {% block javascript %}
{% if perms.agenda.can_manage_agenda %} {% if perms.participant.can_manage_participant %}
<link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/participant.css' %}" />
<script type="text/javascript" src="{% static 'javascript/participant.js' %}"></script> <script type="text/javascript" src="{% static 'javascript/participant.js' %}"></script>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h1>{% trans "Participants" %}</h1> <h1>{% trans "Participants" %}
<small class="pull-right">
<div class="btn-toolbar">
{% if perms.participant.can_manage_participant %}
<a href="{% url 'user_new' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'New participant' %}"><i class="icon-plus"></i> {% trans "New" %}</a>
<a href="{% url 'user_group_overview' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'All groups' %}"><i class="icon-group"></i> {% trans "Groups" %}</a>
<a href="{% url 'user_import' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Import participants' %}"><i class="icon-import"></i> {% trans 'Import' %}</a>
{% endif %}
{% if perms.participant.can_see_participant and perms.participant.can_manage_participant %}
<div class="btn-group pull-right">
{% if user.is_authenticated %}
<a href="#" data-toggle="dropdown" class="btn btn-mini dropdown-toggle">
<i class="icon-print"></i> PDF
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
{% url 'user_settings' as url_usersettings %}
<li><a href="{% url 'user_print' %}"><i class="icon-list"></i> {% trans 'List of participants' %}</a></li>
<li><a href="{% url 'print_passwords' %}"><i class="icon-th-large"></i> {% trans 'First time passwords' %}</a></li>
</ul>
{% else %}
<a href="{% url 'user_login' %}" class="btn">{% trans "Login" %}</a>
{% endif %}
</div>
{% else %}
{% if perms.participant.can_see_participant %}
<a href="{% url 'user_print' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print list of participants as PDF' %}"><i class="icon-print"></i> PDF</a>
{% endif %}
{% if perms.participant.can_manage_participant %}
<a href="{% url 'print_passwords' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print first time passwords as PDF' %}"><i class="icon-print"></i> PDF</a>
{% endif %}
{% endif %}
</div>
</small>
</h1>
<p> <form action="" name="filter" method="get">
<form action="" name="filter" method="get"> {% trans "Filter" %}:
{% trans "Filter" %}: <div class="control-group">
<select class="default-input" name="gender" onchange="document.forms['filter'].submit()"> <select class="span2" name="gender" onchange="document.forms['filter'].submit()">
<option value="---">-- {% trans "Gender" %} --</option> <option value="---">-- {% trans "Gender" %} --</option>
<option value="male"{% if 'male' in sortfilter.gender %} selected{% endif %}>{% trans "Male" %}</option> <option value="male"{% if 'male' in sortfilter.gender %} selected{% endif %}>{% trans "Male" %}</option>
<option value="female"{% if 'female' in sortfilter.gender %} selected{% endif %}>{% trans "Female" %}</option> <option value="female"{% if 'female' in sortfilter.gender %} selected{% endif %}>{% trans "Female" %}</option>
<option value=""{% if '' in sortfilter.gender %} selected{% endif %}>{% trans "Not specified" %}</option> <option value=""{% if '' in sortfilter.gender %} selected{% endif %}>{% trans "Not specified" %}</option>
</select> </select>
<select class="default-input" name="structure_level" onchange="document.forms['filter'].submit()"> <select class="span2" name="structure_level" onchange="document.forms['filter'].submit()">
<option value="---">-- {% trans "Structure level" %} --</option> <option value="---">-- {% trans "Structure level" %} --</option>
{% for level in structure_levels %} {% for level in structure_levels %}
<option value="{{ level }}"{% if level in sortfilter.structure_level %} selected{% endif %}> <option value="{{ level }}"{% if level in sortfilter.structure_level %} selected{% endif %}>
{{ level }}</option> {{ level }}</option>
{% endfor %} {% endfor %}
</select> </select>
<select class="default-input" name="type" onchange="document.forms['filter'].submit()"> <select class="span2" name="type" onchange="document.forms['filter'].submit()">
<option value="---">-- {% trans "Type" %} --</option> <option value="---">-- {% trans "Type" %} --</option>
<option value="delegate"{% if 'delegate' in sortfilter.type %} selected{% endif %}>{% trans "Delegate" %}</option> <option value="delegate"{% if 'delegate' in sortfilter.type %} selected{% endif %}>{% trans "Delegate" %}</option>
<option value="observer"{% if 'observer' in sortfilter.type %} selected{% endif %}>{% trans "Observer" %}</option> <option value="observer"{% if 'observer' in sortfilter.type %} selected{% endif %}>{% trans "Observer" %}</option>
<option value="staff"{% if 'staff' in sortfilter.type %} selected{% endif %}>{% trans "Staff" %}</option> <option value="staff"{% if 'staff' in sortfilter.type %} selected{% endif %}>{% trans "Staff" %}</option>
<option value="guest"{% if 'guest' in sortfilter.type %} selected{% endif %}>{% trans "Guest" %}</option> <option value="guest"{% if 'guest' in sortfilter.type %} selected{% endif %}>{% trans "Guest" %}</option>
<option value=""{% if '' in sortfilter.type %} selected{% endif %}>{% trans "Not specified" %}</option> <option value=""{% if '' in sortfilter.type %} selected{% endif %}>{% trans "Not specified" %}</option>
</select> </select>
<select class="default-input" name="committee" onchange="document.forms['filter'].submit()"> <select class="span2" name="committee" onchange="document.forms['filter'].submit()">
<option value="---">-- {% trans "Committee" %} --</option> <option value="---">-- {% trans "Committee" %} --</option>
{% for committee in committees %} {% for committee in committees %}
<option value="{{ committee }}"{% if committee in sortfilter.committee %} selected{% endif %}> <option value="{{ committee }}"{% if committee in sortfilter.committee %} selected{% endif %}>
{{ committee }}</option> {{ committee }}</option>
{% endfor %} {% endfor %}
</select> </select>
<select class="default-input" name="status" onchange="document.forms['filter'].submit()"> <select class="span2" name="status" onchange="document.forms['filter'].submit()">
<option value="---">-- {% trans "Status" %} --</option> <option value="---">-- {% trans "Status" %} --</option>
<option value="1"{% if '1' in sortfilter.status %} selected{% endif %}>{% trans "Active" %}</option> <option value="1"{% if '1' in sortfilter.status %} selected{% endif %}>{% trans "Active" %}</option>
<option value="0"{% if '0' in sortfilter.status %} selected{% endif %}>{% trans "Inactive" %}</option> <option value="0"{% if '0' in sortfilter.status %} selected{% endif %}>{% trans "Inactive" %}</option>
</select> </select>
</form> </div>
</p> </form>
<small><i>
{% if users.count == allusers %} {% if users.count == allusers %}
{{ users.count }} {{ users.count }}
{% blocktrans count counter=users.count %}participant{% plural %}participants{% endblocktrans %} {% blocktrans count counter=users.count %}participant{% plural %}participants{% endblocktrans %}
{% else %} {% else %}
{{ users.count }} {% trans "of" %} {{ allusers }} {% trans "Participants" %} (= {{ percent }} %) {{ users.count }} {% trans "of" %} {{ allusers }} {% trans "Participants" %} (= {{ percent }} %)
{% endif %} {% endif %}
<table> </i></small>
<table class="table table-striped table-bordered">
<tr> <tr>
<th><a href="?sort=first_name&reverse={% if 'first_name' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "First Name" %}</a></th> <th><a href="?sort=first_name&reverse={% if 'first_name' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "First Name" %}</a></th>
<th><a href="?sort=last_name&reverse={% if 'last_name' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Last Name" %}</a></th> <th><a href="?sort=last_name&reverse={% if 'last_name' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Last Name" %}</a></th>
<th><a href="?sort=structure_level&reverse={% if 'structure_level' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Structure level" %}</a></th> <th class="optional"><a href="?sort=structure_level&reverse={% if 'structure_level' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Structure level" %}</a></th>
<th><a href="?sort=type&reverse={% if 'type' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Type" %}</a></th> <th class="optional"><a href="?sort=type&reverse={% if 'type' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Type" %}</a></th>
<th><a href="?sort=committee&reverse={% if 'committee' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Committee" %}</a></th> <th class="optional"><a href="?sort=committee&reverse={% if 'committee' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Committee" %}</a></th>
{% if perms.participant.can_manage_participant %} {% if perms.participant.can_manage_participant %}
<th><a href="?sort=comment&reverse={% if 'comment' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Comment" %}</a></th> <th class="optional"><a href="?sort=comment&reverse={% if 'comment' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Comment" %}</a></th>
<th><a href="?sort=last_login&reverse={% if 'last_login' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Last Login" %}</a></th> <th class="optional"><a href="?sort=last_login&reverse={% if 'last_login' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{% trans "Last Login" %}</a></th>
<th>{% trans "Actions" %}</th> <th class="mini_width">{% trans "Actions" %}</th>
{% endif %} {% endif %}
</tr> </tr>
{% for user in users %} {% for user in users %}
<tr class="{% cycle '' 'odd' %}"> <tr class="{% if user.active %}activeline{% endif %}">
<td><a href="{% model_url user 'view' %}">{{ user.first_name }}</a></td> <td><a href="{% url 'user_view' user.id %}">{{ user.first_name }}</a></td>
<td><a href="{% model_url user 'view' %}">{{ user.last_name }}</a></td> <td><a href="{% url 'user_view' user.id %}">{{ user.last_name }}</a></td>
<td>{{ user.structure_level }}</td> <td class="optional">{{ user.structure_level }}</td>
<td>{{ user.get_type_display }}</td> <td class="optional">{{ user.get_type_display }}</td>
<td>{{ user.committee }}</td> <td class="optional">{{ user.committee }}</td>
{% if perms.participant.can_manage_participant %} {% if perms.participant.can_manage_participant %}
<td>{{ user.comment|first_line }}</td> <td class="optional">{{ user.comment|first_line }}</td>
<td> <td class="optional">
{% if user.last_login > user.date_joined %} {% if user.last_login > user.date_joined %}
{{ user.last_login }} {{ user.last_login }}
{% endif %} {% endif %}
</td> </td>
<td> <td>
<span style="width: 1px; white-space: nowrap;"> <span style="width: 1px; white-space: nowrap;">
<a href="{% url 'user_edit' user.id %}"> {% if perms.projector.can_manage_projector %}
<img src="{% static 'images/icons/edit.png' %}" title="{% trans 'Edit participant' %}"> <a href="{% url 'projector_activate_slide' user.sid %}" class="activate_link btn {% if user.active %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<i class="icon-facetime-video {% if user.active %}icon-white{% endif %}"></i>
</a>
{% endif %}
<a href="{% url 'user_edit' user.id %}" title="{% trans 'Edit' %}" class="btn btn-mini">
<i class="icon-pencil"></i>
</a> </a>
{% if user != request_user %} {% if user != request_user %}
<a href="{% url 'user_delete' user.id %}"> <a href="{% url 'user_delete' user.id %}" title="{% trans 'Delete' %}" class="btn btn-mini">
<img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Delete participant' %}"> <i class="icon-remove"></i>
</a> </a>
{% endif %} {% endif %}
{% if user != request_user and not user.is_superuser %} {% if user != request_user and not user.is_superuser %}
<a class="status_link deactivate" href="{% url 'user_status_deactivate' user.id %}" title="{% trans 'Change status to inactive' %}"{% if not user.is_active %} style="display:none"{% endif %}> <a href="{% url 'user_status_toggle' user.id %}"
<span></span> class="status_link btn btn-mini {% if user.is_active %}btn-success{% endif %}"
</a> title="{% trans 'Change status (active/inactive)' %}">
<a class="status_link activate" href="{% url 'user_status_activate' user.id %}" title="{% trans 'Change status to active' %}"{% if user.is_active %} style="display:none"{% endif %}> <i class="{% if user.is_active %}icon-on{% else %}icon-off{% endif %}"></i>
<span></span>
</a> </a>
{% endif %} {% endif %}
</span> </span>

View File

@ -4,28 +4,11 @@
{% block title %}{{ block.super }} {% trans "Password Settings" %}{% endblock %} {% block title %}{{ block.super }} {% trans "Password Settings" %}{% endblock %}
{% block submenu %}
<h4 class="sectiontitle">{% trans "User Settings" %}</h4>
<ul>
<li><a href="{% url 'user_settings' %}">{% trans "Personal Settings" %}</a></li>
<li class="selected"><a href="{% url 'password_change' %}">{% trans "Password Settings" %}</a></li>
</ul>
{% endblock %}
{% block content %} {% block content %}
<h1>{% trans "Password Settings" %}</h1> <h1>{% trans "Password Settings" %}</h1>
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{{ form.as_p }} {% include "form.html" %}
{% include "formbuttons_save.html" %}
<button class="button" type="submit">
<span class="icon ok">{% trans 'Save' %}</span>
</button>
<a href=''>
<button class="button" type="button">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
</a>
</form> </form>
<p></p>
{% endblock %} {% endblock %}

View File

@ -2,29 +2,13 @@
{% load i18n %} {% load i18n %}
{% block title %}{{ block.super }} {% trans "Personal Settings" %}{% endblock %} {% block title %}{{ block.super }} {% trans "Edit profile" %}{% endblock %}
{% block submenu %}
<h4 class="sectiontitle">{% trans "User Settings" %}</h4>
<ul>
<li class="selected"><a href="{% url 'user_settings' %}">{% trans "Personal Settings" %}</a></li>
<li><a href="{% url 'password_change' %}">{% trans "Password Settings" %}</a></li>
</ul>
{% endblock %}
{% block content %} {% block content %}
<h1>{% trans "Personal Settings" %}</h1> <h1>{% trans "Edit profile" %}</h1>
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{{ form_user.as_p }} {% include "form.html" %}
{% include "formbuttons_save.html" %}
<button class="button" type="submit">
<span class="icon ok">{% trans 'Save' %}</span>
</button>
<a href=''>
<button class="button" type="button">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
</a>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "participant/base_participant.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load tags %} {% load tags %}
@ -7,11 +7,15 @@
{% block content %} {% block content %}
<h1>{{ shown_user }}</h1> <h1>{{ shown_user }}
<small class="pull-right">
<a href="{% url 'user_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
</small>
</h1>
<p>{{ shown_user.email }}</p> <p>{{ shown_user.email }}</p>
<h2>{% trans "Groups" %}</h2> <h4>{% trans "Groups" %}</h4>
<p> <p>
{% if shown_user.groups.all %} {% if shown_user.groups.all %}
{{ shown_user.groups.all|join:", " }} {{ shown_user.groups.all|join:", " }}
@ -21,32 +25,32 @@
</p> </p>
{% if shown_user.get_gender_display %} {% if shown_user.get_gender_display %}
<h2>{% trans "Gender" %}</h2> <h4>{% trans "Gender" %}</h4>
<p>{{ shown_user.get_gender_display }}</p> <p>{{ shown_user.get_gender_display }}</p>
{% endif %} {% endif %}
{% if shown_user.get_type_display %} {% if shown_user.get_type_display %}
<h2>{% trans "Type" %}</h2> <h4>{% trans "Type" %}</h4>
<p>{{ shown_user.get_type_display }}</p> <p>{{ shown_user.get_type_display }}</p>
{% endif %} {% endif %}
{% if shown_user.committee %} {% if shown_user.committee %}
<h2>{% trans "Committee" %}</h2> <h4>{% trans "Committee" %}</h4>
<p>{{ shown_user.committee }}</p> <p>{{ shown_user.committee }}</p>
{% endif %} {% endif %}
{% if shown_user.about_me %} {% if shown_user.about_me %}
<h2>{% trans "About me" %}</h2> <h4>{% trans "About me" %}</h4>
<p>{{ shown_user.about_me }}</p> <p>{{ shown_user.about_me }}</p>
{% endif %} {% endif %}
{% if perms.participant.can_manage_participant %} {% if perms.participant.can_manage_participant %}
{% if shown_user.comment %} {% if shown_user.comment %}
<h2>{% trans "Comment" %}</h2> <h4>{% trans "Comment" %}</h4>
<p>{{ shown_user.comment }}</p> <p>{{ shown_user.comment }}</p>
{% endif %} {% endif %}
<h2>{% trans "Last Login" %}</h2> <h4>{% trans "Last Login" %}</h4>
{% if shown_user.last_login > shown_user.date_joined %} {% if shown_user.last_login > shown_user.date_joined %}
<p>{{ shown_user.last_login }}</p> <p>{{ shown_user.last_login }}</p>
{% else %} {% else %}

View File

@ -4,17 +4,14 @@
<ul style="line-height: 180%"> <ul style="line-height: 180%">
{% for user in users %} {% for user in users %}
<li class="{% if user.active %}activeline{% endif %}"> <li class="{% if user.active %}activeline{% endif %}">
<a href="{% url 'projector_activate_slide' user.sid %}" class="activate_link {% if user.active %}active{% endif %}"> <a href="{% url 'projector_activate_slide' user.sid %}" class="activate_link btn {% if user.active %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<div></div> <i class="icon-facetime-video {% if user.active %}icon-white{% endif %}"></i>
</a>&nbsp;
<a href="{% model_url user 'edit' %}" title="{% trans 'Edit' %}" class="btn btn-mini right">
<i class="icon-pencil"></i>
</a> </a>
<a href="{% model_url user 'delete' %}" title="{% trans 'Delete' %}" class="icon delete right"> <a href="{% url 'projctor_preview_slide' user.sid %}" title="{% trans 'Preview' %}" class="btn btn-mini right">
<span></span> <i class="icon-search"></i>
</a>
<a href="{% model_url user 'edit' %}" title="{% trans 'Edit' %}" class="icon edit right">
<span></span>
</a>
<a href="{% url 'projctor_preview_slide' user.sid %}" title="{% trans 'Preview' %}" class="icon preview right">
<span></span>
</a> </a>
<a href="{% model_url user 'view' %}">{{ user }}</a> <a href="{% model_url user 'view' %}">{{ user }}</a>
</li> </li>

View File

@ -163,8 +163,7 @@ class UserCreateView(CreateView):
model = User model = User
context_object_name = 'edit_user' context_object_name = 'edit_user'
form_class = UserCreateForm form_class = UserCreateForm
success_url = 'user_overview' success_url_name = 'user_overview'
apply_url = 'user_edit'
def manipulate_object(self, form): def manipulate_object(self, form):
self.object.username = gen_username( self.object.username = gen_username(
@ -183,8 +182,7 @@ class UserUpdateView(UpdateView):
model = User model = User
context_object_name = 'edit_user' context_object_name = 'edit_user'
form_class = UserUpdateForm form_class = UserUpdateForm
success_url = 'user_overview' success_url_name = 'user_overview'
apply_url = 'participant_edit'
class UserDeleteView(DeleteView): class UserDeleteView(DeleteView):
@ -193,7 +191,7 @@ class UserDeleteView(DeleteView):
""" """
permission_required = 'participant.can_manage_participant' permission_required = 'participant.can_manage_participant'
model = User model = User
url = 'user_overview' success_url_name = 'user_overview'
def pre_redirect(self, request, *args, **kwargs): def pre_redirect(self, request, *args, **kwargs):
if self.get_object() == self.request.user: if self.get_object() == self.request.user:
@ -208,7 +206,7 @@ class SetUserStatusView(RedirectView, SingleObjectMixin):
""" """
permission_required = 'participant.can_manage_participant' permission_required = 'participant.can_manage_participant'
allow_ajax = True allow_ajax = True
url = 'user_overview' url_name = 'user_overview'
model = User model = User
def pre_redirect(self, request, *args, **kwargs): def pre_redirect(self, request, *args, **kwargs):
@ -400,8 +398,7 @@ class GroupCreateView(CreateView):
context_object_name = 'group' context_object_name = 'group'
model = Group model = Group
form_class = GroupForm form_class = GroupForm
success_url = 'user_group_overview' success_url_name = 'user_group_overview'
apply_url = 'user_group_edit'
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
delete_default_permissions() delete_default_permissions()
@ -417,8 +414,7 @@ class GroupUpdateView(UpdateView):
model = Group model = Group
context_object_name = 'group' context_object_name = 'group'
form_class = GroupForm form_class = GroupForm
success_url = 'user_group_overview' success_url_name = 'user_group_overview'
apply_url = 'user_group_edit'
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
delete_default_permissions() delete_default_permissions()
@ -431,7 +427,7 @@ class GroupDeleteView(DeleteView):
""" """
permission_required = 'participant.can_manage_participant' permission_required = 'participant.can_manage_participant'
model = Group model = Group
url = 'user_group_overview' success_url_name = 'user_group_overview'
def pre_redirect(self, request, *args, **kwargs): def pre_redirect(self, request, *args, **kwargs):
if self.get_object().name.lower() in ['anonymous', 'registered']: if self.get_object().name.lower() in ['anonymous', 'registered']:
@ -447,6 +443,7 @@ class Config(FormView):
permission_required = 'config.can_manage_config' permission_required = 'config.can_manage_config'
form_class = ConfigForm form_class = ConfigForm
template_name = 'participant/config.html' template_name = 'participant/config.html'
success_url_name = 'config_participant'
def get_initial(self): def get_initial(self):
return { return {
@ -507,7 +504,7 @@ def user_settings(request):
form_user = UsersettingsForm(instance=request.user, initial={'language': language}) form_user = UsersettingsForm(instance=request.user, initial={'language': language})
return { return {
'form_user': form_user, 'form': form_user,
'edituser': request.user, 'edituser': request.user,
} }
@ -523,7 +520,7 @@ def user_settings_password(request):
if form.is_valid(): if form.is_valid():
form.save() form.save()
messages.success(request, _('Password successfully changed.')) messages.success(request, _('Password successfully changed.'))
return redirect(reverse('user_settings')) return redirect(reverse('dashboard'))
else: else:
messages.error(request, _('Please check the form for errors.')) messages.error(request, _('Please check the form for errors.'))
else: else:
@ -541,6 +538,7 @@ def register_tab(request):
selected = request.path.startswith('/participant/') selected = request.path.startswith('/participant/')
return Tab( return Tab(
title=_('Participants'), title=_('Participants'),
app='participant',
url=reverse('user_overview'), url=reverse('user_overview'),
permission=( permission=(
request.user.has_perm('participant.can_see_participant') or request.user.has_perm('participant.can_see_participant') or
@ -554,30 +552,30 @@ def get_widgets(request):
group_widget and a personal_info_widget. group_widget and a personal_info_widget.
""" """
return [ return [
get_personal_info_widget(request), #get_personal_info_widget(request),
get_user_widget(request), get_user_widget(request),
get_group_widget(request)] get_group_widget(request)]
def get_personal_info_widget(request): ## def get_personal_info_widget(request):
""" ## """
Provides a widget for personal info. It shows your submitted motions ## Provides a widget for personal info. It shows your submitted motions
and where you are supporter or candidate. ## and where you are supporter or candidate.
""" ## """
personal_info_context = { ## personal_info_context = {
'submitted_motions': Motion.objects.filter(submitter=request.user), ## 'submitted_motions': Motion.objects.filter(submitter=request.user),
'config_motion_min_supporters': config['motion_min_supporters'], ## 'config_motion_min_supporters': config['motion_min_supporters'],
'supported_motions': Motion.objects.filter(motionsupporter=request.user), ## 'supported_motions': Motion.objects.filter(motionsupporter=request.user),
'assignments': Assignment.objects.filter( ## 'assignments': Assignment.objects.filter(
assignmentcandidate__person=request.user, ## assignmentcandidate__person=request.user,
assignmentcandidate__blocked=False)} ## assignmentcandidate__blocked=False)}
return Widget( ## return Widget(
name='personal_info', ## name='personal_info',
display_name=_('My motions and elections'), ## display_name=_('My motions and elections'),
template='participant/personal_info_widget.html', ## template='participant/personal_info_widget.html',
context=personal_info_context, ## context=personal_info_context,
permission_required=None, ## permission_required=None,
default_column=1) ## default_column=1)
def get_user_widget(request): def get_user_widget(request):

View File

@ -12,42 +12,20 @@
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.forms.models import modelform_factory from django.forms.models import modelform_factory
from django.core.exceptions import ImproperlyConfigured
from openslides.utils.views import TemplateView from openslides.utils.views import TemplateView, UrlMixin
class PollFormView(TemplateView): class PollFormView(UrlMixin, TemplateView):
template_name = 'poll/poll.html' poll_class = None
poll_argument = 'poll_id'
def set_poll(self, poll_id): def get(self, request, *args, **kwargs):
poll_id = poll_id self.poll = self.object = self.get_object()
self.poll = self.poll_class.objects.get(pk=poll_id) return super(PollFormView, self).get(request, *args, **kwargs)
def get_context_data(self, **kwargs):
context = super(PollFormView, self).get_context_data(**kwargs)
self.set_poll(self.kwargs['poll_id'])
context['poll'] = self.poll
if 'forms' in kwargs:
context['forms'] = kwargs['forms']
context['pollform'] = kwargs['pollform']
else:
context['forms'] = self.poll.get_vote_forms()
FormClass = self.get_modelform_class()
context['pollform'] = FormClass(instance=self.poll,
prefix='pollform')
return context
def get_success_url(self):
return self.success_url
def get_modelform_class(self):
fields = []
self.poll.append_pollform_fields(fields)
return modelform_factory(self.poll.__class__, fields=fields)
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
self.set_poll(self.kwargs['poll_id']) self.poll = self.object = self.get_object()
option_forms = self.poll.get_vote_forms(data=self.request.POST) option_forms = self.poll.get_vote_forms(data=self.request.POST)
FormClass = self.get_modelform_class() FormClass = self.get_modelform_class()
@ -76,3 +54,32 @@ class PollFormView(TemplateView):
pollform.save() pollform.save()
return HttpResponseRedirect(self.get_success_url()) return HttpResponseRedirect(self.get_success_url())
def get_poll_class(self):
if self.poll_class is not None:
return self.poll_class
else:
raise ImproperlyConfigured(
"No poll class defined. Either provide a poll_class or define"
" a get_poll_class method.")
def get_object(self):
return self.get_poll_class().objects.get(pk=self.kwargs['poll_id'])
def get_context_data(self, **kwargs):
context = super(PollFormView, self).get_context_data(**kwargs)
context['poll'] = self.poll
if 'forms' in kwargs:
context['forms'] = kwargs['forms']
context['pollform'] = kwargs['pollform']
else:
context['forms'] = self.poll.get_vote_forms()
FormClass = self.get_modelform_class()
context['pollform'] = FormClass(instance=self.poll,
prefix='pollform')
return context
def get_modelform_class(self):
fields = []
self.poll.append_pollform_fields(fields)
return modelform_factory(self.poll.__class__, fields=fields)

View File

@ -38,7 +38,9 @@ class ProjectorSlide(models.Model, SlideMixin):
} }
@models.permalink @models.permalink
def get_absolute_url(self, link='delete'): def get_absolute_url(self, link='edit'):
if link == 'edit':
return ('customslide_edit', [str(self.id)])
if link == 'delete': if link == 'delete':
return ('customslide_delete', [str(self.id)]) return ('customslide_delete', [str(self.id)])

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 867 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 884 B

Some files were not shown because too many files have changed in this diff Show More