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