コード例 #1
0
    def handleApply(self, action):
        data, errors = self.extractData()
        typestool = getToolByName(self.context, 'portal_types')
        # wftool = getToolByName(self.context, 'portal_workflow')
        plone_utils = getToolByName(self.context, 'plone_utils')
        # if not self.context.has_key('registrations'):
        if 'registrations' not in self.context:
            unrestrictedExec(
                typestool.constructContent,
                type_name='Folder',
                container=self.context,
                id='registrations'
            )
            unrestrictedExec(
                self.context['registrations'].setTitle,
                'Registrations'
            )
            cschema = self.context['registrations'].Schema()
            cschema['excludeFromNav'].set(
                self.context['registrations'],
                True
            )
            self.context['registrations'].reindexObject()
        container = self.context['registrations']
        identifier = str(len(container.keys()) + 1)

        unrestrictedExec(
            typestool.constructContent,
            type_name='BarcampParticipant',
            container=container,
            id=identifier,
            **data
        )
        plone_utils.addPortalMessage(
            _(u'Thank you for your submission. You are now registered'),
            'info'
        )
        self.request.response.redirect(self.context.absolute_url())
コード例 #2
0
from zope.interface import implements

BarcampEventSchema = folder.ATFolderSchema.copy() + atapi.Schema(
    (
        # -*- Your Archetypes field definitions here ... -*-
        atapi.TextField(
            "text",
            required=False,
            searchable=True,
            storage=atapi.AnnotationStorage(),
            allowable_content_types=("text/plain", "text/structured", "text/html", "application/msword"),
            validators=("isTidyHtmlWithCleanup",),
            # validators=('isTidyHtml',),
            default_output_type="text/html",
            widget=atapi.RichWidget(description=_(u""), label=_(u"Body Text"), rows=25, allow_file_upload=False),
        ),
        atapi.DateTimeField(
            "startDate",
            required=True,
            searchable=False,
            storage=atapi.AnnotationStorage(),
            default_method=DateTime,
            widget=atapi.CalendarWidget(description="", label=_(u"Event Starts")),
        ),
        atapi.DateTimeField(
            "endDate",
            required=True,
            searchable=False,
            storage=atapi.AnnotationStorage(),
            default_method=DateTime,
コード例 #3
0
from collective.barcamp import barcampMessageFactory as _
from collective.barcamp.unrestrictor import unrestrictedExec
from plone.i18n.normalizer.interfaces import IIDNormalizer
from plone.z3cform.layout import wrap_form

from z3c.form import button
from z3c.form import field
from z3c.form import form
from zope import interface
from zope import schema
from zope.component import queryUtility
from zope.schema.vocabulary import SimpleTerm
from zope.schema.vocabulary import SimpleVocabulary

LEVEL_VOCAB = SimpleVocabulary([
    SimpleTerm(value=u'beginner', title=_(u'Beginner')),
    SimpleTerm(value=u'intermediate', title=_(u'Intermediate')),
    SimpleTerm(value=u'advanced', title=_(u'Advanced'))
])

STYPE_VOCAB = SimpleVocabulary([
    SimpleTerm(value=u'talk', title=_(u'Talk')),
    SimpleTerm(value=u'hackfest', title=_(u'Hackfest')),
    SimpleTerm(value=u'workshop', title=_(u'Workshop')),
    SimpleTerm(value=u'discussion', title=_(u'Discussion'))
])


class ISessionSubmissionForm(interface.Interface):
    title = schema.TextLine(title=_(u'Title'))
    description = schema.Text(title=_(u'Description'), required=True)
コード例 #4
0
from cioppino.twothumbs.interfaces import ILoveThumbsDontYou
# -*- Message Factory Imported Here -*-
from collective.barcamp import barcampMessageFactory as _
from collective.barcamp.config import PROJECTNAME
from collective.barcamp.interfaces import IBarcampSession
from zope.interface import implements

BarcampSessionSchema = ATEventSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-
    atapi.StringField(
        'speaker',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u'Speaker'),
        ),
    ),
    atapi.StringField(
        'level',
        storage=atapi.AnnotationStorage(),
        widget=atapi.SelectionWidget(
            format='select',
            label=_(u'Level'),
        ),
        vocabulary=[_(u'Beginner'), _(u'Intermediate'), _(u'Advanced')]
    ),
    atapi.StringField(
        'session_type',
        storage=atapi.AnnotationStorage(),
        widget=atapi.SelectionWidget(