Changeset 16997 for main/kofacustom.lpng/trunk/src/kofacustom
- Timestamp:
- 6 Jul 2022, 11:38:52 (2 years ago)
- Location:
- main/kofacustom.lpng/trunk/src/kofacustom/lpng
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.lpng/trunk/src/kofacustom/lpng/applicants/applicant.py
r16983 r16997 23 23 from kofacustom.nigeria.applicants.applicant import NigeriaApplicant 24 24 from kofacustom.lpng.applicants.interfaces import( 25 ICustomApplicant, ICustomUGApplicantEdit, ICustomPGApplicantEdit, IPUTMEApplicantEdit)25 ICustomApplicant,) 26 26 27 27 class CustomApplicant(NigeriaApplicant): 28 28 29 grok.implements(ICustomApplicant, ICustomUGApplicantEdit, 30 ICustomPGApplicantEdit, IPUTMEApplicantEdit) 29 grok.implements(ICustomApplicant) 31 30 grok.provides(ICustomApplicant) 32 31 -
main/kofacustom.lpng/trunk/src/kofacustom/lpng/applicants/browser.py
r16983 r16997 19 19 """ 20 20 import grok 21 from zope.formlib.textwidgets import BytesDisplayWidget 22 from waeup.kofa.applicants.pdf import PDFApplicationSlip 21 23 from waeup.kofa.applicants.browser import ( 22 ApplicantRegistrationPage, ApplicantsContainerPage) 23 from kofacustom.nigeria.applicants.browser import ( 24 NigeriaApplicantDisplayFormPage, 25 NigeriaApplicantManageFormPage, 26 NigeriaApplicantEditFormPage, 27 NigeriaPDFApplicationSlip) 24 ApplicantRegistrationPage, ApplicantsContainerPage, 25 ApplicantDisplayFormPage, 26 ApplicantManageFormPage, 27 ApplicantEditFormPage) 28 28 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 29 from kofacustom.lpng.applicants.interfaces import ( 43 ICustomPGApplicant, ICustomUGApplicant, ICustomApplicant, 44 ICustomPGApplicantEdit, ICustomUGApplicantEdit, 30 ICustomApplicant, 45 31 ICustomApplicantOnlinePayment, 46 32 ) … … 48 34 from kofacustom.lpng.interfaces import MessageFactory as _ 49 35 50 class CustomApplicantEditFormPage(NigeriaApplicantEditFormPage): 36 37 class CustomApplicantDisplayFormPage(ApplicantDisplayFormPage): 38 """A display view for applicant data. 39 """ 40 41 @property 42 def form_fields(self): 43 form_fields = grok.AutoFields(ICustomApplicant) 44 form_fields['perm_address'].custom_widget = BytesDisplayWidget 45 form_fields['notice'].custom_widget = BytesDisplayWidget 46 if not getattr(self.context, 'student_id'): 47 form_fields = form_fields.omit('student_id') 48 return form_fields 49 50 class CustomPDFApplicationSlip(PDFApplicationSlip): 51 52 @property 53 def form_fields(self): 54 form_fields = grok.AutoFields(ICustomApplicant) 55 if not getattr(self.context, 'student_id'): 56 form_fields = form_fields.omit('student_id') 57 return form_fields 58 59 class CustomApplicantManageFormPage(ApplicantManageFormPage): 60 """A full edit view for applicant data. 61 """ 62 63 @property 64 def form_fields(self): 65 form_fields = grok.AutoFields(ICustomApplicant) 66 if not getattr(self.context, 'student_id'): 67 form_fields = form_fields.omit('student_id') 68 form_fields['applicant_id'].for_display = True 69 return form_fields 70 71 class CustomApplicantEditFormPage(ApplicantEditFormPage): 51 72 """An applicant-centered edit view for applicant data. 52 73 """ … … 55 76 return True 56 77 78 @property 79 def form_fields(self): 80 form_fields = grok.AutoFields(ICustomApplicant) 81 form_fields = form_fields.omit('notice') 82 if not getattr(self.context, 'student_id'): 83 form_fields = form_fields.omit('student_id') 84 form_fields['applicant_id'].for_display = True 85 form_fields['reg_number'].for_display = True 86 return form_fields 87 -
main/kofacustom.lpng/trunk/src/kofacustom/lpng/applicants/export.py
r16983 r16997 22 22 from waeup.kofa.utils.helpers import iface_names 23 23 from kofacustom.nigeria.applicants.export import NigeriaApplicantExporter 24 from kofacustom.nigeria.applicants.interfaces import (25 INigeriaUGApplicant, INigeriaPGApplicant)26 24 from kofacustom.lpng.applicants.interfaces import ( 27 ICustom UGApplicant, ICustomPGApplicant)25 ICustomApplicant,) 28 26 29 27 class CustomApplicantExporter(NigeriaApplicantExporter): … … 32 30 33 31 fields = tuple(sorted(set( 34 iface_names(ICustomUGApplicant) + 35 iface_names(ICustomPGApplicant) + 36 iface_names(INigeriaUGApplicant) + 37 iface_names(INigeriaPGApplicant) + 32 iface_names(ICustomApplicant) + 38 33 iface_names(IApplicantBaseData) 39 34 ))) + ( -
main/kofacustom.lpng/trunk/src/kofacustom/lpng/applicants/interfaces.py
r16983 r16997 20 20 21 21 from zope import schema 22 from zope.interface import Interface, Attribute, implements, directlyProvides 22 23 from waeup.kofa.applicants.interfaces import ( 23 24 IApplicantBaseData, … … 25 26 from waeup.kofa.schoolgrades import ResultEntryField 26 27 from waeup.kofa.interfaces import ( 27 SimpleKofaVocabulary, academic_sessions_vocab, validate_email) 28 from waeup.kofa.schema import FormattedDate, TextLineChoice 29 from waeup.kofa.students.vocabularies import nats_vocab, GenderSource 28 SimpleKofaVocabulary, academic_sessions_vocab, validate_email, 29 IKofaObject) 30 from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber 31 from waeup.kofa.students.vocabularies import ( 32 nats_vocab, GenderSource,RegNumberSource) 30 33 from waeup.kofa.applicants.interfaces import contextual_reg_num_source 31 from kofacustom.nigeria.applicants.interfaces import (32 LGASource, high_qual, high_grade, exam_types,33 INigeriaUGApplicant, INigeriaPGApplicant,34 INigeriaApplicantOnlinePayment,35 INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,36 INigeriaApplicantUpdateByRegNo,37 IPUTMEApplicantEdit,38 )39 34 from kofacustom.lpng.interfaces import MessageFactory as _ 40 35 from kofacustom.lpng.payments.interfaces import ICustomOnlinePayment 41 42 class ICustomUGApplicant(INigeriaUGApplicant): 43 """An undergraduate applicant. 44 45 This interface defines the least common multiple of all fields 46 in ug application forms. In customized forms, fields can be excluded by 47 adding them to the UG_OMIT* tuples. 48 """ 49 50 class ICustomPGApplicant(INigeriaPGApplicant): 51 """A postgraduate applicant. 52 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): 36 from kofacustom.nigeria.interfaces import LGASource 37 from kofacustom.nigeria.applicants.interfaces import ( 38 INigeriaApplicantOnlinePayment,) 39 40 class IApplicantBaseData(IKofaObject): 41 """This is a base interface of an applicant with no field 42 required. For use with processors, forms, etc., please use one of 43 the derived interfaces below, which set more fields to required 44 state, depending on use-case. 45 """ 46 state = Attribute('Application state of an applicant') 47 history = Attribute('Object history, a list of messages') 48 display_fullname = Attribute('The fullname of an applicant') 49 application_number = Attribute('The key under which the record is stored') 50 container_code = Attribute('Code of the parent container plus additional information if record is used or not') 51 translated_state = Attribute('Real name of the application state') 52 special = Attribute('True if special application') 53 payments = Attribute('List of payment objects stored in the applicant container') 54 55 application_date = Attribute('UTC datetime of submission, used for export only') 56 password = Attribute('Encrypted password of an applicant') 57 58 59 suspended = schema.Bool( 60 title = _(u'Account suspended'), 61 default = False, 62 required = False, 63 ) 64 65 applicant_id = schema.TextLine( 66 title = _(u'Applicant Id'), 67 required = False, 68 readonly = False, 69 ) 70 71 reg_number = TextLineChoice( 72 title = _(u'Registration Number'), 73 readonly = False, 74 required = False, 75 source = contextual_reg_num_source, 76 ) 77 78 firstname = schema.TextLine( 79 title = _(u'First Name'), 80 required = True, 81 ) 82 83 middlename = schema.TextLine( 84 title = _(u'Middle Name'), 85 required = False, 86 ) 87 88 lastname = schema.TextLine( 89 title = _(u'Last Name (Surname)'), 90 required = True, 91 ) 92 93 date_of_birth = FormattedDate( 94 title = _(u'Date of Birth'), 95 required = True, 96 show_year = True, 97 ) 98 99 sex = schema.Choice( 100 title = _(u'Gender'), 101 source = GenderSource(), 102 required = True, 103 ) 104 105 profession = schema.ASCIILine( 106 title = _(u'Profession'), 107 required = False, 108 ) 109 110 occupation = schema.ASCIILine( 111 title = _(u'Occupation'), 112 required = False, 113 ) 114 115 nationality = schema.Choice( 116 source = nats_vocab, 117 title = _(u'Nationality'), 118 required = False, 119 ) 120 121 state_of_residence = schema.Choice( 122 source = nats_vocab, 123 title = _(u'State of Residence'), 124 required = False, 125 ) 126 127 perm_address = schema.Text( 128 title = _(u'Residential Address'), 129 required = False, 130 ) 131 132 lga = schema.Choice( 133 source = LGASource(), 134 title = _(u'Local Government (Nigerians only)'), 135 required = False, 136 ) 137 138 ward = schema.ASCIILine( 139 title = _(u'Ward'), 140 required = False, 141 ) 142 143 phone = PhoneNumber( 144 title = _(u'Phone'), 145 description = u'', 146 required = False, 147 ) 148 149 email = schema.ASCIILine( 150 title = _(u'Email Address'), 151 required = True, 152 constraint=validate_email, 153 ) 154 155 notice = schema.Text( 156 title = _(u'Notice'), 157 required = False, 158 ) 159 160 student_id = schema.TextLine( 161 title = _(u'Student Id'), 162 required = False, 163 readonly = False, 164 ) 165 166 locked = schema.Bool( 167 title = _(u'Form locked'), 168 default = False, 169 required = False, 170 ) 171 172 173 class ICustomApplicant(IApplicantBaseData): 60 174 """An interface for both types of applicants. 61 175 … … 76 190 """ 77 191 78 class ICustomUGApplicantEdit(INigeriaUGApplicantEdit):79 """An undergraduate applicant interface for edit forms.80 81 Here we can repeat the fields from base data and set the82 `required` and `readonly` attributes to True to further restrict83 the data access. Or we can allow only certain certificates to be84 selected by choosing the appropriate source.85 86 We cannot omit fields here. This has to be done in the87 respective form page.88 """89 90 class ICustomPGApplicantEdit(INigeriaPGApplicantEdit):91 """A postgraduate applicant interface for editing.92 93 Here we can repeat the fields from base data and set the94 `required` and `readonly` attributes to True to further restrict95 the data access. Or we can allow only certain certificates to be96 selected by choosing the appropriate source.97 98 We cannot omit fields here. This has to be done in the99 respective form page.100 """101 102 192 class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment): 103 193 """An applicant payment via payment gateways. … … 105 195 """ 106 196 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): 197 class ICustomApplicantUpdateByRegNo(ICustomApplicant): 120 198 """Representation of an applicant. 121 199 … … 123 201 the applicant object. 124 202 """ 203 204 reg_number = schema.TextLine( 205 title = u'Registration Number', 206 required = False, 207 ) -
main/kofacustom.lpng/trunk/src/kofacustom/lpng/applicants/tests/test_browser.py
r16983 r16997 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.date_of_birth").value = '09/09/1988' 86 self.browser.getControl(name="form.sex").value = ['m'] 87 self.browser.getControl(name="form.email").value = 'xx@yy.zz' 83 88 self.browser.getControl("Save").click() 84 89 IWorkflowState(self.applicant).setState('submitted') -
main/kofacustom.lpng/trunk/src/kofacustom/lpng/applicants/utils.py
r16983 r16997 29 29 """A collection of parameters and methods subject to customization. 30 30 """ 31 32 APP_TYPES_DICT = { 33 'app': ['Membership Application', 'APP'], 34 #'special': ['Special Application', 'SPE'], 35 } -
main/kofacustom.lpng/trunk/src/kofacustom/lpng/interswitch/tests.py
r16994 r16997 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.date_of_birth").value = '09/09/1988' 216 self.browser.getControl(name="form.sex").value = ['m'] 217 self.browser.getControl(name="form.email").value = 'xx@yy.zz' 213 218 self.applicantscontainer.application_fee = 1000.0 214 219 self.browser.getControl(name="form.nationality").value = ['NG'] -
main/kofacustom.lpng/trunk/src/kofacustom/lpng/locales/en/LC_MESSAGES/waeup.kofa.po
r16993 r16997 48 48 msgstr "Registration Period" 49 49 50 msgid "Application State" 51 msgstr "Registration State" 52 50 53 msgid "Find applicants" 51 54 msgstr "Find registrants" … … 70 73 msgstr "User Name, Registrant Id or Registration Number" 71 74 75 msgid "Admit applicant" 76 msgstr "Register applicant" 77 78 msgid "Applicant admitted" 79 msgstr "Applicant registered" 80 81 msgid "Student record created" 82 msgstr "Membership record created" 83 84 msgid "admitted" 85 msgstr "registered" 86 87 msgid "not admitted" 88 msgstr "not registered" 89 90 msgid "" 91 "I confirm that the Passport Photograph uploaded on this form is a true " 92 "picture of me." 93 msgstr "" 94 "I accept and subscribe to the Manifesto, Constitution and Programme of the " 95 "party based on the ideology and ideals of Socio Democracy." 96 97 #: waeup/kofa/interfaces.py:704 98 msgid "Name of University" 99 msgstr "Name of Institution" 100 101 #: waeup/kofa/interfaces.py:705 102 msgid "Sample University" 103 msgstr "Sample Institution" 104 105 #: waeup/kofa/interfaces.py:710 106 msgid "Abbreviated Title of University" 107 msgstr "Abbreviated Title of Institution" 108 72 109 #. Default: "You don't have an account because you are a fresh student, or your student record has just been created? Acquire a Password Activation Code (PWD) and inititialize your student account <strong><a href=\"setpassword\"> here</a></strong>." 73 110 msgid "login_trouble2"
Note: See TracChangeset for help on using the changeset viewer.