2020-06-18 15:22:38 +02:00
|
|
|
import os
|
2017-11-28 10:47:29 +01:00
|
|
|
from textwrap import dedent
|
|
|
|
|
2016-06-02 12:47:01 +02:00
|
|
|
from openslides.core.config import ConfigVariable
|
|
|
|
|
|
|
|
|
|
|
|
def get_config_variables():
|
|
|
|
"""
|
|
|
|
Generator which yields all config variables of this app.
|
|
|
|
|
|
|
|
They are grouped in 'Sorting' and 'PDF'. The generator has to be evaluated
|
|
|
|
during app loading (see apps.py).
|
|
|
|
"""
|
|
|
|
# Sorting
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="users_sort_by",
|
|
|
|
default_value="first_name",
|
|
|
|
input_type="choice",
|
|
|
|
label="Sort name of participants by",
|
2016-11-04 13:26:44 +01:00
|
|
|
choices=(
|
2019-01-06 16:22:33 +01:00
|
|
|
{"value": "first_name", "display_name": "Given name"},
|
|
|
|
{"value": "last_name", "display_name": "Surname"},
|
2019-02-13 17:43:28 +01:00
|
|
|
{"value": "number", "display_name": "Participant number"},
|
2019-01-06 16:22:33 +01:00
|
|
|
),
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=510,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Participants",
|
|
|
|
)
|
2016-06-02 12:47:01 +02:00
|
|
|
|
2017-11-21 10:32:31 +01:00
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="users_enable_presence_view",
|
2017-11-21 10:32:31 +01:00
|
|
|
default_value=False,
|
2019-01-06 16:22:33 +01:00
|
|
|
input_type="boolean",
|
|
|
|
label="Enable participant presence view",
|
2017-11-21 10:32:31 +01:00
|
|
|
weight=511,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Participants",
|
|
|
|
)
|
2017-11-21 10:32:31 +01:00
|
|
|
|
2020-03-26 11:33:56 +01:00
|
|
|
yield ConfigVariable(
|
|
|
|
name="users_allow_self_set_present",
|
|
|
|
default_value=False,
|
|
|
|
input_type="boolean",
|
|
|
|
label="Allow users to set themselves as present",
|
2020-03-30 10:43:50 +02:00
|
|
|
help_text="e.g. for online meetings",
|
2020-03-26 11:33:56 +01:00
|
|
|
weight=512,
|
|
|
|
group="Participants",
|
|
|
|
)
|
|
|
|
|
2020-04-22 16:54:50 +02:00
|
|
|
yield ConfigVariable(
|
|
|
|
name="users_activate_vote_weight",
|
|
|
|
default_value=False,
|
|
|
|
input_type="boolean",
|
|
|
|
label="Activate vote weight",
|
|
|
|
weight=513,
|
|
|
|
group="Participants",
|
|
|
|
)
|
|
|
|
|
2016-06-02 12:47:01 +02:00
|
|
|
# PDF
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="users_pdf_welcometitle",
|
|
|
|
default_value="Welcome to OpenSlides",
|
|
|
|
label="Title for access data and welcome PDF",
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=520,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Participants",
|
2019-08-14 21:53:42 +02:00
|
|
|
subgroup="PDF export",
|
2019-01-06 16:22:33 +01:00
|
|
|
)
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="users_pdf_welcometext",
|
|
|
|
default_value="[Place for your welcome and help text.]",
|
|
|
|
label="Help text for access data and welcome PDF",
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=530,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Participants",
|
2019-08-14 21:53:42 +02:00
|
|
|
subgroup="PDF export",
|
2019-01-06 16:22:33 +01:00
|
|
|
)
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
# TODO: Use Django's URLValidator here.
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="users_pdf_url",
|
2020-06-18 15:22:38 +02:00
|
|
|
default_value=os.getenv("INSTANCE_DOMAIN", default="http://example.com:8000"),
|
2019-01-06 16:22:33 +01:00
|
|
|
label="System URL",
|
|
|
|
help_text="Used for QRCode in PDF of access data.",
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=540,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Participants",
|
2019-08-14 21:53:42 +02:00
|
|
|
subgroup="PDF export",
|
2019-01-06 16:22:33 +01:00
|
|
|
)
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="users_pdf_wlan_ssid",
|
|
|
|
default_value="",
|
|
|
|
label="WLAN name (SSID)",
|
|
|
|
help_text="Used for WLAN QRCode in PDF of access data.",
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=550,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Participants",
|
2019-08-14 21:53:42 +02:00
|
|
|
subgroup="PDF export",
|
2019-01-06 16:22:33 +01:00
|
|
|
)
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="users_pdf_wlan_password",
|
|
|
|
default_value="",
|
|
|
|
label="WLAN password",
|
|
|
|
help_text="Used for WLAN QRCode in PDF of access data.",
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=560,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Participants",
|
2019-08-14 21:53:42 +02:00
|
|
|
subgroup="PDF export",
|
2019-01-06 16:22:33 +01:00
|
|
|
)
|
2016-06-02 12:47:01 +02:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="users_pdf_wlan_encryption",
|
|
|
|
default_value="",
|
|
|
|
input_type="choice",
|
|
|
|
label="WLAN encryption",
|
|
|
|
help_text="Used for WLAN QRCode in PDF of access data.",
|
2016-06-02 12:47:01 +02:00
|
|
|
choices=(
|
2019-01-06 16:22:33 +01:00
|
|
|
{"value": "", "display_name": "---------"},
|
|
|
|
{"value": "WEP", "display_name": "WEP"},
|
|
|
|
{"value": "WPA", "display_name": "WPA/WPA2"},
|
|
|
|
{"value": "nopass", "display_name": "No encryption"},
|
|
|
|
),
|
2016-06-02 12:47:01 +02:00
|
|
|
weight=570,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Participants",
|
2019-08-14 21:53:42 +02:00
|
|
|
subgroup="PDF export",
|
2019-01-06 16:22:33 +01:00
|
|
|
)
|
2017-11-28 10:47:29 +01:00
|
|
|
|
|
|
|
# Email
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="users_email_sender",
|
2020-05-14 19:52:18 +02:00
|
|
|
default_value="OpenSlides",
|
2019-01-06 16:22:33 +01:00
|
|
|
input_type="string",
|
2019-06-25 15:49:15 +02:00
|
|
|
label="Sender name",
|
|
|
|
help_text="The sender address is defined in the OpenSlides server settings and should modified by administrator only.",
|
2017-11-28 10:47:29 +01:00
|
|
|
weight=600,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Participants",
|
2019-06-25 15:49:15 +02:00
|
|
|
subgroup="Email",
|
|
|
|
)
|
|
|
|
|
|
|
|
yield ConfigVariable(
|
|
|
|
name="users_email_replyto",
|
|
|
|
default_value="",
|
|
|
|
input_type="string",
|
|
|
|
label="Reply address",
|
|
|
|
weight=601,
|
|
|
|
group="Participants",
|
2019-01-06 16:22:33 +01:00
|
|
|
subgroup="Email",
|
|
|
|
)
|
2017-11-28 10:47:29 +01:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="users_email_subject",
|
2019-08-14 21:53:42 +02:00
|
|
|
default_value="OpenSlides access data",
|
2019-01-06 16:22:33 +01:00
|
|
|
input_type="string",
|
|
|
|
label="Email subject",
|
2019-02-25 16:40:55 +01:00
|
|
|
help_text="You can use {event_name} and {username} as placeholder.",
|
2017-11-28 10:47:29 +01:00
|
|
|
weight=605,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Participants",
|
|
|
|
subgroup="Email",
|
|
|
|
)
|
2017-11-28 10:47:29 +01:00
|
|
|
|
|
|
|
yield ConfigVariable(
|
2019-01-06 16:22:33 +01:00
|
|
|
name="users_email_body",
|
|
|
|
default_value=dedent(
|
|
|
|
"""\
|
2017-11-28 10:47:29 +01:00
|
|
|
Dear {name},
|
|
|
|
|
2020-03-30 10:43:50 +02:00
|
|
|
this is your personal OpenSlides login:
|
2017-11-28 10:47:29 +01:00
|
|
|
|
|
|
|
{url}
|
|
|
|
username: {username}
|
|
|
|
password: {password}
|
|
|
|
|
2019-01-06 16:22:33 +01:00
|
|
|
This email was generated automatically."""
|
|
|
|
),
|
|
|
|
input_type="text",
|
|
|
|
label="Email body",
|
|
|
|
help_text="Use these placeholders: {name}, {event_name}, {url}, {username}, {password}. The url referrs to the system url.",
|
2017-11-28 10:47:29 +01:00
|
|
|
weight=610,
|
2019-01-06 16:22:33 +01:00
|
|
|
group="Participants",
|
|
|
|
subgroup="Email",
|
|
|
|
)
|