[8926] | 1 | ## $Id: interfaces.py 14096 2016-08-19 07:16:33Z henrik $ |
---|
| 2 | ## |
---|
| 3 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann |
---|
| 4 | ## This program is free software; you can redistribute it and/or modify |
---|
| 5 | ## it under the terms of the GNU General Public License as published by |
---|
| 6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | ## (at your option) any later version. |
---|
| 8 | ## |
---|
| 9 | ## This program is distributed in the hope that it will be useful, |
---|
| 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | ## GNU General Public License for more details. |
---|
| 13 | ## |
---|
| 14 | ## You should have received a copy of the GNU General Public License |
---|
| 15 | ## along with this program; if not, write to the Free Software |
---|
| 16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | ## |
---|
| 18 | """Customized interfaces of the university application package. |
---|
| 19 | """ |
---|
| 20 | |
---|
| 21 | from zope import schema |
---|
[13160] | 22 | from zope.component import getUtility |
---|
[13277] | 23 | from zope.schema import getFields |
---|
[8926] | 24 | from waeup.kofa.applicants.interfaces import ( |
---|
[9049] | 25 | contextual_reg_num_source, |
---|
[8926] | 26 | IApplicantBaseData, |
---|
| 27 | AppCatCertificateSource, CertificateSource) |
---|
| 28 | from waeup.kofa.schoolgrades import ResultEntryField |
---|
| 29 | from waeup.kofa.interfaces import ( |
---|
[13160] | 30 | SimpleKofaVocabulary, |
---|
| 31 | academic_sessions_vocab, |
---|
| 32 | validate_email, |
---|
| 33 | SubjectSource, |
---|
[14003] | 34 | IKofaUtils, |
---|
| 35 | IKofaObject) |
---|
[8926] | 36 | from waeup.kofa.schema import FormattedDate, TextLineChoice |
---|
| 37 | from waeup.kofa.students.vocabularies import nats_vocab, GenderSource |
---|
| 38 | from kofacustom.nigeria.interfaces import ( |
---|
| 39 | LGASource, high_qual, high_grade, exam_types) |
---|
| 40 | from kofacustom.nigeria.interfaces import MessageFactory as _ |
---|
| 41 | from kofacustom.nigeria.payments.interfaces import INigeriaOnlinePayment |
---|
| 42 | |
---|
[13554] | 43 | programme_types_vocab = SimpleKofaVocabulary( |
---|
| 44 | (_('Post UTME'), 'putme'), |
---|
| 45 | (_('Post DE'), 'pude'), |
---|
[13945] | 46 | (_('Admission Screening Exercise'), 'ase'), |
---|
[13554] | 47 | (_('not applicable'), 'na'), |
---|
| 48 | ) |
---|
| 49 | |
---|
[13160] | 50 | jambsubjects = SimpleKofaVocabulary( |
---|
| 51 | (_('Use of English'),'english_language'), |
---|
| 52 | (_('Agricultural Science'),'agricultural_science'), |
---|
| 53 | (_('Arabic'),'arabic'), |
---|
| 54 | (_('Biology'),'biology'), |
---|
| 55 | (_('Book Keeping'),'book_keeping'), |
---|
| 56 | (_('Chemistry'),'chemistry'), |
---|
| 57 | (_('Christian Religious Studies'),'christian_religious_studies'), |
---|
| 58 | (_('Commerce'),'commerce'), |
---|
| 59 | (_('Economics'),'economics'), |
---|
| 60 | (_('Financial Accounting'),'financial_accounting'), |
---|
| 61 | (_('Fine Art'),'fine_art'), |
---|
| 62 | (_('Food and Nutrition'),'food_and_nutrition'), |
---|
| 63 | (_('French'),'french'), |
---|
| 64 | (_('Geography'),'geography'), |
---|
| 65 | (_('German'),'german'), |
---|
| 66 | (_('Government'),'government'), |
---|
| 67 | (_('Hausa'),'hausa'), |
---|
| 68 | (_('Home Economics'),'home_economics'), |
---|
| 69 | (_('History'),'history'), |
---|
| 70 | (_('Igbo'),'igbo'), |
---|
| 71 | (_('Literature in English'),'literature_in_english'), |
---|
| 72 | (_('Literature in Nigerian Languages'),'literature_in_nigerian_languages'), |
---|
| 73 | (_('Mathematics'),'mathematics'), |
---|
| 74 | (_('Music'),'music'), |
---|
| 75 | (_('Physics'),'physics'), |
---|
| 76 | (_('Yoruba'),'yoruba'), |
---|
| 77 | ) |
---|
| 78 | |
---|
[13163] | 79 | # Define a validation method for jamb subjects |
---|
| 80 | class NotExactNumberOfItems(schema.ValidationError): |
---|
| 81 | __doc__ = u"Not exactly 4 items selected." |
---|
| 82 | |
---|
| 83 | def four_items(value): |
---|
[13561] | 84 | if len(value) and len(value) != 4: |
---|
[13163] | 85 | raise NotExactNumberOfItems(value) |
---|
| 86 | return True |
---|
| 87 | |
---|
[13160] | 88 | class JAMBSubjectSource(SubjectSource): |
---|
| 89 | """A source for school subjects used in exam documentation. |
---|
| 90 | """ |
---|
| 91 | |
---|
| 92 | def getTitle(self, value): |
---|
| 93 | subjects_dict = getUtility(IKofaUtils).EXAM_SUBJECTS_DICT |
---|
| 94 | return "%s" % subjects_dict[value] |
---|
| 95 | |
---|
[9049] | 96 | # Fields to be omitted in all display forms. course_admitted is |
---|
[9072] | 97 | # rendered separately. |
---|
[9049] | 98 | |
---|
| 99 | OMIT_DISPLAY_FIELDS = ('locked', 'course_admitted', |
---|
[14045] | 100 | 'result_uploaded', 'suspended', 'special_application', |
---|
| 101 | 'bank_account_number', |
---|
| 102 | 'bank_account_name', |
---|
| 103 | 'bank_name') |
---|
[9049] | 104 | |
---|
| 105 | # UG students are all undergraduate students. |
---|
[13554] | 106 | UG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + ( |
---|
| 107 | 'jamb_subjects_list', 'programme_type') |
---|
[9073] | 108 | UG_OMIT_PDF_FIELDS = UG_OMIT_DISPLAY_FIELDS + ('phone',) |
---|
[13554] | 109 | UG_OMIT_MANAGE_FIELDS = ( |
---|
| 110 | 'special_application', |
---|
| 111 | 'jamb_subjects_list', |
---|
| 112 | 'programme_type') |
---|
[9049] | 113 | UG_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + OMIT_DISPLAY_FIELDS + ( |
---|
[13142] | 114 | 'student_id', |
---|
| 115 | 'notice', |
---|
| 116 | 'screening_score', |
---|
| 117 | 'screening_venue', |
---|
| 118 | 'screening_date', |
---|
[13160] | 119 | 'jamb_age', |
---|
[13142] | 120 | 'jamb_subjects', |
---|
| 121 | 'jamb_score', |
---|
| 122 | 'jamb_reg_number', |
---|
| 123 | 'aggregate') |
---|
[9049] | 124 | |
---|
[13142] | 125 | # CBT is a subgroup of UG with the same interface. |
---|
| 126 | CBT_OMIT_FIELDS = ( |
---|
| 127 | 'hq_type', 'hq_matric_no', |
---|
| 128 | 'hq_degree', 'hq_school', |
---|
[13157] | 129 | 'hq_session', 'hq_disc', |
---|
[13554] | 130 | 'aggregate', 'jamb_subjects', |
---|
[14045] | 131 | 'programme_type') |
---|
[13142] | 132 | CBT_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + CBT_OMIT_FIELDS |
---|
[13160] | 133 | CBT_OMIT_MANAGE_FIELDS = CBT_OMIT_FIELDS + ('special_application',) |
---|
| 134 | CBT_OMIT_EDIT_FIELDS = OMIT_DISPLAY_FIELDS + CBT_OMIT_FIELDS + ( |
---|
| 135 | 'special_application', |
---|
[13142] | 136 | 'student_id', |
---|
| 137 | 'notice', |
---|
| 138 | 'screening_score', |
---|
| 139 | 'screening_venue', |
---|
| 140 | 'screening_date', |
---|
| 141 | #'jamb_age', |
---|
| 142 | #'jamb_subjects', |
---|
| 143 | #'jamb_score', |
---|
| 144 | #'jamb_reg_number', |
---|
[13157] | 145 | ) |
---|
[13142] | 146 | CBT_OMIT_PDF_FIELDS = CBT_OMIT_DISPLAY_FIELDS + ('phone',) |
---|
| 147 | |
---|
[13551] | 148 | # AFFIL is a subgroup of UG with the same interface. |
---|
| 149 | AFFIL_OMIT_FIELDS = ( |
---|
| 150 | 'hq_type', 'hq_matric_no', |
---|
| 151 | 'hq_degree', 'hq_school', |
---|
| 152 | 'hq_session', 'hq_disc', |
---|
[14045] | 153 | 'jamb_subjects') |
---|
[13551] | 154 | AFFIL_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + AFFIL_OMIT_FIELDS |
---|
| 155 | AFFIL_OMIT_MANAGE_FIELDS = AFFIL_OMIT_FIELDS + ('special_application',) |
---|
| 156 | AFFIL_OMIT_EDIT_FIELDS = OMIT_DISPLAY_FIELDS + AFFIL_OMIT_FIELDS + ( |
---|
| 157 | 'special_application', |
---|
| 158 | 'student_id', |
---|
| 159 | 'notice', |
---|
| 160 | 'screening_score', |
---|
| 161 | 'screening_venue', |
---|
| 162 | 'screening_date', |
---|
[13744] | 163 | 'aggregate', |
---|
[13551] | 164 | ) |
---|
[13559] | 165 | AFFIL_OMIT_PDF_FIELDS = AFFIL_OMIT_DISPLAY_FIELDS + ('phone',) |
---|
[13551] | 166 | |
---|
[9049] | 167 | # PUTME is a subgroup of UG with the same interface. |
---|
| 168 | PUTME_OMIT_FIELDS = ( |
---|
| 169 | 'hq_type', 'hq_matric_no', |
---|
| 170 | 'hq_degree', 'hq_school', |
---|
[13554] | 171 | 'hq_session', 'hq_disc', |
---|
| 172 | 'jamb_subjects_list', 'programme_type') |
---|
[14045] | 173 | |
---|
| 174 | # temporary solution to display bank account fields only |
---|
| 175 | # for PUTME (ase) application |
---|
| 176 | |
---|
| 177 | #PUTME_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PUTME_OMIT_FIELDS |
---|
| 178 | PUTME_OMIT_DISPLAY_FIELDS = ( |
---|
| 179 | 'locked', 'course_admitted', 'result_uploaded', |
---|
| 180 | 'suspended', 'special_application') + PUTME_OMIT_FIELDS |
---|
| 181 | |
---|
[9049] | 182 | PUTME_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PUTME_OMIT_FIELDS |
---|
[14046] | 183 | |
---|
| 184 | # temporary solution to display bank account fields only |
---|
| 185 | # for PUTME (ase) application |
---|
| 186 | |
---|
| 187 | #PUTME_OMIT_EDIT_FIELDS = UG_OMIT_EDIT_FIELDS + PUTME_OMIT_FIELDS + ( |
---|
| 188 | # 'firstname', 'middlename', 'lastname', 'sex', |
---|
| 189 | # 'course1', 'lga') |
---|
| 190 | PUTME_OMIT_EDIT_FIELDS = UG_OMIT_MANAGE_FIELDS + ( |
---|
| 191 | 'locked', 'course_admitted', 'result_uploaded', |
---|
| 192 | 'suspended', 'special_application', |
---|
| 193 | 'student_id', |
---|
| 194 | 'notice', |
---|
| 195 | 'screening_score', |
---|
| 196 | 'screening_venue', |
---|
| 197 | 'screening_date', |
---|
| 198 | 'jamb_age', |
---|
| 199 | 'jamb_subjects', |
---|
| 200 | 'jamb_score', |
---|
| 201 | 'jamb_reg_number', |
---|
| 202 | 'aggregate', |
---|
[8926] | 203 | 'firstname', 'middlename', 'lastname', 'sex', |
---|
[14046] | 204 | 'course1', 'lga') + PUTME_OMIT_FIELDS |
---|
| 205 | |
---|
[9073] | 206 | PUTME_OMIT_PDF_FIELDS = PUTME_OMIT_DISPLAY_FIELDS + ('phone',) |
---|
[9049] | 207 | PUTME_OMIT_RESULT_SLIP_FIELDS = PUTME_OMIT_DISPLAY_FIELDS + ( |
---|
[9073] | 208 | 'phone', |
---|
[8926] | 209 | 'date_of_birth', 'sex', |
---|
[9072] | 210 | 'nationality', 'lga', #'perm_address', |
---|
[9049] | 211 | 'course2', 'screening_venue', |
---|
[8926] | 212 | 'screening_date') |
---|
| 213 | |
---|
[9054] | 214 | # PUDE is a subgroup of UG with the same interface. |
---|
| 215 | PUDE_OMIT_FIELDS = ( |
---|
[13554] | 216 | 'jamb_subjects', |
---|
| 217 | 'jamb_score', |
---|
| 218 | 'jamb_age', |
---|
| 219 | 'aggregate', |
---|
| 220 | 'jamb_subjects_list', |
---|
[14045] | 221 | 'programme_type') |
---|
[9054] | 222 | PUDE_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PUDE_OMIT_FIELDS |
---|
| 223 | PUDE_OMIT_MANAGE_FIELDS = UG_OMIT_MANAGE_FIELDS + PUDE_OMIT_FIELDS |
---|
| 224 | PUDE_OMIT_EDIT_FIELDS = set(UG_OMIT_EDIT_FIELDS + PUDE_OMIT_FIELDS + ( |
---|
| 225 | 'firstname', 'middlename', 'lastname', 'sex', |
---|
| 226 | 'course1', 'lga')) |
---|
[9073] | 227 | PUDE_OMIT_PDF_FIELDS = PUDE_OMIT_DISPLAY_FIELDS + ('phone',) |
---|
[9054] | 228 | PUDE_OMIT_RESULT_SLIP_FIELDS = PUDE_OMIT_DISPLAY_FIELDS + ( |
---|
[9073] | 229 | 'phone', |
---|
[9054] | 230 | 'date_of_birth', 'sex', |
---|
[9072] | 231 | 'nationality', 'lga', #'perm_address', |
---|
[9054] | 232 | 'course2', 'screening_venue', |
---|
| 233 | 'screening_date') |
---|
| 234 | |
---|
[9049] | 235 | # PG has its own interface |
---|
| 236 | PG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS |
---|
[9073] | 237 | PG_OMIT_PDF_FIELDS = PG_OMIT_DISPLAY_FIELDS + ('phone',) |
---|
[10851] | 238 | PG_OMIT_MANAGE_FIELDS = ('special_application',) |
---|
[9107] | 239 | PG_OMIT_EDIT_FIELDS = PG_OMIT_MANAGE_FIELDS + PG_OMIT_DISPLAY_FIELDS + ( |
---|
[9159] | 240 | 'student_id', 'notice', |
---|
| 241 | 'screening_score', 'screening_venue', |
---|
| 242 | 'screening_date',) |
---|
[8926] | 243 | |
---|
[14003] | 244 | class IBankAccount(IKofaObject): |
---|
| 245 | |
---|
| 246 | bank_name = schema.TextLine( |
---|
| 247 | title = _(u'Bank Name'), |
---|
| 248 | required = False, |
---|
| 249 | readonly = False, |
---|
| 250 | ) |
---|
| 251 | |
---|
| 252 | bank_account_name = schema.TextLine( |
---|
| 253 | title = _(u'Bank Account Name'), |
---|
| 254 | required = False, |
---|
| 255 | readonly = False, |
---|
| 256 | ) |
---|
| 257 | |
---|
| 258 | bank_account_number = schema.TextLine( |
---|
| 259 | title = _(u'Bank Account Number'), |
---|
| 260 | required = False, |
---|
| 261 | readonly = False, |
---|
| 262 | ) |
---|
| 263 | |
---|
| 264 | class INigeriaUGApplicant(IApplicantBaseData, IBankAccount): |
---|
[8926] | 265 | """An undergraduate applicant. |
---|
| 266 | |
---|
| 267 | This interface defines the least common multiple of all fields |
---|
| 268 | in ug application forms. In customized forms, fields can be excluded by |
---|
| 269 | adding them to the UG_OMIT* tuples. |
---|
| 270 | """ |
---|
[10592] | 271 | |
---|
[8926] | 272 | nationality = schema.Choice( |
---|
| 273 | source = nats_vocab, |
---|
| 274 | title = _(u'Nationality'), |
---|
[10386] | 275 | required = False, |
---|
[8926] | 276 | ) |
---|
| 277 | lga = schema.Choice( |
---|
| 278 | source = LGASource(), |
---|
| 279 | title = _(u'State/LGA (Nigerians only)'), |
---|
| 280 | required = False, |
---|
| 281 | ) |
---|
[9072] | 282 | #perm_address = schema.Text( |
---|
| 283 | # title = _(u'Permanent Address'), |
---|
| 284 | # required = False, |
---|
| 285 | # ) |
---|
[8926] | 286 | course1 = schema.Choice( |
---|
| 287 | title = _(u'1st Choice Course of Study'), |
---|
| 288 | source = AppCatCertificateSource(), |
---|
[10592] | 289 | required = True, |
---|
[8926] | 290 | ) |
---|
| 291 | course2 = schema.Choice( |
---|
| 292 | title = _(u'2nd Choice Course of Study'), |
---|
| 293 | source = AppCatCertificateSource(), |
---|
| 294 | required = False, |
---|
| 295 | ) |
---|
[13555] | 296 | |
---|
| 297 | programme_type = schema.Choice( |
---|
| 298 | title = _(u'Programme Type'), |
---|
| 299 | vocabulary = programme_types_vocab, |
---|
| 300 | required = False, |
---|
| 301 | ) |
---|
| 302 | |
---|
[9049] | 303 | hq_type = schema.Choice( |
---|
| 304 | title = _(u'Qualification Obtained'), |
---|
| 305 | required = False, |
---|
| 306 | readonly = False, |
---|
| 307 | vocabulary = high_qual, |
---|
| 308 | ) |
---|
| 309 | hq_matric_no = schema.TextLine( |
---|
| 310 | title = _(u'Former Matric Number'), |
---|
| 311 | required = False, |
---|
| 312 | readonly = False, |
---|
| 313 | ) |
---|
| 314 | hq_degree = schema.Choice( |
---|
| 315 | title = _(u'Class of Degree'), |
---|
| 316 | required = False, |
---|
| 317 | readonly = False, |
---|
| 318 | vocabulary = high_grade, |
---|
| 319 | ) |
---|
| 320 | hq_school = schema.TextLine( |
---|
| 321 | title = _(u'Institution Attended'), |
---|
| 322 | required = False, |
---|
| 323 | readonly = False, |
---|
| 324 | ) |
---|
| 325 | hq_session = schema.TextLine( |
---|
| 326 | title = _(u'Years Attended'), |
---|
| 327 | required = False, |
---|
| 328 | readonly = False, |
---|
| 329 | ) |
---|
| 330 | hq_disc = schema.TextLine( |
---|
| 331 | title = _(u'Discipline'), |
---|
| 332 | required = False, |
---|
| 333 | readonly = False, |
---|
| 334 | ) |
---|
[8926] | 335 | jamb_subjects = schema.Text( |
---|
| 336 | title = _(u'Subjects and Scores'), |
---|
| 337 | required = False, |
---|
| 338 | ) |
---|
[13160] | 339 | jamb_subjects_list = schema.List( |
---|
| 340 | title = _(u'JAMB Subjects'), |
---|
| 341 | required = False, |
---|
[14010] | 342 | defaultFactory=list, |
---|
[13160] | 343 | value_type = schema.Choice( |
---|
| 344 | vocabulary = jambsubjects |
---|
| 345 | #source = JAMBSubjectSource(), |
---|
| 346 | ), |
---|
| 347 | ) |
---|
[8926] | 348 | jamb_score = schema.Int( |
---|
[9462] | 349 | title = _(u'Total JAMB Score'), |
---|
[8926] | 350 | required = False, |
---|
| 351 | ) |
---|
[13142] | 352 | #jamb_age = schema.Int( |
---|
| 353 | # title = _(u'Age (provided by JAMB)'), |
---|
| 354 | # required = False, |
---|
| 355 | # ) |
---|
| 356 | jamb_reg_number = schema.TextLine( |
---|
| 357 | title = _(u'JAMB Registration Number'), |
---|
[11740] | 358 | required = False, |
---|
| 359 | ) |
---|
[8926] | 360 | notice = schema.Text( |
---|
| 361 | title = _(u'Notice'), |
---|
| 362 | required = False, |
---|
| 363 | ) |
---|
| 364 | screening_venue = schema.TextLine( |
---|
| 365 | title = _(u'Screening Venue'), |
---|
| 366 | required = False, |
---|
| 367 | ) |
---|
| 368 | screening_date = schema.TextLine( |
---|
| 369 | title = _(u'Screening Date'), |
---|
| 370 | required = False, |
---|
| 371 | ) |
---|
| 372 | screening_score = schema.Int( |
---|
| 373 | title = _(u'Screening Score (%)'), |
---|
| 374 | required = False, |
---|
| 375 | ) |
---|
| 376 | aggregate = schema.Int( |
---|
| 377 | title = _(u'Aggregate Score (%)'), |
---|
| 378 | description = _(u'(average of relative JAMB and PUTME scores)'), |
---|
| 379 | required = False, |
---|
| 380 | ) |
---|
| 381 | result_uploaded = schema.Bool( |
---|
| 382 | title = _(u'Result uploaded'), |
---|
| 383 | default = False, |
---|
[10385] | 384 | required = False, |
---|
[8926] | 385 | ) |
---|
| 386 | student_id = schema.TextLine( |
---|
| 387 | title = _(u'Student Id'), |
---|
| 388 | required = False, |
---|
| 389 | readonly = False, |
---|
| 390 | ) |
---|
| 391 | course_admitted = schema.Choice( |
---|
| 392 | title = _(u'Admitted Course of Study'), |
---|
| 393 | source = CertificateSource(), |
---|
| 394 | required = False, |
---|
| 395 | ) |
---|
| 396 | locked = schema.Bool( |
---|
| 397 | title = _(u'Form locked'), |
---|
| 398 | default = False, |
---|
[10385] | 399 | required = False, |
---|
[8926] | 400 | ) |
---|
| 401 | |
---|
[10365] | 402 | INigeriaUGApplicant[ |
---|
| 403 | 'locked'].order = IApplicantBaseData['suspended'].order |
---|
| 404 | INigeriaUGApplicant[ |
---|
| 405 | 'result_uploaded'].order = INigeriaUGApplicant['suspended'].order |
---|
| 406 | |
---|
[8926] | 407 | class INigeriaPGApplicant(IApplicantBaseData): |
---|
| 408 | """A postgraduate applicant. |
---|
| 409 | |
---|
| 410 | This interface defines the least common multiple of all fields |
---|
| 411 | in pg application forms. In customized forms, fields can be excluded by |
---|
| 412 | adding them to the PG_OMIT* tuples. |
---|
| 413 | """ |
---|
| 414 | |
---|
| 415 | nationality = schema.Choice( |
---|
| 416 | source = nats_vocab, |
---|
| 417 | title = _(u'Nationality'), |
---|
[9449] | 418 | required = True, |
---|
[8926] | 419 | ) |
---|
| 420 | lga = schema.Choice( |
---|
| 421 | source = LGASource(), |
---|
| 422 | title = _(u'State/LGA (Nigerians only)'), |
---|
| 423 | required = False, |
---|
| 424 | ) |
---|
[9072] | 425 | #perm_address = schema.Text( |
---|
| 426 | # title = _(u'Permanent Address'), |
---|
| 427 | # required = False, |
---|
| 428 | # ) |
---|
[8926] | 429 | course1 = schema.Choice( |
---|
| 430 | title = _(u'1st Choice Course of Study'), |
---|
| 431 | source = AppCatCertificateSource(), |
---|
| 432 | required = True, |
---|
| 433 | ) |
---|
| 434 | course2 = schema.Choice( |
---|
| 435 | title = _(u'2nd Choice Course of Study'), |
---|
| 436 | source = AppCatCertificateSource(), |
---|
| 437 | required = False, |
---|
| 438 | ) |
---|
| 439 | hq_type = schema.Choice( |
---|
| 440 | title = _(u'Qualification Obtained'), |
---|
| 441 | required = False, |
---|
| 442 | readonly = False, |
---|
| 443 | vocabulary = high_qual, |
---|
| 444 | ) |
---|
[13290] | 445 | hq_fname = schema.TextLine( |
---|
| 446 | title = _(u'Full Name'), |
---|
| 447 | required = False, |
---|
| 448 | readonly = False, |
---|
| 449 | ) |
---|
[8926] | 450 | hq_matric_no = schema.TextLine( |
---|
| 451 | title = _(u'Former Matric Number'), |
---|
| 452 | required = False, |
---|
| 453 | readonly = False, |
---|
| 454 | ) |
---|
| 455 | hq_degree = schema.Choice( |
---|
| 456 | title = _(u'Class of Degree'), |
---|
| 457 | required = False, |
---|
| 458 | readonly = False, |
---|
| 459 | vocabulary = high_grade, |
---|
| 460 | ) |
---|
| 461 | hq_school = schema.TextLine( |
---|
| 462 | title = _(u'Institution Attended'), |
---|
| 463 | required = False, |
---|
| 464 | readonly = False, |
---|
| 465 | ) |
---|
| 466 | hq_session = schema.TextLine( |
---|
| 467 | title = _(u'Years Attended'), |
---|
| 468 | required = False, |
---|
| 469 | readonly = False, |
---|
| 470 | ) |
---|
| 471 | hq_disc = schema.TextLine( |
---|
| 472 | title = _(u'Discipline'), |
---|
| 473 | required = False, |
---|
| 474 | readonly = False, |
---|
| 475 | ) |
---|
[13140] | 476 | fst_sit_fname = schema.TextLine( |
---|
| 477 | title = _(u'Full Name'), |
---|
[8926] | 478 | required = False, |
---|
| 479 | readonly = False, |
---|
[13140] | 480 | ) |
---|
| 481 | fst_sit_no = schema.TextLine( |
---|
| 482 | title = _(u'Exam Number'), |
---|
| 483 | required = False, |
---|
| 484 | readonly = False, |
---|
| 485 | ) |
---|
| 486 | fst_sit_date = FormattedDate( |
---|
| 487 | title = _(u'Exam Date'), |
---|
| 488 | required = False, |
---|
| 489 | readonly = False, |
---|
| 490 | show_year = True, |
---|
| 491 | ) |
---|
| 492 | fst_sit_type = schema.Choice( |
---|
| 493 | title = _(u'Exam Type'), |
---|
| 494 | required = False, |
---|
| 495 | readonly = False, |
---|
[8926] | 496 | vocabulary = exam_types, |
---|
| 497 | ) |
---|
[13140] | 498 | fst_sit_results = schema.List( |
---|
| 499 | title = _(u'Exam Results'), |
---|
| 500 | value_type = ResultEntryField(), |
---|
| 501 | required = False, |
---|
| 502 | readonly = False, |
---|
[14010] | 503 | defaultFactory=list, |
---|
[13140] | 504 | ) |
---|
| 505 | scd_sit_fname = schema.TextLine( |
---|
| 506 | title = _(u'Full Name'), |
---|
| 507 | required = False, |
---|
| 508 | readonly = False, |
---|
| 509 | ) |
---|
| 510 | scd_sit_no = schema.TextLine( |
---|
| 511 | title = _(u'Exam Number'), |
---|
| 512 | required = False, |
---|
| 513 | readonly = False, |
---|
| 514 | ) |
---|
| 515 | scd_sit_date = FormattedDate( |
---|
| 516 | title = _(u'Exam Date'), |
---|
| 517 | required = False, |
---|
| 518 | readonly = False, |
---|
| 519 | show_year = True, |
---|
| 520 | ) |
---|
| 521 | scd_sit_type = schema.Choice( |
---|
| 522 | title = _(u'Exam Type'), |
---|
| 523 | required = False, |
---|
| 524 | readonly = False, |
---|
| 525 | vocabulary = exam_types, |
---|
| 526 | ) |
---|
| 527 | scd_sit_results = schema.List( |
---|
| 528 | title = _(u'Exam Results'), |
---|
| 529 | value_type = ResultEntryField(), |
---|
| 530 | required = False, |
---|
| 531 | readonly = False, |
---|
[14010] | 532 | defaultFactory=list, |
---|
[13140] | 533 | ) |
---|
| 534 | # Replaced by first and second sitting |
---|
| 535 | #pp_school = schema.Choice( |
---|
| 536 | # title = _(u'Qualification Obtained'), |
---|
| 537 | # required = False, |
---|
| 538 | # readonly = False, |
---|
| 539 | # vocabulary = exam_types, |
---|
| 540 | # ) |
---|
[8926] | 541 | presently_inst = schema.TextLine( |
---|
| 542 | title = _(u'If yes, name of institution'), |
---|
| 543 | required = False, |
---|
| 544 | readonly = False, |
---|
| 545 | ) |
---|
| 546 | nysc_year = schema.Int( |
---|
| 547 | title = _(u'Nysc Year'), |
---|
| 548 | required = False, |
---|
| 549 | readonly = False, |
---|
| 550 | ) |
---|
| 551 | nysc_lga = schema.Choice( |
---|
| 552 | source = LGASource(), |
---|
| 553 | title = _(u'Nysc Location'), |
---|
| 554 | required = False, |
---|
| 555 | ) |
---|
| 556 | employer = schema.TextLine( |
---|
| 557 | title = _(u'Employer'), |
---|
| 558 | required = False, |
---|
| 559 | readonly = False, |
---|
| 560 | ) |
---|
| 561 | emp_position = schema.TextLine( |
---|
| 562 | title = _(u'Employer Position'), |
---|
| 563 | required = False, |
---|
| 564 | readonly = False, |
---|
| 565 | ) |
---|
| 566 | emp_start = FormattedDate( |
---|
| 567 | title = _(u'Start Date'), |
---|
| 568 | required = False, |
---|
| 569 | readonly = False, |
---|
| 570 | show_year = True, |
---|
| 571 | ) |
---|
| 572 | emp_end = FormattedDate( |
---|
| 573 | title = _(u'End Date'), |
---|
| 574 | required = False, |
---|
| 575 | readonly = False, |
---|
| 576 | show_year = True, |
---|
| 577 | ) |
---|
| 578 | emp_reason = schema.TextLine( |
---|
| 579 | title = _(u'Reason for Leaving'), |
---|
| 580 | required = False, |
---|
| 581 | readonly = False, |
---|
| 582 | ) |
---|
| 583 | employer2 = schema.TextLine( |
---|
| 584 | title = _(u'2nd Employer'), |
---|
| 585 | required = False, |
---|
| 586 | readonly = False, |
---|
| 587 | ) |
---|
| 588 | emp2_position = schema.TextLine( |
---|
| 589 | title = _(u'2nd Employer Position'), |
---|
| 590 | required = False, |
---|
| 591 | readonly = False, |
---|
| 592 | ) |
---|
| 593 | emp2_start = FormattedDate( |
---|
| 594 | title = _(u'Start Date'), |
---|
| 595 | required = False, |
---|
| 596 | readonly = False, |
---|
| 597 | show_year = True, |
---|
| 598 | ) |
---|
| 599 | emp2_end = FormattedDate( |
---|
| 600 | title = _(u'End Date'), |
---|
| 601 | required = False, |
---|
| 602 | readonly = False, |
---|
| 603 | show_year = True, |
---|
| 604 | ) |
---|
| 605 | emp2_reason = schema.TextLine( |
---|
| 606 | title = _(u'Reason for Leaving'), |
---|
| 607 | required = False, |
---|
| 608 | readonly = False, |
---|
| 609 | ) |
---|
| 610 | notice = schema.Text( |
---|
| 611 | title = _(u'Notice'), |
---|
| 612 | required = False, |
---|
| 613 | readonly = False, |
---|
| 614 | ) |
---|
[9159] | 615 | screening_venue = schema.TextLine( |
---|
| 616 | title = _(u'Screening Venue'), |
---|
| 617 | required = False, |
---|
| 618 | ) |
---|
| 619 | screening_date = schema.TextLine( |
---|
| 620 | title = _(u'Screening Date'), |
---|
| 621 | required = False, |
---|
| 622 | ) |
---|
| 623 | screening_score = schema.Int( |
---|
| 624 | title = _(u'Screening Score (%)'), |
---|
| 625 | required = False, |
---|
| 626 | ) |
---|
[8926] | 627 | student_id = schema.TextLine( |
---|
| 628 | title = _(u'Student Id'), |
---|
| 629 | required = False, |
---|
| 630 | readonly = False, |
---|
| 631 | ) |
---|
| 632 | course_admitted = schema.Choice( |
---|
| 633 | title = _(u'Admitted Course of Study'), |
---|
| 634 | source = CertificateSource(), |
---|
| 635 | required = False, |
---|
| 636 | readonly = False, |
---|
| 637 | ) |
---|
| 638 | locked = schema.Bool( |
---|
| 639 | title = _(u'Form locked'), |
---|
| 640 | default = False, |
---|
[10385] | 641 | required = False, |
---|
[8926] | 642 | ) |
---|
| 643 | |
---|
[10365] | 644 | INigeriaPGApplicant[ |
---|
| 645 | 'locked'].order = IApplicantBaseData['suspended'].order |
---|
| 646 | |
---|
[13277] | 647 | # PRE is used by Uniben |
---|
| 648 | # med: "it is as named... PRE - DEGREE... much like a 1 year diploma programme" |
---|
| 649 | PRE_OMIT_FIELDS = tuple([ |
---|
| 650 | i for i in getFields(INigeriaPGApplicant).keys() |
---|
[14096] | 651 | if i[:3] in ('hq_', 'emp', 'nys')]) + ('referees',) |
---|
[13277] | 652 | PRE_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + PRE_OMIT_FIELDS |
---|
| 653 | PRE_OMIT_MANAGE_FIELDS = PG_OMIT_MANAGE_FIELDS + PRE_OMIT_FIELDS |
---|
| 654 | PRE_OMIT_EDIT_FIELDS = set(PG_OMIT_EDIT_FIELDS + PRE_OMIT_FIELDS) |
---|
| 655 | PRE_OMIT_PDF_FIELDS = PRE_OMIT_DISPLAY_FIELDS |
---|
| 656 | PRE_OMIT_RESULT_SLIP_FIELDS = PRE_OMIT_DISPLAY_FIELDS |
---|
| 657 | |
---|
[8926] | 658 | class INigeriaApplicant(INigeriaUGApplicant, INigeriaPGApplicant): |
---|
| 659 | """An interface for both types of applicants. |
---|
| 660 | |
---|
| 661 | Attention: The INigeriaPGApplicant field seetings will be overwritten |
---|
| 662 | by INigeriaPGApplicant field settings. If a field is defined |
---|
| 663 | in both interfaces zope.schema validates only against the |
---|
| 664 | constraints in INigeriaUGApplicant. This does not affect the forms |
---|
| 665 | since they are build on either INigeriaUGApplicant or INigeriaPGApplicant. |
---|
| 666 | """ |
---|
| 667 | |
---|
| 668 | def writeLogMessage(view, comment): |
---|
| 669 | """Adds an INFO message to the log file |
---|
| 670 | """ |
---|
| 671 | |
---|
| 672 | def createStudent(): |
---|
| 673 | """Create a student object from applicant data |
---|
| 674 | and copy applicant object. |
---|
| 675 | """ |
---|
| 676 | |
---|
| 677 | class INigeriaUGApplicantEdit(INigeriaUGApplicant): |
---|
| 678 | """An undergraduate applicant interface for edit forms. |
---|
| 679 | |
---|
| 680 | Here we can repeat the fields from base data and set the |
---|
| 681 | `required` and `readonly` attributes to True to further restrict |
---|
| 682 | the data access. Or we can allow only certain certificates to be |
---|
| 683 | selected by choosing the appropriate source. |
---|
| 684 | |
---|
| 685 | We cannot omit fields here. This has to be done in the |
---|
| 686 | respective form page. |
---|
| 687 | """ |
---|
| 688 | |
---|
| 689 | email = schema.ASCIILine( |
---|
| 690 | title = _(u'Email Address'), |
---|
| 691 | required = True, |
---|
| 692 | constraint=validate_email, |
---|
| 693 | ) |
---|
| 694 | date_of_birth = FormattedDate( |
---|
| 695 | title = _(u'Date of Birth'), |
---|
| 696 | required = True, |
---|
| 697 | show_year = True, |
---|
| 698 | ) |
---|
[13160] | 699 | jamb_subjects_list = schema.List( |
---|
| 700 | title = _(u'JAMB Subjects'), |
---|
| 701 | description = _(u'Select four subjects.'), |
---|
[13155] | 702 | required = True, |
---|
[13163] | 703 | constraint = four_items, |
---|
[13160] | 704 | value_type = schema.Choice( |
---|
| 705 | vocabulary = jambsubjects |
---|
| 706 | #source = JAMBSubjectSource(), |
---|
| 707 | ), |
---|
[13155] | 708 | ) |
---|
[8926] | 709 | |
---|
| 710 | INigeriaUGApplicantEdit[ |
---|
[13155] | 711 | 'date_of_birth'].order = INigeriaUGApplicant['date_of_birth'].order |
---|
[8926] | 712 | INigeriaUGApplicantEdit[ |
---|
[13155] | 713 | 'email'].order = INigeriaUGApplicant['email'].order |
---|
| 714 | INigeriaUGApplicantEdit[ |
---|
[13160] | 715 | 'jamb_subjects_list'].order = INigeriaUGApplicant['jamb_subjects_list'].order |
---|
[8926] | 716 | |
---|
| 717 | class INigeriaPGApplicantEdit(INigeriaPGApplicant): |
---|
| 718 | """A postgraduate applicant interface for editing. |
---|
| 719 | |
---|
| 720 | Here we can repeat the fields from base data and set the |
---|
| 721 | `required` and `readonly` attributes to True to further restrict |
---|
| 722 | the data access. Or we can allow only certain certificates to be |
---|
| 723 | selected by choosing the appropriate source. |
---|
| 724 | |
---|
| 725 | We cannot omit fields here. This has to be done in the |
---|
| 726 | respective form page. |
---|
| 727 | """ |
---|
| 728 | |
---|
| 729 | email = schema.ASCIILine( |
---|
| 730 | title = _(u'Email Address'), |
---|
| 731 | required = True, |
---|
| 732 | constraint=validate_email, |
---|
| 733 | ) |
---|
| 734 | date_of_birth = FormattedDate( |
---|
| 735 | title = _(u'Date of Birth'), |
---|
| 736 | required = True, |
---|
| 737 | show_year = True, |
---|
| 738 | ) |
---|
| 739 | |
---|
| 740 | INigeriaPGApplicantEdit[ |
---|
| 741 | 'date_of_birth'].order = INigeriaPGApplicant['date_of_birth'].order |
---|
| 742 | INigeriaPGApplicantEdit[ |
---|
| 743 | 'email'].order = INigeriaPGApplicant['email'].order |
---|
| 744 | |
---|
| 745 | class INigeriaApplicantOnlinePayment(INigeriaOnlinePayment): |
---|
| 746 | """An applicant payment via payment gateways. |
---|
| 747 | """ |
---|
| 748 | |
---|
| 749 | class IPUTMEApplicantEdit(INigeriaUGApplicant): |
---|
| 750 | """An undergraduate applicant interface for editing. |
---|
| 751 | |
---|
| 752 | Here we can repeat the fields from base data and set the |
---|
| 753 | `required` and `readonly` attributes to True to further restrict |
---|
| 754 | the data access. Or we can allow only certain certificates to be |
---|
| 755 | selected by choosing the appropriate source. |
---|
| 756 | |
---|
| 757 | We cannot omit fields here. This has to be done in the |
---|
| 758 | respective form page. |
---|
| 759 | """ |
---|
| 760 | email = schema.ASCIILine( |
---|
| 761 | title = _(u'Email Address'), |
---|
| 762 | required = True, |
---|
| 763 | constraint=validate_email, |
---|
| 764 | ) |
---|
| 765 | date_of_birth = FormattedDate( |
---|
| 766 | title = _(u'Date of Birth'), |
---|
| 767 | required = True, |
---|
| 768 | show_year = True, |
---|
| 769 | ) |
---|
[10386] | 770 | nationality = schema.Choice( |
---|
| 771 | source = nats_vocab, |
---|
| 772 | title = _(u'Nationality'), |
---|
| 773 | required = True, |
---|
| 774 | ) |
---|
[8926] | 775 | |
---|
| 776 | IPUTMEApplicantEdit[ |
---|
| 777 | 'date_of_birth'].order = INigeriaUGApplicant['date_of_birth'].order |
---|
| 778 | IPUTMEApplicantEdit[ |
---|
| 779 | 'email'].order = INigeriaUGApplicant['email'].order |
---|
[10386] | 780 | IPUTMEApplicantEdit[ |
---|
| 781 | 'nationality'].order = INigeriaUGApplicant['nationality'].order |
---|
[8926] | 782 | |
---|
| 783 | class INigeriaApplicantUpdateByRegNo(INigeriaApplicant): |
---|
| 784 | """Representation of an applicant. |
---|
| 785 | |
---|
| 786 | Skip regular reg_number validation if reg_number is used for finding |
---|
| 787 | the applicant object. |
---|
| 788 | """ |
---|
| 789 | reg_number = schema.TextLine( |
---|
| 790 | title = u'Registration Number', |
---|
| 791 | required = False, |
---|
| 792 | ) |
---|