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

This commit is contained in:
Oskar Hahn 2012-04-14 17:09:23 +02:00
commit d94baf9760
7 changed files with 92 additions and 78 deletions

View File

@ -21,7 +21,6 @@ class ProjectorSlide(models.Model, SlideMixin):
'template': 'projector/ProjectorSlide.html', 'template': 'projector/ProjectorSlide.html',
} }
def __unicode__(self): def __unicode__(self):
return self.title return self.title

View File

@ -70,7 +70,7 @@ class Slide(object):
@receiver(projector_messages, dispatch_uid="projector_countdown") @receiver(projector_messages, dispatch_uid="projector_countdown")
def countdown(sender, **kwargs): def countdown(sender, **kwargs):
name = _('Projector Countdown') name = _('Countdown')
if kwargs['register']: if kwargs['register']:
return name return name
if name in kwargs['call']: if name in kwargs['call']:

View File

@ -15,9 +15,6 @@
<li class="{% if request.path == url_projectoroverview %}selected{% endif %}"> <li class="{% if request.path == url_projectoroverview %}selected{% endif %}">
<a href="{% url projector_control %}">{% trans 'Overview' %}</a> <a href="{% url projector_control %}">{% trans 'Overview' %}</a>
</li> </li>
<li class="{% if request.path == projector_messages %}selected{% endif %}">
<a href="{% url projector_messages %}">{% trans 'Messages' %}</a>
</li>
{% endif %} {% endif %}
{% if perms.projector.can_see_projector %} {% if perms.projector.can_see_projector %}
<li class="{% if request.path == url_projectornew %}selected{% endif %}"> <li class="{% if request.path == url_projectornew %}selected{% endif %}">

View File

@ -71,7 +71,7 @@
<div class="column"> <div class="column">
{% for category, slides in categories.items %} {% for category, slides in categories.items %}
{% if category != 'projector' %}
<div class="portlet"> <div class="portlet">
<div class="portlet-header">{{ category }}</div> <div class="portlet-header">{{ category }}</div>
<div class="portlet-content"> <div class="portlet-content">
@ -100,11 +100,13 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
</div> </div> <!-- end portlet-->
{% endif %}
{% endfor %} {% endfor %}
</div> </div> <!-- end column-->
<div class="column"> <div class="column">
<!-- Projector Live View -->
<div class="portlet"> <div class="portlet">
<div class="portlet-header"> <div class="portlet-header">
{% trans "Projector Live View" %} {% trans "Projector Live View" %}
@ -114,13 +116,68 @@
<iframe id="iframe" src="{% url projector_show %}"></iframe> <iframe id="iframe" src="{% url projector_show %}"></iframe>
</div> </div>
</div> </div>
</div> </div> <!-- end portlet-->
<div class="portlet">
<div class="portlet-header">{% trans "Hidden information" %}</div>
<div class="portlet-content">
TODO: list hidden agenda items
</div>
</div>
</div>
<!-- Single Slides -->
{% for category, slides in categories.items %}
{% if category == 'projector' %}
<div class="portlet">
<div class="portlet-header">{{ category }}</div>
<div class="portlet-content">
{% for slide in slides %}
{% if slide.model_slide %}
<ul style="line-height: 180%">
{% for slide in slide.get_items %}
<li class="{% if slide.active %}activeline{% endif %}"><a href="{% url projector_activate_slide slide.sid %}"
class="activate_link {% if slide.active %}active{% endif %}"
><div></div></a>
{% for i in slide.get_ancestors %}&nbsp;&nbsp;&nbsp;{% endfor %}
<a href="{% url projector_edit_slide slide.id %}">{{ slide }}</a>
{% if slide.children.exists %}
<a href="{% url projector_activate_summary slide.sid %}"><img src="{% static 'images/icons/view-list-tree.png' %}" title="{% trans 'Select item overview' %}"></a>
{% endif %}
</li>
{% endfor %}
</ul>
{% else %}
<hr>
<ul style="line-height: 180%">
<li><a href="{% url projector_activate_slide slide.key %}"
class="activate_link {% if slide.active %}active{% endif %}"
><div></div></a>{{ slide.key }}</li>
</ul>
{% endif %}
{% endfor %}
</div>
</div> <!-- end portlet-->
{% endif %}
{% endfor %}
<!-- Messages (Countdown etc.)-->
<div class="portlet">
<div class="portlet-header">{% trans 'Messages' %}</div>
<div class="portlet-content">
<ul style="line-height: 180%">
<form action="" method="post">{% csrf_token %}
<ul>
{% for message in projector_messages %}
<li>
<input type="checkbox" name="{{ message }}"{% if message.active %} checked="checked"{% endif %}> {{ message }}
</li>
{% endfor %}
</ul>
<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>
<button class="button" type="button" onclick="window.location='{% url projector_control %}'">
<span class="icon cancel">{%trans 'Cancel' %}</span>
</button>
</form>
</ul>
</div>
</div> <!-- end portlet-->
</div> <!-- end column -->
{% endblock %} {% endblock %}

View File

@ -1,24 +0,0 @@
{% extends "projector/base_projector.html" %}
{% load tags %}
{% load i18n %}
{% block content %}
<h1>{% trans 'Messages' %}</h1>
<form action="" method="post">{% csrf_token %}
<ul>
{% for message in projector_messages %}
<li><input type="checkbox" name="{{ message }}"{% if message.active %} checked="checked"{% endif %}>{{ message }}</li>
{% endfor %}
</ul>
<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>
<button class="button" type="button" onclick="window.location='{% url projector_messages %}'">
<span class="icon cancel">{%trans 'Cancel' %}</span>
</button>
</form>
{% endblock %}

View File

@ -14,7 +14,7 @@ from django.conf.urls.defaults import *
from utils.views import CreateView from utils.views import CreateView
from views import ControlView, ActivateView, MessagesView from views import ControlView, ActivateView
from agenda.views import ItemUpdate from agenda.views import ItemUpdate
from models import ProjectorSlide from models import ProjectorSlide
@ -54,11 +54,6 @@ urlpatterns = patterns('projector.views',
name='projector_new', name='projector_new',
), ),
url(r'^messages/$',
MessagesView.as_view(),
name='projector_messages',
),
url(r'^bigger/$', 'projector_edit', {'direction': 'bigger'}, url(r'^bigger/$', 'projector_edit', {'direction': 'bigger'},
name='projector_bigger'), name='projector_bigger'),

View File

@ -40,6 +40,27 @@ class ControlView(TemplateView):
template_name = 'projector/control.html' template_name = 'projector/control.html'
permission_required = 'projector.can_manage_projector' permission_required = 'projector.can_manage_projector'
def get_projector_messages(self):
messages = []
for receiver, name in projector_messages.send(sender='registerer', register=True):
if name is not None:
try:
projector_message = ProjectorMessage.objects.get(def_name=name)
except ProjectorMessage.DoesNotExist:
projector_message = ProjectorMessage(def_name=name, active=False)
projector_message.save()
messages.append(projector_message)
return messages
def post(self, request, *args, **kwargs):
for message in self.get_projector_messages():
if message.def_name in request.POST:
message.active = True
else:
message.active = False
message.save()
return self.get(request, *args, **kwargs)
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(ControlView, self).get_context_data(**kwargs) context = super(ControlView, self).get_context_data(**kwargs)
categories = {} categories = {}
@ -56,6 +77,7 @@ class ControlView(TemplateView):
'categories': ordered_categories, 'categories': ordered_categories,
'countdown_visible': config['countdown_visible'], 'countdown_visible': config['countdown_visible'],
'countdown_time': config['agenda_countdown_time'], 'countdown_time': config['agenda_countdown_time'],
'projector_messages': self.get_projector_messages(),
}) })
return context return context
@ -120,38 +142,6 @@ def active_slide(request):
) )
class MessagesView(TemplateView):
permission_required = 'projector.can_manage_projector'
template_name = 'projector/messages.html'
def get_projector_messages(self):
messages = []
for receiver, name in projector_messages.send(sender='registerer', register=True):
if name is not None:
try:
projector_message = ProjectorMessage.objects.get(def_name=name)
except ProjectorMessage.DoesNotExist:
projector_message = ProjectorMessage(def_name=name, active=False)
projector_message.save()
messages.append(projector_message)
return messages
def post(self, request, *args, **kwargs):
for message in self.get_projector_messages():
if message.def_name in request.POST:
message.active = True
else:
message.active = False
message.save()
return self.get(request, *args, **kwargs)
def get_context_data(self, **kwargs):
context = super(MessagesView, self).get_context_data(**kwargs)
context['projector_messages'] = self.get_projector_messages()
return context
@permission_required('agenda.can_manage_agenda') @permission_required('agenda.can_manage_agenda')
def projector_edit(request, direction): def projector_edit(request, direction):