Ignore:
Timestamp:
7 Mar 2024, 12:57:10 (8 months ago)
Author:
Henrik Bettermann
Message:

Simplify application

Location:
main/kofacustom.udss/trunk/src/kofacustom/udss
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.udss/trunk/src/kofacustom/udss/applicants/applicant.py

    r17689 r17711  
    1919import grok
    2020from zope.interface import implementedBy
    21 from waeup.kofa.applicants.applicant import ApplicantFactory
     21from waeup.kofa.applicants.applicant import ApplicantFactory, Applicant
    2222from waeup.kofa.utils.helpers import attrs_to_fields
    23 from kofacustom.nigeria.applicants.applicant import NigeriaApplicant
    2423from kofacustom.udss.applicants.interfaces import(
    25     ICustomApplicant, ICustomUGApplicantEdit, ICustomPGApplicantEdit, IPUTMEApplicantEdit)
     24    ICustomApplicant, ICustomUGApplicantEdit)
    2625
    27 class CustomApplicant(NigeriaApplicant):
     26class CustomApplicant(Applicant):
    2827
    29     grok.implements(ICustomApplicant, ICustomUGApplicantEdit,
    30         ICustomPGApplicantEdit, IPUTMEApplicantEdit)
     28    grok.implements(ICustomApplicant, ICustomUGApplicantEdit)
    3129    grok.provides(ICustomApplicant)
    3230
  • main/kofacustom.udss/trunk/src/kofacustom/udss/applicants/batching.py

    r17689 r17711  
    1919"""
    2020from kofacustom.nigeria.applicants.batching import NigeriaApplicantProcessor
    21 from waeup.kofa.applicants.batching import ApplicantOnlinePaymentProcessor
     21from waeup.kofa.applicants.batching import (
     22    ApplicantOnlinePaymentProcessor, ApplicantProcessor)
    2223from kofacustom.udss.applicants.interfaces import (
    2324    ICustomApplicant,
     
    2627    )
    2728
    28 class CustomApplicantProcessor(NigeriaApplicantProcessor):
     29class CustomApplicantProcessor(ApplicantProcessor):
    2930
    3031    iface = ICustomApplicant
  • main/kofacustom.udss/trunk/src/kofacustom/udss/applicants/browser.py

    r17689 r17711  
    1919"""
    2020import grok
     21from zope.formlib.textwidgets import BytesDisplayWidget
     22from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
    2123from waeup.kofa.applicants.browser import (
    2224    ApplicantRegistrationPage, ApplicantsContainerPage)
    23 from kofacustom.nigeria.applicants.browser import (
    24     NigeriaApplicantDisplayFormPage,
    25     NigeriaApplicantManageFormPage,
    26     NigeriaApplicantEditFormPage,
    27     NigeriaPDFApplicationSlip)
     25from waeup.kofa.applicants.browser import (
     26    ApplicantDisplayFormPage,
     27    ApplicantManageFormPage,
     28    ApplicantEditFormPage,
     29    ApplicantRegistrationPage,
     30    OnlinePaymentDisplayFormPage,
     31    OnlinePaymentBreadcrumb,
     32    ExportPDFPaymentSlipPage,
     33    )
     34from waeup.kofa.applicants.pdf import PDFApplicationSlip
    2835
    29 from kofacustom.nigeria.applicants.interfaces import (
    30     INigeriaPGApplicant, INigeriaUGApplicant,
    31     INigeriaPGApplicantEdit, INigeriaUGApplicantEdit,
    32     INigeriaApplicantOnlinePayment,
    33     UG_OMIT_DISPLAY_FIELDS,
    34     UG_OMIT_PDF_FIELDS,
    35     UG_OMIT_MANAGE_FIELDS,
    36     UG_OMIT_EDIT_FIELDS,
    37     PG_OMIT_DISPLAY_FIELDS,
    38     PG_OMIT_PDF_FIELDS,
    39     PG_OMIT_MANAGE_FIELDS,
    40     PG_OMIT_EDIT_FIELDS,
    41     )
    4236from kofacustom.udss.applicants.interfaces import (
    43     ICustomPGApplicant, ICustomUGApplicant, ICustomApplicant,
    44     ICustomPGApplicantEdit, ICustomUGApplicantEdit,
     37    ICustomUGApplicant,
     38    ICustomApplicant,
     39    ICustomUGApplicantEdit,
    4540    ICustomApplicantOnlinePayment,
    4641    )
     
    4843from kofacustom.udss.interfaces import MessageFactory as _
    4944
    50 class CustomApplicantEditFormPage(NigeriaApplicantEditFormPage):
     45OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted',
     46    'result_uploaded', 'suspended', 'special_application',)
     47
     48UG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + (
     49    'programme_type', 'course1', 'course2', 'course_admitted')
     50UG_OMIT_PDF_FIELDS = UG_OMIT_DISPLAY_FIELDS + ('phone',)
     51UG_OMIT_MANAGE_FIELDS = (
     52    'special_application',
     53    'programme_type', 'course1', 'course2', 'course_admitted')
     54UG_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + OMIT_DISPLAY_FIELDS + (
     55    'student_id',
     56    'notice',
     57    'jamb_age',
     58    'jamb_subjects',
     59    'jamb_score',
     60    'jamb_reg_number',
     61    'aggregate')
     62
     63class CustomApplicantDisplayFormPage(ApplicantDisplayFormPage):
     64    """A display view for applicant data.
     65    """
     66
     67    def _not_paid(self):
     68        return self.context.state in ('initialized', 'started',)
     69
     70    @property
     71    def form_fields(self):
     72        form_fields = grok.AutoFields(ICustomUGApplicant)
     73        for field in UG_OMIT_PDF_FIELDS:
     74            form_fields = form_fields.omit(field)
     75        form_fields['notice'].custom_widget = BytesDisplayWidget
     76        if not getattr(self.context, 'student_id'):
     77            form_fields = form_fields.omit('student_id')
     78        return form_fields
     79
     80class CustomPDFApplicationSlip(PDFApplicationSlip):
     81
     82    def _addLoginInformation(self):
     83        """ We do no longer render login information on
     84        pdf application slips.
     85        """
     86        return
     87
     88    def _reduced_slip(self):
     89        return getattr(self.context, 'result_uploaded', False)
     90
     91    @property
     92    def form_fields(self):
     93        form_fields = grok.AutoFields(ICustomUGApplicant)
     94        for field in UG_OMIT_PDF_FIELDS:
     95            form_fields = form_fields.omit(field)
     96        if not getattr(self.context, 'student_id'):
     97            form_fields = form_fields.omit('student_id')
     98        return form_fields
     99
     100class CustomApplicantManageFormPage(ApplicantManageFormPage):
     101    """A full edit view for applicant data.
     102    """
     103
     104    @property
     105    def form_fields(self):
     106        form_fields = grok.AutoFields(ICustomUGApplicant)
     107        for field in UG_OMIT_MANAGE_FIELDS:
     108            form_fields = form_fields.omit(field)
     109        form_fields['student_id'].for_display = True
     110        form_fields['applicant_id'].for_display = True
     111        return form_fields
     112
     113class CustomApplicantEditFormPage(ApplicantEditFormPage):
    51114    """An applicant-centered edit view for applicant data.
    52115    """
     116
     117    @property
     118    def form_fields(self):
     119        form_fields = grok.AutoFields(ICustomUGApplicantEdit)
     120        for field in UG_OMIT_EDIT_FIELDS:
     121            form_fields = form_fields.omit(field)
     122        form_fields['applicant_id'].for_display = True
     123        form_fields['reg_number'].for_display = True
     124        return form_fields
    53125
    54126    def unremovable(self, ticket):
  • main/kofacustom.udss/trunk/src/kofacustom/udss/applicants/export.py

    r17689 r17711  
    1919"""
    2020import grok
     21from waeup.kofa.applicants.export import ApplicantExporter
    2122from waeup.kofa.applicants.interfaces import IApplicantBaseData
    2223from waeup.kofa.utils.helpers import iface_names
    23 from kofacustom.nigeria.applicants.export import NigeriaApplicantExporter
    24 from kofacustom.nigeria.applicants.interfaces import (
    25     INigeriaUGApplicant, INigeriaPGApplicant)
    2624from kofacustom.udss.applicants.interfaces import (
    27     ICustomUGApplicant, ICustomPGApplicant)
     25    ICustomUGApplicant,)
    2826
    29 class CustomApplicantExporter(NigeriaApplicantExporter):
     27class CustomApplicantExporter(ApplicantExporter):
    3028    """Exporter for Custom Applicants.
    3129    """
     
    3331    fields = tuple(sorted(set(
    3432        iface_names(ICustomUGApplicant) +
    35         iface_names(ICustomPGApplicant) +
    36         iface_names(INigeriaUGApplicant) +
    37         iface_names(INigeriaPGApplicant) +
    3833        iface_names(IApplicantBaseData)
    3934        ))) + (
  • main/kofacustom.udss/trunk/src/kofacustom/udss/applicants/interfaces.py

    r17689 r17711  
    2828from waeup.kofa.schema import FormattedDate, TextLineChoice
    2929from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
    30 from waeup.kofa.applicants.interfaces import contextual_reg_num_source
     30from waeup.kofa.applicants.interfaces import (
     31    contextual_reg_num_source, IApplicantBaseData, IApplicantOnlinePayment,
     32    IApplicantUpdateByRegNo)
    3133from kofacustom.nigeria.applicants.interfaces import (
    3234    LGASource, high_qual, high_grade, exam_types,
    33     INigeriaUGApplicant, INigeriaPGApplicant,
    34     INigeriaApplicantOnlinePayment,
    35     INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,
    36     INigeriaApplicantUpdateByRegNo,
    37     IPUTMEApplicantEdit,
    38     )
     35    INigeriaApplicantOnlinePayment)
    3936from kofacustom.udss.interfaces import MessageFactory as _
    4037from kofacustom.udss.payments.interfaces import ICustomOnlinePayment
    4138
    42 class ICustomUGApplicant(INigeriaUGApplicant):
     39class ICustomUGApplicant(IApplicantBaseData):
    4340    """An undergraduate applicant.
    4441
     
    4845    """
    4946
    50 class ICustomPGApplicant(INigeriaPGApplicant):
    51     """A postgraduate applicant.
    5247
    53     This interface defines the least common multiple of all fields
    54     in pg application forms. In customized forms, fields can be excluded by
    55     adding them to the PG_OMIT* tuples.
    56     """
    57 
    58 
    59 class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
     48class ICustomApplicant(ICustomUGApplicant):
    6049    """An interface for both types of applicants.
    6150
     
    7665        """
    7766
    78 class ICustomUGApplicantEdit(INigeriaUGApplicantEdit):
     67class ICustomUGApplicantEdit(ICustomUGApplicant):
    7968    """An undergraduate applicant interface for edit forms.
    8069
     
    8877    """
    8978
    90 class ICustomPGApplicantEdit(INigeriaPGApplicantEdit):
    91     """A postgraduate applicant interface for editing.
    92 
    93     Here we can repeat the fields from base data and set the
    94     `required` and `readonly` attributes to True to further restrict
    95     the data access. Or we can allow only certain certificates to be
    96     selected by choosing the appropriate source.
    97 
    98     We cannot omit fields here. This has to be done in the
    99     respective form page.
    100     """
     79    email = schema.ASCIILine(
     80        title = _(u'Email Address'),
     81        required = True,
     82        constraint=validate_email,
     83        )
     84    date_of_birth = FormattedDate(
     85        title = _(u'Date of Birth'),
     86        required = True,
     87        show_year = True,
     88        )
    10189
    10290class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
     
    10593    """
    10694
    107 class IPUTMEApplicantEdit(IPUTMEApplicantEdit):
    108     """An undergraduate applicant interface for editing.
    109 
    110     Here we can repeat the fields from base data and set the
    111     `required` and `readonly` attributes to True to further restrict
    112     the data access. Or we can allow only certain certificates to be
    113     selected by choosing the appropriate source.
    114 
    115     We cannot omit fields here. This has to be done in the
    116     respective form page.
    117     """
    118 
    119 class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
     95class ICustomApplicantUpdateByRegNo(IApplicantUpdateByRegNo):
    12096    """Representation of an applicant.
    12197
  • main/kofacustom.udss/trunk/src/kofacustom/udss/applicants/tests/test_browser.py

    r17689 r17711  
    6060        applicant.email = 'anna@sample.com'
    6161        applicant.phone = u'+234-123-12345'
    62         applicant.course1 = self.certificate
    63         applicant.course2 = self.certificate
    64         applicant.course_admitted = self.certificate
     62        #applicant.course1 = self.certificate
     63        #applicant.course2 = self.certificate
     64        #applicant.course_admitted = self.certificate
    6565        applicant.notice = u'Some notice\nin lines.'
    66         applicant.screening_score = 98
    67         applicant.screening_venue = u'Exam Room'
    68         applicant.screening_date = u'Saturday, 16th June 2012 2:00:00 PM'
     66        #applicant.screening_score = 98
     67        #applicant.screening_venue = u'Exam Room'
     68        #applicant.screening_date = u'Saturday, 16th June 2012 2:00:00 PM'
    6969        applicant.password = 'any password'
    7070        return applicant
     
    8080        self.browser.open(self.manage_path)
    8181        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    82         self.fill_correct_values()
     82        self.browser.getControl(name="form.firstname").value = 'John'
     83        self.browser.getControl(name="form.middlename").value = 'Anthony'
     84        self.browser.getControl(name="form.lastname").value = 'Tester'
     85        #self.browser.getControl(name="form.course1").value = ['CERT1']
     86        self.browser.getControl(name="form.date_of_birth").value = '09/09/1988'
     87        self.browser.getControl(name="form.sex").value = ['m']
     88        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
    8389        self.browser.getControl("Save").click()
    8490        IWorkflowState(self.applicant).setState('submitted')
  • main/kofacustom.udss/trunk/src/kofacustom/udss/applicants/utils.py

    r17689 r17711  
    2929    """A collection of parameters and methods subject to customization.
    3030    """
     31
     32    APP_TYPES_DICT = {
     33        'app': ['General Application', 'APP'],
     34        }
  • main/kofacustom.udss/trunk/src/kofacustom/udss/interswitch/tests.py

    r17689 r17711  
    210210        self.browser.open(self.manage_path)
    211211        #IWorkflowState(self.student).setState('started')
    212         super(InterswitchTestsApplicants, self).fill_correct_values()
     212        self.browser.getControl(name="form.firstname").value = 'John'
     213        self.browser.getControl(name="form.middlename").value = 'Anthony'
     214        self.browser.getControl(name="form.lastname").value = 'Tester'
     215        #self.browser.getControl(name="form.course1").value = ['CERT1']
     216        self.browser.getControl(name="form.date_of_birth").value = '09/09/1988'
     217        self.browser.getControl(name="form.sex").value = ['m']
     218        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
    213219        self.applicantscontainer.application_fee = 1000.0
    214         self.browser.getControl(name="form.nationality").value = ['NG']
     220        #self.browser.getControl(name="form.nationality").value = ['NG']
    215221        self.browser.getControl(name="transition").value = ['start']
    216222        self.browser.getControl("Save").click()
  • main/kofacustom.udss/trunk/src/kofacustom/udss/utils/utils.py

    r16717 r17711  
    2424    """
    2525
     26    STUDY_MODES_DICT = {
     27        'ug_ft': 'n/a',
     28        'no': 'n/a',
     29        }
     30
     31    APP_CATS_DICT = {
     32        'basic': 'General Application',
     33        'no': 'No Application',
     34        }
Note: See TracChangeset for help on using the changeset viewer.