Example #1
0
def PlanTypesVocabulary(context):
    items = [
        (_(u'By Text'), 'plantext'),
        (_(u'By File'), 'planfile'),
    ]

    items = [SimpleTerm(i[1], i[1], i[0]) for i in items]
    return SimpleVocabulary(items)
Example #2
0
class IPlanFolder(model.Schema):
    """Dexterity-schema for Folders of plan."""

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

    description = schema.Text(
        title=_(u'Description'),
        required=False,
    )
Example #3
0
def isValidFileType(value):

    if value:
        if value.contentType != 'application/pdf':
            raise Invalid(
                _(u'Invalid Type File: please correct it, only accept pdf file'
                  ))

    return True
Example #4
0
class IConferenceInfo(Interface):
    conference_title = schema.TextLine(
        title=_(u'label_conference_title', default=u'Título'),
        required=False,
    )

    conference_month = schema.Choice(
        title=_(u'label_conference_month',
                default=u'Mes probable de realización'),
        vocabulary="matem.cv.vocabularies.MonthsVocabularyFactory",
        required=False,
    )

    conference_institution = schema.TextLine(
        title=_(u'label_conference_institution', default=u'Institución'),
        required=False,
    )

    conference_scope = schema.Choice(
        title=_(u'label_conference_', default=u'Ambito'),
        vocabulary="matem.cv.vocabularies.EventType",
        required=False,
    )
Example #5
0
class IPlan(model.Schema):
    """Dexterity Schema for Plans."""

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

    plan_type = MasterSelectField(
        title=_(u'label_plan_type', default=u'Plan type'),
        vocabulary='matem.sis.PlanTypesVocabulary',
        default='plantext',
        required=True,
        slave_fields=(
            {
                'name': 'text',
                'action': 'hide',
                'hide_values': ('planfile', ),
                'siblings': True,
            },
            {
                'name': 'file',
                'action': 'hide',
                'hide_values': ('plantext', ),
                'siblings': True,
            },
            {
                'name': 'textfile',
                'action': 'hide',
                'hide_values': ('plantext', 'planfile'),
                'siblings': True,
            },
            {
                'name': 'conferences',
                'action': 'hide',
                'hide_values': ('planfile', ),
                'siblings': True,
            },
        ),
    )

    form.widget('text', cols=80, rows=20)
    text = schema.Text(
        title=_(u'Text'),
        description=_(
            u'label_help_text',
            u'You can use article latex format and the packages included are: latexsym and amsmath'
        ),
        required=False,
        defaultFactory=defaultPlanText,
    )

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

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

    directives.omitted('thumbpdf')
    thumbpdf = NamedBlobImage(
        title=_(u'ImageThumb'),
        required=False,
    )

    form.widget(
        'conferences',
        DataGridFieldFactory,
        allow_reorder=True,
        # allow_insert=False,
        # allow_delete=False,
        # auto_append=False,
    )
    conferences = schema.List(
        title=_(u'label_conferences', u'Actividades Académiccas a organizar'),
        value_type=DictRow(title=_(u'Conferencia'), schema=IConferenceInfo),
        required=False,
    )