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