Пример #1
0
class ReferenceTypeForm(IndicoForm):
    name = StringField(_('Name'), [DataRequired()],
                       description=_('The name of the external ID type'))
    url_template = URLField(
        _('URL template'),
        description=_(
            "The URL template must contain the '{value}' placeholder."))
    scheme = StringField(
        _('Scheme'),
        filters=[lambda x: x.rstrip(':') if x else x],
        description=_('The scheme/protocol of the external ID type'))

    def __init__(self, *args, **kwargs):
        self.reference_type = kwargs.pop('reference_type', None)
        super().__init__(*args, **kwargs)

    def validate_name(self, field):
        query = ReferenceType.query.filter(
            db.func.lower(ReferenceType.name) == field.data.lower())
        if self.reference_type:
            query = query.filter(ReferenceType.id != self.reference_type.id)
        if query.count():
            raise ValidationError(_('This name is already in use.'))

    def validate_url_template(self, field):
        if field.data and '{value}' not in field.data:
            raise ValidationError(
                _("The URL template must contain the placeholder '{value}'."))
Пример #2
0
class PluginSettingsForm(PaymentPluginSettingsFormBase):
    url = URLField(_('API URL'), [DataRequired()],
                   description=_('URL of the PayPal HTTP API.'))
    business = StringField(
        _('Business'), [Optional(), validate_business],
        description=_(
            'The default PayPal ID or email address associated with a PayPal account. '
            'Event managers will be able to override this.'))
Пример #3
0
class SettingsForm(IndicoForm):
    api_key = StringField(
        _('API key'), [DataRequired()],
        description=_('The API key to access the <tt>ursh</tt> service'))
    api_host = URLField(
        _('API host'), [DataRequired()],
        description=
        _('The <tt>ursh</tt> API host, providing the interface to generate short URLs'
          ))
Пример #4
0
class LegalMessagesForm(IndicoForm):
    network_protected_disclaimer = TextAreaField(
        _('Network-protected information disclaimer'), widget=CKEditorWidget())
    restricted_disclaimer = TextAreaField(
        _('Restricted information disclaimer'), widget=CKEditorWidget())
    tos_url = URLField(
        _('URL'), [Optional(), URL()],
        description=_('The URL to an external page with terms and conditions'))
    tos = TextAreaField(_('Text'),
                        widget=CKEditorWidget(),
                        description=_('Only used if no URL is provided'))
    privacy_policy_url = URLField(
        _('URL'), [Optional(), URL()],
        description=_('The URL to an external page with the privacy policy'))
    privacy_policy = TextAreaField(
        _('Text'),
        widget=CKEditorWidget(),
        description=_('Only used if no URL is provided'))
Пример #5
0
class EventLocationForm(IndicoForm):
    location_data = IndicoLocationField(_('Location'),
                                        allow_location_inheritance=False)
    own_map_url = URLField(_('Map URL'), [Optional(), URL()])

    def __init__(self, *args, **kwargs):
        event = kwargs['event']
        super().__init__(*args, **kwargs)
        if event.room:
            self.own_map_url.render_kw = {'placeholder': event.room.map_url}
Пример #6
0
 class F(Form):
     search = SearchField()
     telephone = TelField()
     url = URLField()
     email = EmailField()
     datetime = DateTimeField()
     date = DateField()
     dt_local = DateTimeLocalField()
     integer = IntegerField()
     decimal = DecimalField()
     int_range = IntegerRangeField()
     decimal_range = DecimalRangeField()
Пример #7
0
class PluginSettingsForm(PaymentPluginSettingsFormBase):
    """Configuration form for the Plugin across all events."""

    url = URLField(
        label=_('API URL'),
        validators=[DataRequired()],
        description=_('URL to contact the Saferpay JSON API'),
    )
    username = StringField(
        label=_('API username'),
        validators=[DataRequired()],
        description=_('The username to access the SaferPay JSON API'))
    password = IndicoPasswordField(
        label=_('API password'),
        validators=[DataRequired()],
        description=_('The password to access the SaferPay JSON API'),
        toggle=True,
    )
    account_id = StringField(
        label=_('Account ID'),
        validators=[Optional(), IndicoRegexp(r'^[0-9-]{0,15}$')],
        description=_(
            'Default Saferpay account ID, such as "123456-12345678". '
            'Event managers will be able to override this.'))
    order_description = StringField(
        label=_('Order Description'),
        validators=[DataRequired(), FormatField(max_length=80)],
        description=_(
            'The default description of each order in a human readable way. '
            'It is presented to the registrant during the transaction with Saferpay. '
            'Event managers will be able to override this. '
            'Supported placeholders: {}').format(', '.join(
                f'{{{p}}}' for p in FormatField.default_field_map)))
    order_identifier = StringField(
        label=_('Order Identifier'),
        validators=[DataRequired(),
                    FormatField(max_length=80, id_safe=True)],
        description=_(
            'The default identifier of each order for further processing. '
            'Event managers will be able to override this. '
            'Supported placeholders: {}').format(', '.join(
                f'{{{p}}}' for p in FormatField.id_safe_field_map)))
    notification_mail = StringField(
        label=_('Notification Email'),
        validators=[Optional(), Email(), Length(0, 50)],
        description=_(
            'Email address to receive notifications of transactions. '
            "This is independent of Indico's own payment notifications. "
            'Event managers will be able to override this.'))
Пример #8
0
class CitadelSettingsForm(IndicoForm):
    search_backend_url = URLField(
        _('Citadel URL'),
        [DataRequired(), URL(require_tld=False)],
        description=_('The URL of the Citadel server'))
    search_backend_token = IndicoPasswordField(
        _('Citadel API token'), [DataRequired()],
        toggle=True,
        description=_('The authentication token to access Citadel'))
    file_extensions = TextListField(
        _('File extensions'),
        description=_('File extensions to upload for full-text search'))
    max_file_size = IntegerField(
        _('Max. file size'),
        [DataRequired(), NumberRange(min=1)],
        description=
        _('Maximum size (in MB) to upload for full-text search. Note that '
          'increasing this after the initial export will upload all files '
          'for indexing that have not been uploaded before during the next queue '
          'run, which may take a long time on larger instances. You may want '
          'to run a manual upload for the new file size first!'))
    num_threads_records = IntegerField(
        _('Parallel threads (records)'), [NumberRange(min=1, max=500)],
        description=_('Number of threads to use when uploading records.'))
    num_threads_records_initial = IntegerField(
        _('Parallel threads (records, initial export)'),
        [NumberRange(min=1, max=500)],
        description=_('Number of threads to use when uploading records during '
                      'the initial export.'))
    num_threads_files = IntegerField(
        _('Parallel threads (files)'), [NumberRange(min=1, max=500)],
        description=_('Number of threads to use when uploading files.'))
    num_threads_files_initial = IntegerField(
        _('Parallel threads (files, initial export)'),
        [NumberRange(min=1, max=500)],
        description=_('Number of threads to use when uploading files during '
                      'the initial export.'))
    disable_search = BooleanField(
        _('Disable search'),
        widget=SwitchWidget(),
        description=
        _('This disables the search integration of the plugin. When this option '
          'is used, the internal Indico search interface will be used. This may '
          'be useful when you are still running a larger initial export and do '
          'not want people to get incomplete search results during that time.'
          ))
Пример #9
0
class SubmissionForm(FlaskForm):
    """
    Create a submission.
    """

    project_name = StringField("Name", [InputRequired("Please enter a name.")])
    project_description = TextAreaField("Description", [validators.Optional()])
    project_website = URLField(
        "Website", [InputRequired("Please enter a Website."),
                    url()])
    licenses = SelectMultipleField("Licenses",
                                   [InputRequired("Please choose a license")],
                                   coerce=int)
    submit = SubmitField("Submit")

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.licenses.choices = [(license.id, license.name)
                                 for license in License.query.all()]
Пример #10
0
class AttachmentLinkFormMixin:
    title = StringField(_('Title'), [DataRequired()])
    link_url = URLField(_('URL'), [DataRequired()])
Пример #11
0
class ImportSourceEventForm(IndicoForm):
    source_event_url = URLField(_('Event URL'), [DataRequired(), URL()])
Пример #12
0
class PluginSettingsForm(VCPluginSettingsFormBase):
    _fieldsets = [
        (_('API Credentials'), ['api_key', 'api_secret', 'webhook_token']),
        (_('Zoom Account'), [
            'user_lookup_mode', 'email_domains', 'authenticators',
            'enterprise_domain', 'allow_webinars', 'phone_link'
        ]),
        (_('Room Settings'), [
            'mute_audio', 'mute_host_video', 'mute_participant_video',
            'join_before_host', 'waiting_room'
        ]),
        (_('Notifications'),
         ['creation_email_footer', 'send_host_url', 'notification_emails']),
        (_('Access'), ['managers', 'acl'])
    ]

    api_key = StringField(_('API Key'), [DataRequired()])

    api_secret = IndicoPasswordField(_('API Secret'), [DataRequired()],
                                     toggle=True)

    webhook_token = IndicoPasswordField(
        _('Webhook Token'),
        toggle=True,
        description=_("Specify Zoom's webhook token if you want live updates"))

    user_lookup_mode = IndicoEnumSelectField(
        _('User lookup mode'), [DataRequired()],
        enum=UserLookupMode,
        description=_('Specify how Indico should look up the zoom user that '
                      'corresponds to an Indico user.'))

    email_domains = TextListField(
        _('E-mail domains'), [
            HiddenUnless('user_lookup_mode', UserLookupMode.email_domains),
            DataRequired()
        ],
        description=
        _('List of e-mail domains which can use the Zoom API. Indico attempts '
          'to find Zoom accounts using all email addresses of a user which use '
          'those domains.'))

    authenticators = TextListField(
        _('Indico identity providers'), [
            HiddenUnless('user_lookup_mode', UserLookupMode.authenticators),
            DataRequired()
        ],
        description=
        _('Identity providers from which to get usernames. '
          'Indico queries those providers using the email addresses of the user '
          'and attempts to find Zoom accounts having an email address with the '
          'format username@enterprise-domain.'))

    enterprise_domain = StringField(
        _('Enterprise domain'), [
            HiddenUnless('user_lookup_mode', UserLookupMode.authenticators),
            DataRequired()
        ],
        description=_(
            'The domain name used together with the usernames from the Indico '
            'identity provider'))

    allow_webinars = BooleanField(
        _('Allow Webinars (Experimental)'),
        widget=SwitchWidget(),
        description=_(
            'Allow webinars to be created through Indico. Use at your own risk.'
        ))

    mute_audio = BooleanField(
        _('Mute audio'),
        widget=SwitchWidget(),
        description=_('Participants will join the VC room muted by default '))

    mute_host_video = BooleanField(
        _('Mute video (host)'),
        widget=SwitchWidget(),
        description=_('The host will join the VC room with video disabled'))

    mute_participant_video = BooleanField(
        _('Mute video (participants)'),
        widget=SwitchWidget(),
        description=_(
            'Participants will join the VC room with video disabled'))

    join_before_host = BooleanField(
        _('Join Before Host'),
        widget=SwitchWidget(),
        description=_(
            'Allow participants to join the meeting before the host starts the '
            'meeting. Only used for scheduled or recurring meetings.'))

    waiting_room = BooleanField(
        _('Waiting room'),
        widget=SwitchWidget(),
        description=_(
            'Participants may be kept in a waiting room by the host'))

    creation_email_footer = TextAreaField(
        _('Creation email footer'),
        widget=CKEditorWidget(),
        description=_(
            'Footer to append to emails sent upon creation of a VC room'))

    send_host_url = BooleanField(
        _('Send host URL'),
        widget=SwitchWidget(),
        description=_(
            'Whether to send an e-mail with the Host URL to the meeting host upon '
            'creation of a meeting'))

    phone_link = URLField(
        _('Join via phone'), [Optional(), URL()],
        description=_('Link to instructions on joining a meeting via phone'))

    def validate_authenticators(self, field):
        invalid = set(field.data) - set(multipass.identity_providers)
        if invalid:
            raise ValidationError(
                _('Invalid identity providers: {}').format(
                    escape(', '.join(invalid))))
Пример #13
0
class MenuLinkForm(MenuUserEntryFormBase):
    link_url = URLField(_('URL'), [DataRequired()])