2013-11-14 01:16:14 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
from django.core.context_processors import csrf
|
|
|
|
from django.utils.translation import ugettext_lazy
|
|
|
|
|
|
|
|
from openslides.utils.widgets import Widget
|
|
|
|
|
|
|
|
from .signals import projector_overlays
|
|
|
|
|
|
|
|
|
|
|
|
class ProjectorLiveWidget(Widget):
|
|
|
|
"""
|
|
|
|
Widget with a live view of the projector.
|
|
|
|
"""
|
|
|
|
name = 'live_view'
|
|
|
|
verbose_name = ugettext_lazy('Projector live view')
|
2014-01-28 08:32:26 +01:00
|
|
|
permission_required = 'core.can_see_projector'
|
2013-11-14 01:16:14 +01:00
|
|
|
default_column = 2
|
|
|
|
default_weight = 10
|
|
|
|
template_name = 'projector/widget_live_view.html'
|
2014-05-15 14:08:44 +02:00
|
|
|
icon_css_class = 'icon-facetime-video'
|
2013-11-14 01:16:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
class OverlayWidget(Widget):
|
|
|
|
"""
|
|
|
|
Widget to control all overlays.
|
|
|
|
"""
|
|
|
|
name = 'overlays' # TODO: Use singular here
|
|
|
|
verbose_name = ugettext_lazy('Overlays')
|
2014-01-28 08:32:26 +01:00
|
|
|
permission_required = 'core.can_manage_projector'
|
2013-11-14 01:16:14 +01:00
|
|
|
default_column = 2
|
|
|
|
default_weight = 20
|
|
|
|
template_name = 'projector/widget_overlay.html'
|
2014-05-15 14:08:44 +02:00
|
|
|
icon_css_class = 'icon-star'
|
2013-11-14 01:16:14 +01:00
|
|
|
|
|
|
|
def get_context_data(self, **context):
|
|
|
|
"""
|
|
|
|
Inserts all overlays into the context. The overlays are collected by
|
|
|
|
the projector_overlays signal.
|
|
|
|
"""
|
|
|
|
overlays = [overlay for __, overlay in projector_overlays.send(sender='overlay_widget', request=self.request)
|
|
|
|
if overlay.widget_html_callback is not None]
|
|
|
|
context.update(csrf(self.request))
|
|
|
|
return super(OverlayWidget, self).get_context_data(
|
|
|
|
overlays=overlays,
|
|
|
|
**context)
|