[7853] | 1 | ## $Id: interfaces.py 15462 2019-06-19 07:24:30Z 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 | |
---|
[8012] | 21 | from zope import schema |
---|
[10298] | 22 | from zope.interface import Attribute, invariant, Invalid |
---|
[8051] | 23 | from waeup.kofa.applicants.interfaces import ( |
---|
[8053] | 24 | IApplicantBaseData, |
---|
[8051] | 25 | AppCatCertificateSource, CertificateSource) |
---|
| 26 | from waeup.kofa.schoolgrades import ResultEntryField |
---|
[8532] | 27 | from waeup.kofa.interfaces import ( |
---|
| 28 | SimpleKofaVocabulary, academic_sessions_vocab, validate_email) |
---|
[13544] | 29 | from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber |
---|
| 30 | from waeup.kofa.interfaces import IKofaObject |
---|
| 31 | from waeup.kofa.students.vocabularies import ( |
---|
| 32 | nats_vocab, GenderSource, StudyLevelSource) |
---|
[10298] | 33 | from waeup.kofa.applicants.interfaces import ( |
---|
| 34 | contextual_reg_num_source, |
---|
| 35 | IApplicantBaseData) |
---|
[13544] | 36 | from waeup.kofa.university.vocabularies import StudyModeSource |
---|
[8931] | 37 | from kofacustom.nigeria.applicants.interfaces import ( |
---|
| 38 | LGASource, high_qual, high_grade, exam_types, |
---|
| 39 | INigeriaUGApplicant, INigeriaPGApplicant, |
---|
| 40 | INigeriaApplicantOnlinePayment, |
---|
[8980] | 41 | INigeriaUGApplicantEdit, INigeriaPGApplicantEdit, |
---|
| 42 | INigeriaApplicantUpdateByRegNo, |
---|
| 43 | IPUTMEApplicantEdit, |
---|
[8931] | 44 | ) |
---|
[8444] | 45 | from waeup.aaue.interfaces import MessageFactory as _ |
---|
| 46 | from waeup.aaue.payments.interfaces import ICustomOnlinePayment |
---|
[7853] | 47 | |
---|
[10924] | 48 | programme_types_vocab = SimpleKofaVocabulary( |
---|
[11542] | 49 | (_('Undergraduate Programme (100 level)'), 'regular'), |
---|
| 50 | (_('Direct Entry (200 level)'), 'direct'), |
---|
[10924] | 51 | (_('not applicable'), 'na'), |
---|
| 52 | ) |
---|
| 53 | |
---|
[15118] | 54 | certificate_types_vocab = SimpleKofaVocabulary( |
---|
| 55 | (_('Full-time Degree'), 'ft'), |
---|
| 56 | (_('Part-time Degree'), 'pt'), |
---|
| 57 | (_('Diploma'), 'dp'), |
---|
| 58 | (_('Masters Degree'), 'ma'), |
---|
| 59 | (_('Doctorate Degree'), 'phd'), |
---|
| 60 | ) |
---|
| 61 | |
---|
[10298] | 62 | class ICustomUGApplicant(IApplicantBaseData): |
---|
[8012] | 63 | """An undergraduate applicant. |
---|
| 64 | |
---|
[8521] | 65 | This interface defines the least common multiple of all fields |
---|
| 66 | in ug application forms. In customized forms, fields can be excluded by |
---|
| 67 | adding them to the UG_OMIT* tuples. |
---|
[8012] | 68 | """ |
---|
| 69 | |
---|
[13977] | 70 | #programme_type = schema.Choice( |
---|
| 71 | # title = _(u'Programme Type'), |
---|
| 72 | # vocabulary = programme_types_vocab, |
---|
| 73 | # required = False, |
---|
| 74 | # ) |
---|
[10924] | 75 | |
---|
[10298] | 76 | nationality = schema.Choice( |
---|
| 77 | source = nats_vocab, |
---|
| 78 | title = _(u'Nationality'), |
---|
| 79 | required = True, |
---|
| 80 | ) |
---|
[14829] | 81 | |
---|
[10298] | 82 | lga = schema.Choice( |
---|
| 83 | source = LGASource(), |
---|
| 84 | title = _(u'State/LGA (Nigerians only)'), |
---|
| 85 | required = False, |
---|
| 86 | ) |
---|
[14829] | 87 | |
---|
[10298] | 88 | perm_address = schema.Text( |
---|
| 89 | title = _(u'Permanent Address'), |
---|
| 90 | required = False, |
---|
| 91 | ) |
---|
[14829] | 92 | |
---|
[10308] | 93 | home_town = schema.TextLine( |
---|
[10306] | 94 | title = _(u'Home Town'), |
---|
| 95 | required = False, |
---|
| 96 | ) |
---|
[14829] | 97 | |
---|
[13977] | 98 | #jamb_reg_number = schema.TextLine( |
---|
| 99 | # title = _(u'JAMB Registration Number'), |
---|
| 100 | # required = False, |
---|
| 101 | # ) |
---|
[14829] | 102 | |
---|
[10311] | 103 | jamb_score = schema.Int( |
---|
| 104 | title = _(u'Total JAMB Score'), |
---|
| 105 | required = False, |
---|
| 106 | ) |
---|
[14829] | 107 | |
---|
[13977] | 108 | jamb_subjects = schema.Text( |
---|
| 109 | title = _(u'JAMB Subjects and Scores'), |
---|
| 110 | required = False, |
---|
| 111 | ) |
---|
[14829] | 112 | |
---|
[10298] | 113 | course1 = schema.Choice( |
---|
| 114 | title = _(u'1st Choice Course of Study'), |
---|
| 115 | source = AppCatCertificateSource(), |
---|
[14468] | 116 | required = False, |
---|
[10298] | 117 | ) |
---|
[14829] | 118 | |
---|
[10298] | 119 | course2 = schema.Choice( |
---|
| 120 | title = _(u'2nd Choice Course of Study'), |
---|
| 121 | source = AppCatCertificateSource(), |
---|
| 122 | required = False, |
---|
| 123 | ) |
---|
[14829] | 124 | |
---|
[15455] | 125 | course3 = schema.Choice( |
---|
| 126 | title = _(u'3rd Choice Course of Study'), |
---|
| 127 | source = AppCatCertificateSource(), |
---|
| 128 | required = False, |
---|
| 129 | ) |
---|
| 130 | |
---|
[10298] | 131 | fst_sit_fname = schema.TextLine( |
---|
| 132 | title = _(u'Full Name'), |
---|
| 133 | required = False, |
---|
| 134 | readonly = False, |
---|
| 135 | ) |
---|
[14829] | 136 | |
---|
[10298] | 137 | fst_sit_no = schema.TextLine( |
---|
| 138 | title = _(u'Exam Number'), |
---|
| 139 | required = False, |
---|
| 140 | readonly = False, |
---|
| 141 | ) |
---|
[14829] | 142 | |
---|
| 143 | fst_sit_sc_pin = schema.TextLine( |
---|
| 144 | title = _(u'Scratch Card Pin'), |
---|
| 145 | required = False, |
---|
| 146 | readonly = False, |
---|
| 147 | ) |
---|
| 148 | |
---|
| 149 | fst_sit_sc_serial_number = schema.TextLine( |
---|
| 150 | title = _(u'Scratch Card Serial Number'), |
---|
| 151 | required = False, |
---|
| 152 | readonly = False, |
---|
| 153 | ) |
---|
| 154 | |
---|
[10298] | 155 | fst_sit_date = FormattedDate( |
---|
| 156 | title = _(u'Exam Date'), |
---|
| 157 | required = False, |
---|
| 158 | readonly = False, |
---|
| 159 | show_year = True, |
---|
| 160 | ) |
---|
[14829] | 161 | |
---|
[10298] | 162 | fst_sit_type = schema.Choice( |
---|
| 163 | title = _(u'Exam Type'), |
---|
| 164 | required = False, |
---|
| 165 | readonly = False, |
---|
| 166 | vocabulary = exam_types, |
---|
| 167 | ) |
---|
[14829] | 168 | |
---|
[10298] | 169 | fst_sit_results = schema.List( |
---|
| 170 | title = _(u'Exam Results'), |
---|
| 171 | value_type = ResultEntryField(), |
---|
| 172 | required = False, |
---|
| 173 | readonly = False, |
---|
[14017] | 174 | defaultFactory=list, |
---|
[10298] | 175 | ) |
---|
[14829] | 176 | |
---|
[10298] | 177 | scd_sit_fname = schema.TextLine( |
---|
| 178 | title = _(u'Full Name'), |
---|
| 179 | required = False, |
---|
| 180 | readonly = False, |
---|
| 181 | ) |
---|
[14829] | 182 | |
---|
[10298] | 183 | scd_sit_no = schema.TextLine( |
---|
| 184 | title = _(u'Exam Number'), |
---|
| 185 | required = False, |
---|
| 186 | readonly = False, |
---|
| 187 | ) |
---|
[14829] | 188 | |
---|
| 189 | scd_sit_sc_pin = schema.TextLine( |
---|
| 190 | title = _(u'Scratch Card Pin'), |
---|
| 191 | required = False, |
---|
| 192 | readonly = False, |
---|
| 193 | ) |
---|
| 194 | |
---|
| 195 | scd_sit_sc_serial_number = schema.TextLine( |
---|
| 196 | title = _(u'Scratch Card Serial Number'), |
---|
| 197 | required = False, |
---|
| 198 | readonly = False, |
---|
| 199 | ) |
---|
| 200 | |
---|
[10298] | 201 | scd_sit_date = FormattedDate( |
---|
| 202 | title = _(u'Exam Date'), |
---|
| 203 | required = False, |
---|
| 204 | readonly = False, |
---|
| 205 | show_year = True, |
---|
| 206 | ) |
---|
[14829] | 207 | |
---|
[10298] | 208 | scd_sit_type = schema.Choice( |
---|
| 209 | title = _(u'Exam Type'), |
---|
| 210 | required = False, |
---|
| 211 | readonly = False, |
---|
| 212 | vocabulary = exam_types, |
---|
| 213 | ) |
---|
[14829] | 214 | |
---|
[10298] | 215 | scd_sit_results = schema.List( |
---|
| 216 | title = _(u'Exam Results'), |
---|
| 217 | value_type = ResultEntryField(), |
---|
| 218 | required = False, |
---|
| 219 | readonly = False, |
---|
[14017] | 220 | defaultFactory=list, |
---|
[10298] | 221 | ) |
---|
[14829] | 222 | |
---|
[10298] | 223 | alr_fname = schema.TextLine( |
---|
| 224 | title = _(u'Full Name'), |
---|
| 225 | required = False, |
---|
| 226 | readonly = False, |
---|
| 227 | ) |
---|
[14829] | 228 | |
---|
[10298] | 229 | alr_no = schema.TextLine( |
---|
| 230 | title = _(u'Exam Number'), |
---|
| 231 | required = False, |
---|
| 232 | readonly = False, |
---|
| 233 | ) |
---|
[14829] | 234 | |
---|
[10298] | 235 | alr_date = FormattedDate( |
---|
| 236 | title = _(u'Exam Date'), |
---|
| 237 | required = False, |
---|
| 238 | readonly = False, |
---|
| 239 | show_year = True, |
---|
| 240 | ) |
---|
[14829] | 241 | |
---|
[10298] | 242 | alr_results = schema.List( |
---|
| 243 | title = _(u'Exam Results'), |
---|
| 244 | value_type = ResultEntryField(), |
---|
| 245 | required = False, |
---|
| 246 | readonly = False, |
---|
[14017] | 247 | defaultFactory=list, |
---|
[10298] | 248 | ) |
---|
[14829] | 249 | |
---|
[10998] | 250 | hq_type = schema.Choice( |
---|
| 251 | title = _(u'Qualification Obtained'), |
---|
| 252 | required = False, |
---|
| 253 | readonly = False, |
---|
| 254 | vocabulary = high_qual, |
---|
| 255 | ) |
---|
| 256 | |
---|
| 257 | hq_fname = schema.TextLine( |
---|
| 258 | title = _(u'Full Name'), |
---|
| 259 | required = False, |
---|
| 260 | readonly = False, |
---|
| 261 | ) |
---|
| 262 | |
---|
| 263 | hq_matric_no = schema.TextLine( |
---|
| 264 | title = _(u'Former Matric Number'), |
---|
| 265 | required = False, |
---|
| 266 | readonly = False, |
---|
| 267 | ) |
---|
| 268 | |
---|
| 269 | hq_degree = schema.Choice( |
---|
| 270 | title = _(u'Class of Degree'), |
---|
| 271 | required = False, |
---|
| 272 | readonly = False, |
---|
| 273 | vocabulary = high_grade, |
---|
| 274 | ) |
---|
| 275 | |
---|
| 276 | hq_school = schema.TextLine( |
---|
| 277 | title = _(u'Institution Attended'), |
---|
| 278 | required = False, |
---|
| 279 | readonly = False, |
---|
| 280 | ) |
---|
| 281 | |
---|
| 282 | hq_session = schema.TextLine( |
---|
| 283 | title = _(u'Years Attended'), |
---|
| 284 | required = False, |
---|
| 285 | readonly = False, |
---|
| 286 | ) |
---|
| 287 | |
---|
| 288 | hq_disc = schema.TextLine( |
---|
| 289 | title = _(u'Discipline'), |
---|
| 290 | required = False, |
---|
| 291 | readonly = False, |
---|
| 292 | ) |
---|
[13545] | 293 | |
---|
| 294 | hq_type2 = schema.Choice( |
---|
| 295 | title = _(u'Qualification Obtained'), |
---|
| 296 | required = False, |
---|
| 297 | readonly = False, |
---|
| 298 | vocabulary = high_qual, |
---|
| 299 | ) |
---|
| 300 | |
---|
| 301 | hq_fname2 = schema.TextLine( |
---|
| 302 | title = _(u'Full Name'), |
---|
| 303 | required = False, |
---|
| 304 | readonly = False, |
---|
| 305 | ) |
---|
| 306 | |
---|
| 307 | hq_matric_no2 = schema.TextLine( |
---|
| 308 | title = _(u'Former Matric Number'), |
---|
| 309 | required = False, |
---|
| 310 | readonly = False, |
---|
| 311 | ) |
---|
| 312 | |
---|
| 313 | hq_degree2 = schema.Choice( |
---|
| 314 | title = _(u'Class of Degree'), |
---|
| 315 | required = False, |
---|
| 316 | readonly = False, |
---|
| 317 | vocabulary = high_grade, |
---|
| 318 | ) |
---|
| 319 | |
---|
| 320 | hq_school2 = schema.TextLine( |
---|
| 321 | title = _(u'Institution Attended'), |
---|
| 322 | required = False, |
---|
| 323 | readonly = False, |
---|
| 324 | ) |
---|
| 325 | |
---|
| 326 | hq_session2 = schema.TextLine( |
---|
| 327 | title = _(u'Years Attended'), |
---|
| 328 | required = False, |
---|
| 329 | readonly = False, |
---|
| 330 | ) |
---|
| 331 | |
---|
| 332 | hq_disc2 = schema.TextLine( |
---|
| 333 | title = _(u'Discipline'), |
---|
| 334 | required = False, |
---|
| 335 | readonly = False, |
---|
| 336 | ) |
---|
| 337 | |
---|
| 338 | hq_type3 = schema.Choice( |
---|
| 339 | title = _(u'Qualification Obtained'), |
---|
| 340 | required = False, |
---|
| 341 | readonly = False, |
---|
| 342 | vocabulary = high_qual, |
---|
| 343 | ) |
---|
| 344 | |
---|
| 345 | hq_fname3 = schema.TextLine( |
---|
| 346 | title = _(u'Full Name'), |
---|
| 347 | required = False, |
---|
| 348 | readonly = False, |
---|
| 349 | ) |
---|
| 350 | |
---|
| 351 | hq_matric_no3 = schema.TextLine( |
---|
| 352 | title = _(u'Former Matric Number'), |
---|
| 353 | required = False, |
---|
| 354 | readonly = False, |
---|
| 355 | ) |
---|
| 356 | |
---|
| 357 | hq_degree3 = schema.Choice( |
---|
| 358 | title = _(u'Class of Degree'), |
---|
| 359 | required = False, |
---|
| 360 | readonly = False, |
---|
| 361 | vocabulary = high_grade, |
---|
| 362 | ) |
---|
| 363 | |
---|
| 364 | hq_school3 = schema.TextLine( |
---|
| 365 | title = _(u'Institution Attended'), |
---|
| 366 | required = False, |
---|
| 367 | readonly = False, |
---|
| 368 | ) |
---|
| 369 | |
---|
| 370 | hq_session3 = schema.TextLine( |
---|
| 371 | title = _(u'Years Attended'), |
---|
| 372 | required = False, |
---|
| 373 | readonly = False, |
---|
| 374 | ) |
---|
| 375 | |
---|
| 376 | hq_disc3 = schema.TextLine( |
---|
| 377 | title = _(u'Discipline'), |
---|
| 378 | required = False, |
---|
| 379 | readonly = False, |
---|
| 380 | ) |
---|
[13679] | 381 | |
---|
| 382 | nysc_year = schema.Int( |
---|
| 383 | title = _(u'Nysc Year'), |
---|
| 384 | required = False, |
---|
| 385 | readonly = False, |
---|
| 386 | ) |
---|
| 387 | |
---|
| 388 | nysc_location = schema.TextLine( |
---|
| 389 | title = _(u'Nysc Location'), |
---|
| 390 | required = False, |
---|
| 391 | ) |
---|
| 392 | |
---|
| 393 | nysc_lga = schema.Choice( |
---|
| 394 | source = LGASource(), |
---|
| 395 | title = _(u'Nysc LGA'), |
---|
| 396 | required = False, |
---|
| 397 | ) |
---|
| 398 | |
---|
| 399 | employer = schema.TextLine( |
---|
| 400 | title = _(u'Employer'), |
---|
| 401 | required = False, |
---|
| 402 | readonly = False, |
---|
| 403 | ) |
---|
| 404 | |
---|
| 405 | emp_position = schema.TextLine( |
---|
| 406 | title = _(u'Employer Position'), |
---|
| 407 | required = False, |
---|
| 408 | readonly = False, |
---|
| 409 | ) |
---|
| 410 | |
---|
| 411 | emp_start = FormattedDate( |
---|
| 412 | title = _(u'Start Date'), |
---|
| 413 | required = False, |
---|
| 414 | readonly = False, |
---|
| 415 | show_year = True, |
---|
| 416 | ) |
---|
| 417 | |
---|
| 418 | emp_end = FormattedDate( |
---|
| 419 | title = _(u'End Date'), |
---|
| 420 | required = False, |
---|
| 421 | readonly = False, |
---|
| 422 | show_year = True, |
---|
| 423 | ) |
---|
| 424 | |
---|
| 425 | emp_reason = schema.TextLine( |
---|
| 426 | title = _(u'Reason for Leaving'), |
---|
| 427 | required = False, |
---|
| 428 | readonly = False, |
---|
| 429 | ) |
---|
| 430 | |
---|
| 431 | employer2 = schema.TextLine( |
---|
| 432 | title = _(u'2nd Employer'), |
---|
| 433 | required = False, |
---|
| 434 | readonly = False, |
---|
| 435 | ) |
---|
| 436 | |
---|
| 437 | emp2_position = schema.TextLine( |
---|
| 438 | title = _(u'2nd Employer Position'), |
---|
| 439 | required = False, |
---|
| 440 | readonly = False, |
---|
| 441 | ) |
---|
| 442 | |
---|
| 443 | emp2_start = FormattedDate( |
---|
| 444 | title = _(u'Start Date'), |
---|
| 445 | required = False, |
---|
| 446 | readonly = False, |
---|
| 447 | show_year = True, |
---|
| 448 | ) |
---|
| 449 | |
---|
| 450 | emp2_end = FormattedDate( |
---|
| 451 | title = _(u'End Date'), |
---|
| 452 | required = False, |
---|
| 453 | readonly = False, |
---|
| 454 | show_year = True, |
---|
| 455 | ) |
---|
| 456 | |
---|
| 457 | emp2_reason = schema.TextLine( |
---|
| 458 | title = _(u'Reason for Leaving'), |
---|
| 459 | required = False, |
---|
| 460 | readonly = False, |
---|
| 461 | ) |
---|
| 462 | |
---|
| 463 | former_matric = schema.TextLine( |
---|
| 464 | title = _(u'If yes, matric number'), |
---|
| 465 | required = False, |
---|
| 466 | readonly = False, |
---|
| 467 | ) |
---|
| 468 | |
---|
[10298] | 469 | notice = schema.Text( |
---|
| 470 | title = _(u'Notice'), |
---|
| 471 | required = False, |
---|
| 472 | ) |
---|
[13977] | 473 | |
---|
| 474 | |
---|
| 475 | master_sheet_number = schema.TextLine( |
---|
| 476 | title = _(u'Master Sheet Number'), |
---|
| 477 | required = False, |
---|
| 478 | readonly = False, |
---|
| 479 | ) |
---|
| 480 | |
---|
[13996] | 481 | screening_venue = schema.TextLine( |
---|
| 482 | title = _(u'Screening Venue'), |
---|
| 483 | required = False, |
---|
| 484 | ) |
---|
[14666] | 485 | |
---|
[13996] | 486 | screening_date = schema.TextLine( |
---|
| 487 | title = _(u'Screening Date'), |
---|
| 488 | required = False, |
---|
| 489 | ) |
---|
[14666] | 490 | |
---|
[13996] | 491 | screening_score = schema.Int( |
---|
[14028] | 492 | title = _(u'Screening Points'), |
---|
[13996] | 493 | required = False, |
---|
| 494 | ) |
---|
[14666] | 495 | |
---|
[10298] | 496 | student_id = schema.TextLine( |
---|
| 497 | title = _(u'Student Id'), |
---|
| 498 | required = False, |
---|
| 499 | readonly = False, |
---|
| 500 | ) |
---|
[14666] | 501 | |
---|
[10298] | 502 | course_admitted = schema.Choice( |
---|
| 503 | title = _(u'Admitted Course of Study'), |
---|
| 504 | source = CertificateSource(), |
---|
| 505 | required = False, |
---|
| 506 | ) |
---|
[14666] | 507 | |
---|
[10298] | 508 | locked = schema.Bool( |
---|
| 509 | title = _(u'Form locked'), |
---|
| 510 | default = False, |
---|
| 511 | ) |
---|
| 512 | |
---|
| 513 | @invariant |
---|
[15455] | 514 | def course_choice(applicant): |
---|
[10298] | 515 | if applicant.course1 == applicant.course2: |
---|
| 516 | raise Invalid(_("2nd choice course must differ from 1st choice course.")) |
---|
[15455] | 517 | if applicant.course1 == applicant.course3: |
---|
| 518 | raise Invalid(_("3rd choice course must differ from 1st choice course.")) |
---|
| 519 | if applicant.course2 == applicant.course3: |
---|
| 520 | raise Invalid(_("3rd choice course must differ from 2nd choice course.")) |
---|
[10298] | 521 | |
---|
[13977] | 522 | #ICustomUGApplicant['programme_type'].order = IApplicantBaseData[ |
---|
| 523 | # 'reg_number'].order |
---|
[10924] | 524 | |
---|
[8931] | 525 | class ICustomPGApplicant(INigeriaPGApplicant): |
---|
[7853] | 526 | """A postgraduate applicant. |
---|
| 527 | |
---|
[8521] | 528 | This interface defines the least common multiple of all fields |
---|
| 529 | in pg application forms. In customized forms, fields can be excluded by |
---|
| 530 | adding them to the PG_OMIT* tuples. |
---|
[7866] | 531 | """ |
---|
| 532 | |
---|
[13544] | 533 | class ITranscriptApplicant(IKofaObject): |
---|
| 534 | """A transcript applicant. |
---|
| 535 | """ |
---|
[8012] | 536 | |
---|
[13544] | 537 | suspended = schema.Bool( |
---|
| 538 | title = _(u'Account suspended'), |
---|
| 539 | default = False, |
---|
| 540 | required = False, |
---|
| 541 | ) |
---|
| 542 | |
---|
| 543 | locked = schema.Bool( |
---|
| 544 | title = _(u'Form locked'), |
---|
| 545 | default = False, |
---|
| 546 | required = False, |
---|
| 547 | ) |
---|
| 548 | |
---|
| 549 | applicant_id = schema.TextLine( |
---|
| 550 | title = _(u'Applicant Id'), |
---|
| 551 | required = False, |
---|
| 552 | readonly = False, |
---|
| 553 | ) |
---|
| 554 | |
---|
[14472] | 555 | reg_number = TextLineChoice( |
---|
[14486] | 556 | title = _(u'Kofa Registration Number'), |
---|
[14472] | 557 | readonly = False, |
---|
| 558 | required = True, |
---|
| 559 | source = contextual_reg_num_source, |
---|
| 560 | ) |
---|
| 561 | |
---|
[13544] | 562 | firstname = schema.TextLine( |
---|
| 563 | title = _(u'First Name'), |
---|
| 564 | required = True, |
---|
| 565 | ) |
---|
| 566 | |
---|
| 567 | middlename = schema.TextLine( |
---|
| 568 | title = _(u'Middle Name'), |
---|
| 569 | required = False, |
---|
| 570 | ) |
---|
| 571 | |
---|
| 572 | lastname = schema.TextLine( |
---|
| 573 | title = _(u'Last Name (Surname)'), |
---|
| 574 | required = True, |
---|
| 575 | ) |
---|
| 576 | |
---|
[14472] | 577 | matric_number = schema.TextLine( |
---|
| 578 | title = _(u'Matriculation Number'), |
---|
[13544] | 579 | readonly = False, |
---|
[14486] | 580 | required = True, |
---|
[13544] | 581 | ) |
---|
| 582 | |
---|
| 583 | date_of_birth = FormattedDate( |
---|
| 584 | title = _(u'Date of Birth'), |
---|
[15275] | 585 | required = False, |
---|
[13544] | 586 | #date_format = u'%d/%m/%Y', # Use grok-instance-wide default |
---|
| 587 | show_year = True, |
---|
| 588 | ) |
---|
| 589 | |
---|
| 590 | place_of_birth = schema.TextLine( |
---|
| 591 | title = _(u'Place of Birth'), |
---|
| 592 | readonly = False, |
---|
[15275] | 593 | required = False, |
---|
[13544] | 594 | ) |
---|
| 595 | |
---|
| 596 | nationality = schema.Choice( |
---|
| 597 | vocabulary = nats_vocab, |
---|
| 598 | title = _(u'Nationality'), |
---|
[15275] | 599 | required = False, |
---|
[13544] | 600 | ) |
---|
| 601 | |
---|
| 602 | email = schema.ASCIILine( |
---|
| 603 | title = _(u'Email Address'), |
---|
| 604 | required = True, |
---|
| 605 | constraint=validate_email, |
---|
| 606 | ) |
---|
| 607 | |
---|
| 608 | phone = PhoneNumber( |
---|
| 609 | title = _(u'Phone'), |
---|
| 610 | description = u'', |
---|
[15275] | 611 | required = False, |
---|
[13544] | 612 | ) |
---|
| 613 | |
---|
| 614 | perm_address = schema.Text( |
---|
| 615 | title = _(u'Current Local Address'), |
---|
[15275] | 616 | required = False, |
---|
[13544] | 617 | readonly = False, |
---|
| 618 | ) |
---|
| 619 | |
---|
| 620 | dispatch_address = schema.Text( |
---|
[14306] | 621 | title = _(u'Dispatch Addresses'), |
---|
| 622 | description = u'Addresses to which transcript should be posted.', |
---|
[15275] | 623 | required = False, |
---|
[13544] | 624 | readonly = False, |
---|
| 625 | ) |
---|
| 626 | |
---|
| 627 | entry_mode = schema.Choice( |
---|
| 628 | title = _(u'Entry Mode'), |
---|
| 629 | source = StudyModeSource(), |
---|
[15275] | 630 | required = False, |
---|
[13544] | 631 | readonly = False, |
---|
| 632 | ) |
---|
| 633 | |
---|
| 634 | entry_session = schema.Choice( |
---|
| 635 | title = _(u'Entry Session'), |
---|
| 636 | source = academic_sessions_vocab, |
---|
[15275] | 637 | required = False, |
---|
[13544] | 638 | readonly = False, |
---|
| 639 | ) |
---|
| 640 | |
---|
| 641 | end_session = schema.Choice( |
---|
| 642 | title = _(u'End Session'), |
---|
| 643 | source = academic_sessions_vocab, |
---|
[15275] | 644 | required = False, |
---|
[13544] | 645 | readonly = False, |
---|
| 646 | ) |
---|
| 647 | |
---|
| 648 | course_studied = schema.Choice( |
---|
| 649 | title = _(u'Course of Study / Degree'), |
---|
| 650 | source = CertificateSource(), |
---|
[15275] | 651 | required = False, |
---|
[13544] | 652 | readonly = False, |
---|
| 653 | ) |
---|
| 654 | |
---|
| 655 | purpose = schema.TextLine( |
---|
| 656 | title = _(u'Purpose of this Application'), |
---|
| 657 | readonly = False, |
---|
| 658 | required = False, |
---|
| 659 | ) |
---|
| 660 | |
---|
| 661 | course_changed = schema.Choice( |
---|
| 662 | title = _(u'Change of Study Course'), |
---|
| 663 | description = u'If yes, select previous course of study.', |
---|
| 664 | source = CertificateSource(), |
---|
| 665 | readonly = False, |
---|
| 666 | required = False, |
---|
| 667 | ) |
---|
| 668 | |
---|
| 669 | change_level = schema.Choice( |
---|
| 670 | title = _(u'Change Level'), |
---|
| 671 | description = u'If yes, select level at which you changed course of study.', |
---|
| 672 | source = StudyLevelSource(), |
---|
| 673 | required = False, |
---|
| 674 | readonly = False, |
---|
| 675 | ) |
---|
| 676 | |
---|
[14306] | 677 | no_copies = schema.Choice( |
---|
| 678 | title = _(u'Number of Copies'), |
---|
| 679 | description = u'Must correspond with the number of dispatch addresses above.', |
---|
| 680 | values=[1, 2, 3, 4], |
---|
| 681 | required = False, |
---|
| 682 | readonly = False, |
---|
| 683 | default = 1, |
---|
| 684 | ) |
---|
| 685 | |
---|
[14304] | 686 | class ICertificateRequest(IKofaObject): |
---|
| 687 | """A transcript applicant. |
---|
| 688 | """ |
---|
[13544] | 689 | |
---|
[14304] | 690 | suspended = schema.Bool( |
---|
| 691 | title = _(u'Account suspended'), |
---|
| 692 | default = False, |
---|
| 693 | required = False, |
---|
| 694 | ) |
---|
| 695 | |
---|
| 696 | locked = schema.Bool( |
---|
| 697 | title = _(u'Form locked'), |
---|
| 698 | default = False, |
---|
| 699 | required = False, |
---|
| 700 | ) |
---|
| 701 | |
---|
| 702 | applicant_id = schema.TextLine( |
---|
| 703 | title = _(u'Applicant Id'), |
---|
| 704 | required = False, |
---|
| 705 | readonly = False, |
---|
| 706 | ) |
---|
| 707 | |
---|
[14472] | 708 | reg_number = TextLineChoice( |
---|
[14486] | 709 | title = _(u'Kofa Registration Number'), |
---|
[14472] | 710 | readonly = False, |
---|
| 711 | required = True, |
---|
| 712 | source = contextual_reg_num_source, |
---|
| 713 | ) |
---|
| 714 | |
---|
[14304] | 715 | firstname = schema.TextLine( |
---|
| 716 | title = _(u'First Name'), |
---|
| 717 | required = True, |
---|
| 718 | ) |
---|
| 719 | |
---|
| 720 | middlename = schema.TextLine( |
---|
| 721 | title = _(u'Middle Name'), |
---|
| 722 | required = False, |
---|
| 723 | ) |
---|
| 724 | |
---|
| 725 | lastname = schema.TextLine( |
---|
| 726 | title = _(u'Last Name (Surname)'), |
---|
| 727 | required = True, |
---|
| 728 | ) |
---|
| 729 | |
---|
[14472] | 730 | matric_number = schema.TextLine( |
---|
| 731 | title = _(u'Matriculation Number'), |
---|
[14304] | 732 | readonly = False, |
---|
[14486] | 733 | required = True, |
---|
[14304] | 734 | ) |
---|
| 735 | |
---|
| 736 | date_of_birth = FormattedDate( |
---|
| 737 | title = _(u'Date of Birth'), |
---|
[15275] | 738 | required = False, |
---|
[14304] | 739 | #date_format = u'%d/%m/%Y', # Use grok-instance-wide default |
---|
| 740 | show_year = True, |
---|
| 741 | ) |
---|
| 742 | |
---|
| 743 | place_of_birth = schema.TextLine( |
---|
| 744 | title = _(u'Place of Birth'), |
---|
| 745 | readonly = False, |
---|
[15275] | 746 | required = False, |
---|
[14304] | 747 | ) |
---|
| 748 | |
---|
| 749 | nationality = schema.Choice( |
---|
| 750 | vocabulary = nats_vocab, |
---|
| 751 | title = _(u'Nationality'), |
---|
[15275] | 752 | required = False, |
---|
[14304] | 753 | ) |
---|
| 754 | |
---|
| 755 | email = schema.ASCIILine( |
---|
| 756 | title = _(u'Email Address'), |
---|
| 757 | required = True, |
---|
| 758 | constraint=validate_email, |
---|
| 759 | ) |
---|
| 760 | |
---|
| 761 | phone = PhoneNumber( |
---|
| 762 | title = _(u'Phone'), |
---|
| 763 | description = u'', |
---|
[15275] | 764 | required = False, |
---|
[14304] | 765 | ) |
---|
| 766 | |
---|
| 767 | entry_session = schema.Choice( |
---|
| 768 | title = _(u'Entry Session'), |
---|
| 769 | source = academic_sessions_vocab, |
---|
[15275] | 770 | required = False, |
---|
[14304] | 771 | readonly = False, |
---|
| 772 | ) |
---|
| 773 | |
---|
| 774 | end_session = schema.Choice( |
---|
| 775 | title = _(u'End Session'), |
---|
| 776 | source = academic_sessions_vocab, |
---|
[15275] | 777 | required = False, |
---|
[14304] | 778 | readonly = False, |
---|
| 779 | ) |
---|
| 780 | |
---|
| 781 | course_studied = schema.Choice( |
---|
| 782 | title = _(u'Course of Study / Degree'), |
---|
| 783 | source = CertificateSource(), |
---|
[14486] | 784 | required = True, |
---|
[14304] | 785 | readonly = False, |
---|
| 786 | ) |
---|
| 787 | |
---|
[15118] | 788 | certificate_type = schema.Choice( |
---|
| 789 | title = _(u'Certificate Type'), |
---|
| 790 | vocabulary = certificate_types_vocab, |
---|
[15275] | 791 | required = False, |
---|
[15118] | 792 | ) |
---|
[14306] | 793 | |
---|
[15118] | 794 | |
---|
[13544] | 795 | class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant, |
---|
[14304] | 796 | ITranscriptApplicant, ICertificateRequest): |
---|
[14471] | 797 | """An interface for all types of applicants. |
---|
[13544] | 798 | |
---|
[8931] | 799 | Attention: The ICustomPGApplicant field seetings will be overwritten |
---|
| 800 | by ICustomPGApplicant field settings. If a field is defined |
---|
[8728] | 801 | in both interfaces zope.schema validates only against the |
---|
[8931] | 802 | constraints in ICustomUGApplicant. This does not affect the forms |
---|
| 803 | since they are build on either ICustomUGApplicant or ICustomPGApplicant. |
---|
[8012] | 804 | """ |
---|
| 805 | |
---|
[8746] | 806 | def writeLogMessage(view, comment): |
---|
[8053] | 807 | """Adds an INFO message to the log file |
---|
| 808 | """ |
---|
| 809 | |
---|
| 810 | def createStudent(): |
---|
| 811 | """Create a student object from applicatnt data |
---|
| 812 | and copy applicant object. |
---|
| 813 | """ |
---|
| 814 | |
---|
[10298] | 815 | class ICustomUGApplicantEdit(ICustomUGApplicant): |
---|
[8728] | 816 | """An undergraduate applicant interface for edit forms. |
---|
[8012] | 817 | |
---|
| 818 | Here we can repeat the fields from base data and set the |
---|
| 819 | `required` and `readonly` attributes to True to further restrict |
---|
| 820 | the data access. Or we can allow only certain certificates to be |
---|
| 821 | selected by choosing the appropriate source. |
---|
| 822 | |
---|
| 823 | We cannot omit fields here. This has to be done in the |
---|
| 824 | respective form page. |
---|
| 825 | """ |
---|
| 826 | |
---|
[13977] | 827 | #programme_type = schema.Choice( |
---|
| 828 | # title = _(u'Programme Type'), |
---|
| 829 | # vocabulary = programme_types_vocab, |
---|
| 830 | # required = True, |
---|
| 831 | # ) |
---|
[13548] | 832 | |
---|
[10924] | 833 | date_of_birth = FormattedDate( |
---|
| 834 | title = _(u'Date of Birth'), |
---|
| 835 | required = True, |
---|
| 836 | show_year = True, |
---|
| 837 | ) |
---|
| 838 | |
---|
[15462] | 839 | course1 = schema.Choice( |
---|
| 840 | title = _(u'1st Choice Course of Study'), |
---|
| 841 | source = AppCatCertificateSource(), |
---|
| 842 | required = True, |
---|
| 843 | ) |
---|
| 844 | |
---|
| 845 | course2 = schema.Choice( |
---|
| 846 | title = _(u'2nd Choice Course of Study'), |
---|
| 847 | source = AppCatCertificateSource(), |
---|
| 848 | required = True, |
---|
| 849 | ) |
---|
| 850 | |
---|
| 851 | course3 = schema.Choice( |
---|
| 852 | title = _(u'3rd Choice Course of Study'), |
---|
| 853 | source = AppCatCertificateSource(), |
---|
| 854 | required = True, |
---|
| 855 | ) |
---|
| 856 | |
---|
[14829] | 857 | fst_sit_fname = schema.TextLine( |
---|
| 858 | title = _(u'Full Name'), |
---|
| 859 | required = True, |
---|
| 860 | readonly = False, |
---|
| 861 | ) |
---|
| 862 | |
---|
| 863 | fst_sit_no = schema.TextLine( |
---|
| 864 | title = _(u'Exam Number'), |
---|
| 865 | required = True, |
---|
| 866 | readonly = False, |
---|
| 867 | ) |
---|
| 868 | |
---|
| 869 | fst_sit_sc_pin = schema.TextLine( |
---|
| 870 | title = _(u'Scratch Card Pin'), |
---|
| 871 | required = True, |
---|
| 872 | readonly = False, |
---|
| 873 | ) |
---|
| 874 | |
---|
| 875 | fst_sit_sc_serial_number = schema.TextLine( |
---|
| 876 | title = _(u'Scratch Card Serial Number'), |
---|
| 877 | required = True, |
---|
| 878 | readonly = False, |
---|
| 879 | ) |
---|
| 880 | |
---|
| 881 | fst_sit_date = FormattedDate( |
---|
| 882 | title = _(u'Exam Date'), |
---|
| 883 | required = True, |
---|
| 884 | readonly = False, |
---|
| 885 | show_year = True, |
---|
| 886 | ) |
---|
| 887 | |
---|
| 888 | fst_sit_type = schema.Choice( |
---|
| 889 | title = _(u'Exam Type'), |
---|
| 890 | required = True, |
---|
| 891 | readonly = False, |
---|
| 892 | vocabulary = exam_types, |
---|
| 893 | ) |
---|
| 894 | |
---|
[15459] | 895 | # course1 works only on manage pages. On edit pages course1 input is missing |
---|
| 896 | # and no Invalid exception is raised. |
---|
| 897 | # NoInputData: NoInputD...course1' |
---|
| 898 | # Therefore, we check and compare course1 on CustomApplicantEditFormPage. |
---|
| 899 | @invariant |
---|
| 900 | def course_choice(applicant): |
---|
| 901 | if applicant.course2 == applicant.course3: |
---|
| 902 | raise Invalid(_("3rd choice course must differ from 2nd choice course.")) |
---|
| 903 | |
---|
[13977] | 904 | #ICustomUGApplicantEdit['programme_type'].order = ICustomUGApplicant[ |
---|
| 905 | # 'programme_type'].order |
---|
[10924] | 906 | ICustomUGApplicantEdit['date_of_birth'].order = ICustomUGApplicant[ |
---|
| 907 | 'date_of_birth'].order |
---|
[15462] | 908 | ICustomUGApplicantEdit['course1'].order = ICustomUGApplicant[ |
---|
| 909 | 'course1'].order |
---|
| 910 | ICustomUGApplicantEdit['course2'].order = ICustomUGApplicant[ |
---|
| 911 | 'course2'].order |
---|
| 912 | ICustomUGApplicantEdit['course3'].order = ICustomUGApplicant[ |
---|
| 913 | 'course3'].order |
---|
[14829] | 914 | ICustomUGApplicantEdit['fst_sit_fname'].order = ICustomUGApplicant[ |
---|
| 915 | 'fst_sit_fname'].order |
---|
| 916 | ICustomUGApplicantEdit['fst_sit_no'].order = ICustomUGApplicant[ |
---|
| 917 | 'fst_sit_no'].order |
---|
| 918 | ICustomUGApplicantEdit['fst_sit_sc_pin'].order = ICustomUGApplicant[ |
---|
| 919 | 'fst_sit_sc_pin'].order |
---|
| 920 | ICustomUGApplicantEdit['fst_sit_sc_serial_number'].order = ICustomUGApplicant[ |
---|
| 921 | 'fst_sit_sc_serial_number'].order |
---|
| 922 | ICustomUGApplicantEdit['fst_sit_date'].order = ICustomUGApplicant[ |
---|
| 923 | 'fst_sit_date'].order |
---|
| 924 | ICustomUGApplicantEdit['fst_sit_type'].order = ICustomUGApplicant[ |
---|
| 925 | 'fst_sit_type'].order |
---|
[10924] | 926 | |
---|
[8980] | 927 | class ICustomPGApplicantEdit(INigeriaPGApplicantEdit): |
---|
[7866] | 928 | """A postgraduate applicant interface for editing. |
---|
| 929 | |
---|
| 930 | Here we can repeat the fields from base data and set the |
---|
| 931 | `required` and `readonly` attributes to True to further restrict |
---|
| 932 | the data access. Or we can allow only certain certificates to be |
---|
| 933 | selected by choosing the appropriate source. |
---|
| 934 | |
---|
| 935 | We cannot omit fields here. This has to be done in the |
---|
| 936 | respective form page. |
---|
[8017] | 937 | """ |
---|
[8455] | 938 | |
---|
[8931] | 939 | class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment): |
---|
[8247] | 940 | """An applicant payment via payment gateways. |
---|
| 941 | |
---|
| 942 | """ |
---|
[8532] | 943 | |
---|
[8980] | 944 | class IPUTMEApplicantEdit(IPUTMEApplicantEdit): |
---|
[8532] | 945 | """An undergraduate applicant interface for editing. |
---|
| 946 | |
---|
| 947 | Here we can repeat the fields from base data and set the |
---|
| 948 | `required` and `readonly` attributes to True to further restrict |
---|
| 949 | the data access. Or we can allow only certain certificates to be |
---|
| 950 | selected by choosing the appropriate source. |
---|
| 951 | |
---|
| 952 | We cannot omit fields here. This has to be done in the |
---|
| 953 | respective form page. |
---|
| 954 | """ |
---|
| 955 | |
---|
[14471] | 956 | class ICustomApplicantUpdateByRegNo(ICustomApplicant): |
---|
[8583] | 957 | """Representation of an applicant. |
---|
| 958 | |
---|
| 959 | Skip regular reg_number validation if reg_number is used for finding |
---|
| 960 | the applicant object. |
---|
| 961 | """ |
---|
[8980] | 962 | |
---|
[14471] | 963 | reg_number = schema.TextLine( |
---|
| 964 | title = u'Registration Number', |
---|
| 965 | required = False, |
---|
| 966 | ) |
---|
[13544] | 967 | |
---|
| 968 | |
---|
[14471] | 969 | |
---|
| 970 | |
---|