2011-07-31 10:46:29 +02:00
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
openslides . system . forms
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Forms for the system app .
: copyright : 2011 by the OpenSlides team , see AUTHORS .
: license : GNU GPL , see LICENSE for more details .
"""
2011-10-25 22:03:21 +02:00
from django . forms import Form , CharField , TextInput , BooleanField , IntegerField , ChoiceField , Textarea , Select
2011-07-31 10:46:29 +02:00
from django . utils . translation import ugettext as _
2012-02-15 12:04:11 +01:00
from system import config
2011-07-31 10:46:29 +02:00
class SystemConfigForm ( Form ) :
error_css_class = ' error '
required_css_class = ' required '
2012-02-15 12:04:11 +01:00
2011-09-04 00:54:45 +02:00
#user_registration = BooleanField(label=_("User registration"), required=False)
system_url = CharField ( widget = TextInput ( ) , required = False , label = _ ( " System URL " ) )
system_welcometext = CharField ( widget = Textarea ( ) , required = False , label = _ ( " Welcome text (for password PDF) " ) )
2011-11-14 16:37:12 +01:00
system_enable_anonymous = BooleanField ( required = False , label = _ ( " Access for anonymous / guest users " ) , help_text = _ ( " Allow access for guest users " ) )
2012-02-15 12:04:11 +01:00
2011-07-31 10:46:29 +02:00
class EventConfigForm ( Form ) :
error_css_class = ' error '
required_css_class = ' required '
2012-02-15 12:04:11 +01:00
2011-07-31 10:46:29 +02:00
event_name = CharField ( widget = TextInput ( ) , label = _ ( " Event name " ) , max_length = 30 )
event_description = CharField ( widget = TextInput ( ) , label = _ ( " Short description of event " ) , max_length = 100 , required = False )
event_date = CharField ( widget = TextInput ( ) , required = False , label = _ ( " Event date " ) )
event_location = CharField ( widget = TextInput ( ) , required = False , label = _ ( " Event location " ) )
event_organizer = CharField ( widget = TextInput ( ) , required = False , label = _ ( " Event organizer " ) )
2011-11-09 21:16:02 +01:00
class AgendaConfigForm ( Form ) :
error_css_class = ' error '
required_css_class = ' required '
agenda_countdown_time = IntegerField ( widget = TextInput ( attrs = { ' class ' : ' small-input ' } ) , label = _ ( " Countdown (in seconds) " ) , initial = 60 , min_value = 0 )
2011-07-31 10:46:29 +02:00
class ApplicationConfigForm ( Form ) :
error_css_class = ' error '
required_css_class = ' required '
application_min_supporters = IntegerField ( widget = TextInput ( attrs = { ' class ' : ' small-input ' } ) , label = _ ( " Number of (minimum) required supporters for a application " ) , initial = 4 , min_value = 0 , max_value = 8 )
application_preamble = CharField ( widget = TextInput ( ) , required = False , label = _ ( " Application preamble " ) )
2011-11-01 08:26:47 +01:00
application_pdf_ballot_papers_selection = ChoiceField ( widget = Select ( ) , required = False , label = _ ( " Number of ballot papers (selection) " ) , choices = [ ( " 1 " , _ ( " Number of all delegates " ) ) , ( " 2 " , _ ( " Number of all participants " ) ) , ( " 0 " , _ ( " Use the following custum number " ) ) ] )
2011-10-25 22:03:21 +02:00
application_pdf_ballot_papers_number = IntegerField ( widget = TextInput ( attrs = { ' class ' : ' small-input ' } ) , required = False , min_value = 1 , label = _ ( " Custom number of ballot papers " ) )
2011-10-05 21:18:28 +02:00
application_pdf_title = CharField ( widget = TextInput ( ) , required = False , label = _ ( " Title for PDF document (all applications) " ) )
application_pdf_preamble = CharField ( widget = Textarea ( ) , required = False , label = _ ( " Preamble text for PDF document (all applications) " ) )
class AssignmentConfigForm ( Form ) :
error_css_class = ' error '
required_css_class = ' required '
2011-09-04 00:54:45 +02:00
2012-01-27 08:51:05 +01:00
assignment_publish_winner_results_only = BooleanField ( required = False , label = _ ( " Only publish voting results for selected winners (Projector view only) " ) )
2011-11-01 08:26:47 +01:00
assignment_pdf_ballot_papers_selection = ChoiceField ( widget = Select ( ) , required = False , label = _ ( " Number of ballot papers (selection) " ) , choices = [ ( " 1 " , _ ( " Number of all delegates " ) ) , ( " 2 " , _ ( " Number of all participants " ) ) , ( " 0 " , _ ( " Use the following custum number " ) ) ] )
2011-10-25 22:03:21 +02:00
assignment_pdf_ballot_papers_number = IntegerField ( widget = TextInput ( attrs = { ' class ' : ' small-input ' } ) , required = False , min_value = 1 , label = _ ( " Custom number of ballot papers " ) )
2011-11-17 18:16:51 +01:00
assignment_pdf_title = CharField ( widget = TextInput ( ) , required = False , label = _ ( " Title for PDF document (all elections) " ) )
assignment_pdf_preamble = CharField ( widget = Textarea ( ) , required = False , label = _ ( " Preamble text for PDF document (all elections) " ) )