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