def set_grouped_config_view(sender, **kwargs): """ Sets a grouped config collection view 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 ConfigGroupedCollection( 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'] })
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))
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))
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))
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))
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))