Ejemplo n.º 1
0
class IRemarkable(Interface):
    # Interface that defines a datagrid row.
    content = schema.Choice(
        title=_(u"Content"),
        source=UUIDSourceBinder(),
        required=True)

    remark = schema.TextLine(
        title=_(u'Remark'), required=True)
Ejemplo n.º 2
0
class IPresenterInfo(Interface):
    # Interface that defines a datagrid row.
    presenter = schema.Choice(
        title=_(u"Presenter"),
        source=UUIDSourceBinder(),
        required=True)

    question = schema.TextLine(
        title=_(u'Question'), required=True)
Ejemplo n.º 3
0
class IProgram(Interface):

    title = schema.TextLine(
        title=_(u'Title'),
        required=True,
    )

    description = schema.Text(
        title=_(u'Description'),
        required=False,
    )
Ejemplo n.º 4
0
class ISimplifiedAttendee(form.Schema):
    """A simplified conference attendee.
    """

    title = schema.TextLine(
        title=_(u"Full name"),
        )
Ejemplo n.º 5
0
class ISession(model.Schema):
    """A conference session. Sessions are managed inside Programs.
    """

    title = schema.TextLine(
        title=_(u"Title"),
        description=_(u"Session title"),
    )

    description = schema.Text(
        title=_(u"Session summary"),
    )

    model.primary('details')
    details = RichText(
        title=_(u"Session details"),
        required=False
    )

    # use an autocomplete selection widget instead of the default content tree
    form.widget(presenter=AutocompleteFieldWidget)
    presenter = RelationChoice(
        title=_(u"Presenter"),
        source=ObjPathSourceBinder(
            object_provides=IPresenter.__identifier__),
        required=False,
    )

    dexterity.write_permission(track='example.conference.ModifyTrack')
    track = schema.Choice(
        title=_(u"Track"),
        source=possibleTracks,
        required=False,
    )
Ejemplo n.º 6
0
class IProgram(model.Schema):
    """A conference program. Programs can contain Sessions.
    """

    title = schema.TextLine(title=_(u"Program name"), )

    description = schema.Text(title=_(u"Program summary"), )

    start = schema.Datetime(
        title=_(u"Start date"),
        required=False,
    )

    end = schema.Datetime(
        title=_(u"End date"),
        required=False,
    )

    form.primary('details')
    details = RichText(
        title=_(u"Details"),
        description=_(u"Details about the program"),
        required=False,
    )

    form.widget(organizer=AutocompleteFieldWidget)
    organizer = schema.Choice(
        title=_(u"Organiser"),
        vocabulary=u"plone.principalsource.Users",
        required=False,
    )

    form.widget(tracks=TextLinesFieldWidget)
    tracks = schema.List(
        title=_(u"Tracks"),
        required=True,
        default=[],
        value_type=schema.TextLine(),
    )

    @invariant
    def validateStartEnd(data):
        if data.start is not None and data.end is not None:
            if data.start > data.end:
                raise StartBeforeEnd(
                    _(u"The start date must be before the end date."))
Ejemplo n.º 7
0
 def validateStartEnd(data):
     if data.start is not None and data.end is not None:
         if data.start > data.end:
             raise StartBeforeEnd(_(
                 u"The start date must be before the end date."))
Ejemplo n.º 8
0
 def validateStartEnd(data):
     if data.start is not None and data.end is not None:
         if data.start > data.end:
             raise StartBeforeEnd(
                 _(u"The start date must be before the end date."))
Ejemplo n.º 9
0
class StartBeforeEnd(Invalid):
    __doc__ = _(u"The start or end date is invalid")
Ejemplo n.º 10
0
class IAttendee(model.Schema):
    """A conference attendee.
    """

    title = schema.TextLine(
        title=_(u"Full name"),
    )

    # Simple choice based on uuid.
    form.widget(program=ContentTreeFieldWidget)
    program = schema.Choice(
        title=_(u"Chosen Program"),
        source=UUIDSourceBinder(portal_type='example.conference.program'),
        required=False,
        )

    # Multiple choice.
    form.widget(sessions=MultiContentTreeFieldWidget)
    sessions = schema.List(
        title=_(u"Sessions you wish to attend"),
        value_type=schema.Choice(
            title=_(u"Selection"),
            source=UUIDSourceBinder(portal_type='example.conference.session')),
        required=False,
        )

    # Data grid
    if DataGridFieldFactory is not None:
        form.widget(presenters=DataGridFieldFactory)
    presenters = schema.List(
        title=_(u'Questions for presenters'),
        description=_(u"Write down a question for a presenter."),
        value_type=DictRow(title=_(u'Presenters'), schema=IPresenterInfo),
        required=False,
       )

    # Another data grid, this time we will put it in a fieldset.
    form.fieldset('remarks', label=_(u"Remarks"), fields=['remarkables'])
    if DataGridFieldFactory is not None:
        form.widget(remarkables=DataGridFieldFactory)
    remarkables = schema.List(
        title=_(u'Remarkable content'),
        description=_(u"Select a remarkable piece of content on this site "
                      u"and add a remark about it. Fine for reporting "
                      u"typos as well."),
        value_type=DictRow(title=_(u'Remarkable'), schema=IRemarkable),
        required=False,
        )