Changeset 13877 for main


Ignore:
Timestamp:
4 Jun 2016, 18:31:00 (9 years ago)
Author:
Henrik Bettermann
Message:

Add components for TPU registration.

Location:
main/waeup.fceokene/trunk/src/waeup/fceokene/applicants
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/browser.py

    r13238 r13877  
    4646    BEC_OMIT_PDF_FIELDS,
    4747    BEC_OMIT_MANAGE_FIELDS,
    48     BEC_OMIT_EDIT_FIELDS
     48    BEC_OMIT_EDIT_FIELDS,
     49    ITPURegistration
    4950    )
    5051
     
    6061    def form_fields(self):
    6162        target = getattr(self.context.__parent__, 'prefix', None)
     63        if target == 'tpu':
     64            form_fields = grok.AutoFields(ITPURegistration).omit(
     65                'locked', 'suspended')
     66            return form_fields
    6267        form_fields = grok.AutoFields(ICustomUGApplicant)
    6368        if target is not None and target.startswith('bec'):
     
    107112    def form_fields(self):
    108113        target = getattr(self.context.__parent__, 'prefix', None)
     114        if target == 'tpu':
     115            form_fields = grok.AutoFields(ITPURegistration).omit(
     116                'locked', 'suspended')
     117            return form_fields
    109118        form_fields = grok.AutoFields(ICustomUGApplicant)
    110119        if target is not None and target.startswith('bec'):
     
    142151    def form_fields(self):
    143152        target = getattr(self.context.__parent__, 'prefix', None)
     153        if target == 'tpu':
     154            form_fields = grok.AutoFields(ITPURegistration)
     155            form_fields['applicant_id'].for_display = True
     156            return form_fields
    144157        form_fields = grok.AutoFields(ICustomUGApplicant)
    145158        if target is not None and target.startswith('bec'):
     
    160173    def form_fields(self):
    161174        target = getattr(self.context.__parent__, 'prefix', None)
     175        if target == 'tpu':
     176            form_fields = grok.AutoFields(ITPURegistration).omit(
     177                'locked', 'suspended')
     178            form_fields['applicant_id'].for_display = True
     179            form_fields['reg_number'].for_display = True
     180            form_fields['firstname'].for_display = True
     181            form_fields['middlename'].for_display = True
     182            form_fields['lastname'].for_display = True
     183            form_fields['lga'].for_display = True
     184            form_fields['matric_number'].for_display = True
     185            return form_fields
    162186        form_fields = grok.AutoFields(ICustomUGApplicantEdit)
    163187        if target is not None and target.startswith('bec'):
  • main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/export.py

    r13094 r13877  
    2222from kofacustom.nigeria.applicants.export import NigeriaApplicantExporter
    2323from kofacustom.nigeria.applicants.interfaces import INigeriaUGApplicant
    24 from waeup.fceokene.applicants.interfaces import ICustomUGApplicant
     24from waeup.fceokene.applicants.interfaces import (
     25    ICustomUGApplicant, ITPURegistration)
    2526
    2627class CustomApplicantExporter(NigeriaApplicantExporter):
     
    3132        ICustomUGApplicant.names() +
    3233        INigeriaUGApplicant.names() +
    33         IApplicantBaseData.names()
     34        IApplicantBaseData.names() +
     35        ITPURegistration.names()
    3436        )))
  • main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/interfaces.py

    r13238 r13877  
    2020
    2121from zope import schema
     22from zc.sourcefactory.basic import BasicSourceFactory
    2223from waeup.kofa.applicants.interfaces import (
    2324    IApplicantBaseData,
     
    2526from waeup.kofa.schoolgrades import ResultEntryField
    2627from waeup.kofa.interfaces import (
    27     SimpleKofaVocabulary, academic_sessions_vocab, validate_email)
    28 from waeup.kofa.schema import FormattedDate, TextLineChoice
     28    SimpleKofaVocabulary, academic_sessions_vocab, validate_email,
     29    IKofaObject)
     30from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber
    2931from waeup.kofa.schoolgrades import ResultEntryField
    3032from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
     
    3941    OMIT_DISPLAY_FIELDS
    4042    )
     43from waeup.fceokene.applicants.schools import SCHOOLS
    4144from waeup.fceokene.interfaces import MessageFactory as _
    4245
     
    5356    'aggregate')
    5457
     58class SchoolSource(BasicSourceFactory):
     59    """A source that delivers all kinds of registrations.
     60    """
     61    def getValues(self):
     62        sorted_items = sorted(SCHOOLS.items(),
     63                              key=lambda element: element[0])
     64        return [item[0] for item in sorted_items]
     65
     66    def getTitle(self, value):
     67        return u"%s: %s -- %s" % (
     68            SCHOOLS[value][0],
     69            SCHOOLS[value][1],
     70            SCHOOLS[value][2],)
     71
     72class ITPURegistration(IKofaObject):
     73    """A TPU registrant.
     74    """
     75
     76    suspended = schema.Bool(
     77        title = _(u'Account suspended'),
     78        default = False,
     79        required = False,
     80        )
     81
     82    locked = schema.Bool(
     83        title = _(u'Form locked'),
     84        default = False,
     85        required = False,
     86        )
     87
     88    applicant_id = schema.TextLine(
     89        title = _(u'Applicant Id'),
     90        required = False,
     91        readonly = False,
     92        )
     93
     94    reg_number = schema.TextLine(
     95        title = _(u'Registration Number'),
     96        required = False,
     97        readonly = False,
     98        )
     99
     100    matric_number = schema.TextLine(
     101        title = _(u'Matriculation Number'),
     102        required = False,
     103        readonly = False,
     104        )
     105
     106    firstname = schema.TextLine(
     107        title = _(u'First Name'),
     108        required = True,
     109        )
     110
     111    middlename = schema.TextLine(
     112        title = _(u'Middle Name'),
     113        required = False,
     114        )
     115
     116    lastname = schema.TextLine(
     117        title = _(u'Last Name (Surname)'),
     118        required = True,
     119        )
     120
     121    email = schema.ASCIILine(
     122        title = _(u'Email Address'),
     123        required = True,
     124        constraint=validate_email,
     125        )
     126
     127    phone = PhoneNumber(
     128        title = _(u'Phone'),
     129        description = u'',
     130        required = False,
     131        )
     132
     133    perm_address = schema.Text(
     134        title = _(u'Home Address'),
     135        required = False,
     136        readonly = False,
     137        )
     138
     139    lga = schema.Choice(
     140        source = LGASource(),
     141        title = _(u'State/LGA'),
     142        required = False,
     143        )
     144
     145    subj_comb = schema.TextLine(
     146        title = _(u'Subject Combination'),
     147        required = False,
     148        readonly = False,
     149        )
     150
     151    school1 = schema.Choice(
     152        title = _(u'1st Choice TPZ and School'),
     153        source = SchoolSource(),
     154        required = True,
     155        )
     156
     157    school2 = schema.Choice(
     158        title = _(u'2nd Choice TPZ and School'),
     159        source = SchoolSource(),
     160        required = True,
     161        )
     162
     163    school3 = schema.Choice(
     164        title = _(u'3rd Choice TPZ and School'),
     165        source = SchoolSource(),
     166        required = True,
     167        )
     168
    55169class ICustomUGApplicant(INigeriaUGApplicant):
    56170    """An undergraduate applicant.
     
    237351    """
    238352
    239 class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
    240     """An interface for both types of applicants.
     353class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant,
     354    ITPURegistration):
     355    """An interface for all types of applicants.
    241356
    242357    Attention: The ICustomPGApplicant field seetings will be overwritten
  • main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/utils.py

    r13027 r13877  
    4141        'pce': ['PCE Screening', 'PCE'],
    4242        'bec': ['Bachelor of Education Certificate Programmes', 'BEC'],
    43         'rem': ['Remedial', 'REM']
     43        'rem': ['Remedial', 'REM'],
     44        'tpu': ['Teaching Practice Unit', 'TPU'],
    4445        }
    4546
Note: See TracChangeset for help on using the changeset viewer.