Exemplo n.º 1
0
def set_simple_config_view_multiple_vars(sender, **kwargs):
    """
    Sets a bad config view with some multiple config vars.
    """
    return ConfigCollection(
        title='Config vars for testing 3',
        url='testsimplepage2',
        variables=(ConfigVariable(name='multiple_config_var', default_value='foobar1'),
                   ConfigVariable(name='multiple_config_var', default_value='foobar2')))
Exemplo n.º 2
0
def set_simple_config_view(sender, **kwargs):
    """
    Sets a simple config view with some config variables but without
    grouping.
    """
    return ConfigCollection(
        title='Config vars for testing 2',
        url='testsimplepage1',
        variables=(ConfigVariable(name='additional_config_var', default_value='BaeB0ahcMae3feem'),
                   ConfigVariable(name='additional_config_var_2', default_value='', form_field=forms.CharField()),
                   ConfigVariable(name='none_config_var', default_value=None)))
Exemplo n.º 3
0
def set_simple_config_page_multiple_vars(sender, **kwargs):
    """
    Sets a bad config page with some multiple config vars.
    """
    return ConfigPage(title='Config vars for testing 3',
                      url='testsimplepage2',
                      required_permission='No permission required',
                      variables=(ConfigVariable(name='multiple_config_var',
                                                default_value='foobar1'),
                                 ConfigVariable(name='multiple_config_var',
                                                default_value='foobar2')))
Exemplo n.º 4
0
def setup_agenda_config(sender, **kwargs):
    """
    Agenda config variables.
    """
    # TODO: Insert validator for the format or use other field carefully.
    agenda_start_event_date_time = ConfigVariable(
        name='agenda_start_event_date_time',
        default_value='',
        form_field=forms.CharField(
            validators=[
                validate_start_time,
            ],
            widget=forms.DateTimeInput(format='%d.%m.%Y %H:%M'),
            required=False,
            label=ugettext_lazy('Begin of event'),
            help_text=ugettext_lazy('Input format: DD.MM.YYYY HH:MM')))

    agenda_show_last_speakers = ConfigVariable(
        name='agenda_show_last_speakers',
        default_value=1,
        form_field=forms.IntegerField(
            min_value=0,
            label=ugettext_lazy(
                'Number of last speakers to be shown on the projector')))

    agenda_couple_countdown_and_speakers = ConfigVariable(
        name='agenda_couple_countdown_and_speakers',
        default_value=False,
        form_field=forms.BooleanField(
            label=ugettext_lazy('Couple countdown with the list of speakers'),
            help_text=ugettext_lazy(
                '[Begin speach] starts the countdown, [End speach] stops the countdown.'
            ),
            required=False))

    extra_stylefiles = ['css/jquery-ui-timepicker.css']
    extra_javascript = [
        'js/jquery/jquery-ui-timepicker-addon.min.js',
        'js/jquery/jquery-ui-sliderAccess.min.js',
        'js/jquery/datepicker-config.js'
    ]

    return ConfigCollection(title=ugettext_noop('Agenda'),
                            url='agenda',
                            required_permission='config.can_manage',
                            weight=20,
                            variables=(agenda_start_event_date_time,
                                       agenda_show_last_speakers,
                                       agenda_couple_countdown_and_speakers),
                            extra_context={
                                'extra_stylefiles': extra_stylefiles,
                                'extra_javascript': extra_javascript
                            })
Exemplo n.º 5
0
def set_simple_config_collection_disabled_view(sender, **kwargs):
    return ConfigCollection(
        title='Ho5iengaoon5Hoht',
        url='testsimplepage3',
        required_permission='No permission required',
        variables=(ConfigVariable(name='hidden_config_var_2',
                                  default_value=''), ))
Exemplo n.º 6
0
def setup_agenda_config_page(sender, **kwargs):
    """
    Agenda config variables.
    """
    # TODO: Insert validator for the format or use other field carefully.
    agenda_start_event_date_time = ConfigVariable(
        name='agenda_start_event_date_time',
        default_value='',
        form_field=forms.CharField(
            validators=[
                validate_start_time,
            ],
            widget=forms.DateTimeInput(format='%d.%m.%Y %H:%M'),
            required=False,
            label=ugettext_lazy('Begin of event'),
            help_text=ugettext_lazy('Input format: DD.MM.YYYY HH:MM')))

    agenda_show_last_speakers = ConfigVariable(
        name='agenda_show_last_speakers',
        default_value=1,
        form_field=forms.IntegerField(
            min_value=0,
            label=ugettext_lazy(
                'Number of last speakers to be shown on the projector')))

    extra_stylefiles = [
        'styles/timepicker.css', 'styles/jquery-ui/jquery-ui.custom.min.css'
    ]
    extra_javascript = [
        'javascript/jquery-ui.custom.min.js',
        'javascript/jquery-ui-timepicker-addon.min.js',
        'javascript/jquery-ui-sliderAccess.min.js',
        'javascript/agenda-config-datepicker.js'
    ]

    return ConfigPage(title=ugettext_noop('Agenda'),
                      url='agenda',
                      required_permission='config.can_manage',
                      weight=20,
                      variables=(agenda_start_event_date_time,
                                 agenda_show_last_speakers),
                      extra_context={
                          'extra_stylefiles': extra_stylefiles,
                          'extra_javascript': extra_javascript
                      })
Exemplo n.º 7
0
def set_simple_config_collection_with_callback(sender, **kwargs):
    def callback():
        raise Exception('Change callback dhcnfg34dlg06kdg successfully called.')
    return ConfigCollection(
        title='Hvndfhsbgkridfgdfg',
        url='testsimplepage4',
        variables=(ConfigVariable(
            name='var_with_callback_ghvnfjd5768gdfkwg0hm2',
            default_value='',
            on_change=callback),))
Exemplo n.º 8
0
def set_grouped_config_page(sender, **kwargs):
    """
    Sets a grouped config page which can be reached under the url
    '/config/testgroupedpage1/'. There are some variables, one variable
    with a string as default value, one with a boolean as default value,
    one with an integer as default value, one with choices and one
    hidden variable. These variables are grouped in two groups.
    """
    string_var = ConfigVariable(
        name='string_var',
        default_value='default_string_rien4ooCZieng6ah',
        form_field=forms.CharField())
    bool_var = ConfigVariable(name='bool_var',
                              default_value=True,
                              form_field=forms.BooleanField(required=False))
    integer_var = ConfigVariable(name='integer_var',
                                 default_value=3,
                                 form_field=forms.IntegerField())
    group_1 = ConfigGroup(title='Group 1 aiYeix2mCieQuae3',
                          variables=(string_var, bool_var, integer_var))

    hidden_var = ConfigVariable(name='hidden_var',
                                default_value='hidden_value')
    choices_var = ConfigVariable(
        name='choices_var',
        default_value=1,
        form_field=forms.ChoiceField(
            choices=((1, 'Choice One Ughoch4ocoche6Ee'),
                     (2, 'Choice Two Vahnoh5yalohv5Eb'))))
    group_2 = ConfigGroup(title='Group 2 Toongai7ahyahy7B',
                          variables=(hidden_var, choices_var))

    return ConfigGroupedPage(
        title='Config vars for testing 1',
        url='testgroupedpage1',
        required_permission='config.can_manage',
        weight=10000,
        groups=(group_1, group_2),
        extra_context={
            'extra_stylefiles': ['styles/test-config-sjNN56dFGDrg2.css'],
            'extra_javascript': ['javascript/test-config-djg4dFGVslk4209f.js']
        })
Exemplo n.º 9
0
def setup_projector_config_variables(sender, **kwargs):
    """
    Projector config variables for OpenSlides. They are not shown on a
    config page.
    """

    presentation = ConfigVariable(name='presentation', default_value='')

    presentation_argument = ConfigVariable(name='presentation_argument',
                                           default_value=None)

    projector_message = ConfigVariable(name='projector_message',
                                       default_value='')

    countdown_time = ConfigVariable(name='countdown_time', default_value=60)

    countdown_start_stamp = ConfigVariable(name='countdown_start_stamp',
                                           default_value=0)

    countdown_pause_stamp = ConfigVariable(name='countdown_pause_stamp',
                                           default_value=0)

    countdown_state = ConfigVariable(name='countdown_state',
                                     default_value='inactive')

    bigger = ConfigVariable(name='bigger', default_value=100)

    up = ConfigVariable(name='up', default_value=0)

    projector_active_overlays = ConfigVariable(
        name='projector_active_overlays', default_value=[])

    return ConfigPage(title='No title here',
                      url='bar',
                      required_permission=None,
                      variables=(presentation, presentation_argument,
                                 projector_message, countdown_time,
                                 countdown_start_stamp, countdown_pause_stamp,
                                 countdown_state, bigger, up,
                                 projector_active_overlays))
Exemplo n.º 10
0
def setup_participant_config_page(sender, **kwargs):
    """
    Participant config variables.
    """
    # TODO: Rename config-vars
    participant_pdf_system_url = ConfigVariable(
        name='participant_pdf_system_url',
        default_value='http://example.com:8000',
        form_field=forms.CharField(
            widget=forms.TextInput(),
            required=False,
            label=ugettext_lazy('System URL'),
            help_text=ugettext_lazy(
                'Printed in PDF of first time passwords only.')))
    participant_pdf_welcometext = ConfigVariable(
        name='participant_pdf_welcometext',
        default_value=_('Welcome to OpenSlides!'),
        form_field=forms.CharField(
            widget=forms.Textarea(),
            required=False,
            label=ugettext_lazy('Welcome text'),
            help_text=ugettext_lazy(
                'Printed in PDF of first time passwords only.')))
    participant_sort_users_by_first_name = ConfigVariable(
        name='participant_sort_users_by_first_name',
        default_value=False,
        form_field=forms.BooleanField(
            required=False,
            label=ugettext_lazy('Sort participants by first name'),
            help_text=ugettext_lazy('Disable for sorting by last name')))

    return ConfigPage(title=ugettext_noop('Participant'),
                      url='participant',
                      required_permission='config.can_manage',
                      weight=50,
                      variables=(participant_pdf_system_url,
                                 participant_pdf_welcometext,
                                 participant_sort_users_by_first_name))
Exemplo n.º 11
0
    def test_improperly_configured_config_view_two(self):
        """
        Tests that a ConfigCollection object without a title raises ConfigError
        when is_shown() is called.
        """
        collection = ConfigCollection(
            url='only_url_ureiraeY1Oochuad7xei',
            variables=(ConfigVariable(name='some_var_vuuC6eiXeiyae3ik4gie',
                                      default_value='',
                                      form_field=forms.CharField()),))

        self.assertRaisesMessage(
            ConfigError,
            'The config collection %s must have a title and an url attribute.' % repr(collection),
            collection.is_shown)
Exemplo n.º 12
0
    def test_improperly_configured_config_view(self):
        """
        Tests that a ConfigCollection object without an url raises ConfigError
        when is_shown() is called.
        """
        collection = ConfigCollection(
            title='Only a small title but no url ci6xahb8Chula0Thesho',
            variables=(ConfigVariable(name='some_var_paiji9theiW8ooXivae6',
                                      default_value='',
                                      form_field=forms.CharField()),))

        self.assertRaisesMessage(
            ConfigError,
            'The config collection %s must have a title and an url attribute.' % repr(collection),
            collection.is_shown)
Exemplo n.º 13
0
    def test_improperly_configured_config_view(self):
        from openslides.config import urls
        collection = ConfigCollection(
            title='Only a small title but no url ci6xahb8Chula0Thesho',
            variables=(ConfigVariable(name='some_var_paiji9theiW8ooXivae6',
                                      default_value='',
                                      form_field=forms.CharField()), ))

        def setup_bad_config_view_one(sender, **kwargs):
            return collection

        config_signal.connect(
            setup_bad_config_view_one,
            dispatch_uid='setup_bad_config_view_one_for_testing')
        self.assertRaisesMessage(
            ConfigError,
            'The config collection %s must have a title and an url attribute.'
            % repr(collection), reload, urls)
        config_signal.disconnect(
            setup_bad_config_view_one,
            dispatch_uid='setup_bad_config_view_one_for_testing')
Exemplo n.º 14
0
    def test_improperly_configured_config_view_two(self):
        from openslides.config import urls
        collection = ConfigCollection(url='only_url_ureiraeY1Oochuad7xei',
                                      variables=(ConfigVariable(
                                          name='some_var_vuuC6eiXeiyae3ik4gie',
                                          default_value='',
                                          form_field=forms.CharField()), ))

        def setup_bad_config_view_two(sender, **kwargs):
            return collection

        config_signal.connect(
            setup_bad_config_view_two,
            dispatch_uid='setup_bad_config_view_twoe_for_testing')
        self.assertRaisesMessage(
            ConfigError,
            'The config collection %s must have a title and an url attribute.'
            % repr(collection), reload, urls)
        config_signal.disconnect(
            setup_bad_config_view_two,
            dispatch_uid='setup_bad_config_view_twoe_for_testing')
Exemplo n.º 15
0
def setup_projector_config(sender, **kwargs):
    """
    Projector config variables for OpenSlides. They are not shown on a
    config view.
    """
    # The active slide. The config-value is a dictonary with at least the entry
    # 'callback'.
    projector = ConfigVariable(name='projector_active_slide',
                               default_value={'callback': None})

    projector_message = ConfigVariable(name='projector_message',
                                       default_value='')

    countdown_time = ConfigVariable(name='countdown_time', default_value=60)

    countdown_start_stamp = ConfigVariable(name='countdown_start_stamp',
                                           default_value=0)

    countdown_pause_stamp = ConfigVariable(name='countdown_pause_stamp',
                                           default_value=0)

    countdown_state = ConfigVariable(name='countdown_state',
                                     default_value='inactive')

    projector_scale = ConfigVariable(name='projector_scale', default_value=0)

    projector_scroll = ConfigVariable(name='projector_scroll', default_value=0)

    projector_js_cache = ConfigVariable(name='projector_js_cache',
                                        default_value={})

    projector_active_overlays = ConfigVariable(
        name='projector_active_overlays', default_value=[])

    projector_pdf_fullscreen = ConfigVariable(name='pdf_fullscreen',
                                              default_value=False)

    return ConfigCollection(
        required_permission=None,
        variables=(projector, projector_message, countdown_time,
                   countdown_start_stamp, countdown_pause_stamp,
                   countdown_state, projector_scale, projector_scroll,
                   projector_active_overlays, projector_js_cache,
                   projector_pdf_fullscreen))
Exemplo n.º 16
0
def setup_assignment_config_page(sender, **kwargs):
    """
    Assignment config variables.
    """
    assignment_publish_winner_results_only = ConfigVariable(
        name='assignment_publish_winner_results_only',
        default_value=False,
        form_field=forms.BooleanField(
            required=False,
            label=ugettext_lazy('Only publish voting results for selected '
                                'winners (Projector view only)')))
    assignment_pdf_ballot_papers_selection = ConfigVariable(
        name='assignment_pdf_ballot_papers_selection',
        default_value='CUSTOM_NUMBER',
        form_field=forms.ChoiceField(
            widget=forms.Select(),
            required=False,
            label=ugettext_lazy('Number of ballot papers (selection)'),
            choices=(
                ('NUMBER_OF_DELEGATES', ugettext_lazy('Number of all delegates')),
                ('NUMBER_OF_ALL_PARTICIPANTS', ugettext_lazy('Number of all participants')),
                ('CUSTOM_NUMBER', ugettext_lazy('Use the following custom number')))))
    assignment_pdf_ballot_papers_number = ConfigVariable(
        name='assignment_pdf_ballot_papers_number',
        default_value=8,
        form_field=forms.IntegerField(
            widget=forms.TextInput(attrs={'class': 'small-input'}),
            required=False,
            min_value=1,
            label=ugettext_lazy('Custom number of ballot papers')))
    assignment_pdf_title = ConfigVariable(
        name='assignment_pdf_title',
        default_value=_('Elections'),
        form_field=forms.CharField(
            widget=forms.TextInput(),
            required=False,
            label=ugettext_lazy('Title for PDF document (all elections)')))
    assignment_pdf_preamble = ConfigVariable(
        name='assignment_pdf_preamble',
        default_value='',
        form_field=forms.CharField(
            widget=forms.Textarea(),
            required=False,
            label=ugettext_lazy('Preamble text for PDF document (all elections)')))
    assignment_poll_vote_values = ConfigVariable(
        name='assignment_poll_vote_values',
        default_value='auto',
        form_field=forms.ChoiceField(
            widget=forms.Select(),
            required=False,
            label=ugettext_lazy('Election method'),
            choices=(
                ('auto', ugettext_lazy('Automatic assign of method')),
                ('votes', ugettext_lazy('Always one option per candidate')),
                ('yesnoabstain', ugettext_lazy('Always Yes-No-Abstain per candidate')))))

    return ConfigPage(title=ugettext_noop('Elections'),
                      url='assignment',
                      required_permission='config.can_manage',
                      weight=40,
                      variables=(assignment_publish_winner_results_only,
                                 assignment_pdf_ballot_papers_selection,
                                 assignment_pdf_ballot_papers_number,
                                 assignment_pdf_title,
                                 assignment_pdf_preamble,
                                 assignment_poll_vote_values))
Exemplo n.º 17
0
def setup_projector_config(sender, **kwargs):
    """
    Receiver function to setup all projector config variables. They are not
    shown on a config view. The function is connected to the signal
    openslides.config.signals.config_signal during app loading.
    """
    # The active slide. The config-value is a dictonary with at least the entry
    # 'callback'.
    projector = ConfigVariable(
        name='projector_active_slide',
        default_value={'callback': None})

    projector_message = ConfigVariable(
        name='projector_message',
        default_value='')

    countdown_time = ConfigVariable(
        name='countdown_time',
        default_value=60)

    countdown_start_stamp = ConfigVariable(
        name='countdown_start_stamp',
        default_value=0)

    countdown_pause_stamp = ConfigVariable(
        name='countdown_pause_stamp',
        default_value=0)

    countdown_state = ConfigVariable(
        name='countdown_state',
        default_value='inactive')

    projector_scale = ConfigVariable(
        name='projector_scale',
        default_value=0)

    projector_scroll = ConfigVariable(
        name='projector_scroll',
        default_value=0)

    projector_js_cache = ConfigVariable(
        name='projector_js_cache',
        default_value={})

    projector_active_overlays = ConfigVariable(
        name='projector_active_overlays',
        default_value=[])

    projector_pdf_fullscreen = ConfigVariable(
        name='pdf_fullscreen',
        default_value=False)

    return ConfigCollection(
        variables=(
            projector, projector_message,
            countdown_time, countdown_start_stamp, countdown_pause_stamp,
            countdown_state, projector_scale, projector_scroll,
            projector_active_overlays, projector_js_cache,
            projector_pdf_fullscreen))
Exemplo n.º 18
0
def setup_users_config(sender, **kwargs):
    """
    Receiver function to setup all users config variables. It is connected
    to the signal openslides.config.signals.config_signal during app loading.
    """
    # General
    users_sort_users_by_first_name = ConfigVariable(
        name='users_sort_users_by_first_name',
        default_value=False,
        form_field=forms.BooleanField(
            required=False,
            label=ugettext_lazy('Sort users by first name'),
            help_text=ugettext_lazy('Disable for sorting by last name')))

    group_general = ConfigGroup(title=ugettext_lazy('Sorting'),
                                variables=(users_sort_users_by_first_name, ))

    # PDF
    users_pdf_welcometitle = ConfigVariable(
        name='users_pdf_welcometitle',
        default_value=_('Welcome to OpenSlides!'),
        translatable=True,
        form_field=forms.CharField(
            widget=forms.Textarea(),
            required=False,
            label=ugettext_lazy('Title for access data and welcome PDF')))

    users_pdf_welcometext = ConfigVariable(
        name='users_pdf_welcometext',
        default_value=_('[Place for your welcome and help text.]'),
        translatable=True,
        form_field=forms.CharField(
            widget=forms.Textarea(),
            required=False,
            label=ugettext_lazy('Help text for access data and welcome PDF')))

    users_pdf_url = ConfigVariable(
        name='users_pdf_url',
        default_value='http://example.com:8000',
        form_field=forms.CharField(
            widget=forms.TextInput(),
            required=False,
            label=ugettext_lazy('System URL'),
            help_text=ugettext_lazy('Used for QRCode in PDF of access data.')))

    users_pdf_wlan_ssid = ConfigVariable(
        name='users_pdf_wlan_ssid',
        default_value='',
        form_field=forms.CharField(
            widget=forms.TextInput(),
            required=False,
            label=ugettext_lazy('WLAN name (SSID)'),
            help_text=ugettext_lazy(
                'Used for WLAN QRCode in PDF of access data.')))

    users_pdf_wlan_password = ConfigVariable(
        name='users_pdf_wlan_password',
        default_value='',
        form_field=forms.CharField(
            widget=forms.TextInput(),
            required=False,
            label=ugettext_lazy('WLAN password'),
            help_text=ugettext_lazy(
                'Used for WLAN QRCode in PDF of access data.')))

    users_pdf_wlan_encryption = ConfigVariable(
        name='users_pdf_wlan_encryption',
        default_value='',
        form_field=forms.ChoiceField(
            widget=forms.Select(),
            required=False,
            label=ugettext_lazy('WLAN encryption'),
            help_text=ugettext_lazy(
                'Used for WLAN QRCode in PDF of access data.'),
            choices=(('', '---------'), ('WEP', 'WEP'), ('WPA', 'WPA/WPA2'),
                     ('nopass', ugettext_lazy('No encryption')))))

    group_pdf = ConfigGroup(
        title=ugettext_lazy('PDF'),
        variables=(users_pdf_welcometitle, users_pdf_welcometext,
                   users_pdf_url, users_pdf_wlan_ssid, users_pdf_wlan_password,
                   users_pdf_wlan_encryption))

    return ConfigGroupedCollection(title=ugettext_noop('Users'),
                                   url='users',
                                   weight=50,
                                   groups=(group_general, group_pdf))
Exemplo n.º 19
0
def setup_general_config_page(sender, **kwargs):
    """
    General config variables for OpenSlides. They are grouped in 'Event',
    'Welcome Widget' and 'System'.
    """
    event_name = ConfigVariable(name='event_name',
                                default_value='OpenSlides',
                                form_field=forms.CharField(
                                    widget=forms.TextInput(),
                                    label=ugettext_lazy('Event name'),
                                    max_length=50))

    event_description = ConfigVariable(
        name='event_description',
        default_value=_('Presentation and assembly system'),
        form_field=forms.CharField(
            widget=forms.TextInput(),
            label=ugettext_lazy('Short description of event'),
            required=False,
            max_length=100))

    event_date = ConfigVariable(name='event_date',
                                default_value='',
                                form_field=forms.CharField(
                                    widget=forms.TextInput(),
                                    label=ugettext_lazy('Event date'),
                                    required=False))

    event_location = ConfigVariable(name='event_location',
                                    default_value='',
                                    form_field=forms.CharField(
                                        widget=forms.TextInput(),
                                        label=ugettext_lazy('Event location'),
                                        required=False))

    event_organizer = ConfigVariable(
        name='event_organizer',
        default_value='',
        form_field=forms.CharField(widget=forms.TextInput(),
                                   label=ugettext_lazy('Event organizer'),
                                   required=False))

    welcome_title = ConfigVariable(name='welcome_title',
                                   default_value=_('Welcome to OpenSlides'),
                                   form_field=forms.CharField(
                                       widget=forms.TextInput(),
                                       label=ugettext_lazy('Title'),
                                       required=False))

    welcome_text = ConfigVariable(
        name='welcome_text',
        default_value=_('[Place for your welcome text.]'),
        form_field=forms.CharField(widget=forms.Textarea(),
                                   label=ugettext_lazy('Welcome text'),
                                   required=False))

    system_enable_anonymous = ConfigVariable(
        name='system_enable_anonymous',
        default_value=False,
        form_field=forms.BooleanField(
            label=ugettext_lazy('Allow access for anonymous guest users'),
            required=False))

    group_event = ConfigGroup(title=ugettext_lazy('Event'),
                              variables=(event_name, event_description,
                                         event_date, event_location,
                                         event_organizer))

    group_welcome_widget = ConfigGroup(title=ugettext_lazy('Welcome Widget'),
                                       variables=(welcome_title, welcome_text))

    group_system = ConfigGroup(title=ugettext_lazy('System'),
                               variables=(system_enable_anonymous, ))

    return ConfigGroupedPage(title=ugettext_noop('General'),
                             url='general',
                             required_permission='config.can_manage',
                             weight=10,
                             groups=(group_event, group_welcome_widget,
                                     group_system))
Exemplo n.º 20
0
def setup_agenda_config(sender, **kwargs):
    """
    Receiver function to setup all agenda config variables. It is connected to
    the signal openslides.config.signals.config_signal during app loading.
    """
    # TODO: Insert validator for the format or use other field carefully.
    agenda_start_event_date_time = ConfigVariable(
        name='agenda_start_event_date_time',
        default_value='',
        form_field=forms.CharField(
            validators=[validate_start_time, ],
            widget=forms.DateTimeInput(format='%d.%m.%Y %H:%M'),
            required=False,
            label=ugettext_lazy('Begin of event'),
            help_text=ugettext_lazy('Input format: DD.MM.YYYY HH:MM')))

    agenda_show_last_speakers = ConfigVariable(
        name='agenda_show_last_speakers',
        default_value=1,
        form_field=forms.IntegerField(
            min_value=0,
            label=ugettext_lazy('Number of last speakers to be shown on the projector')))

    agenda_couple_countdown_and_speakers = ConfigVariable(
        name='agenda_couple_countdown_and_speakers',
        default_value=False,
        form_field=forms.BooleanField(
            label=ugettext_lazy('Couple countdown with the list of speakers'),
            help_text=ugettext_lazy('[Begin speach] starts the countdown, [End speach] stops the countdown.'),
            required=False))

    agenda_number_prefix = ConfigVariable(
        name='agenda_number_prefix',
        default_value='',
        form_field=forms.CharField(
            label=ugettext_lazy('Numbering prefix for agenda items'),
            max_length=20,
            required=False))

    agenda_numeral_system = ConfigVariable(
        name='agenda_numeral_system',
        default_value='arabic',
        form_field=forms.ChoiceField(
            label=ugettext_lazy('Numeral system for agenda items'),
            widget=forms.Select(),
            choices=(
                ('arabic', ugettext_lazy('Arabic')),
                ('roman', ugettext_lazy('Roman'))),
            required=False))

    extra_stylefiles = ['css/jquery-ui-timepicker.css']
    extra_javascript = ['js/jquery/jquery-ui-timepicker-addon.min.js',
                        'js/jquery/jquery-ui-sliderAccess.min.js',
                        'js/jquery/datepicker-config.js']

    return ConfigCollection(title=ugettext_noop('Agenda'),
                            url='agenda',
                            weight=20,
                            variables=(agenda_start_event_date_time,
                                       agenda_show_last_speakers,
                                       agenda_couple_countdown_and_speakers,
                                       agenda_number_prefix,
                                       agenda_numeral_system),
                            extra_context={'extra_stylefiles': extra_stylefiles,
                                           'extra_javascript': extra_javascript})
Exemplo n.º 21
0
def setup_assignment_config(sender, **kwargs):
    """
    Receiver function to setup all assignment config variables. It is
    connected to the signal openslides.config.signals.config_signal during
    app loading.
    """
    # Ballot and ballot papers
    assignment_poll_vote_values = ConfigVariable(
        name='assignment_poll_vote_values',
        default_value='auto',
        form_field=forms.ChoiceField(
            widget=forms.Select(),
            required=False,
            label=ugettext_lazy('Election method'),
            choices=(('auto', ugettext_lazy('Automatic assign of method')),
                     ('votes',
                      ugettext_lazy('Always one option per candidate')),
                     ('yesnoabstain',
                      ugettext_lazy('Always Yes-No-Abstain per candidate')))))
    assignment_poll_100_percent_base = ConfigVariable(
        name='assignment_poll_100_percent_base',
        default_value='WITHOUT_INVALID',
        form_field=forms.ChoiceField(
            widget=forms.Select(),
            required=False,
            label=ugettext_lazy(
                'The 100 % base of an election result consists of'),
            choices=PERCENT_BASE_CHOICES))
    assignment_pdf_ballot_papers_selection = ConfigVariable(
        name='assignment_pdf_ballot_papers_selection',
        default_value='CUSTOM_NUMBER',
        form_field=forms.ChoiceField(
            widget=forms.Select(),
            required=False,
            label=ugettext_lazy('Number of ballot papers (selection)'),
            choices=(('NUMBER_OF_DELEGATES',
                      ugettext_lazy('Number of all delegates')),
                     ('NUMBER_OF_ALL_PARTICIPANTS',
                      ugettext_lazy('Number of all participants')),
                     ('CUSTOM_NUMBER',
                      ugettext_lazy('Use the following custom number')))))
    assignment_pdf_ballot_papers_number = ConfigVariable(
        name='assignment_pdf_ballot_papers_number',
        default_value=8,
        form_field=forms.IntegerField(
            widget=forms.TextInput(attrs={'class': 'small-input'}),
            required=False,
            min_value=1,
            label=ugettext_lazy('Custom number of ballot papers')))
    assignment_publish_winner_results_only = ConfigVariable(
        name='assignment_publish_winner_results_only',
        default_value=False,
        form_field=forms.BooleanField(
            required=False,
            label=ugettext_lazy(
                'Publish election result for elected candidates only '
                '(projector view)')))
    group_ballot = ConfigGroup(
        title=ugettext_lazy('Ballot and ballot papers'),
        variables=(assignment_poll_vote_values,
                   assignment_poll_100_percent_base,
                   assignment_pdf_ballot_papers_selection,
                   assignment_pdf_ballot_papers_number,
                   assignment_publish_winner_results_only))

    # PDF
    assignment_pdf_title = ConfigVariable(
        name='assignment_pdf_title',
        default_value=_('Elections'),
        translatable=True,
        form_field=forms.CharField(
            widget=forms.TextInput(),
            required=False,
            label=ugettext_lazy('Title for PDF document (all elections)')))
    assignment_pdf_preamble = ConfigVariable(
        name='assignment_pdf_preamble',
        default_value='',
        form_field=forms.CharField(
            widget=forms.Textarea(),
            required=False,
            label=ugettext_lazy(
                'Preamble text for PDF document (all elections)')))
    group_pdf = ConfigGroup(title=ugettext_lazy('PDF'),
                            variables=(assignment_pdf_title,
                                       assignment_pdf_preamble))

    return ConfigGroupedCollection(title=ugettext_noop('Elections'),
                                   url='assignment',
                                   weight=40,
                                   groups=(group_ballot, group_pdf))
Exemplo n.º 22
0
def setup_motion_config(sender, **kwargs):
    """
    Motion config variables.
    """
    # General
    motion_workflow = ConfigVariable(
        name='motion_workflow',
        default_value=1,
        form_field=forms.ChoiceField(
            widget=forms.Select(),
            label=ugettext_lazy('Workflow of new motions'),
            required=True,
            choices=[(workflow.pk, ugettext_lazy(workflow.name))
                     for workflow in Workflow.objects.all()]))
    motion_identifier = ConfigVariable(
        name='motion_identifier',
        default_value='per_category',
        form_field=forms.ChoiceField(
            widget=forms.Select(),
            required=True,
            label=ugettext_lazy('Identifier'),
            choices=[('per_category', ugettext_lazy('Numbered per category')),
                     ('serially_numbered', ugettext_lazy('Serially numbered')),
                     ('manually', ugettext_lazy('Set it manually'))]))
    motion_preamble = ConfigVariable(
        name='motion_preamble',
        default_value=_('The assembly may decide,'),
        translatable=True,
        form_field=forms.CharField(widget=forms.TextInput(),
                                   required=False,
                                   label=ugettext_lazy('Motion preamble')))
    motion_stop_submitting = ConfigVariable(
        name='motion_stop_submitting',
        default_value=False,
        form_field=forms.BooleanField(label=ugettext_lazy(
            'Stop submitting new motions by non-staff users'),
                                      required=False))
    motion_allow_disable_versioning = ConfigVariable(
        name='motion_allow_disable_versioning',
        default_value=False,
        form_field=forms.BooleanField(
            label=ugettext_lazy('Allow to disable versioning'),
            required=False))
    group_general = ConfigGroup(
        title=ugettext_lazy('General'),
        variables=(motion_workflow, motion_identifier, motion_preamble,
                   motion_stop_submitting, motion_allow_disable_versioning))

    # Supporters
    motion_min_supporters = ConfigVariable(
        name='motion_min_supporters',
        default_value=0,
        form_field=forms.IntegerField(
            widget=forms.TextInput(attrs={'class': 'small-input'}),
            label=ugettext_lazy(
                'Number of (minimum) required supporters for a motion'),
            min_value=0,
            help_text=ugettext_lazy(
                'Choose 0 to disable the supporting system.')))
    motion_remove_supporters = ConfigVariable(
        name='motion_remove_supporters',
        default_value=False,
        form_field=forms.BooleanField(label=ugettext_lazy(
            'Remove all supporters of a motion if a submitter edits his motion in early state'
        ),
                                      required=False))
    group_supporters = ConfigGroup(title=ugettext_lazy('Supporters'),
                                   variables=(motion_min_supporters,
                                              motion_remove_supporters))

    # Voting and ballot papers
    motion_poll_100_percent_base = ConfigVariable(
        name='motion_poll_100_percent_base',
        default_value='WITHOUT_INVALID',
        form_field=forms.ChoiceField(
            widget=forms.Select(),
            required=False,
            label=ugettext_lazy(
                'The 100 % base of a voting result consists of'),
            choices=PERCENT_BASE_CHOICES))
    motion_pdf_ballot_papers_selection = ConfigVariable(
        name='motion_pdf_ballot_papers_selection',
        default_value='CUSTOM_NUMBER',
        form_field=forms.ChoiceField(
            widget=forms.Select(),
            required=False,
            label=ugettext_lazy('Number of ballot papers (selection)'),
            choices=[('NUMBER_OF_DELEGATES',
                      ugettext_lazy('Number of all delegates')),
                     ('NUMBER_OF_ALL_PARTICIPANTS',
                      ugettext_lazy('Number of all participants')),
                     ('CUSTOM_NUMBER',
                      ugettext_lazy("Use the following custom number"))]))
    motion_pdf_ballot_papers_number = ConfigVariable(
        name='motion_pdf_ballot_papers_number',
        default_value=8,
        form_field=forms.IntegerField(
            widget=forms.TextInput(attrs={'class': 'small-input'}),
            required=False,
            min_value=1,
            label=ugettext_lazy('Custom number of ballot papers')))
    group_ballot_papers = ConfigGroup(
        title=ugettext_lazy('Voting and ballot papers'),
        variables=(motion_poll_100_percent_base,
                   motion_pdf_ballot_papers_selection,
                   motion_pdf_ballot_papers_number))

    # PDF
    motion_pdf_title = ConfigVariable(
        name='motion_pdf_title',
        default_value=_('Motions'),
        translatable=True,
        form_field=forms.CharField(
            widget=forms.TextInput(),
            required=False,
            label=ugettext_lazy('Title for PDF document (all motions)')))
    motion_pdf_preamble = ConfigVariable(
        name='motion_pdf_preamble',
        default_value='',
        form_field=forms.CharField(
            widget=forms.Textarea(),
            required=False,
            label=ugettext_lazy(
                'Preamble text for PDF document (all motions)')))
    motion_pdf_paragraph_numbering = ConfigVariable(
        name='motion_pdf_paragraph_numbering',
        default_value=False,
        form_field=forms.BooleanField(
            label=ugettext_lazy('Show paragraph numbering (only in PDF)'),
            required=False))
    group_pdf = ConfigGroup(title=ugettext_lazy('PDF'),
                            variables=(motion_pdf_title, motion_pdf_preamble,
                                       motion_pdf_paragraph_numbering))

    return ConfigGroupedCollection(title=ugettext_noop('Motion'),
                                   url='motion',
                                   required_permission='config.can_manage',
                                   weight=30,
                                   groups=(group_general, group_supporters,
                                           group_ballot_papers, group_pdf))
Exemplo n.º 23
0
def setup_general_config(sender, **kwargs):
    """
    General config variables for OpenSlides. They are grouped in 'Event',
    'Welcome Widget' and 'System'.
    """
    event_name = ConfigVariable(name='event_name',
                                default_value='OpenSlides',
                                form_field=forms.CharField(
                                    widget=forms.TextInput(),
                                    label=ugettext_lazy('Event name'),
                                    max_length=50))

    event_description = ConfigVariable(
        name='event_description',
        default_value=_('Presentation and assembly system'),
        translatable=True,
        form_field=forms.CharField(
            widget=forms.TextInput(),
            label=ugettext_lazy('Short description of event'),
            required=False,
            max_length=100))

    event_date = ConfigVariable(name='event_date',
                                default_value='',
                                form_field=forms.CharField(
                                    widget=forms.TextInput(),
                                    label=ugettext_lazy('Event date'),
                                    required=False))

    event_location = ConfigVariable(name='event_location',
                                    default_value='',
                                    form_field=forms.CharField(
                                        widget=forms.TextInput(),
                                        label=ugettext_lazy('Event location'),
                                        required=False))

    event_organizer = ConfigVariable(
        name='event_organizer',
        default_value='',
        form_field=forms.CharField(widget=forms.TextInput(),
                                   label=ugettext_lazy('Event organizer'),
                                   required=False))

    projector_enable_logo = ConfigVariable(
        name='projector_enable_logo',
        default_value=True,
        form_field=forms.BooleanField(
            label=ugettext_lazy('Show logo on projector'),
            help_text=ugettext_lazy(
                'You can find and replace the logo under "openslides/projector/static/img/logo-projector.png".'
            ),
            required=False))

    projector_enable_title = ConfigVariable(
        name='projector_enable_title',
        default_value=True,
        form_field=forms.BooleanField(label=ugettext_lazy(
            'Show title and description of event on projector'),
                                      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))

    welcome_title = ConfigVariable(
        name='welcome_title',
        default_value=_('Welcome to OpenSlides'),
        translatable=True,
        form_field=forms.CharField(
            widget=forms.TextInput(),
            label=ugettext_lazy('Title'),
            help_text=ugettext_lazy(
                'Also used for the default welcome slide.'),
            required=False),
        on_change=update_projector)

    welcome_text = ConfigVariable(
        name='welcome_text',
        default_value=_('[Place for your welcome text.]'),
        translatable=True,
        form_field=forms.CharField(widget=forms.Textarea(),
                                   label=ugettext_lazy('Welcome text'),
                                   required=False))

    system_enable_anonymous = ConfigVariable(
        name='system_enable_anonymous',
        default_value=False,
        form_field=forms.BooleanField(
            label=ugettext_lazy('Allow access for anonymous guest users'),
            required=False))

    group_event = ConfigGroup(title=ugettext_lazy('Event'),
                              variables=(event_name, event_description,
                                         event_date, event_location,
                                         event_organizer))

    group_projector = ConfigGroup(
        title=ugettext_lazy('Projector'),
        variables=(projector_enable_logo, projector_enable_title,
                   projector_backgroundcolor1, projector_backgroundcolor2,
                   projector_fontcolor))

    group_welcome_widget = ConfigGroup(title=ugettext_lazy('Welcome Widget'),
                                       variables=(welcome_title, welcome_text))

    group_system = ConfigGroup(title=ugettext_lazy('System'),
                               variables=(system_enable_anonymous, ))

    return ConfigGroupedCollection(title=ugettext_noop('General'),
                                   url='general',
                                   weight=10,
                                   groups=(group_event, group_projector,
                                           group_welcome_widget, group_system))
Exemplo n.º 24
0
def setup_participant_config(sender, **kwargs):
    """
    Participant config variables.
    """
    # General
    participant_sort_users_by_first_name = ConfigVariable(
        name='participant_sort_users_by_first_name',
        default_value=False,
        form_field=forms.BooleanField(
            required=False,
            label=ugettext_lazy('Sort participants by first name'),
            help_text=ugettext_lazy('Disable for sorting by last name')))

    group_general = ConfigGroup(
        title=ugettext_lazy('Sorting'),
        variables=(participant_sort_users_by_first_name, ))

    # PDF
    participant_pdf_welcometitle = ConfigVariable(
        name='participant_pdf_welcometitle',
        default_value=_('Welcome to OpenSlides!'),
        translatable=True,
        form_field=forms.CharField(
            widget=forms.Textarea(),
            required=False,
            label=ugettext_lazy('Title for access data and welcome PDF')))

    participant_pdf_welcometext = ConfigVariable(
        name='participant_pdf_welcometext',
        default_value=_('[Place for your welcome and help text.]'),
        translatable=True,
        form_field=forms.CharField(
            widget=forms.Textarea(),
            required=False,
            label=ugettext_lazy('Help text for access data and welcome PDF')))

    participant_pdf_url = ConfigVariable(
        name='participant_pdf_url',
        default_value='http://example.com:8000',
        form_field=forms.CharField(
            widget=forms.TextInput(),
            required=False,
            label=ugettext_lazy('System URL'),
            help_text=ugettext_lazy('Used for QRCode in PDF of access data.')))

    participant_pdf_wlan_ssid = ConfigVariable(
        name='participant_pdf_wlan_ssid',
        default_value='',
        form_field=forms.CharField(
            widget=forms.TextInput(),
            required=False,
            label=ugettext_lazy('WLAN name (SSID)'),
            help_text=ugettext_lazy(
                'Used for WLAN QRCode in PDF of access data.')))

    participant_pdf_wlan_password = ConfigVariable(
        name='participant_pdf_wlan_password',
        default_value='',
        form_field=forms.CharField(
            widget=forms.TextInput(),
            required=False,
            label=ugettext_lazy('WLAN password'),
            help_text=ugettext_lazy(
                'Used for WLAN QRCode in PDF of access data.')))

    participant_pdf_wlan_encryption = ConfigVariable(
        name='participant_pdf_wlan_encryption',
        default_value='',
        form_field=forms.ChoiceField(
            widget=forms.Select(),
            required=False,
            label=ugettext_lazy('WLAN encryption'),
            help_text=ugettext_lazy(
                'Used for WLAN QRCode in PDF of access data.'),
            choices=(('', '---------'), ('WEP', 'WEP'), ('WPA', 'WPA/WPA2'),
                     ('nopass', ugettext_lazy('No encryption')))))

    group_pdf = ConfigGroup(
        title=ugettext_lazy('PDF'),
        variables=(participant_pdf_welcometitle, participant_pdf_welcometext,
                   participant_pdf_url, participant_pdf_wlan_ssid,
                   participant_pdf_wlan_password,
                   participant_pdf_wlan_encryption))

    return ConfigGroupedCollection(title=ugettext_noop('Participant'),
                                   url='participant',
                                   required_permission='config.can_manage',
                                   weight=50,
                                   groups=(group_general, group_pdf))