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 openslides.config.signals import default_config_value
import settings
class ConfigStore(models.Model):
@ -58,6 +59,8 @@ class Config(object):
for receiver, value in default_config_value.send(sender='config', key=key):
if value is not None:
return value
if settings.DEBUG:
print "No default value for: %s" % key
return None
def __setitem__(self, key, value):
@ -81,10 +84,12 @@ def default_config(sender, key, **kwargs):
return {
'event_name': _('OpenSlides'),
'event_description': _('Presentation and voting system'),
'presentation': '',
'frontpage_title': _('Welcome'),
'frontpage_welcometext': _('Welcome to OpenSlides!'),
'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>.'),
'system_enable_anonymous': False,
}.get(key)

View File

@ -48,7 +48,7 @@ class ProjectorOverlay(models.Model):
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):
return {
'projector_message': '',

View File

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

View File

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