Automated merge with ssh://oshahn.de/openslides

This commit is contained in:
Oskar Hahn 2011-09-06 09:27:11 +02:00
commit 3c42b26d6f
12 changed files with 99 additions and 52 deletions

View File

@ -5,9 +5,12 @@
{% load tags %} {% load tags %}
<head> <head>
<link type="text/css" rel="stylesheet" href="/static/styles/beamer.css"> <link type="text/css" rel="stylesheet" href="/static/styles/beamer.css">
<link rel="shortcut icon" href="/static/images/favicon.png" type="image/png" />
<script type="text/javascript" src="/static/javascript/jquery.js"></script> <script type="text/javascript" src="/static/javascript/jquery.js"></script>
<script type="text/javascript" src="/static/javascript/beamer.js"></script> <script type="text/javascript" src="/static/javascript/beamer.js"></script>
<title>{% block title %} {% get_config 'event_name' %} {% endblock %}</title> <title>{% block title %} {% get_config 'event_name' %} {% endblock %}</title>
{% block header %}
{% endblock %}
</head> </head>
<body> <body>
<div id="config" style="display:none;"> <div id="config" style="display:none;">

View File

@ -1,19 +1,24 @@
{% extends "beamer.html" %} {% extends "beamer.html" %}
{% block title %}{{ block.super }} - {{ item.title }}{% endblock %} {% block title %}{{ block.super }} - #{{ item.title }}{% endblock %}
{% 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 content %} {% block content %}
{% trans "Election" %}: {% trans "Election" %}:
<h1>{{ item.assignment }}</h1> <h1>{{ item.assignment }}</h1>
{% if item.assignment.status == "sea" or item.assignment.status == "vot" %}
<div id="sidebar"> <div id="sidebar">
<div class="box"> <div class="box">
<h4>{% trans "Status" %}:</h4> <h4>{% trans "Status" %}:</h4>
{% trans item.assignment.get_status_display %} {% trans item.assignment.get_status_display %}
<h4>{% trans "Number of available posts" %}:</h4> {% if item.assignment.status == "sea" or item.assignment.status == "vot" %}
{{ item.assignment.posts }} <h4>{% trans "Number of available posts" %}:</h4>
</div> {{ item.assignment.posts }}
</div>
{% endif %} {% endif %}
</div>
</div>
<p> <p>
<div class="text">{{ item.assignment.description|linebreaks }}</div> <div class="text">{{ item.assignment.description|linebreaks }}</div>
@ -44,13 +49,22 @@
</tr> </tr>
{% for vote in votes %} {% for vote in votes %}
<tr class="{% cycle 'odd' '' %}"> <tr class="{% cycle 'odd' '' %}">
{% for v in vote %} <td class="candidate">
<td>{% if v %} {% with vote|first as candidate %}
{% if candidate.1 %}
<a class="elected"><img src="/static/images/icons/games-highscores.png" title="{% trans 'Candidate is elected' %}"></a>
{% endif %}
{{ candidate.0 }}
{% endwith %}
</td>
{% for v in vote|last %}
<td style="white-space:nowrap;">{% if v %}
{% if v|length == 3 %} {% if v|length == 3 %}
<img src="/static/images/icons/voting-yes.png" title="{% trans 'Yes' %}"> {% if v.0 %}{{ v.0 }}{% else %}&empty;{% endif %}<br> <img src="/static/images/icons/voting-yes.png" title="{% trans 'Yes' %}"> {% if v.0 %}{{ v.0 }}{% else %}&empty;{% endif %}<br>
<img src="/static/images/icons/voting-no.png" title="{% trans 'No' %}"> {% if v.1 %}{{ v.1 }}{% else %}&empty;{% endif %}<br> <img src="/static/images/icons/voting-no.png" title="{% trans 'No' %}"> {% if v.1 %}{{ v.1 }}{% else %}&empty;{% endif %}<br>
<img src="/static/images/icons/voting-abstention.png" title="{% trans 'Abstention' %}"> {% if v.2 %}{{ v.2 }}{% else %}&empty;{% endif %}<br> <img src="/static/images/icons/voting-abstention.png" title="{% trans 'Abstention' %}"> {% if v.2 %}{{ v.2 }}{% else %}&empty;{% endif %}<br>
{% else %} {% else %}
{% if v != "-" %}<img src="/static/images/icons/voting-yes.png" title="{% trans 'Yes' %}">{% endif %}
{{ v }} {{ v }}
{% endif %} {% endif %}
{% else %}&empty;{% endif %} {% else %}&empty;{% endif %}

View File

@ -106,26 +106,21 @@ def beamer_edit(request, direction):
def assignment_votes(item): def assignment_votes(item):
votes = [] votes = []
if item.type == "ItemAssignment": if item.type == "ItemAssignment":
assignment = item.cast().assignment assignment = item.cast().assignment
# list of candidates # list of votes
candidates = set() votes = []
for option in Option.objects.filter(poll__assignment=assignment): for candidate in assignment.candidates:
candidates.add(option.value) tmplist = [[candidate, assignment.is_elected(candidate)], []]
# list of votes for poll in assignment.poll_set.all():
votes = [] if candidate in poll.options_values:
for candidate in candidates: option = Option.objects.filter(poll=poll).filter(user=candidate)[0]
tmplist = [] if poll.optiondecision:
tmplist.append(candidate) tmplist[1].append([option.yes, option.no, option.undesided])
for poll in assignment.poll_set.all(): else:
if candidate in poll.options_values: tmplist[1].append(option.yes)
option = Option.objects.filter(poll=poll).filter(user=candidate)[0] else:
if poll.optiondecision: tmplist[1].append("-")
tmplist.append([option.yes, option.no, option.undesided]) votes.append(tmplist)
else:
tmplist.append(option.yes)
else:
tmplist.append("-")
votes.append(tmplist)
return votes return votes

View File

@ -13,8 +13,8 @@
{% endif %} {% endif %}
<a href="{% url print_application application.id %}"><img src="/static/images/icons/application-pdf.png" title="{% trans 'Print Application' %}"></a> <a href="{% url print_application application.id %}"><img src="/static/images/icons/application-pdf.png" title="{% trans 'Print Application' %}"></a>
</h4> </h4>
<span clear="all"> </span> <span clear="all"></span>
{{ application.submitter }} {{ application.submitter.profile }}
{% if user == application.submitter %} {% if user == application.submitter %}
<img src="/static/images/icons/user-information.png" title="{% trans 'You!' %}"> <img src="/static/images/icons/user-information.png" title="{% trans 'You!' %}">
{% endif %} {% endif %}
@ -24,10 +24,11 @@
{% if application.supporter.count == 0 %} {% if application.supporter.count == 0 %}
- -
{% else %} {% else %}
<ol>
{% for supporter in application.supporter.all %} {% for supporter in application.supporter.all %}
{{ forloop.counter }}. {{supporter }} <li> {{ supporter.profile }}</li>
{% if not forloop.last %}<br>{% endif %}
{% endfor %} {% endfor %}
</ol>
{% endif %} {% endif %}
{% endif %} {% endif %}

View File

@ -71,9 +71,10 @@ class Assignment(models.Model):
def candidates(self): def candidates(self):
# list of candidates # list of candidates
from poll.models import Option from poll.models import Option
candidates = set() candidates = []
for option in Option.objects.filter(poll__assignment=self): #for option in Option.objects.values('user__user__profile').filter(poll__assignment=self).order_by('user__user__first_name').distinct():
candidates.add(option.value) for option in Option.objects.filter(poll__assignment=self).order_by('user__user__first_name'):
candidates.append(option.value)
return candidates return candidates
def set_elected(self, profile, value=True): def set_elected(self, profile, value=True):

View File

@ -145,12 +145,18 @@
<tr class="{% cycle 'odd' '' %}"> <tr class="{% cycle 'odd' '' %}">
<td class="candidate"> <td class="candidate">
{% with vote|first as candidate %} {% with vote|first as candidate %}
{{ candidate.0 }}
{% if candidate.1 %} {% if candidate.1 %}
<a class="election_link iselected" href='{% url assignment_user_not_elected assignment.id candidate.0.id %}'>{% trans 'not elected' %}</a> {% if perms.assignment.can_manage_assignment %}
<a class="election_link elected" href='{% url assignment_user_not_elected assignment.id candidate.0.id %}'></a>
{% else %}
<a class="elected"><img src="/static/images/icons/games-highscores.png" title="{% trans 'Candidate is elected' %}"></a>
{% endif %}
{% else %} {% else %}
<a class="election_link" href='{% url assignment_user_elected assignment.id candidate.0.id %}'>{% trans 'elected' %}</a> {% if perms.assignment.can_manage_assignment %}
<a class="election_link" href='{% url assignment_user_elected assignment.id candidate.0.id %}'></a>
{% endif %}
{% endif %} {% endif %}
{{ candidate.0 }}
{% endwith %} {% endwith %}
</td> </td>
{% for v in vote|last %} {% for v in vote|last %}
@ -160,6 +166,7 @@
<img src="/static/images/icons/voting-no.png" title="{% trans 'No' %}"> {% if v.1 %}{{ v.1 }}{% else %}&empty;{% endif %}<br> <img src="/static/images/icons/voting-no.png" title="{% trans 'No' %}"> {% if v.1 %}{{ v.1 }}{% else %}&empty;{% endif %}<br>
<img src="/static/images/icons/voting-abstention.png" title="{% trans 'Abstention' %}"> {% if v.2 %}{{ v.2 }}{% else %}&empty;{% endif %}<br> <img src="/static/images/icons/voting-abstention.png" title="{% trans 'Abstention' %}"> {% if v.2 %}{{ v.2 }}{% else %}&empty;{% endif %}<br>
{% else %} {% else %}
{% if v != "-" %}<img src="/static/images/icons/voting-yes.png" title="{% trans 'Yes' %}">{% endif %}
{{ v }} {{ v }}
{% endif %} {% endif %}
{% else %}&empty;{% endif %} {% else %}&empty;{% endif %}

View File

@ -55,8 +55,11 @@ class Profile(models.Model):
) )
def set_first_user_passwords(): def set_first_user_passwords():
count = 0
for user in Profile.objects.filter(Q(firstpassword='') | Q(firstpassword__isnull=True)): for user in Profile.objects.filter(Q(firstpassword='') | Q(firstpassword__isnull=True)):
count = count + 1
user.firstpassword = gen_password() user.firstpassword = gen_password()
user.user.set_password(user.firstpassword) user.user.set_password(user.firstpassword)
user.user.save() user.user.save()
user.save() user.save()
return count

View File

@ -16,7 +16,7 @@
<button type="submit" name="apply"> <button type="submit" name="apply">
<span class="icon apply">{%trans 'Apply' %}</span> <span class="icon apply">{%trans 'Apply' %}</span>
</button> </button>
<a href='{% url user_overview %}'> <a href='{% url user_group_overview %}'>
<button type="button"> <button type="button">
<span class="icon cancel">{%trans 'Cancel' %}</span> <span class="icon cancel">{%trans 'Cancel' %}</span>
</button> </button>

View File

@ -19,7 +19,7 @@ from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import SetPasswordForm from django.contrib.auth.forms import SetPasswordForm
from django.contrib import messages from django.contrib import messages
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _, ungettext
from participant.models import Profile, set_first_user_passwords from participant.models import Profile, set_first_user_passwords
from participant.api import gen_username from participant.api import gen_username
@ -174,7 +174,7 @@ def group_edit(request, group_id=None):
try: try:
group = Group.objects.get(id=group_id) group = Group.objects.get(id=group_id)
except Group.DoesNotExist: except Group.DoesNotExist:
raise NameError("There is no Group %d" % group_id) raise NameError("There is no group %d" % group_id)
else: else:
group = None group = None
@ -287,7 +287,11 @@ def user_import(request):
@permission_required('participant.can_manage_participant') @permission_required('participant.can_manage_participant')
def gen_passwords(request): def gen_passwords(request):
set_first_user_passwords() count = set_first_user_passwords()
if count:
messages.success(request, ungettext('%s Password was successfully generated.', '%s Passwords were successfully generated.', count ) % count)
else:
messages.info(request, _('There are no participants which need a first time password. No passwords generated.') )
return redirect(reverse('user_overview')) return redirect(reverse('user_overview'))

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -1,5 +1,5 @@
$(function() { $(function() {
$('a.iselected').parent().parent().children('td').addClass('iselected'); $('a.elected').parent().parent().children('td').addClass('elected');
@ -11,15 +11,14 @@ $(function() {
url: line.attr('href'), url: line.attr('href'),
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
if (line.hasClass('iselected') && !data.elected) { if (line.hasClass('elected') && !data.elected) {
line.removeClass('iselected') line.removeClass('elected')
line.parent().parent().children('td').removeClass('iselected') line.parent().parent().children('td').removeClass('elected')
} else if (!line.hasClass('iselected') && data.elected) { } else if (!line.hasClass('elected') && data.elected) {
line.addClass('iselected') line.addClass('elected')
line.parent().parent().children('td').addClass('iselected') line.parent().parent().children('td').addClass('elected')
} }
line.attr('href', data.link); line.attr('href', data.link);
line.text(data.text);
}, },
error: function () { error: function () {
alert("Ajax Error"); alert("Ajax Error");

View File

@ -1,5 +1,25 @@
td.iselected { td.elected {
background-color: green !important; background-color: #BED4DE !important;
} }
td.elected a.election_link {
background-image: url(/static/images/icons/games-highscores.png);
background-repeat: no-repeat;
background-position: center;
width: 16px;
height: 16px;
display: block;
margin-right: 5px;
float: left;
}
td a.election_link {
background-image: url(/static/images/icons/games-highscores-grey.png);
background-repeat: no-repeat;
background-position: center;
width: 16px;
height: 16px;
display: block;
margin-right: 5px;
float: left;
}