fix message issus: #134, also defined some default config-values

This commit is contained in:
Oskar Hahn 2012-04-18 18:35:02 +02:00
parent 67db762575
commit 23df763b1f
4 changed files with 11 additions and 6 deletions

View File

@ -18,6 +18,7 @@ from django.dispatch import receiver
from utils.translation_ext import ugettext as _ from utils.translation_ext import ugettext as _
from openslides.config.signals import default_config_value from openslides.config.signals import default_config_value
import settings
class ConfigStore(models.Model): class ConfigStore(models.Model):
@ -58,6 +59,8 @@ class Config(object):
for receiver, value in default_config_value.send(sender='config', key=key): for receiver, value in default_config_value.send(sender='config', key=key):
if value is not None: if value is not None:
return value return value
if settings.DEBUG:
print "No default value for: %s" % key
return None return None
def __setitem__(self, key, value): def __setitem__(self, key, value):
@ -81,10 +84,12 @@ def default_config(sender, key, **kwargs):
return { return {
'event_name': _('OpenSlides'), 'event_name': _('OpenSlides'),
'event_description': _('Presentation and voting system'), 'event_description': _('Presentation and voting system'),
'presentation': '',
'frontpage_title': _('Welcome'), 'frontpage_title': _('Welcome'),
'frontpage_welcometext': _('Welcome to OpenSlides!'), 'frontpage_welcometext': _('Welcome to OpenSlides!'),
'show_help_text': True, 'show_help_text': True,
'help_text': _('If you need any help wieth OpenSlides, you can find commercial support on our <a href="http://openslides.org/en/support">Webpage</a>.'), 'help_text': _('If you need any help wieth OpenSlides, you can find commercial support on our <a href="http://openslides.org/en/support">Webpage</a>.'),
'system_enable_anonymous': False,
}.get(key) }.get(key)

View File

@ -48,7 +48,7 @@ class ProjectorOverlay(models.Model):
register_slidemodel(ProjectorSlide, model_name=_('Projector Slide')) register_slidemodel(ProjectorSlide, model_name=_('Projector Slide'))
@receiver(default_config_value, dispatch_uid="config_default_config") @receiver(default_config_value, dispatch_uid="projector_default_config")
def default_config(sender, key, **kwargs): def default_config(sender, key, **kwargs):
return { return {
'projector_message': '', 'projector_message': '',

View File

@ -122,7 +122,6 @@
<img src="{% static 'images/icons/media-playback-pause.png' %}" /> <img src="{% static 'images/icons/media-playback-pause.png' %}" />
</a> </a>
{% endif %} {% endif %}
{# Message #}
{% if overlay.def_name == "Message" %} {% if overlay.def_name == "Message" %}
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
<input name='message_text' type='text' style='width: 70%' <input name='message_text' type='text' style='width: 70%'

View File

@ -51,7 +51,8 @@ class ControlView(TemplateView):
try: try:
projector_overlay = ProjectorOverlay.objects.get(def_name=name) projector_overlay = ProjectorOverlay.objects.get(def_name=name)
except ProjectorOverlay.DoesNotExist: except ProjectorOverlay.DoesNotExist:
projector_overlay = ProjectorOverlay(def_name=name, active=False) active = name == 'Message'
projector_overlay = ProjectorOverlay(def_name=name, active=active)
projector_overlay.save() projector_overlay.save()
overlays.append(projector_overlay) overlays.append(projector_overlay)
return overlays return overlays
@ -92,7 +93,6 @@ class ControlView(TemplateView):
context.update({ context.update({
'categories': categories, 'categories': categories,
'countdown_visible': config['countdown_visible'],
'countdown_time': config['agenda_countdown_time'], 'countdown_time': config['agenda_countdown_time'],
'overlays': self.get_projector_overlays(), 'overlays': self.get_projector_overlays(),
}) })
@ -121,10 +121,10 @@ def active_slide(request, sid=None):
data = get_active_slide() data = get_active_slide()
except AttributeError: #TODO: It has to be an Slide.DoesNotExist except AttributeError: #TODO: It has to be an Slide.DoesNotExist
data = None data = None
data['ajax'] = 'on' ajax = 'on'
else: else:
data = get_slide_from_sid(sid) data = get_slide_from_sid(sid)
data['ajax'] = 'off' ajax = 'off'
if data is None: if data is None:
data = { data = {
@ -133,6 +133,7 @@ def active_slide(request, sid=None):
} }
data['overlays'] = [] data['overlays'] = []
data['overlay'] = '' data['overlay'] = ''
data['ajax'] = ajax
# Projector Overlays # Projector Overlays
sid = get_active_slide(True) sid = get_active_slide(True)