2013-03-01 17:13:12 +01:00
|
|
|
from django import forms
|
2015-02-12 20:57:05 +01:00
|
|
|
from django.dispatch import Signal
|
2013-09-25 10:01:01 +02:00
|
|
|
from django.utils.translation import ugettext as _
|
|
|
|
from django.utils.translation import ugettext_lazy, ugettext_noop
|
2013-03-01 17:13:12 +01:00
|
|
|
|
2015-06-16 10:37:23 +02:00
|
|
|
from openslides.config.api import (
|
|
|
|
ConfigGroup,
|
|
|
|
ConfigGroupedCollection,
|
|
|
|
ConfigVariable,
|
|
|
|
)
|
2013-03-11 21:32:09 +01:00
|
|
|
|
2015-02-12 20:57:05 +01:00
|
|
|
# This signal is sent when the migrate command is done. That means it is sent
|
|
|
|
# after post_migrate sending and creating all Permission objects. Don't use it
|
|
|
|
# for other things than dealing with Permission objects.
|
|
|
|
post_permission_creation = Signal()
|
|
|
|
|
2013-03-01 17:13:12 +01:00
|
|
|
|
2013-12-02 19:33:43 +01:00
|
|
|
def setup_general_config(sender, **kwargs):
|
2013-03-01 17:13:12 +01:00
|
|
|
"""
|
2014-11-13 22:23:16 +01:00
|
|
|
Receiver function to setup general config variables for OpenSlides.
|
2015-06-16 18:12:59 +02:00
|
|
|
They are grouped in 'Event', 'Projector' and 'System'. This function is
|
|
|
|
connected to the signal openslides.config.signals.config_signal during
|
|
|
|
app loading.
|
2013-03-01 17:13:12 +01:00
|
|
|
"""
|
2015-06-16 18:12:59 +02:00
|
|
|
general_event_name = ConfigVariable(
|
|
|
|
name='general_event_name',
|
2013-03-01 17:13:12 +01:00
|
|
|
default_value='OpenSlides',
|
|
|
|
form_field=forms.CharField(
|
|
|
|
widget=forms.TextInput(),
|
|
|
|
label=ugettext_lazy('Event name'),
|
2013-06-14 20:24:48 +02:00
|
|
|
max_length=50))
|
2013-03-01 17:13:12 +01:00
|
|
|
|
2015-06-16 18:12:59 +02:00
|
|
|
general_event_description = ConfigVariable(
|
|
|
|
name='general_event_description',
|
2013-03-01 17:13:12 +01:00
|
|
|
default_value=_('Presentation and assembly system'),
|
2014-01-31 01:54:41 +01:00
|
|
|
translatable=True,
|
2013-03-01 17:13:12 +01:00
|
|
|
form_field=forms.CharField(
|
|
|
|
widget=forms.TextInput(),
|
|
|
|
label=ugettext_lazy('Short description of event'),
|
|
|
|
required=False,
|
|
|
|
max_length=100))
|
|
|
|
|
2015-06-16 18:12:59 +02:00
|
|
|
general_event_date = ConfigVariable(
|
|
|
|
name='general_event_date',
|
2013-03-01 17:13:12 +01:00
|
|
|
default_value='',
|
|
|
|
form_field=forms.CharField(
|
|
|
|
widget=forms.TextInput(),
|
|
|
|
label=ugettext_lazy('Event date'),
|
|
|
|
required=False))
|
|
|
|
|
2015-06-16 18:12:59 +02:00
|
|
|
general_event_location = ConfigVariable(
|
|
|
|
name='general_event_location',
|
2013-03-01 17:13:12 +01:00
|
|
|
default_value='',
|
|
|
|
form_field=forms.CharField(
|
|
|
|
widget=forms.TextInput(),
|
|
|
|
label=ugettext_lazy('Event location'),
|
|
|
|
required=False))
|
|
|
|
|
2015-06-16 18:12:59 +02:00
|
|
|
# TODO: Check whether this variable is ever used.
|
|
|
|
general_event_organizer = ConfigVariable(
|
|
|
|
name='general_event_organizer',
|
2013-03-01 17:13:12 +01:00
|
|
|
default_value='',
|
|
|
|
form_field=forms.CharField(
|
|
|
|
widget=forms.TextInput(),
|
|
|
|
label=ugettext_lazy('Event organizer'),
|
|
|
|
required=False))
|
|
|
|
|
2015-06-16 18:12:59 +02:00
|
|
|
general_system_enable_anonymous = ConfigVariable(
|
|
|
|
name='general_system_enable_anonymous',
|
|
|
|
default_value=False,
|
|
|
|
form_field=forms.BooleanField(
|
|
|
|
label=ugettext_lazy('Allow access for anonymous guest users'),
|
|
|
|
required=False))
|
|
|
|
|
2013-11-09 23:04:50 +01:00
|
|
|
projector_enable_logo = ConfigVariable(
|
|
|
|
name='projector_enable_logo',
|
|
|
|
default_value=True,
|
|
|
|
form_field=forms.BooleanField(
|
|
|
|
label=ugettext_lazy('Show logo on projector'),
|
2014-01-27 21:15:53 +01:00
|
|
|
help_text=ugettext_lazy('You can find and replace the logo under "openslides/projector/static/img/logo-projector.png".'),
|
2013-11-09 23:04:50 +01:00
|
|
|
required=False))
|
|
|
|
|
|
|
|
projector_enable_title = ConfigVariable(
|
|
|
|
name='projector_enable_title',
|
|
|
|
default_value=True,
|
|
|
|
form_field=forms.BooleanField(
|
2013-11-12 10:57:07 +01:00
|
|
|
label=ugettext_lazy('Show title and description of event on projector'),
|
2013-11-09 23:04:50 +01:00
|
|
|
required=False))
|
|
|
|
|
|
|
|
projector_backgroundcolor1 = ConfigVariable(
|
|
|
|
name='projector_backgroundcolor1',
|
|
|
|
default_value='#444444',
|
|
|
|
form_field=forms.CharField(
|
|
|
|
widget=forms.TextInput(),
|
|
|
|
label=ugettext_lazy('Background color of projector header'),
|
|
|
|
help_text=ugettext_lazy('Use web color names like "red" or hex numbers like "#ff0000".'),
|
|
|
|
required=True))
|
|
|
|
|
|
|
|
projector_backgroundcolor2 = ConfigVariable(
|
|
|
|
name='projector_backgroundcolor2',
|
|
|
|
default_value='#222222',
|
|
|
|
form_field=forms.CharField(
|
|
|
|
widget=forms.TextInput(),
|
|
|
|
label=ugettext_lazy('Second (optional) background color for linear color gradient'),
|
|
|
|
help_text=ugettext_lazy('Use web color names like "red" or hex numbers like "#ff0000".'),
|
|
|
|
required=False))
|
|
|
|
|
|
|
|
projector_fontcolor = ConfigVariable(
|
|
|
|
name='projector_fontcolor',
|
|
|
|
default_value='#F5F5F5',
|
|
|
|
form_field=forms.CharField(
|
|
|
|
widget=forms.TextInput(),
|
|
|
|
label=ugettext_lazy('Font color of projector header'),
|
|
|
|
help_text=ugettext_lazy('Use web color names like "red" or hex numbers like "#ff0000".'),
|
|
|
|
required=True))
|
|
|
|
|
2015-06-16 18:12:59 +02:00
|
|
|
projector_welcome_title = ConfigVariable(
|
|
|
|
name='projector_welcome_title',
|
2013-03-01 17:13:12 +01:00
|
|
|
default_value=_('Welcome to OpenSlides'),
|
2014-01-31 01:54:41 +01:00
|
|
|
translatable=True,
|
2013-03-01 17:13:12 +01:00
|
|
|
form_field=forms.CharField(
|
|
|
|
widget=forms.TextInput(),
|
|
|
|
label=ugettext_lazy('Title'),
|
2014-01-31 00:55:18 +01:00
|
|
|
help_text=ugettext_lazy('Also used for the default welcome slide.'),
|
2015-01-17 14:01:44 +01:00
|
|
|
required=False))
|
2013-03-01 17:13:12 +01:00
|
|
|
|
2015-06-16 18:12:59 +02:00
|
|
|
projector_welcome_text = ConfigVariable(
|
|
|
|
name='projector_welcome_text',
|
2013-03-01 17:13:12 +01:00
|
|
|
default_value=_('[Place for your welcome text.]'),
|
2014-01-31 01:54:41 +01:00
|
|
|
translatable=True,
|
2013-03-01 17:13:12 +01:00
|
|
|
form_field=forms.CharField(
|
|
|
|
widget=forms.Textarea(),
|
|
|
|
label=ugettext_lazy('Welcome text'),
|
|
|
|
required=False))
|
|
|
|
|
|
|
|
group_event = ConfigGroup(
|
|
|
|
title=ugettext_lazy('Event'),
|
2015-06-16 18:12:59 +02:00
|
|
|
variables=(
|
|
|
|
general_event_name,
|
|
|
|
general_event_description,
|
|
|
|
general_event_date,
|
|
|
|
general_event_location,
|
|
|
|
general_event_organizer))
|
2013-03-01 17:13:12 +01:00
|
|
|
|
|
|
|
group_system = ConfigGroup(
|
|
|
|
title=ugettext_lazy('System'),
|
2015-06-16 18:12:59 +02:00
|
|
|
variables=(general_system_enable_anonymous,))
|
|
|
|
|
|
|
|
group_projector = ConfigGroup(
|
|
|
|
title=ugettext_lazy('Projector'),
|
|
|
|
variables=(
|
|
|
|
projector_enable_logo,
|
|
|
|
projector_enable_title,
|
|
|
|
projector_backgroundcolor1,
|
|
|
|
projector_backgroundcolor2,
|
|
|
|
projector_fontcolor,
|
|
|
|
projector_welcome_title,
|
|
|
|
projector_welcome_text))
|
2013-03-01 17:13:12 +01:00
|
|
|
|
2013-12-02 19:33:43 +01:00
|
|
|
return ConfigGroupedCollection(
|
2013-03-01 17:13:12 +01:00
|
|
|
title=ugettext_noop('General'),
|
|
|
|
url='general',
|
|
|
|
weight=10,
|
2015-06-16 18:12:59 +02:00
|
|
|
groups=(group_event, group_system, group_projector))
|