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