Changeset 17711
- Timestamp:
- 7 Mar 2024, 12:57:10 (10 months ago)
- 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 19 19 import grok 20 20 from zope.interface import implementedBy 21 from waeup.kofa.applicants.applicant import ApplicantFactory 21 from waeup.kofa.applicants.applicant import ApplicantFactory, Applicant 22 22 from waeup.kofa.utils.helpers import attrs_to_fields 23 from kofacustom.nigeria.applicants.applicant import NigeriaApplicant24 23 from kofacustom.udss.applicants.interfaces import( 25 ICustomApplicant, ICustomUGApplicantEdit , ICustomPGApplicantEdit, IPUTMEApplicantEdit)24 ICustomApplicant, ICustomUGApplicantEdit) 26 25 27 class CustomApplicant( NigeriaApplicant):26 class CustomApplicant(Applicant): 28 27 29 grok.implements(ICustomApplicant, ICustomUGApplicantEdit, 30 ICustomPGApplicantEdit, IPUTMEApplicantEdit) 28 grok.implements(ICustomApplicant, ICustomUGApplicantEdit) 31 29 grok.provides(ICustomApplicant) 32 30 -
main/kofacustom.udss/trunk/src/kofacustom/udss/applicants/batching.py
r17689 r17711 19 19 """ 20 20 from kofacustom.nigeria.applicants.batching import NigeriaApplicantProcessor 21 from waeup.kofa.applicants.batching import ApplicantOnlinePaymentProcessor 21 from waeup.kofa.applicants.batching import ( 22 ApplicantOnlinePaymentProcessor, ApplicantProcessor) 22 23 from kofacustom.udss.applicants.interfaces import ( 23 24 ICustomApplicant, … … 26 27 ) 27 28 28 class CustomApplicantProcessor( NigeriaApplicantProcessor):29 class CustomApplicantProcessor(ApplicantProcessor): 29 30 30 31 iface = ICustomApplicant -
main/kofacustom.udss/trunk/src/kofacustom/udss/applicants/browser.py
r17689 r17711 19 19 """ 20 20 import grok 21 from zope.formlib.textwidgets import BytesDisplayWidget 22 from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget 21 23 from waeup.kofa.applicants.browser import ( 22 24 ApplicantRegistrationPage, ApplicantsContainerPage) 23 from kofacustom.nigeria.applicants.browser import ( 24 NigeriaApplicantDisplayFormPage, 25 NigeriaApplicantManageFormPage, 26 NigeriaApplicantEditFormPage, 27 NigeriaPDFApplicationSlip) 25 from waeup.kofa.applicants.browser import ( 26 ApplicantDisplayFormPage, 27 ApplicantManageFormPage, 28 ApplicantEditFormPage, 29 ApplicantRegistrationPage, 30 OnlinePaymentDisplayFormPage, 31 OnlinePaymentBreadcrumb, 32 ExportPDFPaymentSlipPage, 33 ) 34 from waeup.kofa.applicants.pdf import PDFApplicationSlip 28 35 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 )42 36 from kofacustom.udss.applicants.interfaces import ( 43 ICustomPGApplicant, ICustomUGApplicant, ICustomApplicant, 44 ICustomPGApplicantEdit, ICustomUGApplicantEdit, 37 ICustomUGApplicant, 38 ICustomApplicant, 39 ICustomUGApplicantEdit, 45 40 ICustomApplicantOnlinePayment, 46 41 ) … … 48 43 from kofacustom.udss.interfaces import MessageFactory as _ 49 44 50 class CustomApplicantEditFormPage(NigeriaApplicantEditFormPage): 45 OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted', 46 'result_uploaded', 'suspended', 'special_application',) 47 48 UG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + ( 49 'programme_type', 'course1', 'course2', 'course_admitted') 50 UG_OMIT_PDF_FIELDS = UG_OMIT_DISPLAY_FIELDS + ('phone',) 51 UG_OMIT_MANAGE_FIELDS = ( 52 'special_application', 53 'programme_type', 'course1', 'course2', 'course_admitted') 54 UG_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 63 class 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 80 class 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 100 class 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 113 class CustomApplicantEditFormPage(ApplicantEditFormPage): 51 114 """An applicant-centered edit view for applicant data. 52 115 """ 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 53 125 54 126 def unremovable(self, ticket): -
main/kofacustom.udss/trunk/src/kofacustom/udss/applicants/export.py
r17689 r17711 19 19 """ 20 20 import grok 21 from waeup.kofa.applicants.export import ApplicantExporter 21 22 from waeup.kofa.applicants.interfaces import IApplicantBaseData 22 23 from waeup.kofa.utils.helpers import iface_names 23 from kofacustom.nigeria.applicants.export import NigeriaApplicantExporter24 from kofacustom.nigeria.applicants.interfaces import (25 INigeriaUGApplicant, INigeriaPGApplicant)26 24 from kofacustom.udss.applicants.interfaces import ( 27 ICustomUGApplicant, ICustomPGApplicant)25 ICustomUGApplicant,) 28 26 29 class CustomApplicantExporter( NigeriaApplicantExporter):27 class CustomApplicantExporter(ApplicantExporter): 30 28 """Exporter for Custom Applicants. 31 29 """ … … 33 31 fields = tuple(sorted(set( 34 32 iface_names(ICustomUGApplicant) + 35 iface_names(ICustomPGApplicant) +36 iface_names(INigeriaUGApplicant) +37 iface_names(INigeriaPGApplicant) +38 33 iface_names(IApplicantBaseData) 39 34 ))) + ( -
main/kofacustom.udss/trunk/src/kofacustom/udss/applicants/interfaces.py
r17689 r17711 28 28 from waeup.kofa.schema import FormattedDate, TextLineChoice 29 29 from waeup.kofa.students.vocabularies import nats_vocab, GenderSource 30 from waeup.kofa.applicants.interfaces import contextual_reg_num_source 30 from waeup.kofa.applicants.interfaces import ( 31 contextual_reg_num_source, IApplicantBaseData, IApplicantOnlinePayment, 32 IApplicantUpdateByRegNo) 31 33 from kofacustom.nigeria.applicants.interfaces import ( 32 34 LGASource, high_qual, high_grade, exam_types, 33 INigeriaUGApplicant, INigeriaPGApplicant, 34 INigeriaApplicantOnlinePayment, 35 INigeriaUGApplicantEdit, INigeriaPGApplicantEdit, 36 INigeriaApplicantUpdateByRegNo, 37 IPUTMEApplicantEdit, 38 ) 35 INigeriaApplicantOnlinePayment) 39 36 from kofacustom.udss.interfaces import MessageFactory as _ 40 37 from kofacustom.udss.payments.interfaces import ICustomOnlinePayment 41 38 42 class ICustomUGApplicant(I NigeriaUGApplicant):39 class ICustomUGApplicant(IApplicantBaseData): 43 40 """An undergraduate applicant. 44 41 … … 48 45 """ 49 46 50 class ICustomPGApplicant(INigeriaPGApplicant):51 """A postgraduate applicant.52 47 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): 48 class ICustomApplicant(ICustomUGApplicant): 60 49 """An interface for both types of applicants. 61 50 … … 76 65 """ 77 66 78 class ICustomUGApplicantEdit(I NigeriaUGApplicantEdit):67 class ICustomUGApplicantEdit(ICustomUGApplicant): 79 68 """An undergraduate applicant interface for edit forms. 80 69 … … 88 77 """ 89 78 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 ) 101 89 102 90 class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment): … … 105 93 """ 106 94 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): 95 class ICustomApplicantUpdateByRegNo(IApplicantUpdateByRegNo): 120 96 """Representation of an applicant. 121 97 -
main/kofacustom.udss/trunk/src/kofacustom/udss/applicants/tests/test_browser.py
r17689 r17711 60 60 applicant.email = 'anna@sample.com' 61 61 applicant.phone = u'+234-123-12345' 62 applicant.course1 = self.certificate63 applicant.course2 = self.certificate64 applicant.course_admitted = self.certificate62 #applicant.course1 = self.certificate 63 #applicant.course2 = self.certificate 64 #applicant.course_admitted = self.certificate 65 65 applicant.notice = u'Some notice\nin lines.' 66 applicant.screening_score = 9867 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' 69 69 applicant.password = 'any password' 70 70 return applicant … … 80 80 self.browser.open(self.manage_path) 81 81 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' 83 89 self.browser.getControl("Save").click() 84 90 IWorkflowState(self.applicant).setState('submitted') -
main/kofacustom.udss/trunk/src/kofacustom/udss/applicants/utils.py
r17689 r17711 29 29 """A collection of parameters and methods subject to customization. 30 30 """ 31 32 APP_TYPES_DICT = { 33 'app': ['General Application', 'APP'], 34 } -
main/kofacustom.udss/trunk/src/kofacustom/udss/interswitch/tests.py
r17689 r17711 210 210 self.browser.open(self.manage_path) 211 211 #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' 213 219 self.applicantscontainer.application_fee = 1000.0 214 self.browser.getControl(name="form.nationality").value = ['NG']220 #self.browser.getControl(name="form.nationality").value = ['NG'] 215 221 self.browser.getControl(name="transition").value = ['start'] 216 222 self.browser.getControl("Save").click() -
main/kofacustom.udss/trunk/src/kofacustom/udss/utils/utils.py
r16717 r17711 24 24 """ 25 25 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.