Ignore:
Timestamp:
12 Jul 2018, 07:33:18 (6 years ago)
Author:
Henrik Bettermann
Message:

Customize application forms.

Location:
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/applicants/browser.py

    r15000 r15087  
    1919"""
    2020import grok
     21from zope.formlib.textwidgets import BytesDisplayWidget
    2122from waeup.kofa.applicants.browser import (
    2223    ApplicantRegistrationPage, ApplicantsContainerPage)
    2324from kofacustom.nigeria.applicants.browser import (
    2425    NigeriaApplicantDisplayFormPage,
    25     NigeriaPDFApplicationSlip)
     26    NigeriaPDFApplicationSlip,
     27    NigeriaApplicantManageFormPage,
     28    NigeriaApplicantEditFormPage)
     29from kofacustom.nigeria.applicants.interfaces import (
     30    UG_OMIT_DISPLAY_FIELDS,
     31    UG_OMIT_PDF_FIELDS,
     32    UG_OMIT_MANAGE_FIELDS,
     33    UG_OMIT_EDIT_FIELDS,
     34    PG_OMIT_DISPLAY_FIELDS,
     35    PG_OMIT_PDF_FIELDS,
     36    PG_OMIT_MANAGE_FIELDS,
     37    PG_OMIT_EDIT_FIELDS,
     38    )
     39from kofacustom.edopoly.applicants.interfaces import (
     40    ICustomUGApplicantEdit, ICustomUGApplicant,
     41    ICustomPGApplicantEdit, ICustomPGApplicant)
    2642
    2743from kofacustom.edopoly.interfaces import MessageFactory as _
    2844
     45# Fields to be omitted in all display forms. course_admitted is
     46# rendered separately.
     47
     48OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted',
     49    'result_uploaded', 'suspended', 'special_application',
     50    'bank_account_number',
     51    'bank_account_name',
     52    'bank_name')
     53
     54# UG students are all undergraduate students.
     55UG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + (
     56    'jamb_subjects_list', 'programme_type')
     57UG_OMIT_PDF_FIELDS = UG_OMIT_DISPLAY_FIELDS + ('phone',)
     58UG_OMIT_MANAGE_FIELDS = (
     59    'special_application',
     60    'jamb_subjects_list',
     61    'programme_type')
     62UG_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + OMIT_DISPLAY_FIELDS + (
     63    'student_id',
     64    'notice',
     65    'screening_score',
     66    'screening_venue',
     67    'screening_date',
     68#    'jamb_age',
     69#    'jamb_subjects',
     70#    'jamb_score',
     71#    'jamb_reg_number',
     72    'aggregate')
     73
     74class CustomApplicantDisplayFormPage(NigeriaApplicantDisplayFormPage):
     75    """A display view for applicant data.
     76    """
     77
     78    @property
     79    def form_fields(self):
     80        target = getattr(self.context.__parent__, 'prefix', None)
     81        form_fields = grok.AutoFields(ICustomUGApplicant)
     82        form_fields['notice'].custom_widget = BytesDisplayWidget
     83        form_fields['jamb_subjects'].custom_widget = BytesDisplayWidget
     84        if not getattr(self.context, 'student_id'):
     85            form_fields = form_fields.omit('student_id')
     86        if not getattr(self.context, 'screening_score'):
     87            form_fields = form_fields.omit('screening_score')
     88        if not getattr(self.context, 'screening_venue'):
     89            form_fields = form_fields.omit('screening_venue')
     90        if not getattr(self.context, 'screening_date'):
     91            form_fields = form_fields.omit('screening_date')
     92        return form_fields
     93
     94class CustomPDFApplicationSlip(NigeriaPDFApplicationSlip):
     95
     96    @property
     97    def form_fields(self):
     98        target = getattr(self.context.__parent__, 'prefix', None)
     99        form_fields = grok.AutoFields(ICustomUGApplicant)
     100        for field in UG_OMIT_PDF_FIELDS:
     101            form_fields = form_fields.omit(field)
     102        if not getattr(self.context, 'student_id'):
     103            form_fields = form_fields.omit('student_id')
     104        if not getattr(self.context, 'screening_score'):
     105            form_fields = form_fields.omit('screening_score')
     106        if not getattr(self.context, 'screening_venue'):
     107            form_fields = form_fields.omit('screening_venue')
     108        if not getattr(self.context, 'screening_date'):
     109            form_fields = form_fields.omit('screening_date')
     110        return form_fields
     111
     112class CustomApplicantManageFormPage(NigeriaApplicantManageFormPage):
     113    """A full edit view for applicant data.
     114    """
     115
     116    @property
     117    def form_fields(self):
     118        target = getattr(self.context.__parent__, 'prefix', None)
     119        form_fields = grok.AutoFields(ICustomUGApplicant)
     120        for field in UG_OMIT_MANAGE_FIELDS:
     121            form_fields = form_fields.omit(field)
     122        form_fields['student_id'].for_display = True
     123        form_fields['applicant_id'].for_display = True
     124        return form_fields
     125
     126class CustomApplicantEditFormPage(NigeriaApplicantEditFormPage):
     127    """An applicant-centered edit view for applicant data.
     128    """
     129
     130    @property
     131    def form_fields(self):
     132        target = getattr(self.context.__parent__, 'prefix', None)
     133        form_fields = grok.AutoFields(ICustomUGApplicantEdit)
     134        for field in UG_OMIT_EDIT_FIELDS:
     135            form_fields = form_fields.omit(field)
     136        form_fields['applicant_id'].for_display = True
     137        form_fields['reg_number'].for_display = True
     138        return form_fields
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/applicants/interfaces.py

    r15000 r15087  
    4545    This interface defines the least common multiple of all fields
    4646    in ug application forms. In customized forms, fields can be excluded by
    47     adding them to the UG_OMIT* tuples.
    48     """
     47    adding them to the OMIT* tuples.
     48    """
     49
     50    nationality = schema.Choice(
     51        source = nats_vocab,
     52        title = _(u'Nationality'),
     53        required = True,
     54        )
     55    lga = schema.Choice(
     56        source = LGASource(),
     57        title = _(u'State/LGA (Nigerians only)'),
     58        required = False,
     59        )
     60    #perm_address = schema.Text(
     61    #    title = _(u'Permanent Address'),
     62    #    required = False,
     63    #    )
     64    course1 = schema.Choice(
     65        title = _(u'1st Choice Course of Study'),
     66        source = AppCatCertificateSource(),
     67        required = False,
     68        )
     69    course2 = schema.Choice(
     70        title = _(u'2nd Choice Course of Study'),
     71        source = AppCatCertificateSource(),
     72        required = False,
     73        )
     74    olevel_type = schema.Choice(
     75        title = _(u'1st Qualification Obtained'),
     76        required = False,
     77        readonly = False,
     78        vocabulary = exam_types,
     79        )
     80    olevel_school = schema.TextLine(
     81        title = _(u'1st Institution Attended'),
     82        required = False,
     83        readonly = False,
     84        )
     85    olevel_exam_number = schema.TextLine(
     86        title = _(u'1st Exam Number'),
     87        required = False,
     88        readonly = False,
     89        )
     90    olevel_exam_date = FormattedDate(
     91        title = _(u'1st Exam Date'),
     92        required = False,
     93        readonly = False,
     94        show_year = True,
     95        )
     96    olevel_results = schema.List(
     97        title = _(u'1st Exam Results'),
     98        value_type = ResultEntryField(),
     99        required = False,
     100        readonly = False,
     101        defaultFactory=list,
     102        )
     103    olevel_type2 = schema.Choice(
     104        title = _(u'2nd Qualification Obtained'),
     105        required = False,
     106        readonly = False,
     107        vocabulary = exam_types,
     108        )
     109    olevel_school2 = schema.TextLine(
     110        title = _(u'2nd Institution Attended'),
     111        required = False,
     112        readonly = False,
     113        )
     114    olevel_exam_number2 = schema.TextLine(
     115        title = _(u'2nd Exam Number'),
     116        required = False,
     117        readonly = False,
     118        )
     119    olevel_exam_date2 = FormattedDate(
     120        title = _(u'2nd Exam Date'),
     121        required = False,
     122        readonly = False,
     123        show_year = True,
     124        )
     125    olevel_results2 = schema.List(
     126        title = _(u'2nd Exam Results'),
     127        value_type = ResultEntryField(),
     128        required = False,
     129        readonly = False,
     130        defaultFactory=list,
     131        )
     132    hq_type = schema.Choice(
     133        title = _(u'Qualification Obtained'),
     134        required = False,
     135        readonly = False,
     136        vocabulary = high_qual,
     137        )
     138    hq_matric_no = schema.TextLine(
     139        title = _(u'Former Matric Number'),
     140        required = False,
     141        readonly = False,
     142        )
     143    hq_degree = schema.Choice(
     144        title = _(u'Class of Degree'),
     145        required = False,
     146        readonly = False,
     147        vocabulary = high_grade,
     148        )
     149    hq_school = schema.TextLine(
     150        title = _(u'Institution Attended'),
     151        required = False,
     152        readonly = False,
     153        )
     154    hq_session = schema.TextLine(
     155        title = _(u'Years Attended'),
     156        required = False,
     157        readonly = False,
     158        )
     159    hq_disc = schema.TextLine(
     160        title = _(u'Discipline'),
     161        required = False,
     162        readonly = False,
     163        )
     164    jamb_subjects = schema.Text(
     165        title = _(u'Subjects and Scores'),
     166        description = _(u'(one subject with score per line)'),
     167        required = False,
     168        )
     169    jamb_score = schema.Int(
     170        title = _(u'Total JAMB Score'),
     171        required = False,
     172        )
     173    jamb_reg_number = schema.TextLine(
     174        title = _(u'JAMB Registration Number'),
     175        required = False,
     176        )
     177    notice = schema.Text(
     178        title = _(u'Notice'),
     179        required = False,
     180        )
     181    screening_venue = schema.TextLine(
     182        title = _(u'Screening Venue'),
     183        required = False,
     184        )
     185    screening_date = schema.TextLine(
     186        title = _(u'Screening Date'),
     187        required = False,
     188        )
     189    screening_score = schema.Int(
     190        title = _(u'Screening Score (%)'),
     191        required = False,
     192        )
     193    aggregate = schema.Int(
     194        title = _(u'Aggregate Score (%)'),
     195        description = _(u'(average of relative JAMB and PUTME scores)'),
     196        required = False,
     197        )
     198    result_uploaded = schema.Bool(
     199        title = _(u'Result uploaded'),
     200        default = False,
     201        required = False,
     202        )
     203    student_id = schema.TextLine(
     204        title = _(u'Student Id'),
     205        required = False,
     206        readonly = False,
     207        )
     208    course_admitted = schema.Choice(
     209        title = _(u'Admitted Course of Study'),
     210        source = CertificateSource(),
     211        required = False,
     212        )
     213    locked = schema.Bool(
     214        title = _(u'Form locked'),
     215        default = False,
     216        required = False,
     217        )
    49218
    50219class ICustomPGApplicant(INigeriaPGApplicant):
     
    76245        """
    77246
    78 class ICustomUGApplicantEdit(INigeriaUGApplicantEdit):
     247class ICustomUGApplicantEdit(ICustomUGApplicant):
    79248    """An undergraduate applicant interface for edit forms.
    80249
     
    88257    """
    89258
    90 class ICustomPGApplicantEdit(INigeriaPGApplicantEdit):
     259
     260    email = schema.ASCIILine(
     261        title = _(u'Email Address'),
     262        required = True,
     263        constraint=validate_email,
     264        )
     265    date_of_birth = FormattedDate(
     266        title = _(u'Date of Birth'),
     267        required = True,
     268        show_year = True,
     269        )
     270    jamb_reg_number = schema.TextLine(
     271        title = _(u'JAMB Registration Number'),
     272        required = True,
     273        )
     274    course1 = schema.Choice(
     275        title = _(u'1st Choice Course of Study'),
     276        source = AppCatCertificateSource(),
     277        required = True,
     278        )
     279
     280ICustomUGApplicantEdit[
     281    'date_of_birth'].order =  ICustomUGApplicant['date_of_birth'].order
     282ICustomUGApplicantEdit[
     283    'email'].order =  ICustomUGApplicant['email'].order
     284ICustomUGApplicantEdit[
     285    'jamb_reg_number'].order =  ICustomUGApplicant['jamb_reg_number'].order
     286ICustomUGApplicantEdit[
     287    'course1'].order =  ICustomUGApplicant['course1'].order
     288
     289class ICustomPGApplicantEdit(ICustomPGApplicant):
    91290    """A postgraduate applicant interface for editing.
    92291
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/applicants/utils.py

    r15000 r15087  
    2929    """A collection of parameters and methods subject to customization.
    3030    """
     31
     32    APP_TYPES_DICT = {
     33        #'pude': ['Post-UDE Screening', 'PUDE'],
     34        #'prence': ['Pre-NCE Programme', 'PRE'],
     35        #'sandwich': ['Part-Time Degree in Education', 'SAND'],
     36        'pt': ['Part-Time Degree Programmes', 'PTP'],
     37        #'putme': ['Post-UTME Screening Exercise', 'PUTME'],
     38        'app': ['General Studies', 'APP'],
     39        #'cest': ['Common Entry Screening Test', 'CEST'],
     40        #'ct': ['Certificate Programmes', 'CTP'],
     41        #'dp': ['Diploma Programmes', 'DPP'],
     42        #'pce': ['PCE Screening', 'PCE'],
     43        #'pgft': ['Postgraduate Full-Time Programmes', 'PG'],
     44        #'pgpt': ['Postgraduate Part-Time Programmes', 'PG'],
     45        #'pre': ['Pre-Degree Studies', 'PRE'],
     46        #'cbt': ['CBT Practice Test', 'CBT'],
     47        'ase': ['Admission Screening Exercise', 'ASE'], # successor of putme
     48        }
     49
     50    SEPARATORS_DICT = {
     51        'form.applicant_id': _(u'Base Data'),
     52        'form.course1': _(u'Programmes/Courses Desired'),
     53        'form.hq_type': _(u'Higher Education Record'),
     54        'form.presently': _(u'Course or Programme Presently Attending'),
     55        'form.nysc_year': _(u'NYSC Information'),
     56        'form.employer': _(u'Employment History'),
     57        'form.jamb_subjects': _(u'JAMB Data'),
     58        'form.notice': _(u'Application Process Information'),
     59        'form.pp_school': _(u'Post Primary School Qualification'),
     60        'form.presently_inst': _(u'Presently attending a course or programme'),
     61        'form.olevel_type': _(u"'O' Level Records"),
     62        }
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/interswitch/tests.py

    r15074 r15087  
    105105            self.browser.contents)
    106106        self.assertTrue(
    107             'item_name="Tuition and Exams Fee" item_amt="3775000" bank_id="121" acct_num="0068241848"' in
     107            'item_name="Tuition/Exams Fee and Student Union Dues" item_amt="3775000" bank_id="121" acct_num="0068241848"' in
    108108            self.browser.contents)
    109109        self.assertTrue(
Note: See TracChangeset for help on using the changeset viewer.