Merge branch 'master' into agenda-orga-items

Conflicts:
	openslides/agenda/static/styles/agenda.css
	openslides/agenda/templates/agenda/config.html
	openslides/agenda/templates/agenda/item_row.html
	openslides/agenda/templates/agenda/overview.html
	openslides/locale/de/LC_MESSAGES/django.mo
	openslides/locale/de/LC_MESSAGES/django.po
	openslides/static/styles/base.css
	requirements.txt
This commit is contained in:
Emanuel Schuetze 2013-02-11 22:36:19 +01:00
commit e101fb8212
223 changed files with 6023 additions and 6794 deletions

View File

@ -3,9 +3,9 @@ python:
- "2.6"
- "2.7"
install:
- easy_install https://www.djangoproject.com/download/1.5b2/tarball/
- easy_install https://www.djangoproject.com/download/1.5c1/tarball/
- pip install -r requirements.txt --use-mirrors
- python extras/scripts/create_local_settings.py
script:
- 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

@ -2,6 +2,18 @@ CHANGELOG of OpenSlides
http://openslides.org
Version 1.4 (unreleased)
========================
Version 1.3.1 (2013-01-09)
==========================
[http://dev.openslides.org/milestone/1.3.1]
- Fixed unwanted automatical language switching on projector view if more than
one browser languages send projector request to OpenSlides (#434)
Version 1.3 (2012-12-10)
========================
[http://dev.openslides.org/milestone/1.3]

View File

@ -18,7 +18,11 @@ I. Installation on GNU/Linux and MacOSX using the Python Package Index (PyPI)
1. Check requirements:
Make sure that you have installed Python Programming Language 2
(>= 2.6) on your system.
(>= 2.6) on your system. You will also need the Python
development headers.
E. g. for Ubuntu run:
$ sudo apt-get install python-dev
2. Setup a virtual environment with virtualenv (optional):

View File

@ -2,7 +2,7 @@
English README file for OpenSlides
==================================
This is OpenSlides, version 1.3.1 (unreleased).
This is OpenSlides, version 1.4.0 (unreleased).
What is OpenSlides?

6
THANKS
View File

@ -12,14 +12,14 @@ OpenSlides uses parts of the following projects:
* jQuery UI
<http://jqueryui.com/>
* Twitter Bootstrap
<http://twitter.github.com/bootstrap/>
* ReportLab
<http://www.reportlab.com/software/opensource/rl-toolkit/>
* Drupal (tabledrag function)
<http://www.drupal.org/>
* Oxygen-Icons
<http://www.oxygen-icons.org/>
* Ubuntu TrueType Font
<http://font.ubuntu.com/>

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 B

View File

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

View File

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

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

@ -65,8 +65,9 @@
{% block content %}
<h1>{% trans "Agenda settings" %}</h1>
<h1>{% trans "Configuration" %}: {% trans "Agenda" %}
{% block config_submenu %}{{ block.super }}{% endblock %}
</h1>
<form action="" method="post">{% csrf_token %}
{{ form.as_p }}
<p>

View File

@ -1,4 +1,4 @@
{% extends "agenda/base_agenda.html" %}
{% extends "base.html" %}
{% load i18n %}
@ -12,24 +12,22 @@
{% endblock %}
{% block content %}
<h1>
{% if item %}
<h1>{% trans "Edit item" %}</h1>
{% trans "Edit item" %}
{% else %}
<h1>{% trans "New item" %}</h1>
{% 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.as_p }}
{% include "form.html" %}
<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 'item_overview' %}">
<button class="button" type="button" onclick="window.location='{% url 'item_overview' %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
{% include "formbuttons_saveapply.html" %}
<a href='{% url 'item_overview' %}' class="btn">
{% trans 'Cancel' %}
</a>
</p>
<small>* {% trans "required" %}</small>

View File

@ -1,17 +1,17 @@
{% load i18n %}
{% load staticfiles %}
{% load tags %}
<td>
<span class="close_link{% if item.closed %} closed{% endif %}">
{% if perms.agenda.can_manage_agenda %}
<a href="{% if item.closed %}{% url 'item_open' item.id %}{% else %}{% url 'item_close' item.id %}{% endif %}" title="{% trans 'Mark item as done' %}">
<span></span>
<a href="{% if item.closed %}{% url 'item_open' item.id %}{% else %}{% url 'item_close' item.id %}{% endif %}"
class="close_link btn btn-mini {% if item.closed %}btn-success{% endif %}" title="{% trans 'Change status (open/closed)' %}">
<i class="{% if item.closed %}icon-checked-new{% else %}icon-unchecked-new{% endif %}"></i>
</a>
{% elif item.closed %}
<img src="{% static 'images/icons/close.png' %}" title="{% trans 'Item closed' %}">
{% endif %}
{% else %}
<span class="close_link">
<i class="{% if item.closed %}icon-checked-new{% else %}icon-unchecked-new{% endif %}"></i>
</span>
{% endif %}
</td>
<td>
{% for p in item.get_ancestors %}
@ -24,7 +24,7 @@
{{ item.get_title_supplement|safe }}
</td>
{% if perms.agenda.can_manage_agenda %}
<td>
<td class="optional">
{{ item.comment|first_line }}
</td>
{% endif %}
@ -39,28 +39,32 @@
<td>
<span style="width: 1px; white-space: nowrap;">
{% 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' %}">
<span></span>
<a href="{% url 'projector_activate_slide' item.sid %}" class="activate_link btn {% if item.active %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<i class="icon-facetime-video {% if item.active %}icon-white{% endif %}"></i>
</a>
{% endif %}
{% 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 'delete' %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Delete item' %}"></a>
<a href="{% model_url item 'edit' %}" title="{% trans 'Edit' %}" class="btn btn-mini">
<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 %}
<a class="activate_link" href="{% url 'projector_activate_slide' item.sid 'summary' %}">
<img src="{% static 'images/icons/summary.png' %}" title="{% trans 'Activate summary for this item' %}">
<a href="{% url 'projector_activate_slide' item.sid 'summary' %}" class="activate_link btn btn-mini" title="{% trans 'Show summary for this item' %}">
<i class="icon-summary"></i>
</a>
{% endif %}
{% endif %}
</span>
</td>
{% endif %}
{% if perms.agenda.can_manage_agenda %}
<td class="tabledrag-hide">
<td class="tabledrag-hide" style="display: none;">
{% with form=item.weight_form %}
{{ form.weight }}
{{ form.self }}
{{ form.parent }}
{% endwith %}
</td>
{% endif %}

View File

@ -1,4 +1,4 @@
{% extends "agenda/base_agenda.html" %}
{% extends "base.html" %}
{% load tags %}
{% load i18n %}
@ -10,11 +10,13 @@
{% 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/agenda.css' %}" />
{% endblock %}
{% block javascript %}
<script type="text/javascript" src="{% static 'javascript/agenda.js' %}"></script>
<script type="text/javascript" src="{% static 'javascript/jquery.cookie.js' %}"></script>
{% 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.tmpl.js' %}"></script>
<script type="text/javascript" src="{% static 'javascript/tabledrag.js' %}"></script>
<script type="text/javascript">
@ -37,15 +39,16 @@
{% endif %}
{% endblock %}
{% block content %}
<form action="" method="post">{% csrf_token %}
{% if perms.agenda.can_manage_agenda %}
<div id="changed-order-message" style="display:none" class="notification warning">
<em>{% trans "Do you want to save the changed order of agenda items?" %}<br>
<input type="submit" value="{% trans 'Yes' %}">
<input type="button" onclick="window.location.href='{% url 'item_overview' %}';" value="{% trans 'No' %}">
</em>
<div id="changed-order-message" style="display:none" class="alert alert-warning">
<button type="button" class="close" data-dismiss="alert">×</button>
<p>{% trans "Do you want to save the changed order of agenda items?" %}</p>
<p>
<button class="btn" type="submit">{% trans 'Yes' %}</button>
<a href="{% url 'item_overview' %}" class="btn">{% trans 'No' %}</a>
</p>
</div>
{% endif %}
@ -64,37 +67,45 @@
</table>
{% endif %}
{% endif %}
<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>
{% trans "Filter" %}:
<label class="checkbox">
<input type="checkbox" id="hide_closed_items"> {% trans "Hide closed items" %}
</p>
{{ items|length }}
</label>
<small><i>{{ items|length }}
{% 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>
<th width="50">{% trans "Done" %}</th>
<th class="mini_width"></th>
<th>{% trans "Item" %}</th>
{% 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 %}
{% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %}
<th width="50">{% trans "Actions" %}</th>
{% endif %}
{% if perms.agenda.can_manage_agenda %}
<th class="tabledrag-hide">{% trans "Weight" %}</th>
<th class="mini_width">{% trans "Actions" %}</th>
{% endif %}
<th class="tabledrag-hide" style="display: none;">
{% trans "Weight" %}
</th>
</tr>
<tr class="topline{% if active_sid == 'agenda' %} activeline{% endif %}">
<td></td>
<td>
<strong>{% trans "Agenda" %}</strong>
{% trans "Agenda" %}
</td>
{% if perms.agenda.can_manage_agenda %}
<td></td>
<td class="optional"></td>
{% endif %}
{% if perms.agenda.can_see_orga_items %}
<td>{{duration}}h</td>
@ -103,17 +114,17 @@
<td>
{% if perms.projector.can_manage_projector %}
<span>
<a class="activate_link{% if active_sid == 'agenda' %} active{% endif %}" href="{% url 'projector_activate_slide' 'agenda' %}" title="{% trans 'Activate item' %}">
<span></span>
<a href="{% url 'projector_activate_slide' 'agenda' %}" class="activate_link btn {% if active_sid == 'agenda' %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<i class="icon-facetime-video {% if active_sid == 'agenda' %}icon-white{% endif %}"></i>
</a>
</span>
<span>
{% endif %}
</td>
{% endif %}
</tr>
{% if 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" %}
</tr>
{% endfor %}

View File

@ -1,11 +1,35 @@
{% extends "agenda/base_agenda.html" %}
{% extends "base.html" %}
{% load i18n %}
{% block title %}{{ block.super }} {{ item.title }}{% endblock %}
{% 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>
{% if perms.agenda.can_manage_agenda %}

View File

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

View File

@ -127,7 +127,7 @@ class SetClosed(RedirectView, SingleObjectMixin):
"""
permission_required = 'agenda.can_manage_agenda'
allow_ajax = True
url = 'item_overview'
url_name = 'item_overview'
model = Item
def get_ajax_context(self, **kwargs):
@ -159,16 +159,7 @@ class ItemUpdate(UpdateView):
model = Item
context_object_name = 'item'
form_class = ItemForm
success_url = '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())
success_url_name = 'item_overview'
class ItemCreate(CreateView):
@ -180,16 +171,7 @@ class ItemCreate(CreateView):
model = Item
context_object_name = 'item'
form_class = ItemForm
success_url = '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())
success_url_name = 'item_overview'
class ItemDelete(DeleteView):
@ -198,7 +180,8 @@ class ItemDelete(DeleteView):
"""
permission_required = 'agenda.can_manage_agenda'
model = Item
url = 'item_overview'
question_url_name = 'item_overview'
success_url_name = 'item_overview'
def get_answer_options(self):
if self.object.children.exists():
@ -263,6 +246,7 @@ def register_tab(request):
selected = request.path.startswith('/agenda/')
return Tab(
title=_('Agenda'),
app='agenda',
url=reverse('item_overview'),
permission=(request.user.has_perm('agenda.can_see_agenda') or
request.user.has_perm('agenda.can_manage_agenda')),
@ -273,8 +257,7 @@ def get_widgets(request):
"""
return the agenda widget for the projector-tab.
"""
return [
Widget(
return [Widget(
name='agenda',
display_name=_('Agenda'),
template='agenda/widget.html',

View File

@ -24,9 +24,6 @@ $(function() {
line.parent().parent().children('td').addClass('elected')
}
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) {
event.preventDefault();
link = $(this);
var link = $(this);
$.ajax({
type: 'GET',
url: link.attr('href'),
url: $(this).attr('href'),
dataType: 'json',
success: function(data) {
if (data.published) {
link.addClass('published');
//link.attr('title', gettext('Unpublish ballot'))
newclass = 'icon-checked-new_white';
link.addClass('btn-primary');
} else {
link.removeClass('published');
//link.attr('title', 'Publish ballot')
newclass = 'icon-unchecked-new';
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 {
background-image: url(../images/icons/voting-yes.png);
background-image: url(../img/voting-yes.png);
background-repeat: no-repeat;
background-position: center;
width: 16px;
@ -21,7 +21,7 @@ td.elected 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-position: center;
width: 16px;
@ -30,15 +30,3 @@ td a.election_link {
margin-right: 5px;
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 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.as_p }}
{% include "form.html" %}
<p>
<button class="button" type="submit">
<span class="icon ok">{% trans 'Save' %}</span>
</button>
<a href="{% url 'config_assignment' %}">
<button class="button" type="button" onclick="window.location='{% url 'config_assignment' %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
{% include "formbuttons_save.html" %}
<a href="{% url 'config_assignment' %}" class="btn">
{% trans 'Cancel' %}
</a>
</p>
<small>* {% trans "required" %}</small>
</form>
{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "assignment/base_assignment.html" %}
{% extends "base.html" %}
{% load i18n %}
@ -11,27 +11,24 @@
{% endif %}
{% endblock %}
{% block content %}
<h1>
{% if assignment %}
<h1>{% trans "Edit election" %}</h1>
{% trans "Edit election" %}
{% else %}
<h1>{% trans "New election" %}</h1>
{% 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.as_p }}
{% include "form.html" %}
<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 'assignment_overview' %}">
<button class="button" type="button" onclick="window.location='{% url 'assignment_overview' %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
{% include "formbuttons_saveapply.html" %}
<a href='{% url 'assignment_overview' %}' class="btn">
{% trans 'Cancel' %}
</a>
</p>
<small>* {% trans "required" %}</small>

View File

@ -1,35 +1,44 @@
{% extends "assignment/base_assignment.html" %}
{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% 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" %}:
<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="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="fin" {% if 'fin' in request.GET.status %}selected{% endif %}>{% trans "Finished" %}</option>
</select>
</form>
</p>
{{ assignments|length }}
<small><i>{{ assignments|length }}
{% blocktrans count counter=assignments|length %}election{% plural %}elections{% endblocktrans %}
<table>
</i></small>
<table class="table table-striped table-bordered">
<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>{% 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 style="width: 1px;">{% trans "Actions" %}</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 class="mini_width">{% trans "Actions" %}</th>
</tr>
{% for assignment in assignments %}
<tr class="{% cycle '' 'odd' %}
{% if assignment.active %}activeline{% endif %}">
<tr {% if assignment.active %}activeline{% endif %}">
<td><a href="{% url 'assignment_view' assignment.id %}">{{ assignment }}</a></td>
<td>
{% blocktrans with posts=assignment.posts context "Number of searched candidates for an election"%}posts: {{ posts }}{% endblocktrans %}
@ -38,19 +47,25 @@
{% endif %}
| {% blocktrans with elected=assignment.elected|length %}elected: {{ elected }}{% endblocktrans %}
</td>
<td>{{ assignment.get_status_display }}</td>
<td class="optional">{{ assignment.get_status_display }}</td>
<td>
<span style="width: 1px; white-space: nowrap;">
{% 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' %}">
<span></span>
<a href="{% url 'projector_activate_slide' assignment.sid %}" class="activate_link btn {% if assignment.active %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<i class="icon-facetime-video {% if assignment.active %}icon-white{% endif %}"></i>
</a>
{% endif %}
{% 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_delete' assignment.id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Delete election' %}"></a>
<a href="{% url 'assignment_edit' assignment.id %}" title="{% trans 'Edit' %}" class="btn btn-mini">
<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 %}
<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>
</td>
</tr>

View File

@ -1,19 +1,35 @@
{% extends 'assignment/base_assignment.html' %}
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{{ block.super }} {% trans "Election" %} "{{ assignment }}" {{ ballotnumber }}. {% trans "ballot" %}{% endblock %}
{% block content %}
<h1>{{ assignment }} {{ ballotnumber }}. {% trans "ballot" %}</h1>
<h1>
{{ assignment }}
<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 %}
</small>
</h1>
{% if assignment.polldescription %}
<p><b>{% trans "Short description (for ballot paper)" %}:</b> {{ assignment.polldescription }}</p>
{% endif %}
<i class="helptext">{% trans "Special values" %}: -1 = {% trans 'majority' %}; -2 = {% trans 'undocumented' %}</i>
<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 style="width:auto">
<table class="table table-striped table-bordered" style="width: auto;">
<tr>
<th>{% trans "Candidates" %}</th>
{% for value in poll.get_vote_values %}
@ -31,7 +47,7 @@
{% endfor %}
</tr>
{% endfor %}
<tr class="total">
<tr>
<td>{% trans "Invalid votes" %}</td>
{% for value in poll.get_vote_values %}
{% if forloop.first %}
@ -41,7 +57,7 @@
{% endif %}
{% endfor %}
</tr>
<tr class="total">
<tr class="total warning">
<td>{% trans "Votes cast" %}</td>
{% for value in poll.get_vote_values %}
{% if forloop.first %}
@ -54,26 +70,21 @@
</table>
<p>
<a href="{% url 'print_assignment_poll' poll.id %}">
<button class="button" type="button" onclick="window.location='{% url 'print_assignment_poll' poll.id %}'">
<span class="icon pdf">{% trans 'Ballot paper as PDF' %}</span>
</button>
<a href="{% url 'print_assignment_poll' poll.id %}" class="btn">
<i class="icon-print"></i> {% trans 'Ballot paper as PDF' %}
</a>
</p>
<p>
<button class="button" type="submit">
<span class="icon ok">{% trans 'Save' %}</span>
<!-- Control buttons -->
<div class="control-group">
<button type="submit" class="btn btn-primary">
{% trans 'Save' %}
</button>
<button class="button" type="submit" name="apply">
<span class="icon apply">{% trans 'Apply' %}</span>
</button>
<a href="{% url 'assignment_view' poll.assignment.id %}">
<button class="button" type="button" onclick="window.location='{% url 'assignment_view' poll.assignment.id %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
<button type="submit" name="apply" class="btn">
{% trans 'Apply' %}
</button>
<a href="{% url 'assignment_view' poll.assignment.id %}" class="btn">
{% trans 'Cancel' %}
</a>
</p>
</div>
</form>
{% endblock %}

View File

@ -1,79 +1,105 @@
{% extends "assignment/base_assignment.html" %}
{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% 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 %}
<div id="sidebar">
<div class="box">
<h4>{% trans "Status" %}:</h4>
{% trans assignment.get_status_display %}
<h4>{% trans "Number of available posts" %}:</h4>
{{ assignment.posts }}
</div>
<br><br>
{% 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>
<h1>
{{ assignment }}
<small class="pull-right">
<a href="{% url 'assignment_overview' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</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 %}
<div class="btn-group">
<a data-toggle="dropdown" href="#" class="btn btn-mini dropdown-toggle">
{% trans 'More actions' %}
<span class="caret"></span>
</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 style="margin-right: 250px; min-width: 400px;">
<h1>{{ assignment }}</h1>
<p>{{ assignment.description|linebreaks }}</p>
<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" %}
<h3>{% trans "Candidates" %}</h3>
<h4>{% trans "Candidates" %}</h4>
<ol>
{% for person in assignment.get_participants %}
<li>
{{ person }}
{% if perms.assignment.can_manage_assignment %}
{% 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 %}
{% if person in assignment.elected %}
| <b>{% trans "elected" %}</b>
{% if perms.assignment.can_manage_assignment %}
{% 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 %}
</li>
{% 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 %}
</ol>
{% 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 %}
<form action="" method="post">{% csrf_token %}
{% if perms.assignment.can_nominate_self %}
<p>
{% if user_is_candidate %}
<a href="{% url 'assignment_delrun' assignment.id %}">
<span class="button">
<span class="icon removeuser">{% trans 'Withdraw self candidature' %}</span>
</span>
<a href='{% url 'assignment_delrun' assignment.id %}' class="btn btn-mini">
<i class="icon-remove"></i> {% trans 'Withdraw self candidature' %}
</a>
{% else %}
<a href="{% url 'assignment_run' assignment.id %}">
<span class="button">
<span class="icon adduser">{% trans 'Self candidature' %}</span>
</span>
<a href='{% url 'assignment_run' assignment.id %}' class="btn btn-mini">
<i class="icon-plus"></i> {% trans 'Self candidature' %}
</a>
{% endif %}
</p>
@ -81,16 +107,15 @@
{% if perms.assignment.can_nominate_other %}
{% for field in form %}
<label>{{ field.label }}:</label>
<nobr>{{ field }}
<div class="input-append">
{{ field }}
<button class="btn btn-primary" type="submit" title="{% trans 'Apply' %}"><i class="icon-ok icon-white"></i></button>
{% if perms.participant.can_see_participant and perms.participant.can_manage_participant %}
<a href="{% url 'user_new' %}" target="_blank"><img src="{% static 'images/icons/add-user.png' %}" title="{% trans 'Add new participant' %}"></a>
<a href="{% url 'user_new' %}" target="_blank" class="btn" title="{% trans 'Add new participant' %}"><i class="icon-add-user"></i></a>
{% endif %}
</nobr>
</div>
{% endfor %}
<p>
<button class="button" type="submit">
<span class="icon ok">{% trans 'Apply' %}</span>
</button>
</p>
{% endif %}
</form>
@ -99,11 +124,14 @@
{% endif %}
{% if perms.assignment.can_manage_assignments and blocked_candidates and assignment.status != "fin" %}
<h3>{% trans "Blocked Candidates" %}</h3>
<h4>{% trans "Blocked Candidates" %}</h4>
<ul>
{% for person in blocked_candidates %}
<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>
{% empty %}
<li>{% trans "No blocked candidates available." %}</li>
@ -111,48 +139,58 @@
</ul>
{% endif %}
{% if assignment.status != "sea" or polls.exists %}
<h3>{% trans "Election results" %}</h3>
<!-- Results -->
{% if assignment.status != "sea" or polls.exists %}
<h4>{% trans "Election results" %}</h4>
{% if polls.exists %}
<table id="election_table" style="width: auto;">
<table class="table table-striped table-bordered">
<tr>
<th></th>
{% with ballotnumber=polls.count %}
<th colspan="{{ ballotnumber|add:'1' }}" style="text-align: center;">
{% trans "ballot" %}
</th>
{% endwith %}
</tr>
<tr>
<th>{% trans "Candidates" %}</th>
{% for poll in polls %}
<th style="vertical-align: top; white-space:nowrap;">
<th style="white-space:nowrap;" class="span1">
{{ poll.get_ballot }}. {% trans 'ballot' %}
{% if perms.assignment.can_manage_assignment %}
<br>
<a class="publish_link {% if poll.published %}published{% endif %}"
<a class="publish_link btn btn-mini {% if poll.published %}btn-primary{% endif %}"
href="{% url 'assignment_poll_publish_status' poll.id %}"
title="{% trans 'Publish/unpublish results' %}">
<span></span>
rel="tooltip" data-original-title="{% trans 'Publish/unpublish results' %}">
{% if poll.published %}
<i class="icon-checked-new_white"></i>
{% else %}
<i class="icon-unchecked-new"></i>
{% endif %}
</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>
<a href="{% url 'assignment_poll_view' poll.id %}" class="btn btn-mini" title="{% trans 'Edit' %}"><i class="icon-pencil"></i></a>
<a href="{% url 'assignment_poll_delete' poll.id %}" class="btn btn-mini" title="{% trans 'Delete' %}"><i class="icon-remove"></i></a>
{% endif %}
</th>
{% endfor %}
{% if assignment.candidates and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
<th>
<a href="{% url 'assignment_gen_poll' assignment.id %}">
<span class="button">
<span class="icon statistics">{% trans 'New ballot' %}</span>
</span>
<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>
</th>
{% endif %}
</tr>
{% for candidate, poll_list in vote_results.items %}
<tr class="{% cycle 'odd' '' as rowcolors %}">
<td class="candidate">
<tr>
<td>
{% if candidate in assignment.elected %}
{% if perms.assignment.can_manage_assignment %}
<a class="election_link elected" href="{% url 'assignment_user_not_elected' assignment.id candidate.person_id %}"></a>
{% else %}
<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>
{% endif %}
{% else %}
@ -165,11 +203,11 @@
{% for vote in poll_list %}
<td style="white-space:nowrap;">
{% 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 'images/icons/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-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Yes }}<br>
<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 '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 %}
{% trans 'was not a <br> candidate'%}
{% else %}
@ -182,13 +220,13 @@
{% endif %}
</tr>
{% endfor %}
<tr class="{% cycle rowcolors %}">
<tr>
<td>{% trans 'Invalid votes' %}</td>
{% for poll in polls %}
{% if poll.published or perms.assignment.can_manage_assignment %}
<td style="white-space:nowrap;">
{% 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 }}
{% endif %}
</td>
@ -198,13 +236,13 @@
<td></td>
{% endif %}
</tr>
<tr class="total">
<tr class="info total">
<td><strong>{% trans 'Votes cast' %}</strong></td>
{% for poll in polls %}
{% if poll.published or perms.assignment.can_manage_assignment %}
<td style="white-space:nowrap;">
{% 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>
{% endif %}
</td>
@ -216,15 +254,45 @@
</tr>
</table>
{% 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" %}
<p><a href="{% url 'assignment_gen_poll' assignment.id %}">
<span class="button">
<span class="icon statistics">{% trans 'New ballot' %}</span>
</span>
</a></p>
<p>
<a href='{% url 'assignment_gen_poll' assignment.id %}' class="btn">
<i class="icon-plus"></i> {% trans 'New ballot' %}
</a>
</p>
{% 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 %}

View File

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

View File

@ -66,7 +66,7 @@
<td class="candidate{% if candidate in assignment.elected %} elected{% endif %}">
{% if candidate in assignment.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>
{% endif %}
{{ candidate }}
@ -75,11 +75,11 @@
<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 '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 'images/icons/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-yes.png' %}" title="{% trans 'Yes' %}"> {{ vote.Yes }}<br>
<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 '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 %}
{% trans 'was not a <br> candidate'%}
{% else %}
@ -97,7 +97,7 @@
{% for poll in polls %}
<td style="white-space:nowrap;">
{% 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 }}
{% endif %}
</td>
@ -112,7 +112,7 @@
<td style="white-space:nowrap;">
{% 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>
{% endif %}
</td>

View File

@ -10,7 +10,7 @@
:license: GNU GPL, see LICENSE for more details.
"""
from django.conf.urls.defaults import url, patterns
from django.conf.urls import url, patterns
from openslides.assignment.views import (ViewPoll, AssignmentPDF,
AssignmentPollPDF, AssignmentPollDelete, CreateAgendaItem)

View File

@ -145,6 +145,7 @@ def edit(request, assignment_id=None):
def delete(request, assignment_id):
assignment = Assignment.objects.get(pk=assignment_id)
if request.method == 'POST':
if 'submit' in request.POST:
assignment.delete()
messages.success(request, _('Election <b>%s</b> was successfully deleted.') % assignment)
else:
@ -204,6 +205,7 @@ def delother(request, assignment_id, user_id):
is_blocked = assignment.is_blocked(person)
if request.method == 'POST':
if 'submit' in request.POST:
try:
assignment.delrun(person, blocked=False)
except Exception, e:
@ -533,7 +535,7 @@ class AssignmentPollPDF(PDFView):
pdf_document.build(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
cell = []
cell.append(Spacer(0, 0.8 * cm))
@ -635,6 +637,7 @@ class Config(FormView):
permission_required = 'config.can_manage_config'
form_class = ConfigForm
template_name = 'assignment/config.html'
success_url_name = 'config_assignment'
def get_initial(self):
return {
@ -673,6 +676,7 @@ def register_tab(request):
selected = request.path.startswith('/assignment/')
return Tab(
title=_('Elections'),
app='assignment',
url=reverse('assignment_overview'),
permission=(
request.user.has_perm('assignment.can_see_assignment') or
@ -684,8 +688,7 @@ def register_tab(request):
def get_widgets(request):
return [
Widget(
return [Widget(
name='assignments',
display_name=_('Elections'),
template='assignment/widget.html',

View File

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

View File

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

View File

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

View File

@ -11,7 +11,7 @@
"""
from django.conf import settings
from django.conf.urls.defaults import patterns, url
from django.conf.urls import patterns, url
from django.utils.importlib import import_module
from openslides.config.views import GeneralConfig, VersionConfig

View File

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

View File

@ -26,9 +26,12 @@ LOGIN_REDIRECT_URL = '/'
SESSION_COOKIE_NAME = 'OpenSlidesSessionID'
ugettext = lambda s: s
MOTION_WORKFLOW = (
('default', ugettext('default'), 'openslides.motion.workflow.default_workflow'),
)
LANGUAGES = (
('de', ugettext('German')),
('en', ugettext('English')),

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -90,6 +90,10 @@ def process_options(argv=None):
parser.add_option(
"--no-reload", action="store_true",
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(
"--version", action="store_true",
help="Show version and exit.")
@ -172,7 +176,11 @@ def _main(opts, database_path=None):
extra_args = ['--noreload']
else:
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):

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

@ -2,68 +2,101 @@
# -*- coding: utf-8 -*-
"""
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.
"""
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.person import PersonFormField, MultiplePersonFormField
from openslides.motion.models import Motion
from .models import Motion
from .workflow import motion_workflow_choices
class MotionForm(forms.Form, CssClassMixin):
class BaseMotionForm(forms.ModelForm, CssClassMixin):
"""Base FormClass for a Motion.
For it's own, it append the version data es 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 of the Motion. Will be saved in a MotionVersion object."""
text = forms.CharField(widget=forms.Textarea(), label=_("Text"))
"""Text of the Motion. Will be saved in a MotionVersion object."""
reason = forms.CharField(
widget=forms.Textarea(), required=False, label=_("Reason"))
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"))
"""Reason of the Motion. will be saved in a MotionVersion object."""
class Meta:
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):
# TODO: Do not show the submitter in the user-list
class MotionSubmitterMixin(forms.ModelForm):
"""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 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):
csvfile = forms.FileField(
widget=forms.FileInput(attrs={'size': '50'}),
label=_("CSV File"),
)
import_permitted = forms.BooleanField(
required=False,
label=_("Import motions with status \"authorized\""),
help_text=_('Set the initial status for each motion to '
'"authorized"'),
)
class MotionCreateNewVersionMixin(forms.ModelForm):
"""Mixin to add the option to the form, to choose, to create a new version."""
new_version = forms.BooleanField(
required=False, label=_("Create new version"), initial=True,
help_text=_("Trivial changes don't create a new version."))
"""BooleanField to decide, if a new version will be created, or the
last_version will be used."""
class ConfigForm(forms.Form, CssClassMixin):
class ConfigForm(CssClassMixin, forms.Form):
"""Form for the configuration tab of OpenSlides."""
motion_min_supporters = forms.IntegerField(
widget=forms.TextInput(attrs={'class': 'small-input'}),
label=_("Number of (minimum) required supporters for a motion"),
initial=4,
min_value=0,
max_value=8,
initial=4, min_value=0, max_value=8,
help_text=_("Choose 0 to disable the supporting system"),
)
motion_preamble = forms.CharField(
@ -98,9 +131,18 @@ class ConfigForm(forms.Form, CssClassMixin):
label=_("Preamble text for PDF document (all motions)")
)
motion_allow_trivial_change = forms.BooleanField(
label=_("Allow trivial changes"),
help_text=_('Warning: Trivial changes undermine the motions '
'autorisation system.'),
motion_create_new_version = forms.ChoiceField(
widget=forms.Select(),
label=_("Create new versions"),
required=False,
choices=(
('ALLWASY_CREATE_NEW_VERSION', _('create allways a new versions')),
('NEVER_CREATE_NEW_VERSION', _('create never a new version')),
('ASK_USER', _('Let the user choose if he wants to create a new version')))
)
motion_workflow = forms.ChoiceField(
widget=forms.Select(),
label=_("Workflow for the motions"),
required=True,
choices=motion_workflow_choices())

File diff suppressed because it is too large Load Diff

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

@ -0,0 +1,170 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
openslides.motion.pdf
~~~~~~~~~~~~~~~~~~~~~
Functions to generate the PDFs for the motion app.
"""
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.signales
~~~~~~~~~~~~~~~~~~~~~~~~~~
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_create_new_version': 'ALLWASY_CREATE_NEW_VERSION',
'motion_workflow': 'default'}.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 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.as_p }}
{% include "form.html" %}
<p>
<button class="button" type="submit">
<span class="icon ok">{% trans 'Save' %}</span>
</button>
<a href="{% url 'config_motion' %}">
<button class="button" type="button" onclick="window.location='{% url 'config_motion' %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
{% include "formbuttons_save.html" %}
<a href="{% url 'config_motion' %}" class="btn">
{% trans 'Cancel' %}
</a>
</p>
<small>* {% trans "required" %}</small>
</form>
{% 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 %}
<li><a href="{% url 'motion_set_state' motion.pk state.id %}">{{ 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 tags %}
<ul style="line-height: 180%">
{% for motion in motions %}
<li class="{% if motion.active %}activeline{% endif %}">
<a href="{% url 'projector_activate_slide' motion.sid %}" class="activate_link {% if motion.active %}active{% endif %}">
<div></div>
<a href="{% url 'projector_activate_slide' motion.sid %}" class="activate_link btn {% if motion.active %}btn-primary{% endif %} btn-mini" title="{% trans 'Show' %}">
<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 href="{% model_url motion 'delete' %}" title="{% trans 'Delete' %}" class="icon delete right">
<span></span>
</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 href="{% url 'projctor_preview_slide' motion.sid %}" title="{% trans 'Preview' %}" class="btn btn-mini right">
<i class="icon-search"></i>
</a>
<a href="{% model_url motion 'view' %}">
{{ motion.public_version.title }}

View File

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

View File

@ -2,140 +2,104 @@
# -*- coding: utf-8 -*-
"""
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.
"""
from django.conf.urls.defaults import url, patterns
from openslides.motion.views import (MotionDelete, ViewPoll,
MotionPDF, MotionPollPDF, CreateAgendaItem, SupportView)
from django.conf.urls import url, patterns
urlpatterns = patterns('openslides.motion.views',
url(r'^$',
'overview',
name='motion_overview',
'motion_list',
name='motion_list',
),
url(r'^(?P<motion_id>\d+)/$',
'view',
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',
url(r'^create/$',
'motion_create',
name='motion_new',
),
url(r'^import/$',
'motion_import',
name='motion_import',
url(r'^(?P<pk>\d+)/$',
'motion_detail',
name='motion_detail',
),
url(r'^(?P<motion_id>\d+)/edit/$',
'edit',
url(r'^(?P<pk>\d+)/edit/$',
'motion_edit',
name='motion_edit',
),
url(r'^(?P<motion_id>\d+)/del/$',
MotionDelete.as_view(),
url(r'^(?P<pk>\d+)/del/$',
'motion_delete',
name='motion_delete',
),
url(r'^del/$',
MotionDelete.as_view(),
{ 'motion_id' : None , 'motion_ids' : None },
name='motion_delete',
url(r'^(?P<pk>\d+)/version/(?P<version_number>\d+)/$',
'motion_detail',
name='motion_version_detail',
),
url(r'^(?P<motion_id>\d+)/setnumber/$',
'set_number',
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',
url(r'^(?P<pk>\d+)/version/(?P<version_number>\d+)/permit/$',
'version_permit',
name='motion_version_permit',
),
url(r'^version/(?P<aversion_id>\d+)/reject/$',
'reject_version',
url(r'^(?P<pk>\d+)/version/(?P<version_number>\d+)/reject/$',
'version_reject',
name='motion_version_reject',
),
url(r'^(?P<motion_id>\d+)/notpermit/$',
'notpermit',
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),
url(r'^(?P<pk>\d+)/support/$',
'motion_support',
name='motion_support',
),
url(r'^(?P<motion_id>\d+)/unsupport/$',
SupportView.as_view(support=False),
url(r'^(?P<pk>\d+)/unsupport/$',
'motion_unsupport',
name='motion_unsupport',
),
url(r'^(?P<motion_id>\d+)/gen_poll/$',
'gen_poll',
name='motion_gen_poll',
url(r'^(?P<pk>\d+)/create_poll/$',
'poll_create',
name='motion_poll_create',
),
url(r'^print/$',
MotionPDF.as_view(),
{'motion_id': None},
name='print_motions',
url(r'^(?P<pk>\d+)/poll/(?P<poll_number>\d+)/edit/$',
'poll_edit',
name='motion_poll_edit',
),
url(r'^(?P<motion_id>\d+)/print/$',
MotionPDF.as_view(),
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',
url(r'^(?P<pk>\d+)/poll/(?P<poll_number>\d+)/del/$',
'poll_delete',
name='motion_poll_delete',
),
url(r'^(?P<pk>\d+)/set_state/(?P<state>[a-z]{3})/$',
'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,144 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
openslides.utils.workflow
~~~~~~~~~~~~~~~~~~~~~~~~~
Defines the States for motions. All States are linked together with there
'next_state' attributes. Together there are a workflow.
:copyright: (c) 2011-2013 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
from django.conf import settings
from django.core import exceptions
from django.utils.importlib import import_module
from django.utils.translation import ugettext_noop
from openslides.config.models import config
_workflow = None
class State(object):
"""Define a state for a motion."""
def __init__(self, id, name, next_states=[], create_poll=False, support=False,
edit_as_submitter=False, version_permission=True):
"""Set attributes for the state.
The Arguments are:
- 'id' a unique id for the state.
- 'name' a string representing the state.
- 'next_states' a list with all states, that can be choosen from this state.
All the other arguments are boolean values. If True, the specific action for
motions in this state.
- 'create_poll': polls can be created in this state.
- 'support': persons can support the motion in this state.
- 'edit_as_submitter': the submitter can edit the motion in this state.
- 'version_permission': new versions are not permitted.
"""
self.id = id
self.name = name
self.next_states = next_states
self.create_poll = create_poll
self.support = support
self.edit_as_submitter = edit_as_submitter
self.version_permission = version_permission
def __unicode__(self):
"""Return the name of the state."""
return self.name
class WorkflowError(Exception):
"""Exception raised when errors in a state accure."""
pass
def motion_workflow_choices():
"""Return all possible workflows.
The possible workflows can be set in the settings with the setting
'MOTION_WORKFLOW'.
"""
for workflow in settings.MOTION_WORKFLOW:
yield workflow[0], workflow[1]
def get_state(state='default'):
"""Return a state object.
The argument 'state' has to be a state_id.
If the argument 'state' is 'default', the default state is returned.
The default state is the state object choosen in the config tab.
"""
global _workflow
if _workflow is not None:
try:
return _workflow[state]
except KeyError:
raise WorkflowError('Unknown state: %s' % state)
_workflow = {}
for workflow in settings.MOTION_WORKFLOW:
if workflow[0] == config['motion_workflow']:
try:
wf_module, wf_default_state_name = workflow[2].rsplit('.', 1)
except ValueError:
raise exceptions.ImproperlyConfigured(
'%s isn\'t a workflow module' % workflow[2])
try:
mod = import_module(wf_module)
except ImportError as e:
raise exceptions.ImproperlyConfigured(
'Error importing workflow %s: "%s"' % (wf_module, e))
try:
default_state = getattr(mod, wf_default_state_name)
except AttributeError:
raise exceptions.ImproperlyConfigured(
'Workflow module "%s" does not define a "%s" State'
% (wf_module, wf_default_state_name))
_workflow['default'] = default_state
break
else:
raise ImproperlyConfigured('Unknown workflow %s' % conf['motion_workflow'])
populate_workflow(default_state, _workflow)
return get_state(state)
def populate_workflow(state, workflow):
"""Append all 'next_states' from state to the workflow.
The argument state has to be a state object.
The argument workflow has to be a dictonary.
Calls this function recrusiv with all next_states from the next_states states.
"""
workflow[state.id] = state
for s in state.next_states:
if s.id not in workflow:
populate_workflow(s, workflow)
DUMMY_STATE = State('dummy', ugettext_noop('Unknwon state'))
"""A dummy state object. Returned, if the state_id is not known."""
default_workflow = State('pub', ugettext_noop('Published'), support=True,
edit_as_submitter=True, version_permission=False)
"""Default Workflow for OpenSlides."""
default_workflow.next_states = [
State('per', ugettext_noop('Permitted'), create_poll=True, edit_as_submitter=True, next_states=[
State('acc', ugettext_noop('Accepted')),
State('rej', ugettext_noop('Rejected')),
State('wit', ugettext_noop('Withdrawed')),
State('adj', ugettext_noop('Adjourned')),
State('noc', ugettext_noop('Not Concerned')),
State('com', ugettext_noop('Commited a bill')),
State('rev', ugettext_noop('Needs Review'))]),
State('nop', ugettext_noop('Rejected (not authorized)'))]

View File

@ -6,22 +6,24 @@
*/
$(function() {
// change participant status (on/off)
$('.status_link').click(function(event) {
event.preventDefault();
link = $(this);
group = $(this).parent();
var link = $(this);
$.ajax({
type: 'GET',
url: link.attr('href'),
url: $(this).attr('href'),
dataType: 'json',
success: function(data) {
if (data.active) {
group.children('.status_link.deactivate').show();
group.children('.status_link.activate').hide();
newclass = 'icon-on';
link.addClass('btn-success');
} else {
group.children('.status_link.deactivate').hide();
group.children('.status_link.activate').show();
newclass = 'icon-off';
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 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.as_p }}
{% include "form.html" %}
<p>
<button class="button" type="submit">
<span class="icon ok">{% trans 'Save' %}</span>
</button>
<a href="{% url 'config_participant' %}">
<button class="button" type="button" onclick="window.location='{% url 'config_participant' %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
{% include "formbuttons_save.html" %}
<a href="{% url 'config_participant' %}" class="btn">
{% trans 'Cancel' %}
</a>
</p>
<small>* {% trans "required" %}</small>
</form>
{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "participant/base_participant.html" %}
{% extends "base.html" %}
{% load i18n %}
@ -11,32 +11,29 @@
{% endif %}
{% endblock %}
{% block content %}
<h1>
{% if edit_user %}
<h1>{% trans "Edit participant" %}</h1>
{% trans "Edit participant" %}
{% else %}
<h1>{% trans "New participant" %}</h1>
{% 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.as_p }}
{% include "form.html" %}
{% if edit_user %}
<p>
<a href="{% url 'user_reset_password' edit_user.id %}">{% trans 'Reset to First Password' %}</a>
<p style="margin: -15px 0 25px 0;">
<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>
{% endif %}
<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 "user_overview" %}'>
<button class="button" type="button" onclick="window.location='{% url 'user_overview' %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
{% include "formbuttons_saveapply.html" %}
<a href="{% url 'user_overview' %}" class="btn">
{% trans 'Cancel' %}
</a>
</p>
<small>* {% trans "required" %}</small>

View File

@ -1,4 +1,4 @@
{% extends "participant/base_participant.html" %}
{% extends "base.html" %}
{% load i18n %}
{% load tags %}
@ -7,16 +7,22 @@
{% 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>
<h2>{% trans "Members" %}</h2>
<h4>{% trans "Members" %}</h4>
<ol>
{% for member in group.user_set.all %}
<p>{{ member }}</p>
<li>{{ member }}</li>
{% empty %}
<p>{% trans "No members available." %}</p>
{% endfor %}
</ol>
{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "participant/base_participant.html" %}
{% extends "base.html" %}
{% load i18n %}
@ -12,25 +12,23 @@
{% endblock %}
{% block content %}
<h1>
{% if group %}
<h1>{% trans "Edit group" %}</h1>
{% trans "Edit group" %}
{% else %}
<h1>{% trans "New group" %}</h1>
{% trans "New group" %}
{% 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.as_p }}
{% include "form.html" %}
<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 "user_group_overview" %}'>
<button class="button" type="button" onclick="window.location='{% url 'user_group_overview' %}'">
<span class="icon cancel">{% trans 'Cancel' %}</span>
</button>
{% include "formbuttons_saveapply.html" %}
<a href="{% url 'user_group_overview' %}" class="btn">
{% trans 'Cancel' %}
</a>
</p>
<small>* {% trans "required" %}</small>

View File

@ -1,30 +1,45 @@
{% extends "participant/base_participant.html" %}
{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% load tags %}
{% block title %}{{ block.super }} {% trans "Groups" %}{% endblock %}
{% block content %}
<h1>{% trans "Groups" %}</h1>
<table>
<h1>{% trans "Groups" %}
<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>
<th>{% trans "Group" %}</th>
<th>{% trans "Actions" %}</th>
<th style="width: 1px;">{% trans "Actions" %}</th>
</tr>
{% for group in groups %}
<tr class="{% cycle '' 'odd' %}">
<td><a href="{% model_url group 'view' %}">{{ group.name }}</a></td>
<td><a href="{% url 'user_group_edit' group.id %}"><img src="{% static 'images/icons/edit.png' %}" title="{% trans 'Edit group' %}"></a>
{% if group.name|lower != 'anonymous' and group.name|lower != 'registered' %}
<a href="{% url 'user_group_delete' group.id %}"><img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Delete group' %}"></a>
{% endif %}
<tr class="{% if group.active %}activeline{% endif %}">
<td>
<a href="{% model_url group 'view' %}">{{ group.name }}</a>
</td>
<td>
<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>
</tr>
{% empty %}
<tr>
<td colspan="5"><i>{% trans "No groups available." %}</i></td>
</tr>
{% endfor %}
</table>

View File

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

View File

@ -1,11 +1,17 @@
{% extends "participant/base_participant.html" %}
{% extends "base.html" %}
{% load i18n %}
{% block title %}{{ block.super }} {% trans "Import participants" %} {% endblock %}
{% 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 'Required comma separated values' %}:
@ -18,15 +24,13 @@
</p>
<form enctype="multipart/form-data" action="" method="post">{% csrf_token %}
{{ form.as_p }}
{% include "form.html" %}
<p>
<button class="button" type="submit">
<button class="btn btn-primary" type="submit">
<span class="icon import">{% trans 'Import' %}</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 href="{% url 'user_overview' %}" class="btn">
{% trans 'Cancel' %}
</a>
</p>
<small>* {% trans "required" %}</small>

View File

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

View File

@ -1,4 +1,4 @@
{% extends "participant/base_participant.html" %}
{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
@ -6,34 +6,66 @@
{% block title %}{{ block.super }} {% trans "Participants" %}{% endblock %}
{% block header %}
{% if perms.agenda.can_manage_agenda %}
<link type="text/css" rel="stylesheet" media="all" href="{% static 'styles/participant.css' %}" />
{% block javascript %}
{% if perms.participant.can_manage_participant %}
<script type="text/javascript" src="{% static 'javascript/participant.js' %}"></script>
{% endif %}
{% endblock %}
{% 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">
{% trans "Filter" %}:
<select class="default-input" name="gender" onchange="document.forms['filter'].submit()">
<div class="control-group">
<select class="span2" name="gender" onchange="document.forms['filter'].submit()">
<option value="---">-- {% trans "Gender" %} --</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=""{% if '' in sortfilter.gender %} selected{% endif %}>{% trans "Not specified" %}</option>
</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>
{% for level in structure_levels %}
<option value="{{ level }}"{% if level in sortfilter.structure_level %} selected{% endif %}>
{{ level }}</option>
{% endfor %}
</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="delegate"{% if 'delegate' in sortfilter.type %} selected{% endif %}>{% trans "Delegate" %}</option>
<option value="observer"{% if 'observer' in sortfilter.type %} selected{% endif %}>{% trans "Observer" %}</option>
@ -41,69 +73,75 @@
<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>
</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>
{% for committee in committees %}
<option value="{{ committee }}"{% if committee in sortfilter.committee %} selected{% endif %}>
{{ committee }}</option>
{% endfor %}
</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="1"{% if '1' in sortfilter.status %} selected{% endif %}>{% trans "Active" %}</option>
<option value="0"{% if '0' in sortfilter.status %} selected{% endif %}>{% trans "Inactive" %}</option>
</select>
</div>
</form>
</p>
<small><i>
{% if users.count == allusers %}
{{ users.count }}
{% blocktrans count counter=users.count %}participant{% plural %}participants{% endblocktrans %}
{% else %}
{{ users.count }} {% trans "of" %} {{ allusers }} {% trans "Participants" %} (= {{ percent }} %)
{% endif %}
<table>
</i></small>
<table class="table table-striped table-bordered">
<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=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><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=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=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=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 %}
<th><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>{% trans "Actions" %}</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 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 class="mini_width">{% trans "Actions" %}</th>
{% endif %}
</tr>
{% for user in users %}
<tr class="{% cycle '' 'odd' %}">
<td><a href="{% model_url user 'view' %}">{{ user.first_name }}</a></td>
<td><a href="{% model_url user 'view' %}">{{ user.last_name }}</a></td>
<td>{{ user.structure_level }}</td>
<td>{{ user.get_type_display }}</td>
<td>{{ user.committee }}</td>
<tr class="{% if user.active %}activeline{% endif %}">
<td><a href="{% url 'user_view' user.id %}">{{ user.first_name }}</a></td>
<td><a href="{% url 'user_view' user.id %}">{{ user.last_name }}</a></td>
<td class="optional">{{ user.structure_level }}</td>
<td class="optional">{{ user.get_type_display }}</td>
<td class="optional">{{ user.committee }}</td>
{% if perms.participant.can_manage_participant %}
<td>{{ user.comment|first_line }}</td>
<td>
<td class="optional">{{ user.comment|first_line }}</td>
<td class="optional">
{% if user.last_login > user.date_joined %}
{{ user.last_login }}
{% endif %}
</td>
<td>
<span style="width: 1px; white-space: nowrap;">
<a href="{% url 'user_edit' user.id %}">
<img src="{% static 'images/icons/edit.png' %}" title="{% trans 'Edit participant' %}">
{% if perms.projector.can_manage_projector %}
<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>
{% if user != request_user %}
<a href="{% url 'user_delete' user.id %}">
<img src="{% static 'images/icons/delete.png' %}" title="{% trans 'Delete participant' %}">
<a href="{% url 'user_delete' user.id %}" title="{% trans 'Delete' %}" class="btn btn-mini">
<i class="icon-remove"></i>
</a>
{% endif %}
{% 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 %}>
<span></span>
</a>
<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 %}>
<span></span>
<a href="{% url 'user_status_toggle' user.id %}"
class="status_link btn btn-mini {% if user.is_active %}btn-success{% endif %}"
title="{% trans 'Change status (active/inactive)' %}">
<i class="{% if user.is_active %}icon-on{% else %}icon-off{% endif %}"></i>
</a>
{% endif %}
</span>

View File

@ -4,28 +4,11 @@
{% 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 %}
<h1>{% trans "Password Settings" %}</h1>
<form action="" method="post">{% csrf_token %}
{{ form.as_p }}
<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>
{% include "form.html" %}
{% include "formbuttons_save.html" %}
</form>
<p></p>
{% endblock %}

View File

@ -2,29 +2,13 @@
{% load i18n %}
{% block title %}{{ block.super }} {% trans "Personal Settings" %}{% 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 title %}{{ block.super }} {% trans "Edit profile" %}{% endblock %}
{% block content %}
<h1>{% trans "Personal Settings" %}</h1>
<h1>{% trans "Edit profile" %}</h1>
<form action="" method="post">{% csrf_token %}
{{ form_user.as_p }}
<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>
{% include "form.html" %}
{% include "formbuttons_save.html" %}
</form>
{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "participant/base_participant.html" %}
{% extends "base.html" %}
{% load i18n %}
{% load tags %}
@ -7,11 +7,15 @@
{% 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>
<h2>{% trans "Groups" %}</h2>
<h4>{% trans "Groups" %}</h4>
<p>
{% if shown_user.groups.all %}
{{ shown_user.groups.all|join:", " }}
@ -21,32 +25,32 @@
</p>
{% if shown_user.get_gender_display %}
<h2>{% trans "Gender" %}</h2>
<h4>{% trans "Gender" %}</h4>
<p>{{ shown_user.get_gender_display }}</p>
{% endif %}
{% if shown_user.get_type_display %}
<h2>{% trans "Type" %}</h2>
<h4>{% trans "Type" %}</h4>
<p>{{ shown_user.get_type_display }}</p>
{% endif %}
{% if shown_user.committee %}
<h2>{% trans "Committee" %}</h2>
<h4>{% trans "Committee" %}</h4>
<p>{{ shown_user.committee }}</p>
{% endif %}
{% if shown_user.about_me %}
<h2>{% trans "About me" %}</h2>
<h4>{% trans "About me" %}</h4>
<p>{{ shown_user.about_me }}</p>
{% endif %}
{% if perms.participant.can_manage_participant %}
{% if shown_user.comment %}
<h2>{% trans "Comment" %}</h2>
<h4>{% trans "Comment" %}</h4>
<p>{{ shown_user.comment }}</p>
{% endif %}
<h2>{% trans "Last Login" %}</h2>
<h4>{% trans "Last Login" %}</h4>
{% if shown_user.last_login > shown_user.date_joined %}
<p>{{ shown_user.last_login }}</p>
{% else %}

View File

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

View File

@ -10,7 +10,7 @@
:license: GNU GPL, see LICENSE for more details.
"""
from django.conf.urls.defaults import url, patterns
from django.conf.urls import url, patterns
from openslides.participant.views import (
UserOverview, UserCreateView, UserDetailView, UserUpdateView,

View File

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

View File

@ -12,42 +12,20 @@
from django.http import HttpResponseRedirect
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):
template_name = 'poll/poll.html'
poll_argument = 'poll_id'
class PollFormView(UrlMixin, TemplateView):
poll_class = None
def set_poll(self, poll_id):
poll_id = poll_id
self.poll = self.poll_class.objects.get(pk=poll_id)
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 get(self, request, *args, **kwargs):
self.poll = self.object = self.get_object()
return super(PollFormView, self).get(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)
FormClass = self.get_modelform_class()
@ -76,3 +54,32 @@ class PollFormView(TemplateView):
pollform.save()
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
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':
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -5,48 +5,30 @@
* :license: GNU GPL, see LICENSE for more details.
*/
// function that writes the portlet list order to a cookie
// function that writes the widget list order to a cookie
function saveOrder() {
$(".column").each(function(index, value){
var colid = value.id;
var cookieName = "cookie-" + colid;
// Get the order for this column.
var order = $('#' + colid).sortable("toArray");
// For each portlet in the column
for ( var i = 0, n = order.length; i < n; i++ ) {
// Determine if it is 'opened' or 'closed'
var v = $('#' + order[i] ).find('.portlet-content').is(':visible');
// Modify the array we're saving to indicate what's open and
// what's not.
order[i] = order[i] + ":" + v;
}
$.cookie(cookieName, order, { path: "/", expiry: new Date(2012, 1, 1)});
});
}
// function that restores the portlet list order from a cookie
// function that restores the widget list order from a cookie
function restoreOrder() {
$(".column").each(function(index, value) {
var colid = value.id;
var cookieName = "cookie-" + colid
var cookieName = "cookie-" + colid;
var cookie = $.cookie(cookieName);
if ( cookie == null ) { return; }
var IDs = cookie.split(",");
for (var i = 0, n = IDs.length; i < n; i++ ) {
var toks = IDs[i].split(":");
if ( toks.length != 2 ) {
continue;
}
var portletID = toks[0];
var visible = toks[1]
var portlet = $(".column")
.find('#' + portletID)
var widgetID = IDs[i];
var widget = $(".column")
.find('#' + widgetID)
.appendTo($('#' + colid));
if (visible === 'false') {
portlet.find(".ui-icon").toggleClass("ui-icon-minus");
portlet.find(".ui-icon").toggleClass("ui-icon-plus");
portlet.find(".portlet-content").hide();
}
}
});
}
@ -57,75 +39,7 @@ $(function() {
stop: function() { saveOrder(); }
});
$(".portlet")
.addClass("ui-widget ui-widget-content")
.addClass("ui-helper-clearfix ui-corner-all")
.find(".portlet-header")
.addClass("ui-widget-header ui-corner-all")
.prepend('<span class="ui-icon ui-icon-minus"></span>')
.end()
.find(".portlet-content");
restoreOrder();
$(".portlet-header .ui-icon").click(function() {
$(this).toggleClass("ui-icon-minus");
$(this).toggleClass("ui-icon-plus");
$(this).parents(".portlet:first").find(".portlet-content").toggle();
saveOrder(); // This is important
});
if ($.browser.msie) {
if ($.browser.version >= 8.0 && $.browser.version < 9.0)
{
/* scaling bug in IE8.. iframe has to be 4 times bigger */
$( "#iframe" ).css('width', 1024 * 4);
$( "#iframe" ).css('height', 768 * 4);
}
$( "#iframe" ).css('zoom', '0.25');
}
// activate an element to show it on projector
$('.activate_link').click(function(event) {
event.preventDefault();
var link = $(this);
$.ajax({
type: 'GET',
url: $(this).attr('href'),
dataType: 'json',
success: function(data) {
$('.activate_link').removeClass('active');
$('li').removeClass('activeline');
$('div').removeClass('activeline');
link.addClass('active');
link.parent().addClass('activeline');
},
error: function () {
alert("Ajax Error");
}
});
});
$('a.overlay').click(function(event) {
event.preventDefault();
var link = $(this);
$.ajax({
type: 'GET',
url: $(this).attr('href'),
dataType: 'json',
success: function(data) {
if (data['active']) {
$('#' + data['def_name'] + '_active').show();
$('#' + data['def_name'] + '_inactive').hide();
} else {
$('#' + data['def_name'] + '_active').hide();
$('#' + data['def_name'] + '_inactive').show();
}
},
});
});
// control the projector
// control the projector view
$('.projector_edit').click(function(event) {
event.preventDefault();
var link = $(this);
@ -143,7 +57,6 @@ $(function() {
event.preventDefault();
var link = $(this);
var requestData = {};
if (link.attr('id') == "countdown_set") {
requestData = { "countdown_time" : $( "#countdown_time" ).val() };
}
@ -165,7 +78,8 @@ $(function() {
});
});
$('.countdown_visible_link').click(function(event) {
// activate/deactivate overlay
$('.overlay_activate_link').click(function(event) {
event.preventDefault();
var link = $(this);
$.ajax({
@ -173,13 +87,13 @@ $(function() {
url: link.attr('href'),
dataType: 'json',
success: function(data) {
if (data.countdown_visible == "True") {
newclass = 'open';
if (data['active']) {
$('#' + data['def_name'] + '_active').show();
$('#' + data['def_name'] + '_inactive').hide();
} else {
newclass = 'closed';
$('#' + data['def_name'] + '_active').hide();
$('#' + data['def_name'] + '_inactive').show();
}
link.removeClass('closed open').addClass(newclass);
link.attr('href', data.link);
}
});
});
@ -190,4 +104,21 @@ $(function() {
$('#overlay_message_text').val(data['overlay_message']);
}
});
/* comment out this function because '$.browser' has been removed from jquery 1.9, see:
http://blog.jquery.com/2013/01/15/jquery-1-9-final-jquery-2-0-beta-migrate-final-released/
TODO: use jquery migrate to have $.browser support for IE8;
if ($.browser.msie) {
if ($.browser.version >= 8.0 && $.browser.version < 9.0)
{
// scaling bug in IE8.. iframe has to be 4 times bigger
$( "#iframe" ).css('width', 1024 * 4);
$( "#iframe" ).css('height', 768 * 4);
}
$( "#iframe" ).css('zoom', '0.25');
}
*/
restoreOrder();
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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