예제 #1
0
class IFlowAttachment(model.Schema):
    """Flow submission attachment"""

    primary('file')
    file = NamedBlobFile(
        title=_(u'File'),
        required=False,
    )

    primary('image')
    image = NamedBlobImage(
        title=_(u'Image'),
        required=False,
    )
예제 #2
0
class IPerson(model.Schema):
    """Content schema
    """
    title = schema.TextLine(title=_(u'Display name'),
                            readonly=True,
                            required=False)

    first_name = schema.TextLine(title=_(u'First name'))

    last_name = schema.TextLine(title=_(u'Last name'))

    position = schema.TextLine(title=_(u'Title'),
                               missing_value=u'',
                               required=False)

    description = schema.Text(title=_(u'Description'),
                              missing_value=u'',
                              required=False)

    biography = RichText(title=_(u'Biography'), required=False)

    primary('image')
    image = NamedBlobImage(
        title=_(u'Image'),
        required=False,
    )
class IRoom(model.Schema):
    """A conference room.
    """
    
    title = schema.TextLine(
            title=_(u"Name of the Room"),
        )


    description = schema.Text(
            title=_(u"A description of the room and its location"),
        )

    
    picture = NamedBlobImage(
            title=_(u"A picture of the room"),
            description=_(u"Please upload an image"),
            required=False,
        )
    
    primary ('details')
    details = RichText(
             title=_(u"A full description of the room, it's location and the way to get there"),
             required=True,                          
        )
    
    capacity = schema.Int(
             title=_(u"Capacity of the room"),
             description=_(u"Please fill in the maximum number of attendees"),
             required=False,
        )
class ICallforpaper(model.Schema):
    """A call for paper for a conferences.
    A call for paper can contain incomming talks.
    """
    title = schema.TextLine(
        title=_(safe_unicode('Call for paper title')),
    )

    description = schema.Text(
        title=_(safe_unicode('Call for paper summary')),
        required=False,
    )

    primary('details')
    details = RichText(
        title=_(safe_unicode('Details')),
        description=_(safe_unicode('Details about the program')),
        required=True,
    )

    cfp_topics = schema.List(title=_(safe_unicode('Topics for the Call for Papers')),
                             description=_(
                                 safe_unicode('Fill in the topics for conference talks and workshops. '
                                              'Use a new line for every value / topic.')),
                             default=['Development',
                                      'Documentation',
                                      'Project-Administration'],
                             value_type=schema.TextLine(),
                             )
예제 #5
0
class INoticeImageSchema(model.Schema):

    primary('image')
    image = NamedBlobImage(
        title=_(u'label_image', default=u'Image'),
        required=True
    )
예제 #6
0
class IConferencebreak(model.Schema):
    title = schema.TextLine(
        title=_(safe_unicode('Title')),
        description=_(safe_unicode('Conference break title')),
    )

    description = schema.Text(
        title=_(safe_unicode('Conference break summary')),
        required=False,
    )

    primary('details')
    details = RichText(
        title=_(safe_unicode('Conference break details')),
        required=False,
    )

    write_permission(startitem='collective.conferences.ModifyTalktime')
    startitem = schema.Datetime(
        title=_(safe_unicode('Startdate')),
        description=_(safe_unicode('Start date')),
        defaultFactory=startDefaultValue,
        required=False,
    )

    write_permission(enditem='collective.conferences.ModifyTalktime')
    enditem = schema.Datetime(
        title=_(safe_unicode('Enddate')),
        description=_(safe_unicode('End date')),
        defaultFactory=endDefaultValue,
        required=False,
    )
    write_permission(twclength='collective.conferences.ModifyTalktime')
    directives.widget(twclength=RadioFieldWidget)
    twclength = schema.List(
        title=_(safe_unicode('Length')),
        value_type=schema.Choice(source='BreakLength'),
        required=True,
    )

    write_permission(conferencetrack='collective.conferences.ModifyTalktime')
    conferencetrack = RelationList(
        title=_(safe_unicode('Choose the track for this break')),
        default=[],
        value_type=RelationChoice(vocabulary='ConferenceTrack'),
        required=False,
        missing_value=[],
    )
    directives.widget(
        'conferencetrack',
        RadioFieldWidget,
    )

    positionintrack = schema.Int(
        title=_(safe_unicode('Position In The Track')),
        description=_(
            safe_unicode('Choose a number for the order in the track')),
        required=False,
    )
class IHTMLTile(Schema):

    ignore_querystring('content')
    primary('content')
    content = schema.Text(
        title=_(u'HTML'),
        required=True,
    )
예제 #8
0
class IRoomfolder(model.Schema):
    """A folder for the rooms of a conference.
    """

    title = schema.TextLine(title=_(u"Name of the room folder"), )

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

    primary('details')
    details = RichText(title=_(u"Information about the Conference Rooms"),
                       required=False)
예제 #9
0
class IDocumentFileSchema(model.Schema):

    directives.omitted('image')

    image = NamedBlobImage(title=_(u"label_image", u"Image"),
                           description=_("description_image",
                                         u"Document image representation"))

    primary("file")
    file = NamedBlobFile(title=_(u"label_file", u"File"),
                         description=_("description_file", u"Document file"),
                         required=True)
예제 #10
0
class IRoomfolder(model.Schema):
    """A folder for the rooms of a conference.
    """

    title = schema.TextLine(title=_(safe_unicode('Name of the room folder')), )

    description = schema.Text(title=_(
        safe_unicode('roomfolder description')), )

    primary('details')
    details = RichText(
        title=_(safe_unicode('Information about the Conference Rooms')),
        required=False,
    )
class IAttendeefolder(model.Schema):
    """A attendee folder. The attendee of the conference are created in the folder.
    """

    title = schema.TextLine(title=_(u"Name of the attendee folder"), )

    description = schema.Text(
        title=_(u"attendee folder description"),
        required=False,
    )

    primary('moreinformation')
    moreinformation = RichText(
        title=_(u"Information about registration process"), required=False)
예제 #12
0
class IRegistration(model.Schema):
    title = schema.TextLine(
        title=_(safe_unicode('Title of the Registration Page')),
    )

    description = schema.Text(
        title=_(safe_unicode('Registration Description')),
        required=False,
    )

    primary('moreinformation')
    moreinformation = RichText(
        title=_(safe_unicode('Information About The Registration Process')),
        required=False,
    )
예제 #13
0
class IProgram(model.Schema):
    """A conference program. Programs can contain Tracks.
    """

    title = schema.TextLine(title=_(safe_unicode('Program name')), )

    description = schema.Text(title=_(safe_unicode('Program summary')), )

    start = schema.Datetime(
        title=_(safe_unicode('Start date')),
        required=False,
        defaultFactory=startDefaultValue,
    )

    end = schema.Datetime(
        title=_(safe_unicode('End date')),
        required=False,
        defaultFactory=endDefaultValue,
    )

    primary('details')
    details = RichText(
        title=_(safe_unicode('Details')),
        description=_(safe_unicode('Details about the program')),
        required=False,
    )

    directives.widget(organizer=AjaxSelectFieldWidget)
    organizer = schema.Choice(
        title=_(safe_unicode('Organiser')),
        vocabulary=safe_unicode('plone.app.vocabularies.Users'),
        required=False,
    )

    @invariant
    def validateStartEnd(data):
        if data.start is not None and data.end is not None:
            if data.start > data.end:
                raise StartBeforeEnd(
                    _(
                        safe_unicode(
                            'The start date must be before the end date.')))
class IConference(model.Schema):

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

    description = schema.Text(title=_(u"Conference summary"), required=False)

    primary('details')
    details = RichText(
        title=_(u"Details"),
        description=_(u"Write information about the conference"),
        required=False,
    )

    break_length = schema.List(
        title=_(u"Length Of Conference Breaks"),
        description=
        _(u"Fill in the time slots for conference breaks in minutes. Use a new line for every "
          u"value / talk length. Write only the numbers without the addition 'minutes'."
          ),
        value_type=schema.TextLine(),
        required=True,
    )

    talk_length = schema.List(
        title=_(u"Length Of Talks"),
        description=
        _(u"Fill in the time slots for conference talks in minutes. Use a new line for every "
          u"value / talk length. Write only the numbers without the addition 'minutes'."
          ),
        value_type=schema.TextLine(),
        required=True,
    )

    workshop_length = schema.List(
        title=_(u"Length Of Workshops"),
        description=
        _(u"Fill in the time slots for workshops at the conference in minutes. Use a new line for every "
          u"value / workshop length. Write only the numbers without the addition 'minutes'."
          ),
        value_type=schema.TextLine(),
        required=True,
    )
예제 #15
0
class IConferencebreak(model.Schema):

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

    description = schema.Text(title=_(u"Conference break summary"),
                              required=False)

    primary('details')
    details = RichText(title=_(u"Conference break details"), required=False)

    #    form.widget(track=AutocompleteFieldWidget)
    #    track = RelationChoice(
    #            title=_(u"Track"),
    #            source=ObjPathSourceBinder(object_provides=ITrack.__identifier__),
    #            required=False,
    #        )

    write_permission(startitem='collective.conferences.ModifyTalktime')
    startitem = schema.Datetime(
        title=_(u"Startdate"),
        description=_(u"Start date"),
        required=False,
    )

    write_permission(enditem='collective.conferences.ModifyTalktime')
    enditem = schema.Datetime(
        title=_(u"Enddate"),
        description=_(u"End date"),
        required=False,
    )

    directives.widget(breaklength=RadioFieldWidget)
    breaklength = schema.List(
        title=_(u"Length"),
        value_type=schema.Choice(source=vocabBreakLength),
        required=True,
    )
예제 #16
0
class ICallforpaper(model.Schema):
    """A call for paper for a conferences.
    A call for paper can contain incomming talks.
    """

    title = schema.TextLine(title=_(u"Call for paper title"), )

    description = schema.Text(
        title=_(u"Call for paper summary"),
        required=False,
    )

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

    cfp_topics = schema.List(
        title=_(u"Topics for the Call for Papers"),
        default=['Development', 'Documentation', 'Project-Administration'],
        value_type=schema.TextLine())
예제 #17
0
class IWorkshop(model.Schema):
    """A conference workshop. Workshops are managed inside tracks of the Program.
    """

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

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

    primary('details')
    details = RichText(title=_(u"Workshop details"), required=False)

    # use an autocomplete selection widget instead of the default content tree
    #    form.widget(speaker=AutocompleteFieldWidget)
    #    speaker = RelationChoice(
    #            title=_(u"Leader of the workshop"),
    #           # source=ObjPathSourceBinder(object_provides=ISpeaker.__identifier__),
    #            required=False,
    #        )
    #    form.widget(speaker=AutocompleteFieldWidget)
    #    speaker2 = RelationChoice(
    #            title=_(u"Co-Leader of the workshop"),
    #           # source=ObjPathSourceBinder(object_provides=ISpeaker.__identifier__),
    #            required=False,
    #            )
    dexteritytextindexer.searchable('call_for_paper_topics')
    directives.widget(call_for_paper_topic=RadioFieldWidget)
    call_for_paper_topic = schema.List(
        title=_(u"Choose the topic for your workshop"),
        value_type=schema.Choice(source=vocabCfPTopics),
        required=True,
    )

    write_permission(startitem='collective.conferences.ModifyTalktime')
    startitem = schema.Datetime(
        title=_(u"Startdate"),
        description=_(u"Start date"),
        required=False,
    )

    write_permission(enditem='collective.conferences.ModifyTalktime')
    enditem = schema.Datetime(
        title=_(u"Enddate"),
        description=_(u"End date"),
        required=False,
    )

    directives.widget(planedworkshoplength=RadioFieldWidget)
    planedworkshoplength = schema.List(
        title=_(u"Planed Length"),
        description=_(
            u"Give an estimation about the time you'd plan for your workshop."
        ),
        value_type=schema.Choice(source=vocabWorkshopLength),
        required=True,
    )

    write_permission(order='collective.conferences.ModifyTrack')
    order = schema.Int(
        title=_(u"Orderintrack"),
        description=_(u"Order in the track: write in an Integer from 1 to 12"),
        min=1,
        max=12,
        required=False,
    )

    slides = NamedBlobFile(
        title=_(u"Workshop slides / material"),
        description=
        _(u"Please upload your workshop presentation or material about the content of the workshop in front or short after you have given the workshop."
          ),
        required=False,
    )

    creativecommonslicense = schema.Bool(
        title=_(
            u'label_creative_commons_license',
            default=
            u'License is Creative Commons Attribution-Share Alike 3.0 License.'
        ),
        description=_(
            u'help_creative_commons_license',
            default=
            u'You agree that your talk and slides are provided under the Creative Commons Attribution-Share Alike 3.0 License.'
        ),
        default=True)

    messagetocommittee = schema.Text(
        title=_(u'Messages to the Program Committee'),
        description=
        _(u'You can give some information to the committee here, e.g. about days you are (not) available to give the workshop'
          ),
        required=False,
    )

    read_permission(reviewNotes='cmf.ReviewPortalContent')
    write_permission(reviewNotes='cmf.ReviewPortalContent')
    reviewNotes = schema.Text(
        title=u"Review notes",
        required=False,
    )
예제 #18
0
class IWorkshop(model.Schema):
    """A conference workshop.
    """

    title = schema.TextLine(
        title=_(safe_unicode('Title')),
        description=_(safe_unicode('Workshop title')),
    )

    description = schema.Text(title=_(safe_unicode('Workshop summary')), )

    primary('details')
    details = RichText(
        title=_(safe_unicode('Workshop details')),
        required=False,
    )

    speaker = RelationList(
        title=_(safe_unicode('Workshop Leader')),
        default=[],
        value_type=RelationChoice(vocabulary='ConferenceSpeaker'),
        required=False,
        missing_value=[],
    )
    directives.widget(
        'speaker',
        SelectFieldWidget,
    )

    dexteritytextindexer.searchable('call_for_paper_topics')
    directives.widget(call_for_paper_topic=RadioFieldWidget)
    call_for_paper_topic = schema.List(
        title=_(safe_unicode('Choose the topic for your workshop')),
        value_type=schema.Choice(source=vocabCfPTopics),
        required=True,
    )

    directives.widget(planedworkshoplength=RadioFieldWidget)
    planedworkshoplength = schema.List(
        title=_(safe_unicode('Planed Length')),
        description=_(
            safe_unicode(
                "Give an estimation about the time you'd plan for your workshop."
            )),
        value_type=schema.Choice(source='WorkshopLength'),
        required=True,
    )

    directives.widget(license=RadioFieldWidget)
    license = schema.List(
        title=_(safe_unicode('License Of Your Talk')),
        description=_(safe_unicode('Choose a license for your workshop')),
        value_type=schema.Choice(source='ContentLicense'),
        required=True,
    )

    read_permission(conferencetrack='cmf.ReviewPortalContent')
    write_permission(conferencetrack='cmf.ReviewPortalContent')
    conferencetrack = RelationList(
        title=_(safe_unicode('Choose the track for this workshop')),
        default=[],
        value_type=RelationChoice(vocabulary='ConferenceTrack'),
        required=False,
        missing_value=[],
    )
    directives.widget(
        'conferencetrack',
        RadioFieldWidget,
    )

    messagetocommittee = schema.Text(
        title=_(safe_unicode('Messages to the Program Committee')),
        description=_(
            safe_unicode(
                'You can give some information to the committee here, e.g. about days you are (not) '
                'available to give the workshop')),
        required=False,
    )

    read_permission(twclength='cmf.ReviewPortalContent')
    write_permission(twclength='cmf.ReviewPortalContent')
    directives.widget(twclength=RadioFieldWidget)
    twclength = schema.List(
        title=_(safe_unicode('Workshop Length')),
        description=_(
            safe_unicode('Set a time frame for the workshop in minutes.')),
        value_type=schema.Choice(source='WorkshopLength'),
        required=False,
    )

    read_permission(positionintrack='cmf.ReviewPortalContent')
    write_permission(positionintrack='cmf.ReviewPortalContent')
    positionintrack = schema.Int(
        title=_(safe_unicode('Position In The Track')),
        description=_(
            safe_unicode('Choose a number for the order in the track')),
        required=False,
    )

    write_permission(startitem='collective.conferences.ModifyTalktime')
    startitem = schema.Datetime(
        title=_(safe_unicode('Startdate')),
        description=_(safe_unicode('Start date')),
        defaultFactory=startDefaultValue,
        required=False,
    )

    write_permission(enditem='collective.conferences.ModifyTalktime')
    enditem = schema.Datetime(
        title=_(safe_unicode('Enddate')),
        description=_(safe_unicode('End date')),
        defaultFactory=endDefaultValue,
        required=False,
    )

    model.fieldset(
        'slides',
        label=_(safe_unicode('Slides')),
        fields=[
            'slidefileextension',
            'slides',
            'slides2',
            'slides3',
            'slides4',
        ],
    )

    model.fieldset(
        'files',
        label=_(safe_unicode('Files / Material')),
        fields=[
            'materialfileextension',
            'material',
        ],
    )

    model.fieldset(
        'video',
        label=_(safe_unicode('Video')),
        fields=['videofileextension', 'video'],
    )

    directives.mode(slidefileextension='display')
    slidefileextension = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for the upload of '
                'slides of conference workshop as well as for linked slides '
                '(upper case and lower case and mix of both):')),
        defaultFactory=allowedconferenceworkshopslideextensions,
    )

    slides = NamedBlobFile(
        title=_(safe_unicode('Presentation slides')),
        description=_(
            safe_unicode(
                'If you used slides during your workshop, please upload your '
                'slides shortly after you have given your workshop.')),
        constraint=validateworshopslidefileextension,
        required=False,
    )

    slides2 = NamedBlobFile(
        title=_(safe_unicode('Presentation Slides In Further File Format')),
        description=_(
            safe_unicode(
                'If you used slides during your workshop, please upload your '
                'slides shortly after you have given your workshop.')),
        constraint=validateworshopslidefileextension,
        required=False,
    )

    slides3 = schema.URI(
        title=_(safe_unicode('Link To The Presentation Slides')),
        constraint=validatelinkedworkshopslidefileextension,
        required=False,
    )

    slides4 = schema.URI(
        title=_(
            safe_unicode(
                'Link To The Presentation Slides In Further File Format')),
        constraint=validatelinkedworkshopslidefileextension,
        required=False,
    )

    directives.mode(materialfileextension='display')
    materialfileextension = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for workshop '
                'material uploads (upper case and lower case and mix of both):'
            )),
        defaultFactory=allowedconferenceworkshopmaterialextensions,
    )

    material = NamedBlobFile(
        title=_(safe_unicode('Workshop slides / material')),
        description=_(
            safe_unicode(
                'Please upload your workshop presentation or material about the content of the workshop '
                'in front or short after you have given the workshop.')),
        constraint=validateworkshopmaterialfileextension,
        required=False,
    )

    directives.mode(videofileextension='display')
    videofileextension = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for conference '
                'video uploads (upper case and lower case and mix of both):')),
        defaultFactory=allowedconferencevideoextensions,
    )

    video = schema.URI(
        title=_(safe_unicode('Link to the Video of the talk')),
        constraint=validatevideofileextension,
        required=False,
    )

    read_permission(reviewNotes='cmf.ReviewPortalContent')
    write_permission(reviewNotes='cmf.ReviewPortalContent')
    reviewNotes = schema.Text(
        title=_(safe_unicode('Review notes')),
        required=False,
    )

    @invariant
    def validateLicensechoosen(data):
        if not data.license:
            raise ChooseLicense(
                _(safe_unicode('Please choose a license for your talk.'), ), )

    @invariant
    def trackpositionset(value):
        if value.conferencetrack and not value.positionintrack:
            raise Invalid(
                _(
                    safe_unicode(
                        'You need to choose a position in the track. Please '
                        "add this position to the field 'Position in Track'."))
            )

    @invariant
    def validatecfptopicchoosen(data):
        if not data.call_for_paper_topic:
            raise ChooseCfpTopic(
                _(
                    safe_unicode(
                        'Please choose a call for paper topic for your workshop.'
                    ), ), )

    @invariant
    def validateplanedlengthchoosen(data):
        if not data.planedworkshoplength:
            raise ChoosePlanedLength(
                _(
                    safe_unicode(
                        'Please choose a planed length for your workshop.'), ),
            )
class ITalk(model.Schema):
    """A conference talk. Talks are managed inside tracks of the Program.
    """

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

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

    primary('details')
    details = RichText(title=_(u"Talk details"), required=True)

    # use an autocomplete selection widget instead of the default content tree
    #    form.widget(speaker=AutocompleteFieldWidget)
    #    speaker = RelationChoice(
    #            title=_(u"Presenter"),
    #            source=ObjPathSourceBinder(object_provides=IConferenceSpeaker.__identifier__),
    #            required=False,
    #        )
    #    form.widget(speaker=AutocompleteFieldWidget)
    #    speaker2 = RelationChoice(
    #            title=_(u"Co-Presenter"),
    #            source=ObjPathSourceBinder(object_provides=ISpeaker.__identifier__),
    #            required=False,
    #        )

    #    form.widget(speaker=AutocompleteFieldWidget)
    #    speaker3 = RelationChoice(
    #            title=_(u"Co-Presenter"),
    #            source=ObjPathSourceBinder(object_provides=ISpeaker.__identifier__),
    #            required=False,
    #        )

    dexteritytextindexer.searchable('call_for_paper_topics')
    directives.widget(call_for_paper_topic=RadioFieldWidget)
    call_for_paper_topic = schema.List(
        title=_(u"Choose the topic for your talk"),
        value_type=schema.Choice(source=vocabCfPTopics),
        required=True,
    )

    #    form.widget(track=AutocompleteFieldWidget)
    #    track = RelationChoice(
    #            title=_(u"Track"),
    #            source=ObjPathSourceBinder(object_provides=ITrack.__identifier__),
    #            required=False,
    #        )

    write_permission(startitem='collective.conferences.ModifyTalktime')
    startitem = schema.Datetime(
        title=_(u"Startdate"),
        description=_(u"Start date"),
        required=False,
    )

    write_permission(enditem='collective.conferences.ModifyTalktime')
    enditem = schema.Datetime(
        title=_(u"Enddate"),
        description=_(u"End date"),
        required=False,
    )

    directives.widget(planedtalklength=RadioFieldWidget)
    planedtalklength = schema.List(
        title=_(u"Planed Length"),
        description=_(
            u"Give an estimation about the time you'd plan for your talk."),
        value_type=schema.Choice(source=vocabTalkLength),
        required=True,
    )
    write_permission(order='collective.conferences.ModifyTrack')
    order = schema.Int(
        title=_(u"Orderintrack"),
        description=_(u"Order in the track: write in an Integer from 1 to 12"),
        min=1,
        max=12,
        required=False,
    )

    slides = NamedBlobFile(
        title=_(u"Presentation slides in ODT-File-Format"),
        description=
        _(u"Please upload your presentation shortly after you have given your talk."
          ),
        required=False,
    )

    slides2 = NamedBlobFile(
        title=_(
            u"Presentation slides in PDF-File-Format or PDF-Hybrid-File-Format"
        ),
        description=
        _(u"Please upload your presentation shortly after you have given your talk."
          ),
        required=False,
    )

    slides3 = schema.URI(
        title=_(u"Link to the presentation slides in ODT-File-Format"),
        required=False,
    )
    slides4 = schema.URI(
        title=
        _(u"Link to the presentation slides in PDF-File-Format or PDF-Hybrid-File-Format"
          ),
        required=False,
    )

    files = NamedBlobFile(
        title=_(u"Additional Files of your presentation."),
        description=
        _(u"Please upload the additional files of your presentation (in archive format) shortly after you have given your talk."
          ),
        required=False,
    )

    files2 = schema.URI(
        title=
        _(u"Link to additional Files of your presentation in archive file format (e.g. zip-file-format."
          ),
        required=False,
    )

    video = schema.URI(
        title=_(u"Link to the Video of the talk"),
        required=False,
    )
    creativecommonslicense = schema.Bool(
        title=_(
            u'label_creative_commons_license',
            default=
            u'License is Creative Commons Attribution-Share Alike 3.0 License.'
        ),
        description=_(
            u'help_creative_commons_license',
            default=
            u'You agree that your talk and slides are provided under the Creative Commons Attribution-Share Alike 3.0 License.'
        ),
        default=True)

    messagetocommittee = schema.Text(
        title=_(u'Messages to the Program Committee'),
        description=
        _(u'You can give some information to the committee here, e.g. about days you are (not) available to give the talk'
          ),
        required=False,
    )

    read_permission(reviewNotes='cmf.ReviewPortalContent')
    write_permission(reviewNotes='cmf.ReviewPortalContent')
    reviewNotes = schema.Text(
        title=u"Review notes",
        required=False,
    )
예제 #20
0
class IAddonCenter(model.Schema):
    """ A Templates Upload Center.
    """

    title = schema.TextLine(title=_(
        safe_unicode('Name of the Add-on Center')), )

    description = schema.Text(title=_(
        safe_unicode('Description of the Add-on Center')), )

    product_description = schema.Text(title=_(
        safe_unicode('Description of the features of Add-ons')), )

    product_title = schema.TextLine(
        title=_(safe_unicode('Add-on product name')),
        description=_(
            safe_unicode('Name of the Add-on product, e.g. only Add-ons')),
    )

    model.fieldset(
        'instructions',
        label=safe_unicode('Instructions'),
        fields=['install_instructions', 'reporting_bugs'],
    )

    primary('install_instructions')
    install_instructions = RichText(
        title=_(safe_unicode('Add-on installation instructions')),
        description=_(safe_unicode('Please fill in the install instructions')),
        required=False,
    )

    primary('reporting_bugs')
    reporting_bugs = RichText(
        title=_(safe_unicode('Instruction how to report Bugs')),
        required=False,
    )

    primary('information_oldversions')
    information_oldversions = RichText(
        title=_(
            safe_unicode('Information about search for old product versions')),
        description=_(
            safe_unicode('Enter an information about the search for older '
                         'versions of the product, if they are not on the '
                         'versions list (compatibility) anymore.')),
        required=False,
    )

    model.fieldset(
        'contactadresses',
        label=u'Special email adresses',
        fields=['releaseAllert', 'contactForCenter'],
    )

    releaseAllert = schema.ASCIILine(
        title=_(
            safe_unicode('EMail address for the messages about new releases')),
        description=_(
            safe_unicode(
                'Enter an email address to which information about a new '
                'release should be send.')),
        required=False,
    )

    contactForCenter = schema.ASCIILine(
        title=_(
            safe_unicode(
                'EMail address for communication with the add-on center '
                'manager and reviewer')),
        description=_(
            safe_unicode(
                'Enter an email address for the communication with add-on '
                'center manager and reviewer')),
        default='*****@*****.**',
        constraint=validateemail,
    )
예제 #21
0
class IDXTestDocumentSchema(model.Schema):

    # zope.schema fields
    test_ascii_field = schema.ASCII(required=False)
    test_asciiline_field = schema.ASCIILine(required=False)
    test_bool_field = schema.Bool(required=False)
    test_bytes_field = schema.Bytes(required=False)
    test_bytesline_field = schema.BytesLine(required=False)
    test_choice_field = schema.Choice(values=[u"foo", u"bar"], required=False)
    test_choice_field_with_vocabulary = schema.Choice(
        vocabulary=SimpleVocabulary([
            SimpleTerm(u"value1", "token1", u"title1"),
            SimpleTerm(u"value2", "token2", u"title2"),
        ]),
        required=False,
    )

    test_choice_with_non_iterable_source = schema.Choice(
        required=False, source=my_non_iterable_source)
    test_choice_with_source = schema.Choice(required=False,
                                            source=my_iterable_source)
    test_choice_with_context_source = schema.Choice(
        required=False, source=my_context_source_binder)
    test_choice_with_querysource = schema.Choice(required=False,
                                                 source=my_querysource)
    test_choice_with_context_querysource = schema.Choice(
        required=False, source=my_context_querysource_binder)

    test_date_field = schema.Date(required=False)
    test_datetime_field = schema.Datetime(required=False)
    test_datetime_tz_field = schema.Datetime(
        required=False,
        defaultFactory=lambda: timezone("Europe/Zurich").localize(
            datetime(2017, 10, 31, 10, 0)),
    )
    test_decimal_field = schema.Decimal(required=False)
    test_dict_field = schema.Dict(required=False)
    test_float_field = schema.Float(required=False)
    test_frozenset_field = schema.FrozenSet(required=False)
    test_int_field = schema.Int(required=False)
    test_list_field = schema.List(required=False)
    test_list_field_with_choice_with_vocabulary = schema.List(
        value_type=schema.Choice(vocabulary=SimpleVocabulary([
            SimpleTerm(u"value1", "token1", u"title1"),
            SimpleTerm(u"value2", "token2", u"title2"),
            SimpleTerm(u"value3", "token3", u"title3"),
        ])),
        required=False,
    )
    test_set_field = schema.Set(required=False)
    test_set_field_with_choice_with_vocabulary = schema.Set(
        value_type=schema.Choice(vocabulary=SimpleVocabulary([
            SimpleTerm(u"value1", "token1", u"title1"),
            SimpleTerm(u"value2", "token2", u"title2"),
            SimpleTerm(u"value3", "token3", u"title3"),
        ])),
        required=False,
    )
    test_text_field = schema.Text(required=False)
    test_textline_field = schema.TextLine(required=False)
    test_time_field = schema.Time(required=False)
    test_timedelta_field = schema.Timedelta(required=False)
    test_tuple_field = schema.Tuple(required=False)
    test_nested_list_field = schema.List(required=False,
                                         value_type=schema.Tuple())
    test_nested_dict_field = schema.Dict(required=False,
                                         key_type=schema.ASCIILine(),
                                         value_type=schema.Tuple())
    test_list_choice_with_context_vocabulary_field = schema.List(
        title=u"Field",
        value_type=schema.Choice(
            vocabulary="plone.restapi.testing.context_vocabulary"),
        required=False,
    )

    # plone.app.textfield
    test_richtext_field = RichText(
        required=False, allowed_mime_types=["text/html", "text/plain"])

    # plone.namedfile fields
    test_namedfile_field = namedfile.NamedFile(required=False)
    test_namedimage_field = namedfile.NamedImage(required=False)
    test_namedblobfile_field = namedfile.NamedBlobFile(required=False)
    test_namedblobimage_field = namedfile.NamedBlobImage(required=False)

    primary("test_primary_namedfile_field")
    test_primary_namedfile_field = namedfile.NamedFile(required=False)

    # z3c.relationfield
    test_relationchoice_field = RelationChoice(
        required=False, source=CatalogSource(id=["doc1", "doc2"]))
    test_relationlist_field = RelationList(
        required=False,
        value_type=RelationChoice(vocabulary="plone.app.vocabularies.Catalog"),
    )

    # Test fields for validation
    test_required_field = schema.TextLine(required=True)
    test_readonly_field = schema.TextLine(required=False, readonly=True)
    test_maxlength_field = schema.TextLine(required=False, max_length=10)
    test_constraint_field = schema.TextLine(required=False,
                                            constraint=lambda x: u"00" in x)
    test_datetime_min_field = schema.Datetime(required=False,
                                              min=datetime(2000, 1, 1))
    test_time_min_field = schema.Time(required=False, min=time(1))
    test_timedelta_min_field = schema.Timedelta(required=False,
                                                min=timedelta(100))
    test_list_value_type_field = schema.List(required=False,
                                             value_type=schema.Int())
    test_dict_key_type_field = schema.Dict(required=False,
                                           key_type=schema.Int())

    read_permission(test_read_permission_field="cmf.ManagePortal")
    test_read_permission_field = schema.TextLine(required=False)
    write_permission(test_write_permission_field="cmf.ManagePortal")
    test_write_permission_field = schema.TextLine(required=False)

    read_permission(test_read_permission_field="cmf.ManagePortal")
    test_read_permission_field = schema.TextLine(required=False)

    test_invariant_field1 = schema.TextLine(required=False)
    test_invariant_field2 = schema.TextLine(required=False)

    test_missing_value_field = schema.TextLine(required=False,
                                               missing_value=u"missing",
                                               default=u"default")

    test_missing_value_required_field = schema.TextLine(
        required=True, missing_value=u"missing", default=u"some value")

    @invariant
    def validate_same_value(data):
        if data.test_invariant_field1 != data.test_invariant_field2:
            raise Invalid(u"Must have same values")

    # Test fields with default values
    test_default_value_field = schema.TextLine(required=True,
                                               default=u"Default")

    @provider(IContextAwareDefaultFactory)
    def default_factory(context):
        return u"DefaultFactory"

    test_default_factory_field = schema.TextLine(
        required=True, defaultFactory=default_factory)
예제 #22
0
class ITrack(model.Schema):
    """A conference track. Tracks are managed inside Programs.
    """

    title = schema.TextLine(
        title=_(safe_unicode('Title')),
        description=_(safe_unicode('Track title')),
    )

    description = schema.Text(title=_(safe_unicode('Track summary')), )

    primary('details')
    details = RichText(
        title=_(safe_unicode('Track details')),
        required=False,
    )

    trackstart = schema.Datetime(
        title=_(safe_unicode('Startdate')),
        description=_(safe_unicode('Start date')),
        required=False,
    )

    trackend = schema.Datetime(
        title=_(safe_unicode('Enddate')),
        description=_(safe_unicode('End date')),
        required=False,
    )

    room = RelationList(
        title=_(safe_unicode('Choose the room for the track')),
        default=[],
        value_type=RelationChoice(vocabulary='ConferenceRoom'),
        required=False,
        missing_value=[],
    )
    directives.widget(
        'room',
        RadioFieldWidget,
    )

    @invariant
    def validateStartEnd(data):
        if data.trackstart is not None and data.trackend is not None:
            if data.trackstart > data.trackend:
                raise StartBeforeEnd(
                    _(
                        safe_unicode(
                            'The start date must be before the end date.')))

    @invariant
    def validateStartNotBeforeProgram(data):
        if data.trackstart is not None:
            catalog = api.portal.get_tool(name='portal_catalog')
            result = catalog.uniqueValuesFor('programstart')
            trackstart = DateTime(data.trackstart).toZone('UTC')
            if DateTime(trackstart) < DateTime(result[0]):
                raise StartBeforeConferenceProgram(
                    _(
                        safe_unicode(
                            'The start date could not be set before the begin of the conference program.'
                        )))

    @invariant
    def validateEndNotAfterProgram(data):
        if data.trackend is not None:
            catalog = api.portal.get_tool(name='portal_catalog')
            result = catalog.uniqueValuesFor('programend')
            trackend = DateTime(data.trackend).toZone('UTC')
            if DateTime(trackend) > DateTime(result[0]):
                raise EndAfterConferenceProgram(
                    _(
                        safe_unicode(
                            "The end date couldn't be set after the end of the conference program."
                        )))
예제 #23
0
class ITraining(model.Schema):
    """A conference training.
    """

    title = schema.TextLine(
        title=_(safe_unicode('Title')),
        description=_(safe_unicode('Training title')),
    )

    description = schema.Text(title=_(safe_unicode('Training Summary')), )

    primary('details')
    details = RichText(
        title=_(safe_unicode('Training Details')),
        required=False,
    )

    speaker = RelationList(
        title=_(safe_unicode('Instructor')),
        description=_(
            safe_unicode(
                'Click with the mouse pointer into the field and choose the '
                'instructor(s) from the appearing list.')),
        default=[],
        value_type=RelationChoice(vocabulary='ConferenceSpeaker'),
        required=False,
        missing_value=[],
    )
    directives.widget(
        'speaker',
        SelectFieldWidget,
    )

    level = schema.Choice(
        title=_(safe_unicode('Level')),
        description=_(safe_unicode('Choose the level of the training.')),
        required=True,
        source='TrainingLevel',
    )

    audience = schema.Set(
        title=_(safe_unicode('Audience')),
        description=_(safe_unicode('Choose the audience of the training.')),
        required=True,
        value_type=schema.Choice(source='TrainingAudience'),
    )

    directives.widget(planedtraininglength=RadioFieldWidget)
    planedtraininglength = schema.List(
        title=_(safe_unicode('Planed Length')),
        description=_(
            safe_unicode(
                "Give an estimation about the time you'd plan for the training."
            )),
        value_type=schema.Choice(source='TrainingLength'),
        required=True,
    )

    directives.widget(license=RadioFieldWidget)
    license = schema.List(
        title=_(safe_unicode('License Of Your Training')),
        description=_(safe_unicode('Choose a license for the training')),
        value_type=schema.Choice(source='ContentLicense'),
        required=True,
    )

    messagetocommittee = schema.Text(
        title=_(safe_unicode('Messages to the Program Committee')),
        description=_(
            safe_unicode(
                'You can give some information to the committee here, e.g. about days you are (not) '
                'available to give the workshop')),
        required=False,
    )

    read_permission(traininglength='cmf.ReviewPortalContent')
    write_permission(traininglength='cmf.ReviewPortalContent')
    directives.widget(traininglength=RadioFieldWidget)
    traininglength = schema.List(
        title=_(safe_unicode('Training Length')),
        description=_(
            safe_unicode('Set a time frame for the training in minutes.')),
        value_type=schema.Choice(source='TrainingLength'),
        required=False,
    )

    write_permission(startitem='collective.conferences.ModifyTalktime')
    startitem = schema.Datetime(
        title=_(safe_unicode('Startdate')),
        description=_(safe_unicode('Start date')),
        defaultFactory=startDefaultValue,
        required=False,
    )

    write_permission(enditem='collective.conferences.ModifyTalktime')
    enditem = schema.Datetime(
        title=_(safe_unicode('Enddate')),
        description=_(safe_unicode('End date')),
        defaultFactory=endDefaultValue,
        required=False,
    )

    read_permission(room='cmf.ReviewPortalContent')
    write_permission(room='cmf.ReviewPortalContent')
    room = RelationList(
        title=_(safe_unicode('Room')),
        description=_(safe_unicode('Choose the room for the training')),
        default=[],
        value_type=RelationChoice(vocabulary='ConferenceRoom'),
        required=False,
        missing_value=[],
    )
    directives.widget(
        'room',
        RadioFieldWidget,
    )

    model.fieldset(
        'slides',
        label=_(safe_unicode('Slides')),
        fields=[
            'slidefileextension', 'slides', 'slides2', 'slides3', 'slides4'
        ],
    )

    model.fieldset(
        'material',
        label=_(safe_unicode('Material')),
        fields=['materialfileextension', 'material'],
    )

    model.fieldset(
        'video',
        label=_(safe_unicode('Video')),
        fields=['videofileextension', 'video'],
    )

    directives.mode(slidefileextension='display')
    slidefileextension = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for the upload of '
                'slides of conference workshop as well as for linked slides '
                '(upper case and lower case and mix of both):')),
        defaultFactory=allowedconferencetrainingslideextensions,
    )

    slides = NamedBlobFile(
        title=_(safe_unicode('Presentation slides')),
        description=_(
            safe_unicode(
                'If you used slides during your workshop, please upload your '
                'slides shortly after you have given your workshop.')),
        constraint=validatetrainingslidefileextension,
        required=False,
    )

    slides2 = NamedBlobFile(
        title=_(safe_unicode('Presentation Slides In Further File Format')),
        description=_(
            safe_unicode(
                'If you used slides during your workshop, please upload your '
                'slides shortly after you have given your workshop.')),
        constraint=validatetrainingslidefileextension,
        required=False,
    )

    slides3 = schema.URI(
        title=_(safe_unicode('Link To The Presentation Slides')),
        constraint=validatelinkedtrainingslidefileextension,
        required=False,
    )

    slides4 = schema.URI(
        title=_(
            safe_unicode(
                'Link To The Presentation Slides In Further File Format')),
        constraint=validatelinkedtrainingslidefileextension,
        required=False,
    )

    directives.mode(materialfileextension='display')
    materialfileextension = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for workshop '
                'material uploads (upper case and lower case and mix of both):'
            )),
        defaultFactory=allowedconferencetrainingmaterialextensions,
    )

    material = NamedBlobFile(
        title=_(safe_unicode('Workshop slides / material')),
        description=_(
            safe_unicode(
                'Please upload your workshop presentation or material about the content of the workshop '
                'in front or short after you have given the workshop.')),
        constraint=validatetrainingmaterialfileextension,
        required=False,
    )

    directives.mode(videofileextension='display')
    videofileextension = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for conference '
                'video uploads (upper case and lower case and mix of both):')),
        defaultFactory=allowedconferencevideoextensions,
    )

    video = schema.URI(
        title=_(safe_unicode('Link to the Video of the talk')),
        constraint=validatevideofileextension,
        required=False,
    )

    @invariant
    def validateLicensechoosen(data):
        if not data.license:
            raise ChooseLicense(
                _(safe_unicode('Please choose a license for your talk.'), ), )

    @invariant
    def validateplanedlengthchoosen(data):
        if not data.planedtraininglength:
            raise ChoosePlanedLength(
                _(
                    safe_unicode(
                        'Please choose a planed length for your training.'), ),
            )

    @invariant
    def validateStartEnd(data):
        if data.startitem is not None and data.enditem is not None:
            if data.startitem > data.enditem:
                raise StartBeforeEnd(
                    _(
                        safe_unicode(
                            'The start date must be before the end date.')))
예제 #24
0
class IAddonProject(model.Schema):
    directives.mode(information='display')
    information = schema.Text(
        title=_(safe_unicode('Information')),
        description=_(
            safe_unicode('The Dialog to create a new project consists of '
                         'different register. Please go through this register '
                         'and fill in the appropriate data for your project. '
                         "The register 'Documentation' and its fields are "
                         'optional.')),
    )

    dexteritytextindexer.searchable('title')
    title = schema.TextLine(
        title=_(safe_unicode('Title')),
        description=_(
            safe_unicode(
                'Project Title - minimum 5 and maximum 50 characters')),
        min_length=5,
        max_length=50,
    )

    dexteritytextindexer.searchable('description')
    description = schema.Text(title=_(safe_unicode('Project Summary')), )

    dexteritytextindexer.searchable('details')
    primary('details')
    details = RichText(
        title=_(safe_unicode('Full Project Description')),
        required=False,
    )

    model.fieldset(
        'Categories',
        label=_(safe_unicode('Category / Categories')),
        fields=['category_choice'],
    )

    model.fieldset(
        'logo_screenshot',
        label=_(safe_unicode('Logo / Screenshot')),
        fields=[
            'addonimageextension', 'project_logo', 'addonimageextension1',
            'screenshot'
        ],
    )

    model.fieldset(
        'documentation',
        label=_(safe_unicode('Documentation')),
        fields=[
            'documentation_link', 'addondocextension', 'documentation_file'
        ],
    )

    dexteritytextindexer.searchable('category_choice')
    directives.widget(category_choice=CheckBoxFieldWidget)
    category_choice = schema.List(
        title=_(safe_unicode('Choose your categories')),
        description=_(
            safe_unicode('Please select the appropriate categories (one or '
                         'more) for your project.')),
        value_type=schema.Choice(source='Categories'),
        constraint=isNotEmptyCategory,
        required=True,
    )

    addoncontactAddress = schema.TextLine(
        title=_(safe_unicode('Contact email-address')),
        description=_(safe_unicode('Contact email-address for the project.')),
        constraint=validateemail,
    )

    make_addon_contact_address_public = schema.Choice(
        title=_(safe_unicode('Email Public?')),
        description=_(
            safe_unicode('Please decide if your email address '
                         'should be displayed on the project website.')),
        vocabulary=yesnochoice,
        required=True,
    )

    display_addon_user_name = schema.Choice(
        title=_(safe_unicode('Project Author Public?')),
        description=_(
            safe_unicode('Please decide if your name '
                         'should be displayed on the project website.')),
        vocabulary=yesnochoice,
        required=True,
    )

    homepage = schema.URI(
        title=_(safe_unicode('Homepage')),
        description=_(
            safe_unicode('If the project has an external home page, enter its '
                         "URL (example: 'http://www.mysite.org').")),
        required=False,
    )

    documentation_link = schema.URI(
        title=_(safe_unicode('URL of documentation repository ')),
        description=_(
            safe_unicode('If the project has externally hosted '
                         'documentation, enter its URL '
                         "(example: 'http://www.mysite.org').")),
        required=False,
    )

    directives.mode(addondocextension='display')
    addondocextension = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for documentation '
                'files (upper case and lower case and mix of both):')),
        defaultFactory=alloweddocextensions,
    )

    documentation_file = NamedBlobFile(
        title=_(safe_unicode('Dokumentation File')),
        description=_(
            safe_unicode(
                "If you have a Documentation in the file format 'PDF' "
                "or 'ODT' you could add it here.")),
        required=False,
        constraint=validatedocextension,
    )

    directives.mode(addonimageextension='display')
    addonimageextension = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for project logo '
                'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedimageextensions,
    )

    project_logo = NamedBlobImage(
        title=_(safe_unicode('Logo')),
        description=_(
            safe_unicode(
                'Add a logo for the project (or organization/company) '
                "by clicking the 'Browse' button. You could provide "
                "an image of the file format 'png', 'gif' or 'jpg'.")),
        required=False,
        constraint=validateimageextension,
    )

    directives.mode(addonimageextension1='display')
    addonimageextension1 = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for screenshot '
                'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedimageextensions,
    )

    screenshot = NamedBlobImage(
        title=_(safe_unicode('Screenshot of the Add-on')),
        description=_(
            safe_unicode(
                "Add a screenshot by clicking the 'Browse' button. You "
                "could provide an image of the file format 'png', "
                "'gif' or 'jpg'.")),
        required=False,
        constraint=validateimageextension,
    )

    @invariant
    def missingScreenshotOrLogo(data):
        if not data.screenshot and not data.project_logo:
            raise ProvideScreenshotLogo(
                _(
                    safe_unicode('Please add a screenshot or a logo '
                                 'to your project page. You will '
                                 'find the appropriate fields below '
                                 'on this page.')))
class ITUpCenter(model.Schema):
    """ An Template Upload Center for LibreOffice templates.
    """

    title = schema.TextLine(title=_(
        safe_unicode("Name of the Template Center")), )

    description = schema.Text(title=_(
        safe_unicode('Descirption Of The Template Center')), )

    product_description = schema.Text(
        title=_(safe_unicode("Description Of The Features Of Templates")))

    product_title = schema.TextLine(
        title=_(safe_unicode("Template Product Name")),
        description=_(
            safe_unicode("Name of the Template product, e.g. only Templates "
                         "or LibreOffice Templates")),
    )

    model.fieldset('categories_et_all',
                   label=safe_unicode("Categories et all"),
                   fields=[
                       'available_category', 'available_licenses',
                       'available_versions', 'available_platforms'
                   ])

    available_category = schema.List(title=_(
        safe_unicode("Available Categories")),
                                     default=[
                                         'Accounting',
                                         'Agenda',
                                         'Arts',
                                         'Book',
                                         'Brochure / Pamphlet',
                                         'Budget',
                                         'Business',
                                         'Business POS',
                                         'Business Shipping',
                                         'Calendar',
                                         'Cards',
                                         'Curriculum Vitae',
                                         'CD / DVD|CD',
                                         'Certificate',
                                         'Checkbook',
                                         'Christmas',
                                         'Computer',
                                         'Conference',
                                         'E-book',
                                         'Education',
                                         'Academia',
                                         'Elementary/Secondary '
                                         'school panels',
                                         'Envelope'
                                         'Fax',
                                         'Genealogy',
                                         'Grocery',
                                         'Invoice',
                                         'Labels',
                                         'LibreLogo',
                                         'Letter',
                                         'Magazine',
                                         'Media',
                                         'Medical',
                                         'Memo',
                                         'Music',
                                         'Newsletter',
                                         'Notes',
                                         'Paper',
                                         'Presentation',
                                         'Recipe',
                                         'Science',
                                         'Sports',
                                         'Timeline',
                                         'Timesheet',
                                         'Trades',
                                         'To Do List',
                                         'Writer',
                                     ],
                                     value_type=schema.TextLine())

    available_licenses = schema.List(
        title=_(safe_unicode("Available Licenses")),
        default=[
            'GNU-GPL-v2 (GNU General Public '
            'License Version 2)', 'GNU-GPL-v3+ (General Public License '
            'Version 3 and later)', 'LGPL-v2.1 (GNU Lesser General '
            'Public License Version 2.1)',
            'LGPL-v3+ (GNU Lesser General Public '
            'License Version 3 and later)', 'BSD (BSD License (revised))',
            'MPL-v1.1 (Mozilla Public License '
            'Version 1.1)', 'MPL-v2.0+ (Mozilla Public License '
            'Version 2.0 or later)', 'CC-by-sa-v3 (Creative Commons '
            'Attribution-ShareAlike 3.0)', 'CC-BY-SA-v4 (Creative Commons '
            'Attribution-ShareAlike 4.0 '
            'International)', 'AL-v2 (Apache License Version 2.0)',
            'Public Domain', 'OSI (Other OSI Approved)'
        ],
        value_type=schema.TextLine())

    available_versions = schema.List(
        title=_(safe_unicode("Available Versions")),
        default=[
            'LibreOffice 3.3', 'LibreOffice 3.4', 'LibreOffice 3.5',
            'LibreOffice 3.6', 'LibreOffice 4.0', 'LibreOffice 4.1',
            'LibreOffice 4.2', 'LibreOffice 4.3', 'LibreOffice 4.4',
            'LibreOffice 5.0', 'LibreOffice 5.1', 'LibreOffice 5.2',
            'LibreOffice 5.3', 'LibreOffice 5.4', 'LibreOffice 6.0',
            'LibreOffice 6.1', 'LibreOffice 6.2', 'LibreOffice 6.3',
            'LibreOffice 6.4'
        ],
        value_type=schema.TextLine())

    available_platforms = schema.List(
        title=_(safe_unicode("Available Platforms")),
        default=[
            'All platforms', 'Linux', 'Linux-x64', 'Mac OS X', 'Windows',
            'BSD', 'UNIX (other)'
        ],
        value_type=schema.TextLine())

    model.fieldset(
        'Allowed File Extensions',
        label=safe_unicode('Allowed file extensions'),
        fields=['allowed_templatefileextension', 'allowed_imagefileextension'])

    allowed_templatefileextension = schema.TextLine(
        title=_(safe_unicode('Allowed Template File Extensions')),
        description=_(
            safe_unicode('Fill in the allowed template file extensions, '
                         'seperated by a pipe \'|\'.')),
    )

    allowed_imagefileextension = schema.TextLine(
        title=_(safe_unicode('Allowed Image File Extensions')),
        description=_(
            safe_unicode('Fill in the allowed image file extensions, '
                         'seperated by a pipe \'|\'.')),
    )

    model.fieldset('instructions',
                   label=u'Instructions',
                   fields=[
                       'install_instructions',
                       'reporting_bugs',
                   ])

    primary('install_instructions')
    install_instructions = RichText(
        title=_(safe_unicode("Template Installation Instructions")),
        description=_(safe_unicode("Please fill in the install instructions")),
        required=False)

    primary('reporting_bugs')
    reporting_bugs = RichText(title=_(
        safe_unicode("Instruction how to report Bugs")),
                              required=False)

    model.fieldset('disclaimer',
                   label=safe_unicode('Legal Disclaimer'),
                   fields=[
                       'title_legaldisclaimer', 'legal_disclaimer',
                       'title_legaldownloaddisclaimer',
                       'legal_downloaddisclaimer'
                   ])

    title_legaldisclaimer = schema.TextLine(
        title=_(safe_unicode("Title for Legal Disclaimer and Limitations")),
        default=_(safe_unicode("Legal Disclaimer and Limitations")),
        required=False)

    legal_disclaimer = schema.Text(
        title=_(safe_unicode("Text of the Legal Disclaimer and Limitations")),
        description=_(
            safe_unicode(
                "Enter the text of the legal disclaimer and limitations that "
                "should be displayed to the project creator and should be "
                "accepted by the owner of the project.")),
        default=_(
            safe_unicode(
                "Fill in the legal disclaimer, that had to be accepted by the "
                "project owner")),
        required=False)

    title_legaldownloaddisclaimer = schema.TextLine(
        title=_(
            safe_unicode(
                "Title of the Legal Disclaimer and Limitations for Downloads")
        ),
        default=_(
            safe_unicode("Legal Disclaimer and Limitations for Downloads")),
        required=False)

    primary('legal_downloaddisclaimer')
    legal_downloaddisclaimer = RichText(
        title=_(
            safe_unicode(
                "Text of the Legal Disclaimer and Limitations for Downlaods")),
        description=_(
            safe_unicode(
                "Enter any legal disclaimer and limitations for downloads that "
                "should appear on each page for dowloadable files.")),
        default=_(
            safe_unicode(
                "Fill in the text for the legal download disclaimer")),
        required=False)

    primary('information_oldversions')
    information_oldversions = RichText(
        title=_(
            safe_unicode(
                "Information About Search For Old LibreOffice Versions")),
        description=_(
            safe_unicode("Enter an information about the search for older "
                         "versions of LibreOffice, if they are not on the "
                         "versions list (compatibility) anymore.")),
        required=False)

    model.fieldset('contactadresses',
                   label=safe_unicode('Special Email Adresses'),
                   fields=['contactForCenter'])

    contactForCenter = schema.ASCIILine(
        title=_(
            safe_unicode(
                "EMail address for communication with the template center "
                "manager and reviewer")),
        description=_(
            safe_unicode(
                "Enter an email address for the communication with template "
                "center manager and reviewer")),
        default='*****@*****.**',
        constraint=validateEmail)
예제 #26
0
class ITUpProject(model.Schema):
    directives.mode(information="display")
    information = schema.Text(
        title=_(safe_unicode("Information")),
        description=_(
            safe_unicode(
                "The Dialog to create a new project consists of different "
                "register. Please go through these register and fill in the "
                "appropriate data for your project.")))

    dexteritytextindexer.searchable('title')
    title = schema.TextLine(
        title=_(safe_unicode("Title")),
        description=_(
            safe_unicode(
                "Project Title - minimum 5 and maximum 50 characters")),
        min_length=5,
        max_length=50)

    dexteritytextindexer.searchable('description')
    description = schema.Text(title=_(safe_unicode("Project Summary")), )

    dexteritytextindexer.searchable('details')
    primary('details')
    details = RichText(title=_(safe_unicode("Full Project Description")),
                       required=False)

    model.fieldset('Categories',
                   label='Category / Categories',
                   fields=['category_choice'])
    model.fieldset('logo_screenshot',
                   label='Logo / Screenshot',
                   fields=[
                       'tucimageextension', 'project_logo',
                       'tucimageextension1', 'screenshot'
                   ])

    dexteritytextindexer.searchable('category_choice')
    directives.widget(category_choice=CheckBoxFieldWidget)
    category_choice = schema.List(
        title=_(safe_unicode("Choose your categories")),
        description=_(
            safe_unicode(
                "Please select the appropriate categories (one or more) for "
                "your project.")),
        value_type=schema.Choice(source=vocabCategories),
        constraint=isNotEmptyCategory,
        required=True)

    contactAddress = schema.TextLine(
        title=_(safe_unicode("Contact email-address")),
        description=_(safe_unicode("Contact email-address for the project.")),
        constraint=validateEmail)

    homepage = schema.URI(
        title=_(safe_unicode("Homepage")),
        description=_(
            safe_unicode(
                "If the project has an external home page, enter its URL "
                "(example: 'http://www.mysite.org').")),
        required=False)

    documentation_link = schema.URI(
        title=_(safe_unicode("URL of documentation repository ")),
        description=_(
            safe_unicode(
                "If the project has externally hosted documentation, enter its "
                "URL (example: 'http://www.mysite.org').")),
        required=False)

    directives.mode(tucimageextension='display')
    tucimageextension = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for screenshot '
                'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedimagefileextensions,
    )

    project_logo = NamedBlobImage(
        title=_(safe_unicode("Logo")),
        description=_(
            safe_unicode(
                "Add a logo for the project (or organization/company) by "
                "clicking the 'Browse' button. You could provide an image of "
                "the file format 'png', 'gif' or 'jpg'.")),
        required=False,
        constraint=validateimagefileextension)

    directives.mode(tucimageextension1='display')
    tucimageextension1 = schema.TextLine(
        title=_(u'The following file extensions are allowed for screenshot '
                u'files (upper case and lower case and mix of both):'),
        defaultFactory=allowedimagefileextensions,
    )

    screenshot = NamedBlobImage(
        title=_(safe_unicode("Screenshot of the Template")),
        description=_(
            safe_unicode(
                "Add a screenshot by clicking the 'Browse' button. You could "
                "provide an image of the file format 'png', 'gif' or 'jpg'. ")
        ),
        required=False,
        constraint=validateimagefileextension)

    @invariant
    def missingScreenshotOrLogo(data):
        if not data.screenshot and not data.project_logo:
            raise ProvideScreenshotLogo(
                _(u'Please add a screenshot or a logo to your project page. '
                  u'You will find the appropriate fields below on this page.'))
예제 #27
0
class IAddonLinkedRelease(model.Schema):
    directives.mode(information='display')
    information = schema.Text(
        title=_(safe_unicode('Information')),
        description=_(safe_unicode(
            'This Dialog to create a new release consists of different '
            'register. Please go through this register and fill in the '
            'appropriate data for your linked release. This register '
            "'Default' provide fields for general information of your "
            "linked release. The next register 'compatibility' is the "
            'place to submit information about the versions with which '
            'your linked release file(s) is / are compatible. The '
            'following register asks for some legal informations. '
            "The next register 'Linked File' provide a field to link "
            'your release file. The further register are optional. '
            'There is the opportunity to link further release files '
            '(for different platforms).')),
    )

    directives.mode(projecttitle='hidden')
    projecttitle = schema.TextLine(
        title=_(safe_unicode('The computed project title')),
        description=_(safe_unicode(
            'The linked release title will be computed from the parent '
            'project title')),
        defaultFactory=getContainerTitle,
    )

    releasenumber = schema.TextLine(
        title=_(safe_unicode('Release Number')),
        description=_(safe_unicode('Release Number (up to twelf chars)')),
        default=_(safe_unicode('1.0')),
        max_length=12,
    )

    description = schema.Text(
        title=_(safe_unicode('Release Summary')),
    )

    primary('details')
    details = RichText(
        title=_(safe_unicode('Full Release Description')),
        required=False,
    )

    primary('changelog')
    changelog = RichText(
        title=_(safe_unicode('Changelog')),
        description=_(safe_unicode(
            'A detailed log of what has changed since the '
            'previous release.')),
        required=False,
    )

    model.fieldset('compatibility',
                   label=_(safe_unicode('Compatibility')),
                   fields=['compatibility_choice'])

    model.fieldset('legal',
                   label=_(safe_unicode('Legal')),
                   fields=['licenses_choice', 'title_declaration_legal',
                           'declaration_legal', 'accept_legal_declaration',
                           'source_code_inside', 'link_to_source'])

    directives.widget(licenses_choice=CheckBoxFieldWidget)
    licenses_choice = schema.List(
        title=_(safe_unicode('License of the uploaded file')),
        description=_(safe_unicode(
            'Please mark one or more licenses you publish your '
            'release.')),
        value_type=schema.Choice(source='Licenses'),
        required=True,
    )

    directives.widget(compatibility_choice=CheckBoxFieldWidget)
    compatibility_choice = schema.List(
        title=_(safe_unicode('Compatible with the versions of the product')),
        description=_(safe_unicode(
            'Please mark one or more program versions with which '
            'this release is compatible with.')),
        value_type=schema.Choice(source='Versions'),
        required=True,
    )

    directives.mode(title_declaration_legal='display')
    title_declaration_legal = schema.TextLine(
        title=_(safe_unicode('')),
        required=False,
        defaultFactory=legaldeclarationtitle,
    )

    directives.mode(declaration_legal='display')
    declaration_legal = schema.Text(
        title=_(safe_unicode('')),
        required=False,
        defaultFactory=legaldeclarationtext,
    )

    accept_legal_declaration = schema.Bool(
        title=_(safe_unicode('Accept the above legal disclaimer')),
        description=_(safe_unicode(
            'Please declare that you accept the above legal '
            'disclaimer.')),
        required=True,
    )

    contact_address2 = schema.TextLine(
        title=_(safe_unicode('Contact email-address')),
        description=_(safe_unicode(
            'Contact email-address for the project.')),
        required=False,
        defaultFactory=contactinfoDefault,
    )

    source_code_inside = schema.Choice(
        title=_(safe_unicode('Is the source code inside the add-on?')),
        vocabulary=yesnochoice,
        required=True,
    )

    link_to_source = schema.URI(
        title=_(safe_unicode('Please fill in the Link (URL) to the Source Code.')),
        required=False,
    )

    model.fieldset('linked_file',
                   label=_(safe_unicode('Linked File')),
                   fields=['addonlinkedfileextension',
                           'link_to_file',
                           'external_file_size',
                           'platform_choice',
                           'information_further_file_uploads'])

    directives.mode(addonlinkedfileextension='display')
    addonlinkedfileextension = schema.TextLine(
        title=_(safe_unicode(
            'The following file extensions are allowed for linked '
            'files (upper case and lower case and mix of '
            'both):')),
        defaultFactory=allowedaddonfileextensions,
    )

    link_to_file = schema.URI(
        title=_(safe_unicode('The Link to the file of the release')),
        description=_(safe_unicode('Please insert a link to your add-on file.')),
        required=True,
        constraint=validatelinkedaddonextension,
    )

    external_file_size = schema.Float(
        title=_(safe_unicode('The size of the external hosted file')),
        description=_(safe_unicode(
            'Please fill in the size in kilobyte of the external hosted '
            'file (e.g. 633, if the size is 633 kb)')),
        required=False,
    )

    directives.widget(platform_choice=CheckBoxFieldWidget)
    platform_choice = schema.List(
        title=_(safe_unicode('First linked file is compatible with the Platform(s)')),
        description=_(safe_unicode(
            'Please mark one or more platforms with which the '
            'uploaded file is compatible.')),
        value_type=schema.Choice(source='Platforms'),
        required=True,
    )

    directives.mode(information_further_file_uploads='display')
    primary('information_further_file_uploads')
    information_further_file_uploads = RichText(
        title=_(safe_unicode('Further linked files for this Release')),
        description=_(safe_unicode(
            'If you want to link more files for this release, e.g. because '
            "there are files for other operating systems, you'll find the "
            'fields to link this files on the next registers, e.g. '
            "'Second linked file' for this Release'.")),
        required=False,
    )

    model.fieldset('fieldset1',
                   label=_(safe_unicode('Second linked file')),
                   fields=['addonlinkedfileextension1',
                           'link_to_file1',
                           'external_file_size1',
                           'platform_choice1'],
                   )

    model.fieldset('fieldset2',
                   label=_(safe_unicode('Third linked file')),
                   fields=['addonlinkedfileextension2',
                           'link_to_file2',
                           'external_file_size2',
                           'platform_choice2'],
                   )

    model.fieldset('fieldset3',
                   label=_(safe_unicode('Fourth linked file')),
                   fields=['addonlinkedfileextension3',
                           'link_to_file3',
                           'external_file_size3',
                           'platform_choice3'],
                   )

    model.fieldset('fieldset4',
                   label=_(safe_unicode('Fifth linked file')),
                   fields=['addonlinkedfileextension4',
                           'link_to_file4',
                           'external_file_size4',
                           'platform_choice4'],
                   )

    model.fieldset('fieldset5',
                   label=_(safe_unicode('Sixth linked file')),
                   fields=['addonlinkedfileextension5',
                           'link_to_file5',
                           'external_file_size5',
                           'platform_choice5'],
                   )

    directives.mode(addonlinkedfileextension1='display')
    addonlinkedfileextension1 = schema.TextLine(
        title=_(safe_unicode(
            'The following file extensions are allowed for linked '
            'files (upper case and lower case and mix of '
            'both):')),
        defaultFactory=allowedaddonfileextensions,
    )

    link_to_file1 = schema.URI(
        title=_(safe_unicode('The Link to the file of the release')),
        description=_(safe_unicode('Please insert a link to your add-on file.')),
        required=False,
        constraint=validatelinkedaddonextension,
    )

    external_file_size1 = schema.Float(
        title=_(safe_unicode('The size of the external hosted file')),
        description=_(safe_unicode(
            'Please fill in the size in kilobyte of the external '
            'hosted file (e.g. 633, if the size is 633 kb)')),
        required=False,
    )

    directives.widget(platform_choice1=CheckBoxFieldWidget)
    platform_choice1 = schema.List(
        title=_(safe_unicode('Second linked file is compatible with the Platform(s)')),
        description=_(safe_unicode(
            'Please mark one or more platforms with which the '
            'linked file is compatible.')),
        value_type=schema.Choice(source='Platforms'),
        required=True,
    )

    directives.mode(addonlinkedfileextension2='display')
    addonlinkedfileextension2 = schema.TextLine(
        title=_(safe_unicode(
            'The following file extensions are allowed for linked '
            'files (upper case and lower case and mix of '
            'both):')),
        defaultFactory=allowedaddonfileextensions,
    )

    link_to_file2 = schema.URI(
        title=_(safe_unicode('The Link to the file of the release')),
        description=_(safe_unicode('Please insert a link to your add-on file.')),
        required=False,
        constraint=validatelinkedaddonextension,
    )

    external_file_size2 = schema.Float(
        title=_(safe_unicode('The size of the external hosted file')),
        description=_(safe_unicode(
            'Please fill in the size in kilobyte of the external '
            'hosted file (e.g. 633, if the size is 633 kb)')),
        required=False,
    )

    directives.widget(platform_choice2=CheckBoxFieldWidget)
    platform_choice2 = schema.List(
        title=_(safe_unicode('Third linked file is compatible with the Platform(s)')),
        description=_(safe_unicode(
            'Please mark one or more platforms with which the '
            'linked file is compatible.')),
        value_type=schema.Choice(source='Platforms'),
        required=True,
    )

    directives.mode(addonlinkedfileextension3='display')
    addonlinkedfileextension3 = schema.TextLine(
        title=_(safe_unicode(
            'The following file extensions are allowed for linked '
            'files (upper case and lower case and mix of '
            'both):')),
        defaultFactory=allowedaddonfileextensions,
    )

    link_to_file3 = schema.URI(
        title=_(safe_unicode('The Link to the file of the release')),
        description=_(safe_unicode('Please insert a link to your add-on file.')),
        required=False,
        constraint=validatelinkedaddonextension,
    )

    external_file_size3 = schema.Float(
        title=_(safe_unicode('The size of the external hosted file')),
        description=_(safe_unicode(
            'Please fill in the size in kilobyte of the external '
            'hosted file (e.g. 633, if the size is 633 kb)')),
        required=False,
    )

    directives.widget(platform_choice3=CheckBoxFieldWidget)
    platform_choice3 = schema.List(
        title=_(safe_unicode('Fourth linked file is compatible with the Platform(s)')),
        description=_(safe_unicode(
            'Please mark one or more platforms with which the '
            'linked file is compatible.')),
        value_type=schema.Choice(source='Platforms'),
        required=True,
    )

    directives.mode(addonlinkedfileextension4='display')
    addonlinkedfileextension4 = schema.TextLine(
        title=_(safe_unicode(
            'The following file extensions are allowed for linked '
            'files (upper case and lower case and mix of '
            'both):')),
        defaultFactory=allowedaddonfileextensions,
    )

    link_to_file4 = schema.URI(
        title=_(safe_unicode('The Link to the file of the release')),
        description=_(safe_unicode('Please insert a link to your add-on file.')),
        required=False,
        constraint=validatelinkedaddonextension,
    )

    external_file_size4 = schema.Float(
        title=_(safe_unicode('The size of the external hosted file')),
        description=_(safe_unicode(
            'Please fill in the size in kilobyte of the external '
            'hosted file (e.g. 633, if the size is 633 kb)')),
        required=False,
    )

    directives.widget(platform_choice4=CheckBoxFieldWidget)
    platform_choice4 = schema.List(
        title=_(safe_unicode('Fifth linked file is compatible with the Platform(s)')),
        description=_(safe_unicode(
            'Please mark one or more platforms with which the '
            'linked file is compatible.')),
        value_type=schema.Choice(source='Platforms'),
        required=True,
    )

    directives.mode(addonlinkedfileextension5='display')
    addonlinkedfileextension5 = schema.TextLine(
        title=_(safe_unicode(
            'The following file extensions are allowed for linked '
            'files (upper case and lower case and mix of '
            'both):')),
        defaultFactory=allowedaddonfileextensions,
    )

    link_to_file5 = schema.URI(
        title=_(safe_unicode('The Link to the file of the release')),
        description=_(safe_unicode('Please insert a link to your add-on file.')),
        required=False,
        constraint=validatelinkedaddonextension,
    )

    external_file_size5 = schema.Float(
        title=_(safe_unicode('The size of the external hosted file')),
        description=_(safe_unicode(
            'Please fill in the size in kilobyte of the external '
            'hosted file (e.g. 633, if the size is 633 kb)')),
        required=False,
    )

    directives.widget(platform_choice5=CheckBoxFieldWidget)
    platform_choice5 = schema.List(
        title=_(safe_unicode('Sixth linked file is compatible with the Platform(s)')),
        description=_(safe_unicode(
            'Please mark one or more platforms with which the '
            'linked file is compatible.')),
        value_type=schema.Choice(source='Platforms'),
        required=True,
    )

    @invariant
    def licensenotchoosen(value):
        if not value.licenses_choice:
            raise Invalid(_(safe_unicode('Please choose a license for your release.')))

    @invariant
    def compatibilitynotchoosen(data):
        if not data.compatibility_choice:
            raise Invalid(_(safe_unicode(
                'Please choose one or more compatible product '
                'versions for your release.')))

    @invariant
    def legaldeclarationaccepted(data):
        if data.accept_legal_declaration is not True:
            raise AcceptLegalDeclaration(_(
                safe_unicode(
                    'Please accept the Legal '
                    'Declaration about your Release '
                    'and your linked File')))

    @invariant
    def testingvalue(data):
        if data.source_code_inside != 1 and data.link_to_source is None:
            raise Invalid(_(
                safe_unicode(
                    'You answered the question, whether the source '
                    'code is inside your add-on with no '
                    '(default answer). If this is the correct '
                    'answer, please fill in the Link (URL) '
                    'to the Source Code.')))

    @invariant
    def noOSChosen(data):
        if data.link_to_file is not None and data.platform_choice == []:
            raise Invalid(_(
                safe_unicode(
                    'Please choose a compatible platform for the '
                    'linked file.')))
예제 #28
0
class IExample(model.Schema):
    """Dexterity-Schema with all field-types."""

    # The most used fields
    # textline, text, bool, richtext, email

    fieldset(
        "numberfields",
        label=u"Number fields",
        fields=("int_field", "float_field"),
    )

    fieldset(
        "datetimefields",
        label=u"Date and time fields",
        fields=(
            "datetime_field",
            "date_field",
            "time_field",
            "timedelta_field",
        ),
    )

    fieldset(
        "choicefields",
        label=u"Choice and Multiple Choice fields",
        fields=(
            "choice_field",
            "choice_field_radio",
            "choice_field_select",
            "choice_field_voc",
            "list_field",
            "list_field_checkbox",
            "list_field_select",
            "list_field_voc_unconstrained",
            "tuple_field",
            "set_field",
            "set_field_checkbox",
        ),
    )

    fieldset(
        "relationfields",
        label=u"Relation fields",
        fields=(
            "relationchoice_field",
            "relationlist_field",
            "relationchoice_field_constrained",
            "relationlist_field_constrained",
            "relationlist_field_search_mode",
            "relationchoice_field_select",
            "relationchoice_field_radio",
            "relationlist_field_select",
            "relationlist_field_checkbox",
            "relationchoice_field_ajax_select",
            "relationlist_field_ajax_select",
        ),
    )

    fieldset(
        "uuidrelationfields",
        label=u"Relation widgets with uuids",
        fields=(
            "uuid_choice_field",
            "uuid_list_field",
            "uuid_choice_field_constrained",
            "uuid_list_field_constrained",
            "uuid_list_field_search_mode",
            "uuid_choice_field_select",
            "uuid_choice_field_radio",
            "uuid_list_field_select",
            "uuid_list_field_checkbox",
            "uuid_choice_field_ajax_select",
            "uuid_list_field_ajax_select",
        ),
    )

    fieldset(
        "filefields",
        label=u"File fields",
        fields=("file_field", "image_field"),
    )

    fieldset(
        "otherfields",
        label=u"Other fields",
        fields=(
            "uri_field",
            "sourcetext_field",
            "ascii_field",
            "bytesline_field",
            "asciiline_field",
            "pythonidentifier_field",
            "dottedname_field",
            # 'dict_field',
            # "vocabularyterms_field",
            # "vocabularytermstranslation_field",
            # 'dict_field_with_choice',
        ),
    )

    fieldset(
        "datagrid",
        label=u"Datagrid field",
        fields=("datagrid_field", ),
    )

    primary("title")
    title = schema.TextLine(
        title=u"Primary Field (Textline)",
        description=u"zope.schema.TextLine",
        required=True,
    )

    description = schema.TextLine(
        title=u"Description (Textline)",
        description=u"zope.schema.TextLine",
        required=False,
    )

    text_field = schema.Text(
        title=u"Text Field",
        description=u"zope.schema.Text",
        required=False,
        missing_value=u"",
    )

    textline_field = schema.TextLine(
        title=u"Textline field",
        description=u"A simple input field (schema.TextLine)",
        required=False,
    )

    bool_field = schema.Bool(
        title=u"Boolean field",
        description=u"zope.schema.Bool",
        required=False,
    )

    choice_field = schema.Choice(
        title=u"Choice field",
        description=u"zope.schema.Choice",
        values=[u"One", u"Two", u"Three"],
        required=True,
    )

    directives.widget(choice_field_radio=RadioFieldWidget)
    choice_field_radio = schema.Choice(
        title=u"Choice field with radio boxes",
        description=u"zope.schema.Choice",
        values=[u"One", u"Two", u"Three"],
        required=False,
    )

    choice_field_voc = schema.Choice(
        title=u"Choicefield with values from named vocabulary",
        description=u"zope.schema.Choice",
        vocabulary="plone.app.vocabularies.PortalTypes",
        required=False,
    )

    directives.widget(choice_field_select=SelectFieldWidget)
    choice_field_select = schema.Choice(
        title=u"Choicefield with select2 widget",
        description=u"zope.schema.Choice",
        vocabulary="plone.app.vocabularies.PortalTypes",
        required=False,
    )

    list_field = schema.List(
        title=u"List field",
        description=u"zope.schema.List",
        value_type=schema.Choice(
            values=[u"Beginner", u"Advanced", u"Professional"], ),
        required=False,
        missing_value=[],
    )

    directives.widget(list_field_checkbox=CheckBoxFieldWidget)
    list_field_checkbox = schema.List(
        title=u"List field with checkboxes",
        description=u"zope.schema.List",
        value_type=schema.Choice(
            values=[u"Beginner", u"Advanced", u"Professional"], ),
        required=False,
        missing_value=[],
    )

    directives.widget(list_field_select=SelectFieldWidget)
    list_field_select = schema.List(
        title=u"List field with select widget",
        description=u"zope.schema.List",
        value_type=schema.Choice(
            values=[u"Beginner", u"Advanced", u"Professional"], ),
        required=False,
        missing_value=[],
    )

    list_field_voc_unconstrained = schema.List(
        title=
        u"List field with values from vocabulary but not constrained to them.",
        description=u"zope.schema.List",
        value_type=schema.TextLine(),
        required=False,
        missing_value=[],
    )
    directives.widget(
        "list_field_voc_unconstrained",
        AjaxSelectFieldWidget,
        vocabulary="plone.app.vocabularies.PortalTypes",
        pattern_options={
            "closeOnSelect":
            False,  # Select2 option to leave dropdown open for multiple selection
        },
    )

    tuple_field = schema.Tuple(
        title=u"Tuple field",
        description=u"zope.schema.Tuple",
        value_type=schema.Choice(
            values=[u"Beginner", u"Advanced", u"Professional"], ),
        required=False,
        missing_value=(),
    )

    set_field = schema.Set(
        title=u"Set field",
        description=u"zope.schema.Set",
        value_type=schema.Choice(
            values=[u"Beginner", u"Advanced", u"Professional"], ),
        required=False,
        missing_value={},
    )

    directives.widget(set_field_checkbox=CheckBoxFieldWidget)
    set_field_checkbox = schema.Set(
        title=u"Set field with checkboxes",
        description=u"zope.schema.Set",
        value_type=schema.Choice(
            values=[u"Beginner", u"Advanced", u"Professional"], ),
        required=False,
        missing_value={},
    )

    # File fields
    image_field = NamedBlobImage(
        title=u"Image field",
        description=
        u"A upload field for images (plone.namedfile.field.NamedBlobImage)",
        required=False,
    )

    file_field = NamedBlobFile(
        title=u"File field",
        description=
        u"A upload field for files (plone.namedfile.field.NamedBlobFile)",
        required=False,
    )

    # Date and Time fields
    datetime_field = schema.Datetime(
        title=u"Datetime field",
        description=u"Uses a date and time picker (zope.schema.Datetime)",
        required=False,
    )

    date_field = schema.Date(
        title=u"Date field",
        description=u"Uses a date picker (zope.schema.Date)",
        required=False,
    )

    time_field = schema.Time(
        title=u"Time field",
        description=u"zope.schema.Time",
        required=False,
    )

    timedelta_field = schema.Timedelta(
        title=u"Timedelta field",
        description=u"zope.schema.Timedelta",
        required=False,
    )

    # Relation Fields
    relationchoice_field = RelationChoice(
        title=u"Relationchoice field",
        description=u"z3c.relationfield.schema.RelationChoice",
        vocabulary="plone.app.vocabularies.Catalog",
        required=False,
    )

    relationlist_field = RelationList(
        title=u"Relationlist Field",
        description=u"z3c.relationfield.schema.RelationList",
        default=[],
        value_type=RelationChoice(vocabulary="plone.app.vocabularies.Catalog"),
        required=False,
        missing_value=[],
    )

    relationchoice_field_constrained = RelationChoice(
        title=u"Relationchoice field (only allows Documents)",
        description=u"z3c.relationfield.schema.RelationChoice",
        vocabulary="plone.app.vocabularies.Catalog",
        required=False,
    )
    directives.widget(
        "relationchoice_field_constrained",
        RelatedItemsFieldWidget,
        pattern_options={"selectableTypes": ["Document"]},
    )

    relationlist_field_constrained = RelationList(
        title=u"Relationlist Field (only allows Documents and Events)",
        description=u"z3c.relationfield.schema.RelationList",
        default=[],
        value_type=RelationChoice(vocabulary="plone.app.vocabularies.Catalog"),
        required=False,
        missing_value=[],
    )
    directives.widget(
        "relationlist_field_constrained",
        RelatedItemsFieldWidget,
        pattern_options={"selectableTypes": ["Document", "Event"]},
    )

    relationlist_field_search_mode = RelationList(
        title=
        u"Relationlist Field in Search Mode (constrained to published Documents and Events)",
        description=u"z3c.relationfield.schema.RelationList",
        default=[],
        value_type=RelationChoice(source=CatalogSource(
            portal_type=["Document", "Event"], review_state="published")),
        required=False,
        missing_value=[],
    )
    directives.widget(
        "relationlist_field_search_mode",
        RelatedItemsFieldWidget,
        pattern_options={
            "baseCriteria":
            [  # This is a optimization that limits the catalog-query
                {
                    "i": "portal_type",
                    "o": "plone.app.querystring.operation.selection.any",
                    "v": ["Document", "Event"],
                },
                {
                    "i": "review_state",
                    "o": "plone.app.querystring.operation.selection.any",
                    "v": "published",
                },
            ],
            "mode":
            "search",
        },
    )

    # From here on we use other widgets than the default RelatedItemsFieldWidget

    # This one also works in Volto!
    # All other options use the default ObjectWidget in Volto so far.
    relationchoice_field_select = RelationChoice(
        title=u"RelationChoice with Select Widget",
        vocabulary=StaticCatalogVocabulary({
            "portal_type": ["Document", "Event"],
            "review_state": "published",
        }),
        required=False,
    )
    directives.widget(
        "relationchoice_field_select",
        SelectFieldWidget,
    )

    relationchoice_field_radio = RelationChoice(
        title=
        u"RelationChoice with Radio Widget (and customized title-template)",
        vocabulary=StaticCatalogVocabulary(
            {
                "portal_type": ["Document", "Event"],
                "review_state": "published",
            },
            title_template="{brain.Title}",
        ),  # Set a custom vocabulary item title
        required=False,
    )
    directives.widget(
        "relationchoice_field_radio",
        RadioFieldWidget,
    )

    relationlist_field_select = RelationList(
        title=
        u"RelationList with select widget with items from a named vocabulary",
        value_type=RelationChoice(
            vocabulary="example.vocabularies.documents", ),
        required=False,
    )
    directives.widget(
        "relationlist_field_select",
        SelectFieldWidget,
        pattern_options={
            "closeOnSelect":
            False,  # Select2 option to leave dropdown open for multiple selection
        },
    )

    relationlist_field_checkbox = RelationList(
        title=u"RelationList with Checkboxes",
        value_type=RelationChoice(
            vocabulary="example.vocabularies.documents", ),
        required=False,
    )
    directives.widget(
        "relationlist_field_checkbox",
        CheckBoxFieldWidget,
    )

    relationchoice_field_ajax_select = RelationChoice(
        title=u"Relationchoice Field with AJAXSelect",
        description=u"z3c.relationfield.schema.RelationChoice",
        vocabulary=StaticCatalogVocabulary({
            "portal_type": ["Document", "Event"],
        }),
        required=False,
    )
    directives.widget(
        "relationchoice_field_ajax_select",
        AjaxSelectFieldWidget,
        vocabulary=StaticCatalogVocabulary({
            "portal_type": ["Document", "Event"],
        }),
        pattern_options={  # Options for Select2
            "minimumInputLength":
            2,  # - Don't query until at least two characters have been typed
            "ajax": {
                "quietMillis": 500
            },  # - Wait 500ms after typing to make query
        },
    )

    relationlist_field_ajax_select = RelationList(
        title=u"Relationlist Field with AJAXSelect",
        description=u"z3c.relationfield.schema.RelationList",
        value_type=RelationChoice(vocabulary=StaticCatalogVocabulary({
            "portal_type": ["Document", "Event"],
            "review_state":
            "published",
        })),
        required=False,
    )
    directives.widget(
        "relationlist_field_ajax_select",
        AjaxSelectFieldWidget,
        vocabulary=StaticCatalogVocabulary(
            {
                "portal_type": ["Document", "Event", "Folder"],
            },
            title_template="{brain.Type}: {brain.Title} at {path}",
        ),  # Custom item rendering
        pattern_options={  # Options for Select2
            "minimumInputLength":
            2,  # - Don't query until at least two characters have been typed
            "ajax": {
                "quietMillis": 500
            },  # - Wait 500ms after typing to make query
        },
    )

    # These look like relationsfields (see above) but only store the uuid(s) of the selected target
    # as a string in a the field instead of a RelationValue.
    # A good way to use these is in combination with a index that allows you to query these connenctions.
    uuid_choice_field = schema.Choice(
        title=u"Choice field with RelatedItems widget storing uuids",
        description=u"schema.Choice",
        vocabulary="plone.app.vocabularies.Catalog",
        required=False,
    )
    directives.widget("uuid_choice_field", RelatedItemsFieldWidget)

    uuid_list_field = schema.List(
        title=u"List Field with RelatedItems widget storing uuids",
        description=u"schema.List",
        default=[],
        value_type=schema.Choice(vocabulary="plone.app.vocabularies.Catalog"),
        required=False,
        missing_value=[],
    )
    directives.widget("uuid_list_field", RelatedItemsFieldWidget)

    uuid_choice_field_constrained = schema.Choice(
        title=
        u"Choice field with RelatedItems widget storing uuids (only allows Documents)",
        description=u"schema.Choice",
        vocabulary="plone.app.vocabularies.Catalog",
        required=False,
    )
    directives.widget(
        "uuid_choice_field_constrained",
        RelatedItemsFieldWidget,
        pattern_options={"selectableTypes": ["Document"]},
    )

    uuid_list_field_constrained = schema.List(
        title=
        u"List Field with RelatedItems widget storing uuids (only allows Documents and Events)",
        description=u"schema.List",
        default=[],
        value_type=schema.Choice(vocabulary="plone.app.vocabularies.Catalog"),
        required=False,
        missing_value=[],
    )
    directives.widget(
        "uuid_list_field_constrained",
        RelatedItemsFieldWidget,
        pattern_options={"selectableTypes": ["Document", "Folder"]},
    )

    uuid_list_field_search_mode = schema.List(
        title=
        u"List Field with RelatedItems widget in Search Mode storing uuids",
        description=u"schema.List",
        default=[],
        value_type=schema.Choice(source=CatalogSource(
            portal_type=["Document", "Event"], review_state="published")),
        required=False,
        missing_value=[],
    )
    directives.widget(
        "uuid_list_field_search_mode",
        RelatedItemsFieldWidget,
        pattern_options={
            "selectableTypes": ["Document", "Folder"],
            "basePath": "",  # Start the search at the portal root
            "mode": "search",
        },
    )

    # From here on we use other widgets than the default RelatedItemsFieldWidget

    uuid_choice_field_select = schema.Choice(
        title=u"UUID Choice with select widget storing uuids",
        vocabulary=StaticCatalogVocabulary({
            "portal_type": ["Document", "Event"],
            "review_state": "published",
        }),
        required=False,
    )
    directives.widget(
        "uuid_choice_field_select",
        SelectFieldWidget,
    )

    uuid_choice_field_radio = schema.Choice(
        title=u"RelationChoice with Radio widget storing uuids",
        vocabulary=StaticCatalogVocabulary(
            {
                "portal_type": ["Document", "Event"],
                "review_state": "published",
            },
            title_template="{brain.Title}",
        ),  # Set a custom vocabulary item title
        required=False,
    )
    directives.widget(
        "uuid_choice_field_radio",
        RadioFieldWidget,
    )

    uuid_list_field_select = schema.List(
        title=
        u"RelationList with select widget with items from a named vocabulary storing uuids",
        value_type=schema.Choice(
            vocabulary="example.vocabularies.documents", ),
        required=False,
    )
    directives.widget(
        "uuid_list_field_select",
        SelectFieldWidget,
        pattern_options={
            "closeOnSelect":
            False,  # Select2 option to leave dropdown open for multiple selection
        },
    )

    uuid_list_field_checkbox = schema.List(
        title=u"RelationList with Checkboxes storing uuids",
        value_type=schema.Choice(
            vocabulary="example.vocabularies.documents", ),
        required=False,
    )
    directives.widget(
        "uuid_list_field_checkbox",
        CheckBoxFieldWidget,
    )

    uuid_choice_field_ajax_select = schema.Choice(
        title=u"Relationchoice Field with AJAXSelect storing uuids",
        description=u"z3c.relationfield.schema.RelationChoice",
        vocabulary=StaticCatalogVocabulary({
            "portal_type": ["Document", "Event"],
        }),
        required=False,
    )
    directives.widget(
        "uuid_choice_field_ajax_select",
        AjaxSelectFieldWidget,
        vocabulary=StaticCatalogVocabulary({
            "portal_type": ["Document", "Event"],
        }),
        pattern_options={  # Options for Select2
            "minimumInputLength":
            2,  # - Don't query until at least two characters have been typed
            "ajax": {
                "quietMillis": 500
            },  # - Wait 500ms after typing to make query
        },
    )

    uuid_list_field_ajax_select = schema.List(
        title=u"Relationlist Field with AJAXSelect storing uuids",
        description=u"z3c.relationfield.schema.RelationList",
        value_type=schema.Choice(vocabulary=StaticCatalogVocabulary({
            "portal_type": ["Document", "Event"],
            "review_state":
            "published",
        })),
        required=False,
    )
    directives.widget(
        "uuid_list_field_ajax_select",
        AjaxSelectFieldWidget,
        vocabulary=StaticCatalogVocabulary(
            {
                "portal_type": ["Document", "Event"],
            },
            title_template="{brain.Type}: {brain.Title} at {path}",
        ),  # Custom item rendering
        pattern_options={  # Options for Select2
            "minimumInputLength":
            2,  # - Don't query until at least two characters have been typed
            "ajax": {
                "quietMillis": 500
            },  # - Wait 500ms after typing to make query
            "closeOnSelect":
            False,  # - Leave dropdown open for multiple selection
        },
    )

    # Number fields
    int_field = schema.Int(
        title=u"Integer Field (e.g. 12)",
        description=u"zope.schema.Int",
        required=False,
    )

    float_field = schema.Float(
        title=u"Float field, e.g. 12.7",
        description=u"zope.schema.Float",
        required=False,
    )

    # Text fields
    email_field = Email(
        title=u"Email field",
        description=
        u"A simple input field for a email (plone.schema.email.Email)",
        required=False,
    )

    uri_field = schema.URI(
        title=u"URI field",
        description=u"A simple input field for a URLs (zope.schema.URI)",
        required=False,
    )

    richtext_field = RichText(
        title=u"RichText field",
        description=
        u"This uses a richtext editor. (plone.app.textfield.RichText)",
        max_length=2000,
        required=False,
    )

    sourcetext_field = schema.SourceText(
        title=u"SourceText field",
        description=u"zope.schema.SourceText",
        required=False,
    )

    ascii_field = schema.ASCII(
        title=u"ASCII field",
        description=u"zope.schema.ASCII",
        required=False,
    )

    bytesline_field = schema.BytesLine(
        title=u"BytesLine field",
        description=u"zope.schema.BytesLine",
        required=False,
    )

    asciiline_field = schema.ASCIILine(
        title=u"ASCIILine field",
        description=u"zope.schema.ASCIILine",
        required=False,
    )

    pythonidentifier_field = schema.PythonIdentifier(
        title=u"PythonIdentifier field",
        description=u"zope.schema.PythonIdentifier",
        required=False,
    )

    dottedname_field = schema.DottedName(
        title=u"DottedName field",
        description=u"zope.schema.DottedName",
        required=False,
    )

    # dict_field = schema.Dict(
    #     title=u'Dict field',
    #     description=u"zope.schema.Dict",
    #     required=False,
    #     key_type=schema.TextLine(
    #         title=u'Key',
    #         required=False,
    #     ),
    #     value_type=schema.TextLine(
    #         title=u'Value',
    #         required=False,
    #     ),
    # )

    # vocabularyterms_field = Dict(  # we use the plone.schema field Dict not zope.schema field to use the attribute 'widget'
    #     title=u"Vocabulary terms field",
    #     description=u"plone.schema.Dict field with value_type schema.TextLine and frontend widget 'VocabularyTermsWidget'",
    #     required=False,
    #     key_type=schema.TextLine(
    #         title=u"Key",
    #         required=False,
    #     ),
    #     value_type=schema.TextLine(
    #         title=u"Value",
    #         required=False,
    #     ),
    #     widget="vocabularyterms",  # we use the widget attribute to apply the frontend widget VocabularyWidget
    # )

    # vocabularytermstranslation_field = Dict(  # we use the plone.schema field Dict not zope.schema field to use the attribute 'widget'
    #     title=u"Vocabulary terms field with translations",
    #     description=u"plone.schema.Dict field with value_type Dict and frontend widget 'VocabularyTermsWidget'",
    #     required=False,
    #     key_type=schema.TextLine(
    #         title=u"Key",
    #         required=False,
    #     ),
    #     value_type=Dict(  # we use the plone.schema field Dict not zope.schema field to use the attribute 'widget'
    #         title=u"Term translation",
    #         description=u"plone.schema.Dict field for translations of vocabulary term",
    #         required=True,
    #         key_type=schema.TextLine(
    #             title=u"Key",
    #             required=False,
    #         ),
    #         value_type=schema.TextLine(
    #             title=u"Value",
    #             required=False,
    #         ),
    #     ),
    #     widget="vocabularyterms",  # we use the widget attribute to apply the frontend widget VocabularyWidget
    # )

    # dict_field_with_choice = schema.Dict(
    #     title=u'Dict field with key and value as choice',
    #     description=u"zope.schema.Dict",
    #     required=False,
    #     key_type=schema.Choice(
    #         title=u'Key',
    #         values=[u'One', u'Two', u'Three'],
    #         required=False,
    #         ),
    #     value_type=schema.Set(
    #         title=u'Value',
    #         value_type=schema.Choice(
    #             values=[u'Beginner', u'Advanced', u'Professional'],
    #             ),
    #         required=False,
    #         missing_value={},
    #         ),
    #     )

    datagrid_field = schema.List(
        title=u"Datagrid field",
        description=u"schema.List",
        value_type=DictRow(title=u"Table", schema=IMyRowSchema),
        default=[],
        required=False,
    )
    directives.widget("datagrid_field", DataGridFieldFactory)
class IProgram(model.Schema):
    """A conference program. Programs can contain Tracks.
    """

    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,
    )

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

    talk_length = schema.List(
        title=_(u"Length Of Conference Talks"),
        description=
        _(u"Fill in the time slots for talks in minutes. Use a new line for every value / "
          u"talk length. Write only the numbers without the addition 'minutes'."
          ),
        value_type=schema.TextLine(),
        required=True,
    )

    workshop_length = schema.List(
        title=_(u"Length Of Conference Workshops"),
        description=
        _(u"Fill in the time slots for workshops in minutes. Use a new line for every value / "
          u"workshop length. Write only the numbers without the addition 'minutes'."
          ),
        value_type=schema.TextLine(),
        required=True,
    )

    break_length = schema.List(
        title=_(u"Length Of Conference Breaks"),
        description=
        _(u"Fill in the time slots for conference breaks in minutes. Use a new line for every "
          u"value / break length. Write only the numbers without the addition 'minutes'."
          ),
        value_type=schema.TextLine(),
        required=True,
    )

    directives.widget(organizer=AjaxSelectFieldWidget)
    organizer = schema.Choice(
        title=_(u"Organiser"),
        vocabulary=u"plone.app.vocabularies.Users",
        required=False,
    )

    @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."))
예제 #30
0
class ITUpRelease(model.Schema):
    directives.mode(information="display")
    information = schema.Text(
        title=_(safe_unicode("Information")),
        description=_(
            safe_unicode(
                "This Dialog to create a new release consists of different "
                "register. Please go through this register and fill in the "
                "appropriate data for your release. This register 'Default' "
                "provide fields for general information of your release. The "
                "next register 'compatibility' is the place to submit "
                "information about the versions with which your release file(s) "
                "is / are compatible. The following register asks for some "
                "legal informations. The next register File Upload' provide a "
                "field to upload your release file. The further register are "
                "optional. There is the opportunity to upload further release "
                "files (for different platforms).")))

    directives.mode(projecttitle='hidden')
    projecttitle = schema.TextLine(
        title=_(safe_unicode("The Computed Project Title")),
        description=_(
            safe_unicode(
                "The release title will be computed from the parent project "
                "title")),
        defaultFactory=getContainerTitle)

    releasenumber = schema.TextLine(
        title=_(safe_unicode("Release Number")),
        description=_(safe_unicode("Release Number (up to twelf chars)")),
        default=_(safe_unicode("1.0")),
        max_length=12)

    description = schema.Text(title=_(safe_unicode("Release Summary")), )

    primary('details')
    details = RichText(title=_(safe_unicode("Full Release Description")),
                       required=False)

    primary('changelog')
    changelog = RichText(
        title=_(safe_unicode("Changelog")),
        description=_(
            safe_unicode(
                "A detailed log of what has changed since the previous release."
            )),
        required=False,
    )

    model.fieldset('compatibility',
                   label=safe_unicode("Compatibility"),
                   fields=['compatibility_choice'])

    model.fieldset('legal',
                   label=safe_unicode("Legal"),
                   fields=[
                       'licenses_choice', 'title_declaration_legal',
                       'declaration_legal', 'accept_legal_declaration',
                       'source_code_inside', 'link_to_source'
                   ])

    directives.widget(licenses_choice=CheckBoxFieldWidget)
    licenses_choice = schema.List(
        title=_(safe_unicode('License of the uploaded file')),
        description=_(
            safe_unicode(
                "Please mark one or more licenses you publish your release.")),
        value_type=schema.Choice(source=vocabAvailLicenses),
        required=True,
    )

    directives.widget(compatibility_choice=CheckBoxFieldWidget)
    compatibility_choice = schema.List(
        title=_(safe_unicode("Compatible with versions of LibreOffice")),
        description=_(
            safe_unicode(
                "Please mark one or more program versions with which this "
                "release is compatible with.")),
        value_type=schema.Choice(source=vocabAvailVersions),
        required=True,
        default=[])

    directives.mode(title_declaration_legal='display')
    title_declaration_legal = schema.TextLine(
        title=_(safe_unicode("")),
        required=False,
        defaultFactory=legal_declaration_title)

    directives.mode(declaration_legal='display')
    declaration_legal = schema.Text(title=_(safe_unicode("")),
                                    required=False,
                                    defaultFactory=legal_declaration_text)

    accept_legal_declaration = schema.Bool(
        title=_(safe_unicode("Accept the above legal disclaimer")),
        description=_(
            safe_unicode(
                "Please declare that you accept the above legal disclaimer")),
        required=True)

    contact_address2 = schema.TextLine(
        title=_(safe_unicode("Contact email-address")),
        description=_(safe_unicode("Contact email-address for the project.")),
        required=False,
        defaultFactory=contactinfoDefault)

    source_code_inside = schema.Choice(title=_(
        safe_unicode("Is the source code inside the template?")),
                                       vocabulary=yesnochoice,
                                       required=True)

    link_to_source = schema.URI(title=_(
        safe_unicode("Please fill in the Link (URL) to the Source Code")),
                                required=False)

    model.fieldset('fileupload',
                   label=safe_unicode("Fileupload"),
                   fields=[
                       'tucfileextension', 'file', 'platform_choice',
                       'information_further_file_uploads'
                   ])

    directives.mode(tucfileextension='display')
    tucfileextension = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for template '
                'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedtemplatefileextensions,
    )

    file = NamedBlobFile(
        title=_(safe_unicode("The first file you want to upload")),
        description=_(safe_unicode("Please upload your file.")),
        required=True,
        constraint=validatetemplatefileextension)

    directives.widget(platform_choice=CheckBoxFieldWidget)
    platform_choice = schema.List(
        title=_(
            safe_unicode(
                "First uploaded file is compatible with the Platform(s)")),
        description=_(
            safe_unicode(
                "Please mark one or more platforms with which the uploaded file "
                "is compatible.")),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=True,
    )

    directives.mode(information_further_file_uploads='display')
    primary('information_further_file_uploads')
    information_further_file_uploads = RichText(
        title=_(safe_unicode("Further File Uploads for this Release")),
        description=_(
            safe_unicode(
                "If you want to upload more files for this release, e.g. "
                "because there are files for other operating systems, you'll "
                "find the upload fields on the register 'Further Uploads' and "
                "'Further More Uploads'.")),
        required=False)

    model.fieldset('fileset1',
                   label=safe_unicode("Further Uploads"),
                   fields=[
                       'tucfileextension1', 'file1', 'platform_choice1',
                       'tucfileextension2', 'file2', 'platform_choice2',
                       'tucfileextension3', 'file3', 'platform_choice3'
                   ])

    directives.mode(tucfileextension1='display')
    tucfileextension1 = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for template '
                'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedtemplatefileextensions,
    )

    file1 = NamedBlobFile(title=_(
        safe_unicode("The second file you want to upload (this is optional)")),
                          description=_(
                              safe_unicode("Please upload your file.")),
                          required=False,
                          constraint=validatetemplatefileextension)

    directives.widget(platform_choice1=CheckBoxFieldWidget)
    platform_choice1 = schema.List(
        title=_(
            safe_unicode(
                "Second uploaded file is compatible with the Platform(s)")),
        description=_(
            safe_unicode(
                "Please mark one or more platforms with which the uploaded file "
                "is compatible.")),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=False,
    )

    directives.mode(tucfileextension2='display')
    tucfileextension2 = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for template '
                'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedtemplatefileextensions,
    )

    file2 = NamedBlobFile(title=_(
        safe_unicode("The third file you want to upload (this is optional)")),
                          description=_(
                              safe_unicode("Please upload your file.")),
                          required=False,
                          constraint=validatetemplatefileextension)

    directives.widget(platform_choice2=CheckBoxFieldWidget)
    platform_choice2 = schema.List(
        title=_(
            safe_unicode(
                "Third uploaded file is compatible with the Platform(s))")),
        description=_(
            safe_unicode(
                "Please mark one or more platforms with which the uploaded file "
                "is compatible.")),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=False,
    )

    directives.mode(tucfileextension3='display')
    tucfileextension3 = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for template '
                'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedtemplatefileextensions,
    )

    file3 = NamedBlobFile(title=_(
        safe_unicode("The fourth file you want to upload (this is optional)")),
                          description=_(
                              safe_unicode("Please upload your file.")),
                          required=False,
                          constraint=validatetemplatefileextension)

    directives.widget(platform_choice3=CheckBoxFieldWidget)
    platform_choice3 = schema.List(
        title=_(
            safe_unicode(
                "Fourth uploaded file is compatible with the Platform(s)")),
        description=_(
            safe_unicode(
                "Please mark one or more platforms with which the uploaded file "
                "is compatible.")),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=False,
    )

    model.fieldset('fileset2',
                   label=safe_unicode("Further More Uploads"),
                   fields=[
                       'tucfileextension4', 'file4', 'platform_choice4',
                       'tucfileextension5', 'file5', 'platform_choice5'
                   ])

    directives.mode(tucfileextension4='display')
    tucfileextension4 = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for template '
                'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedtemplatefileextensions,
    )

    file4 = NamedBlobFile(title=_(
        safe_unicode("The fifth file you want to upload (this is optional)")),
                          description=_(
                              safe_unicode("Please upload your file.")),
                          required=False,
                          constraint=validatetemplatefileextension)

    directives.widget(platform_choice4=CheckBoxFieldWidget)
    platform_choice4 = schema.List(
        title=_(
            safe_unicode(
                "Fifth uploaded file is compatible with the Platform(s)")),
        description=_(
            safe_unicode(
                "Please mark one or more platforms with which the uploaded file "
                "is compatible.")),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=False,
    )

    directives.mode(tucfileextension5='display')
    tucfileextension5 = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for template '
                'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedtemplatefileextensions,
    )

    file5 = NamedBlobFile(title=_(
        safe_unicode("The sixth file you want to upload (this is optional)")),
                          description=_(
                              safe_unicode("Please upload your file.")),
                          required=False,
                          constraint=validatetemplatefileextension)

    directives.widget(platform_choice5=CheckBoxFieldWidget)
    platform_choice5 = schema.List(
        title=_(
            safe_unicode(
                "Sixth uploaded file is compatible with the Platform(s)")),
        description=_(
            safe_unicode(
                "Please mark one or more platforms with which the uploaded file "
                "is compatible.")),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=False,
    )

    @invariant
    def licensenotchoosen(value):
        if not value.licenses_choice:
            raise Invalid(
                _(safe_unicode("Please choose a license for your release.")))

    @invariant
    def compatibilitynotchoosen(data):
        if not data.compatibility_choice:
            raise Invalid(
                _(
                    safe_unicode(
                        "Please choose one or more compatible product versions for "
                        "your release")))

    @invariant
    def legaldeclarationaccepted(data):
        if data.accept_legal_declaration is not True:
            raise AcceptLegalDeclaration(
                _(
                    safe_unicode("Please accept the Legal Declaration about "
                                 "your Release and your Uploaded File")))

    @invariant
    def testingvalue(data):
        if data.source_code_inside != 1 and data.link_to_source is None:
            raise Invalid(
                _(
                    safe_unicode(
                        "You answered the question, whether the source code is "
                        "inside your template with no (default answer). If this is "
                        "the correct answer, please fill in the Link (URL) "
                        "to the Source Code.")))

    @invariant
    def noOSChosen(data):
        if data.file is not None and data.platform_choice == []:
            raise Invalid(
                _(
                    safe_unicode(
                        "Please choose a compatible platform for the uploaded file."
                    )))