Beispiel #1
0
    def get_jsonschema_for_talk_proposal(self, schema):
        fieldsets = utils.get_fieldsets(self.context, self.request, schema)
        schema_fieldsets = utils.get_fieldset_infos(fieldsets)
        # Build JSON schema properties
        properties = utils.get_jsonschema_properties(self.context,
                                                     self.request, fieldsets)
        properties['image'] = {
            "type": "string",
            "format": "data-url",
            "title": _("Image"),
            "description": _("Add your profile image here."),
        }
        # add image before privacy
        schema_fieldsets[0]['fields'].insert(
            len(schema_fieldsets[0]['fields']) - 1, 'image')
        # Determine required fields
        required = []
        for field in utils.iter_fields(fieldsets):
            if field.field.required:
                required.append(field.field.getName())

        # Include field modes
        for field in utils.iter_fields(fieldsets):
            if field.mode:
                properties[field.field.getName()]['mode'] = field.mode

        return {
            'type': 'object',
            'properties': properties,
            'required': required,
            'fieldsets': schema_fieldsets,
        }
class IScheduledTalk(model.Schema):
    """ Marker interface and Dexterity Python Schema for Person
    """

    title = schema.TextLine(
        title=_('Title'),
        description=_(
            u'If you don\'t set a title, will be used the talk title.'),
        required=False,
    )

    room = schema.Choice(
        title=_('Room'),
        description=u'',
        required=True,
        vocabulary='ploneconf.vocabularies.Rooms',
    )

    talk = RelationChoice(
        title=u'Related talk',
        vocabulary='plone.app.vocabularies.Catalog',
        required=True,
    )

    form.widget(
        'talk',
        RelatedItemsFieldWidget,
        vocabulary='plone.app.vocabularies.Catalog',
        pattern_options={
            'selectableTypes': ['Talk'],
            'basePath': '/talks'
        },
    )
Beispiel #3
0
class IPerson(model.Schema):
    """ Marker interface and Dexterity Python Schema for Person
    """

    # bio = RichTextField(title=_(u'Bio'), description=u'', required=False)
    # directives.widget('bio', RichTextFieldWidget)
    title = schema.TextLine(title=_('Name'), description=u'', required=True)
    bio = schema.Text(
        title=_('Bio'),
        description=u'Tell us some informations about you.',
        required=True,
    )

    twitter = schema.TextLine(
        title=_('Twitter account'),
        description=_(u'Insert your Twitter account name.'),
        required=False,
    )

    github = schema.TextLine(
        title=_('Github account'),
        description=_(u'Insert your Github account name.'),
        required=False,
    )
    email = Email(
        title=_('Email'), description=_(u'Insert your email.'), required=False
    )
Beispiel #4
0
class IPloneconfPolicySettings(Interface):
    """
    """

    conference_rooms = schema.List(
        title=_(u'Conference rooms'),
        default=[],
        missing_value=[],
        value_type=schema.TextLine(),
    )
Beispiel #5
0
    def serialize_form(self):
        json_schema = self.get_jsonschema()
        json_data = {}

        # JSON schema
        return {
            '@id': '{}/contact-form'.format(self.context.portal_url()),
            'title': _('Contact form'),
            'schema': json_schema,
            'data': json_data,
        }
Beispiel #6
0
    def serialize_form(self):
        schema = ITalkProposalSchema
        json_schema = self.get_jsonschema_for_talk_proposal(schema=schema)
        json_data = {}

        # JSON schema
        return {
            '@id': '{}/talk-proposal'.format(self.context.portal_url()),
            'title': _('Talk proposal'),
            'schema': json_schema,
            'data': json_data,
        }
class ITalkProposalSchema(ITalk):
    """
    """

    name = schema.TextLine(title=_('Your name'),
                           description=u'',
                           required=True)
    email = schema.TextLine(title=_('Email'),
                            description=_(u'Insert your email.'),
                            required=True)

    bio = schema.Text(title=_('Bio'), description=u'', required=False)

    twitter = schema.TextLine(
        title=_('Twitter account'),
        description=_(u'Insert your Twitter account name.'),
        required=False,
    )

    github = schema.TextLine(
        title=_('Github account'),
        description=_(u'Insert your Github account name.'),
        required=False,
    )

    privacy = schema.Bool(
        title=_(u'label_privacy', default=u'Terms and conditions'),
        description=u'We want you to know exactly how our service works and '
        u'why we need your registration details. Please state that you have '
        u'read and agreed to these terms before you continue.',
        required=True,
    )

    directives.mode(slides_url='hidden')
    directives.mode(slides_embed='hidden')
    directives.mode(video_embed='hidden')
    directives.mode(room='hidden')
    directives.mode(start='hidden')
    directives.mode(end='hidden')
    directives.mode(is_keynote='hidden')
Beispiel #8
0
class ITalk(model.Schema):
    """ Marker interface and Dexterity Python Schema for Talk
    """

    title = schema.TextLine(
        title=_('Talk'), description=u'Title of talk.', required=True
    )
    description = schema.Text(
        title=_('Description'),
        description=u'Please provide a description of your talk. This text '
        u'will be shown in talks overview and details, so try to arouse '
        u'curiosity of attendants.',
        required=True,
    )

    text = RichTextField(
        title=_(u'Formatted description'),
        description=u'Used to better format the description (for presentation purposes).',
        required=False,
    )
    directives.widget('text', RichTextFieldWidget)

    duration = schema.Choice(
        title=_('Duration'),
        description=u'Choose the talk length. Short will be 20 minutes and '
        u'Long will be 40 minutes. Remember that a short talk doesn\'t mean '
        u'it\'s a worst talk.',
        required=True,
        source=PRESENTATION_DURATION_TYPES,
    )

    level = schema.Choice(
        title=_('Level'),
        description=u'What should be the technical level needed to understand'
        u'this talk? This is useful for people to choose what talks to attend '
        u'or not based on their skills.',
        required=True,
        source=LEVEL_TYPES,
    )
    audience = schema.List(
        title=_('Audience'),
        description=u'What kind of people should be interested listening this'
        u' talk?',
        required=True,
        value_type=schema.Choice(source=AUDIENCE_TYPES),
    )
    topic = schema.List(
        title=_('Topic'),
        description=u'Choose one or more topics related to your talk.'
        u'This will help us to create a better talks schedule.',
        required=True,
        value_type=schema.Choice(source=TALK_TOPICS),
    )
    directives.widget('topic', CheckBoxFieldWidget)

    other_topics = schema.TextLine(
        title=_('Other topics'),
        description=_(
            u'If you selected "Other", please insert your topics here.'
        ),
        required=False,
    )
    slides_url = schema.TextLine(
        title=_('Slides'), description=_(u'Url of slides.'), required=False
    )
    slides_embed = schema.Text(
        title=_('Embed code for slides'), description=u'', required=False
    )

    video_embed = schema.Text(
        title=_('Video embed code'),
        description=_('Embed code for video recording.'),
        required=False,
    )

    room = schema.Choice(
        title=_('Room'),
        description=u'',
        required=False,
        vocabulary='ploneconf.vocabularies.Rooms',
    )

    start = schema.Datetime(title=u'Start', required=False)
    directives.widget(
        'start',
        DatetimeFieldWidget,
        default_timezone=default_timezone,
        klass=u'event_start',
    )

    end = schema.Datetime(title=u'End', required=False)
    directives.widget(
        'end',
        DatetimeFieldWidget,
        default_timezone=default_timezone,
        klass=u'event_end',
    )

    is_keynote = schema.Bool(title=u'Is keynote', required=False)
class PloneconfControlpanel(controlpanel.RegistryEditForm):
    schema = IPloneconfPolicySettings
    id = u'PloneconfControlpanel'
    label = _(u'Ploneconf Controlpanel')
Beispiel #10
0
class ITraining(model.Schema):
    """ Marker interface and Dexterity Python Schema for Training
    """

    duration = schema.Choice(
        title=_('Duration'),
        description=u'',
        required=True,
        source=TRAINING_CLASS_DURATION_TYPES,
    )

    level = schema.Choice(title=_('Level'),
                          description=u'',
                          required=True,
                          source=LEVEL_TYPES)
    audience = schema.Set(
        title=_('Audience'),
        description=u'',
        required=True,
        value_type=schema.Choice(source=AUDIENCE_TYPES),
    )
    room = schema.Choice(
        title=_('Room'),
        description=u'',
        required=True,
        source=TRAINING_CLASS_ROOMS,
    )
    start = schema.Datetime(title=u'Start', required=False)
    directives.widget(
        'start',
        DatetimeFieldWidget,
        default_timezone=default_timezone,
        klass=u'event_start',
    )

    end = schema.Datetime(title=u'End', required=False)
    directives.widget(
        'end',
        DatetimeFieldWidget,
        default_timezone=default_timezone,
        klass=u'event_end',
    )
    docs_link = schema.TextLine(
        title=_('Documentation link'),
        description=u'Insert a link to an online documentation.',
        required=False,
    )

    what_learn = RichTextField(title=_(u'What you will learn'),
                               description=u'',
                               required=False)
    directives.widget('what_learn', RichTextFieldWidget)

    prerequisites = RichTextField(title=_(u'Prerequisites'),
                                  description=u'',
                                  required=False)
    directives.widget('prerequisites', RichTextFieldWidget)

    things_to_bring = RichTextField(title=_(u'Things to bring'),
                                    description=u'',
                                    required=False)
    directives.widget('things_to_bring', RichTextFieldWidget)