Ignore:
Timestamp:
14 Oct 2014, 17:45:38 (10 years ago)
Author:
Henrik Bettermann
Message:

Adjust registration forms. Add localization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.pcn/trunk/src/kofacustom/pcn/applicants/interfaces.py

    r11832 r11843  
    1818"""Customized interfaces of the university application package.
    1919"""
    20 
     20from datetime import datetime
     21from grokcore.content.interfaces import IContainer
     22from zc.sourcefactory.contextual import BasicContextualSourceFactory
     23from zope import schema
     24from zope.component import queryUtility, getUtility
     25from zope.catalog.interfaces import ICatalog
     26from zope.interface import Interface, Attribute, implements, directlyProvides
     27from zope.schema.interfaces import (
     28    ValidationError, ISource, IContextSourceBinder)
     29from waeup.kofa.browser.interfaces import IApplicantBase
     30from waeup.kofa.schema import TextLineChoice, FormattedDate
     31from waeup.kofa.interfaces import (
     32    IKofaObject, validate_email,
     33    SimpleKofaVocabulary)
     34from waeup.kofa.interfaces import MessageFactory as _
     35from waeup.kofa.payments.interfaces import IOnlinePayment
     36from waeup.kofa.schema import PhoneNumber
     37from waeup.kofa.students.vocabularies import GenderSource, RegNumberSource
     38from waeup.kofa.university.vocabularies import (
     39    AppCatSource, CertificateSource, SpecialApplicationSource)
    2140from waeup.kofa.applicants.interfaces import (
    22     IApplicantBaseData,
    23     IApplicantOnlinePayment,
    24     IApplicantEdit,
    25     )
     41    contextual_reg_num_source, AppCatCertificateSource,
     42    IApplicantOnlinePayment)
    2643from kofacustom.pcn.interfaces import MessageFactory as _
    2744
    28 class ICustomApplicant(IApplicantBaseData):
    29     """A custom applicant.
     45class ICustomApplicant(IApplicantBase):
     46    """The data for an applicant.
    3047
     48    This is a base interface with no field
     49    required. For use with processors, forms, etc., please use one of
     50    the derived interfaces below, which set more fields to required
     51    state, depending on use-case.
    3152    """
    3253
    33 class ICustomApplicantEdit(IApplicantEdit):
     54    def writeLogMessage(view, comment):
     55        """Adds an INFO message to the log file
     56        """
     57
     58    def createStudent():
     59        """Create a student object from applicatnt data
     60        and copy applicant object.
     61        """
     62
     63    history = Attribute('Object history, a list of messages')
     64    state = Attribute('The application state of an applicant')
     65    display_fullname = Attribute('The fullname of an applicant')
     66    application_date = Attribute('UTC datetime of submission, used for export only')
     67    password = Attribute('Encrypted password of a applicant')
     68    application_number = Attribute('The key under which the record is stored')
     69
     70    suspended = schema.Bool(
     71        title = _(u'Account suspended'),
     72        default = False,
     73        required = False,
     74        )
     75
     76    applicant_id = schema.TextLine(
     77        title = _(u'Applicant Id'),
     78        required = False,
     79        readonly = False,
     80        )
     81    reg_number = TextLineChoice(
     82        title = _(u'Registration Number'),
     83        readonly = False,
     84        required = True,
     85        source = contextual_reg_num_source,
     86        )
     87    firstname = schema.TextLine(
     88        title = _(u'First Name'),
     89        required = True,
     90        )
     91    middlename = schema.TextLine(
     92        title = _(u'Middle Name'),
     93        required = False,
     94        )
     95    lastname = schema.TextLine(
     96        title = _(u'Last Name (Surname)'),
     97        required = True,
     98        )
     99    date_of_birth = FormattedDate(
     100        title = _(u'Date of Birth'),
     101        required = False,
     102        #date_format = u'%d/%m/%Y', # Use grok-instance-wide default
     103        show_year = True,
     104        )
     105    sex = schema.Choice(
     106        title = _(u'Sex'),
     107        source = GenderSource(),
     108        required = True,
     109        )
     110    email = schema.ASCIILine(
     111        title = _(u'Email Address'),
     112        required = False,
     113        constraint=validate_email,
     114        )
     115    phone = PhoneNumber(
     116        title = _(u'Phone'),
     117        description = u'',
     118        required = False,
     119        )
     120    course1 = schema.Choice(
     121        title = _(u'1st Choice Course of Study'),
     122        source = AppCatCertificateSource(),
     123        required = True,
     124        )
     125
     126    notice = schema.Text(
     127        title = _(u'Notice'),
     128        required = False,
     129        )
     130
     131    course_admitted = schema.Choice(
     132        title = _(u'Admitted Course of Study'),
     133        source = CertificateSource(),
     134        required = False,
     135        )
     136    locked = schema.Bool(
     137        title = _(u'Form locked'),
     138        default = False,
     139        required = False,
     140        )
     141
     142class ICustomApplicantEdit(ICustomApplicant):
    34143    """A custom applicant interface for editing.
    35144
     
    41150    We cannot omit fields here. This has to be done in the
    42151    respective form page.
     152
    43153    """
     154
     155    email = schema.ASCIILine(
     156        title = _(u'Email Address'),
     157        required = True,
     158        constraint=validate_email,
     159        )
     160    course1 = schema.Choice(
     161        title = _(u'1st Choice Course of Study'),
     162        source = AppCatCertificateSource(),
     163        required = True,
     164        )
     165    course_admitted = schema.Choice(
     166        title = _(u'Admitted Course of Study'),
     167        source = CertificateSource(),
     168        required = False,
     169        readonly = True,
     170        )
     171    notice = schema.Text(
     172        title = _(u'Notice'),
     173        required = False,
     174        readonly = True,
     175        )
    44176
    45177class ICustomApplicantOnlinePayment(IApplicantOnlinePayment):
Note: See TracChangeset for help on using the changeset viewer.