Ignore:
Timestamp:
7 Apr 2016, 14:21:25 (8 years ago)
Author:
Henrik Bettermann
Message:

Define IUnibenRegistration for ICTWK registrations and implement RegTypesSource?.

File:
1 edited

Legend:

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

    r13796 r13814  
    4040    NigeriaPDFApplicationSlip)
    4141from waeup.uniben.applicants.interfaces import (
    42     ICustomApplicant)
     42    ICustomApplicant, IUnibenRegistration)
    4343from waeup.kofa.applicants.workflow import ADMITTED, PAID
    4444
     
    6161PASTQ_MSS = ['ACC','BNK','BUS','ECO','GEO','POL','SAA','SWK'] + PASTQ_ALL
    6262
    63 ICT_WEEK_FIELDS = (
    64     'course1',
    65     'course2',
    66     'aggregate',
    67     'screening_score',
    68     'screening_venue',
    69     'screening_date',
    70     'jamb_subjects',
    71     'jamb_score',
    72     'jamb_reg_number',
    73     'hq_type',
    74     'hq_matric_no',
    75     'hq_degree',
    76     'hq_school',
    77     'hq_session',
    78     'hq_disc',
    79     'student_id',
    80     'course_admitted',
     63REGISTRATION_OMIT_DISPLAY_FIELDS = (
     64    'locked',
     65    'suspended',
    8166    )
    8267
     68REGISTRATION_OMIT_EDIT_FIELDS = (
     69    'locked',
     70    'suspended',
     71    'applicant_id',
     72    )
     73
     74REGISTRATION_OMIT_MANAGE_FIELDS = (
     75    'applicant_id',
     76    )
     77
     78
     79REGISTRATION_OMIT_PDF_FIELDS = (
     80    'locked',
     81    'suspended',
     82    )
    8383class CustomApplicantsContainerPage(ApplicantsContainerPage):
    8484    """The standard view for regular applicant containers.
     
    140140               and self.context.state in ('paid', 'submitted')
    141141
    142     # Customizations for admission checking payments
    143 
    144     @property
    145     def form_fields(self):
    146         form_fields = super(CustomApplicantDisplayFormPage, self).form_fields
    147         if self.target == 'ictwk':
    148             for field in ICT_WEEK_FIELDS:
     142    @property
     143    def label(self):
     144        if self.target == 'ictwk':
     145            container_title = self.context.__parent__.title
     146            return _('${a} <br /> Registration Record ${b}', mapping = {
     147                'a':container_title, 'b':self.context.application_number})
     148        return super(CustomApplicantDisplayFormPage, self).label
     149
     150    @property
     151    def form_fields(self):
     152        if self.target == 'ictwk':
     153            form_fields = grok.AutoFields(IUnibenRegistration)
     154            for field in REGISTRATION_OMIT_DISPLAY_FIELDS:
    149155                form_fields = form_fields.omit(field)
    150156            return form_fields
     157        form_fields = super(CustomApplicantDisplayFormPage, self).form_fields
    151158        if not self.context.admchecking_fee_paid():
    152159            form_fields = form_fields.omit(
     
    256263
    257264    @property
    258     def form_fields(self):
     265    def label(self):
     266        if self.target == 'ictwk':
     267            container_title = self.context.__parent__.title
     268            return _('${a} <br /> Registration Record ${b}', mapping = {
     269                'a':container_title, 'b':self.context.application_number})
     270        return super(CustomApplicantManageFormPage, self).label
     271
     272    @property
     273    def form_fields(self):
     274        if self.target == 'ictwk':
     275            form_fields = grok.AutoFields(IUnibenRegistration)
     276            for field in REGISTRATION_OMIT_MANAGE_FIELDS:
     277                form_fields = form_fields.omit(field)
     278            return form_fields
    259279        form_fields = super(CustomApplicantManageFormPage, self).form_fields
    260         if self.target == 'ictwk':
    261             for field in ICT_WEEK_FIELDS:
    262                 form_fields = form_fields.omit(field)
    263280        return form_fields
    264281
     
    270287    @property
    271288    def form_fields(self):
     289        if self.target == 'ictwk':
     290            form_fields = grok.AutoFields(IUnibenRegistration)
     291            for field in REGISTRATION_OMIT_EDIT_FIELDS:
     292                form_fields = form_fields.omit(field)
     293            return form_fields
    272294        form_fields = super(CustomApplicantEditFormPage, self).form_fields
    273         if self.target == 'ictwk':
    274             for field in ICT_WEEK_FIELDS:
    275                 form_fields = form_fields.omit(field)
    276         return form_fields
     295        return form_fields
     296
     297    @property
     298    def label(self):
     299        if self.target == 'ictwk':
     300            container_title = self.context.__parent__.title
     301            return _('${a} <br /> Registration Record ${b}', mapping = {
     302                'a':container_title, 'b':self.context.application_number})
     303        return super(CustomApplicantEditFormPage, self).label
    277304
    278305class CustomOnlinePaymentApprovePage(OnlinePaymentApprovePage):
     
    328355
    329356    @property
     357    def form_fields(self):
     358        if self.target == 'ictwk':
     359            form_fields = grok.AutoFields(IUnibenRegistration)
     360            for field in REGISTRATION_OMIT_PDF_FIELDS:
     361                form_fields = form_fields.omit(field)
     362            return form_fields
     363        form_fields = super(CustomPDFApplicationSlip, self).form_fields
     364        return form_fields
     365
     366    @property
    330367    def title(self):
    331368        container_title = self.context.__parent__.title
     
    333370        ar_translation = translate(_('Application Record'),
    334371            'waeup.kofa', target_language=portal_language)
    335         if 'afas' in self.target:
     372        if self.target == 'ictwk':
     373            return '%s - Registration Record %s' % (container_title,
     374            self.context.application_number)
     375        elif 'afas' in self.target:
    336376            return 'Federal College of Education (Technical) Asaba - %s %s %s' % (
    337377                container_title, ar_translation,
Note: See TracChangeset for help on using the changeset viewer.