class SettingsForm(IndicoForm): _fieldsets = [ ('Conference room emails', ['rooms', 'reservation_rooms', 'categories', 'conf_room_recipients']), ('Startup assistance emails', ['startup_assistance_recipients']), ('Seminar emails', ['seminar_categories', 'seminar_recipients']) ] rooms = IndicoQuerySelectMultipleField('Rooms', get_label='full_name', collection_class=set, render_kw={'size': 20}, modify_object_list=_order_func) reservation_rooms = IndicoQuerySelectMultipleField('Reservation rooms', get_label='full_name', collection_class=set, render_kw={'size': 20}, modify_object_list=_order_func) categories = MultipleItemsField('Categories', fields=[{'id': 'id', 'caption': 'Category ID', 'required': True}]) conf_room_recipients = EmailListField('Recipients') startup_assistance_recipients = EmailListField('Recipients') seminar_categories = MultipleItemsField('Seminar categories', fields=[{'id': 'id', 'caption': 'Category ID', 'required': True}]) seminar_recipients = EmailListField('Recipients') def __init__(self, *args, **kwargs): super(SettingsForm, self).__init__(*args, **kwargs) self.rooms.query = Room.query self.reservation_rooms.query = Room.query def validate_categories(self, field): ids = [x['id'] for x in field.data] if Category.query.filter(Category.id.in_(ids)).count() != len(ids): raise ValidationError('Not a valid category ID.')
class UpcomingEventsForm(IndicoForm): max_entries = IntegerField( _('Max. events'), [InputRequired(), NumberRange(min=0)], description= _("The maximum number of upcoming events to show. Events are sorted by " "weight so events with a lower weight are more likely to be omitted if " "there are too many events to show.")) entries = MultipleItemsField( _('Upcoming events'), fields=[{ 'id': 'type', 'caption': _("Type"), 'required': True, 'type': 'select' }, { 'id': 'id', 'caption': _("ID"), 'required': True, 'type': 'number', 'step': 1, 'coerce': int }, { 'id': 'days', 'caption': _("Days"), 'required': True, 'type': 'number', 'step': 1, 'coerce': int }, { 'id': 'weight', 'caption': _("Weight"), 'required': True, 'type': 'number', 'coerce': float }], choices={'type': { 'category': _('Category'), 'event': _('Event') }}, description=_( "Specify categories/events shown in the 'upcoming events' list on the " "home page.")) def validate_entries(self, field): if field.errors: return for entry in field.data: if entry['days'] < 0: raise ValidationError(_("'Days' must be a positive integer")) if entry['type'] not in {'category', 'event'}: raise ValidationError(_('Invalid type')) if entry['type'] == 'category' and not Category.get( entry['id'], is_deleted=False): raise ValidationError( _('Invalid category: {}').format(entry['id'])) if entry['type'] == 'event' and not Event.get(entry['id'], is_deleted=False): raise ValidationError( _('Invalid event: {}').format(entry['id']))
class AdminSettingsForm(IndicoForm): currencies = MultipleItemsField( _('Currencies'), [DataRequired()], fields=[{ 'id': 'code', 'caption': _('Code') }, { 'id': 'name', 'caption': _('Name') }], unique_field='code', description= _('List of currencies that can be selected for an event. When deleting ' 'a currency, existing events will keep using it. The currency code ' "must be a valid <a href='{0}'>ISO-4217</a> code such " "as 'EUR' or 'CHF'.").format(CURRENCY_CODE_LINK)) currency = SelectField( _('Currency'), [DataRequired()], description=_( 'The default currency for new events. If you add a new currency, you need to ' 'save the settings first for it to show up here.')) conditions = TextAreaField(_('Conditions'), description=CONDITIONS_DESC) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._set_currencies() def _set_currencies(self): currencies = [(c['code'], '{0[code]} ({0[name]})'.format(c)) for c in payment_settings.get('currencies')] self.currency.choices = sorted(currencies, key=lambda x: x[1].lower()) def validate_currency(self, field): if field.data not in {c['code'] for c in self.currencies.data}: raise ValidationError('Please select a different currency.')
class PluginSettingsForm(IndicoForm): managers = PrincipalListField(_('Managers'), groups=True, description=_('List of users who can manage recording/webcast requests.')) notification_emails = EmailListField(_('Notification email addresses'), description=_('Notifications about recording/webcast requests are sent to ' 'these email addresses (one per line).')) notification_reply_email = StringField(_('E-mail notification "reply" address'), [IndicoEmail()], description=_('Notifications that are sent to event managers will use ' 'this address in their "Reply-To:" fields.')) webcast_audiences = MultipleItemsField(_('Webcast Audiences'), fields=[{'id': 'audience', 'caption': _('Audience'), 'required': True}], unique_field='audience', description=_('List of audiences for non-public webcasts.')) webcast_ping_url = URLField(_('Webcast Ping URL'), description=_("A ping is sent via HTTP GET to this URL whenever a webcast request " "enters/leaves the 'accepted' state.")) webcast_url = URLField(_('Webcast URL'), [DataRequired()], description=_("The URL to watch the webcast for an event. Can contain {event_id} which " "will be replaced with the ID of the event.")) agreement_paper_url = URLField(_('Agreement Paper URL'), description=_("The URL to the agreement that can be printed and signed offline.")) recording_cds_url = URLField(_('CDS URL'), description=_("The URL used when creating recording links. Must contain the {cds_id} " "placeholder.")) room_feature = QuerySelectField(_("Room feature"), [DataRequired()], allow_blank=True, query_factory=lambda: RoomFeature.query, get_label='title', description=_("The feature indicating that a room supports webcast/recording.")) def validate_recording_cds_url(self, field): if field.data and '{cds_id}' not in field.data: raise ValidationError('{cds_id} placeholder is missing')
class PluginSettingsForm(IndicoForm): adams_url = URLField(_('ADaMS URL'), [DataRequired()], description=_('The URL of the ADaMS REST API')) username = StringField(_('Username'), [DataRequired()], description=_('The login used to authenticate with ADaMS service')) password = IndicoPasswordField(_('Password'), [DataRequired()], description=_('The password used to authenticate with ADaMS service')) secret_key = IndicoPasswordField(_('Secret key'), [DataRequired()], description=_('Secret key to sign ADaMS requests')) authorized_users = PrincipalListField(_('Authorized users'), allow_groups=True, description=_('List of users/groups who can send requests')) excluded_categories = MultipleItemsField('Excluded categories', fields=[{'id': 'id', 'caption': 'Category ID'}]) access_ticket_template = QuerySelectField(_("Access ticket template"), allow_blank=True, blank_text=_("No access ticket selected"), get_label='title', description=_("Ticket template allowing access to CERN")) earliest_start_dt = IndicoDateTimeField(_("Earliest start date"), [Optional()], default_time=time(0, 0), description=_("The earliest date an event can start to qualify for CERN " "access badges")) delete_personal_data_after = TimeDeltaField(_('Delete personal data'), [DataRequired()], units=('days',), description=_('Personal data will be deleted once the event has ' 'finished and the duration specified here has been ' 'exceeded. Once the data has been deleted, access badges ' 'will not be accessible anymore.')) api_username = StringField(_('Username'), [DataRequired()], description=_('The username to access the API')) api_password = IndicoPasswordField(_('Password'), [DataRequired()], toggle=True, description=_('The password to access the API')) def __init__(self, *args, **kwargs): super(PluginSettingsForm, self).__init__(*args, **kwargs) self.access_ticket_template.query = (DesignerTemplate.query .filter(DesignerTemplate.category_id == 0, DesignerTemplate.type == TemplateType.badge) .order_by(db.func.lower(DesignerTemplate.title)))
class AdminSettingsForm(IndicoForm): currencies = MultipleItemsField( _('Currencies'), [DataRequired()], fields=(('code', _('Code')), ('name', _('Name'))), unique_field='code', description= _("List of currencies that can be selected for an event. When deleting " "a currency, existing events will keep using it. The currency code " "must be a valid <a href='{0}'>ISO-4217</a> code such " "as 'EUR' or 'CHF'.").format(CURRENCY_CODE_LINK)) currency = SelectField( _('Currency'), [DataRequired()], description=_( 'The default currency for new events. If you add a new currency, you need to ' 'save the settings first for it to show up here.')) conditions = TextAreaField(_('Conditions'), description=CONDITIONS_DESC) checkout_session_timeout = IntegerField( 'Checkout session timeout', validators=[DataRequired(), NumberRange(min=0)], description=CHECKOUT_SESSION_TIMEOUT_MSG) def __init__(self, *args, **kwargs): super(AdminSettingsForm, self).__init__(*args, **kwargs) self._set_currencies() def _set_currencies(self): currencies = [(c['code'], '{0[code]} ({0[name]})'.format(c)) for c in settings.get('currencies')] self.currency.choices = sorted(currencies, key=lambda x: x[1].lower()) def validate_currency(self, field): if field.data not in {c['code'] for c in self.currencies.data}: raise ValidationError('Please select a different currency.')
class SettingsForm(IndicoForm): footer_links = MultipleItemsField( _('Footer Links'), fields=[{ 'id': 'name', 'caption': _('Name'), 'required': True, 'coerce': custom_string_validation }, { 'id': 'link', 'caption': _('Link'), 'required': True, 'coerce': custom_string_validation }, { 'id': 'target', 'caption': _('Target'), 'type': 'select', 'required': True }], description=_("Add further links to be added to the footer of Indico"), sortable=True, choices={'target': { '_self': _('_self'), '_blank': _('_blank') }})
class PluginSettingsForm(PaymentPluginSettingsFormBase): authorized_users = PrincipalListField( _('Authorized users'), allow_groups=True, description=_( 'List of users/groups who are authorized to configure the CERN ' 'Payment module for any event.')) fp_email_address = EmailField( _('FP email adress'), [DataRequired()], description=_('Email address to contact FP.')) fp_department_name = StringField(_('FP department name'), [DataRequired()]) payment_url = URLField(_('Payment URL'), [DataRequired()], description=_('URL used for the epayment')) shop_id_chf = StringField(_('Shop ID (CHF)'), [DataRequired()]) shop_id_eur = StringField(_('Shop ID (EUR)'), [DataRequired()]) hash_seed_chf = StringField(_('Hash seed (CHF)'), [DataRequired()]) hash_seed_eur = StringField(_('Hash seed (EUR)'), [DataRequired()]) hash_seed_out_chf = StringField(_('Hash seed out (CHF)'), [DataRequired()]) hash_seed_out_eur = StringField(_('Hash seed out (EUR)'), [DataRequired()]) server_url_suffix = StringField( _('Server URL Suffix'), description='Server URL Suffix (indico[suffix].cern.ch)') order_id_prefix = StringField(_('Order ID Prefix')) payment_methods = MultipleItemsField(_('Payment Methods'), fields=PAYMENT_METHODS_FIELDS, unique_field='name')
class SettingsForm(IndicoForm): queue_entry_ttl = IntegerField( _('Queue entry TTL'), [NumberRange(min=0)], description= _("How many days should processed entries be kept in the queue. " "The time counts from the creation of the queue entries, so if the " "LiveSync task is not running for some time, queue entries may be " "deleted during the next run after processing them. Setting it to 0 " "disables automatic deletion.")) excluded_categories = MultipleItemsField( _('Excluded categories'), fields=[{ 'id': 'id', 'caption': _("Category ID"), 'required': True }], description=_( "Changes to objects inside these categories or any of their " "subcategories are excluded.")) disable_queue_runs = BooleanField( _('Disable queue runs'), widget=SwitchWidget(), description=_('Disable all scheduled queue runs.')) skip_category_changes = BooleanField( _('Skip category changes'), widget=SwitchWidget(), description=_( 'Skip category changes when processing the queue. This can be ' 'useful in large instances when there are significant changes ' 'to large categories in order to avoid processing those ' 'immediately.'))
class SettingsForm(IndicoForm): admin_principals = PrincipalListField(_('Administrators'), groups=True) authorized_principals = PrincipalListField(_('Authorized users/groups'), groups=True) excluded_categories = MultipleItemsField( _('Excluded categories'), fields=[{ 'id': 'id', 'caption': 'Category ID' }], description=_( 'Disable quick-book on event creation in these categories')) assistance_emails = EmailListField( _('Assistance email addresses (one per line)')) notification_before_days = IntegerField( _('Send booking reminders X days before (single/daily)'), [InputRequired(), NumberRange(min=1, max=30)]) notification_before_days_weekly = IntegerField( _('Send booking reminders X days before (weekly)'), [InputRequired(), NumberRange(min=1, max=30)]) notification_before_days_monthly = IntegerField( _('Send booking reminders X days before (monthly)'), [InputRequired(), NumberRange(min=1, max=30)]) notifications_enabled = BooleanField(_('Reminders enabled')) vc_support_emails = EmailListField( _('Videoconference support email addresses (one per line)')) booking_limit = IntegerField( _('Maximum length of booking (days)'), [InputRequired(), NumberRange(min=1)]) google_maps_api_key = StringField(_('Google Maps API key'), description=GOOGLE_API_KEY_DESC)
class PluginSettingsForm(IndicoForm): managers = PrincipalListField(_('Managers'), groups=True, description=_('List of users who can manage recording/webcast requests.')) notification_emails = EmailListField(_('Notification email addresses'), description=_('Notifications about recording/webcast requests are sent to ' 'these email addresses (one per line).')) webcast_audiences = MultipleItemsField(_('Webcast Audiences'), fields=[{'id': 'audience', 'caption': _('Audience'), 'required': True}], unique_field='audience', description=_('List of audiences for non-public webcasts.')) webcast_ping_url = URLField(_('Webcast Ping URL'), description=_("A ping is sent via HTTP GET to this URL whenever a webcast request " "enters/leaves the 'accepted' state.")) webcast_url = URLField(_('Webcast URL'), [DataRequired()], description=_("The URL to watch the webcast for an event. Can contain {event_id} which " "will be replaced with the ID of the event.")) agreement_paper_url = URLField(_('Agreement Paper URL'), description=_("The URL to the agreement that can be printed and signed offline.")) recording_cds_url = URLField(_('CDS URL'), description=_("The URL used when creating recording links. Must contain the {cds_id} " "placeholder.")) def validate_recording_cds_url(self, field): if field.data and '{cds_id}' not in field.data: raise ValidationError('{cds_id} placeholder is missing')
class SettingsForm(IndicoForm): _fieldsets = [('Seminar emails', ['seminar_categories', 'seminar_recipients'])] seminar_categories = MultipleItemsField('Seminar categories', fields=[{ 'id': 'id', 'caption': 'Category ID', 'required': True }]) seminar_recipients = EmailListField('Recipients')
class SettingsForm(IndicoForm): admins = PrincipalListField( _('Administrators'), groups=True, description=_( 'List of users/groups who can manage chatrooms for all events')) server = StringField(_('XMPP server'), [DataRequired()], description=_('The hostname of the XMPP server')) muc_server = StringField( _('XMPP MUC server'), [DataRequired()], description=_("The hostname of the XMPP MUC server")) bot_jid = StringField( _('Bot JID'), [DataRequired()], description=_( "Jabber ID of the XMPP bot. Can be just a username (in that case the default " "server is assumed) or a username@server.")) bot_password = IndicoPasswordField(_('Bot Password'), [DataRequired()], toggle=True, description=_("Password for the bot")) notify_emails = EmailListField( _('Notification emails'), description=_( "Email addresses to sent notifications to (one per line)")) log_url = URLField( _('Log URL'), description=_( 'You can set this to the URL of the ' '<a href="https://github.com/indico/jabber-logs/">jabber-logs ' 'app</a>, running on the jabber server to let event managers can ' 'retrieve chat logs for rooms on that server.')) chat_links = MultipleItemsField( _('Chatroom links'), fields=[{ 'id': 'title', 'caption': _("Title"), 'required': True }, { 'id': 'link', 'caption': _("Link"), 'required': True }], description=_( "Links to join the chatroom. You can use the placeholders {room} for " "the room name and {server} for the MUC server.")) how_to_connect = TextAreaField( _('How to connect'), widget=CKEditorWidget(), description=_("Text shown below the chatrooms on an event page")) def validate_chat_links(self, field): for item in field.data: if not all(item.values()): raise ValidationError(_('All fields must contain a value.'))
class SettingsForm(IndicoForm): queue_entry_ttl = IntegerField( _('Queue entry TTL'), [NumberRange(min=0)], description= _("How many days should processed entries be kept in the queue. " "The time counts from the creation of the queue entries, so if the " "LiveSync task is not running for some time, queue entries may be " "deleted during the next run after processing them. Setting it to 0 " "disables automatic deletion.")) excluded_categories = MultipleItemsField( _('Excluded categories'), fields=[{ 'id': 'id', 'caption': _("Category ID"), 'required': True }], description=_( "Changes to objects inside these categories or any of their " "subcategories are excluded."))