[16142] | 1 | # -*- coding: utf-8 -*- |
---|
[10765] | 2 | ## $Id: interfaces.py 16553 2021-07-15 12:32:55Z henrik $ |
---|
| 3 | ## |
---|
| 4 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann |
---|
| 5 | ## This program is free software; you can redistribute it and/or modify |
---|
| 6 | ## it under the terms of the GNU General Public License as published by |
---|
| 7 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 8 | ## (at your option) any later version. |
---|
| 9 | ## |
---|
| 10 | ## This program is distributed in the hope that it will be useful, |
---|
| 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 13 | ## GNU General Public License for more details. |
---|
| 14 | ## |
---|
| 15 | ## You should have received a copy of the GNU General Public License |
---|
| 16 | ## along with this program; if not, write to the Free Software |
---|
| 17 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 18 | ## |
---|
| 19 | """Customized interfaces of the university application package. |
---|
| 20 | """ |
---|
| 21 | |
---|
| 22 | from zope import schema |
---|
[16165] | 23 | from zope.component import getUtility |
---|
| 24 | from zope.catalog.interfaces import ICatalog |
---|
[16142] | 25 | from zc.sourcefactory.basic import BasicSourceFactory |
---|
[10765] | 26 | from waeup.kofa.applicants.interfaces import ( |
---|
| 27 | IApplicantBaseData, |
---|
| 28 | AppCatCertificateSource, CertificateSource) |
---|
| 29 | from waeup.kofa.schoolgrades import ResultEntryField |
---|
[16142] | 30 | from waeup.kofa.university.vocabularies import StudyModeSource |
---|
[10765] | 31 | from waeup.kofa.interfaces import ( |
---|
[16142] | 32 | SimpleKofaVocabulary, academic_sessions_vocab, validate_email, |
---|
| 33 | IKofaObject) |
---|
[15863] | 34 | from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber |
---|
[16142] | 35 | from waeup.kofa.students.vocabularies import ( |
---|
| 36 | nats_vocab, GenderSource, StudyLevelSource) |
---|
[15807] | 37 | from waeup.kofa.applicants.interfaces import ( |
---|
[16281] | 38 | contextual_reg_num_source, IApplicantBaseData, IApplicantRefereeReport, |
---|
| 39 | contextual_email_source, IApplicantRegisterUpdate) |
---|
[16049] | 40 | from waeup.kofa.refereeentries import RefereeEntryField |
---|
[10765] | 41 | from kofacustom.nigeria.applicants.interfaces import ( |
---|
[15838] | 42 | LGASource, high_qual, high_grade, exam_types, DisabilitiesSource, |
---|
| 43 | programme_types_vocab, jambsubjects, validate_jamb_reg_number, |
---|
[10765] | 44 | INigeriaUGApplicant, INigeriaPGApplicant, |
---|
| 45 | INigeriaApplicantOnlinePayment, |
---|
| 46 | INigeriaUGApplicantEdit, INigeriaPGApplicantEdit, |
---|
| 47 | INigeriaApplicantUpdateByRegNo, |
---|
| 48 | IPUTMEApplicantEdit, |
---|
| 49 | ) |
---|
[15563] | 50 | from kofacustom.iuokada.interfaces import MessageFactory as _ |
---|
| 51 | from kofacustom.iuokada.payments.interfaces import ICustomOnlinePayment |
---|
[10765] | 52 | |
---|
[15793] | 53 | sponsors_vocab = SimpleKofaVocabulary( |
---|
| 54 | (_('Bauchi Government'), 'bauchi'), |
---|
| 55 | (_('Company'), 'company'), |
---|
[15863] | 56 | (_('Federal Government of Nigeria'), 'federalgov'), |
---|
| 57 | #(_('Dangote Group'), 'dangote'), |
---|
[15793] | 58 | (_('Kano Government'), 'kano'), |
---|
| 59 | (_('Parent/Guardian'), 'parent'), |
---|
| 60 | (_('Rosula Organization'), 'rosula'), |
---|
| 61 | (_('Self'), 'self'), |
---|
[15863] | 62 | #(_('Social Impact Project'), 'social'), |
---|
[15793] | 63 | ) |
---|
| 64 | |
---|
| 65 | heard_about_types_vocab = SimpleKofaVocabulary( |
---|
| 66 | (_('Facebook/Twitter/Other Social Media'), 'socmedia'), |
---|
| 67 | (_('From a Friend'), 'friend'), |
---|
| 68 | (_('Newspaper Advertisement'), 'newspaper'), |
---|
| 69 | (_('Radio Advertisement'), 'radio'), |
---|
| 70 | (_('Television Advertisement'), 'television'), |
---|
[15863] | 71 | (_('SMS'), 'sms'), |
---|
[15793] | 72 | ) |
---|
| 73 | |
---|
[15858] | 74 | subtype_vocab = SimpleKofaVocabulary( |
---|
| 75 | (_('UTME'), 'utme'), |
---|
| 76 | (_('Direct Entry'), 'de'), |
---|
| 77 | (_('Inter Uni Transfer'), 'transfer'), |
---|
| 78 | ) |
---|
| 79 | |
---|
[16062] | 80 | rating_vocab = SimpleKofaVocabulary( |
---|
| 81 | (_('Excellent'), 'e'), |
---|
| 82 | (_('Very good'), 'vg'), |
---|
| 83 | (_('Good'), 'g'), |
---|
| 84 | (_('Slightly above average'), 'saa'), |
---|
| 85 | (_('Average'), 'a'), |
---|
| 86 | (_('Below average'), 'ba'), |
---|
| 87 | (_('Unable to assess'), 'unable'), |
---|
| 88 | ) |
---|
| 89 | |
---|
| 90 | |
---|
| 91 | overallpromise_vocab = SimpleKofaVocabulary( |
---|
[16063] | 92 | (_('Very good (highest 10%)'), 'vg'), |
---|
[16062] | 93 | (_('Above average (next 15%)'), 'aa'), |
---|
| 94 | (_('Average (middle 20%)'), 'a'), |
---|
| 95 | (_('Below average (middle 40%)'), 'ba'), |
---|
| 96 | ) |
---|
| 97 | |
---|
[16142] | 98 | DESTINATION_COST = { |
---|
[16147] | 99 | 'local': ('Local (Nigeria)', 15000.0, 1), |
---|
| 100 | 'overseas': ('Overseas', 25000.0, 2), |
---|
[16142] | 101 | } |
---|
| 102 | |
---|
| 103 | class DestinationCostSource(BasicSourceFactory): |
---|
| 104 | """A source that delivers continents and shipment costs. |
---|
| 105 | """ |
---|
| 106 | def getValues(self): |
---|
| 107 | sorted_items = sorted(DESTINATION_COST.items(), |
---|
| 108 | key=lambda element: element[1][2]) |
---|
| 109 | return [item[0] for item in sorted_items] |
---|
| 110 | |
---|
| 111 | def getTitle(self, value): |
---|
| 112 | return u"%s (₦ %s)" % ( |
---|
| 113 | DESTINATION_COST[value][0], |
---|
| 114 | DESTINATION_COST[value][1]) |
---|
| 115 | |
---|
[16165] | 116 | class TranscriptCertificateSource(CertificateSource): |
---|
| 117 | """Include Department and Faculty in Title. |
---|
| 118 | """ |
---|
| 119 | def getValues(self, context): |
---|
| 120 | catalog = getUtility(ICatalog, name='certificates_catalog') |
---|
| 121 | resultset = catalog.searchResults(code=(None, None)) |
---|
| 122 | resultlist = sorted(resultset, key=lambda |
---|
| 123 | value: value.__parent__.__parent__.__parent__.code + |
---|
| 124 | value.__parent__.__parent__.code + |
---|
| 125 | value.code) |
---|
| 126 | return resultlist |
---|
| 127 | |
---|
| 128 | def getTitle(self, context, value): |
---|
| 129 | """ |
---|
| 130 | """ |
---|
| 131 | try: title = "%s / %s / %s (%s)" % ( |
---|
| 132 | value.__parent__.__parent__.__parent__.title, |
---|
| 133 | value.__parent__.__parent__.title, |
---|
| 134 | value.title, value.code) |
---|
| 135 | except AttributeError: |
---|
| 136 | title = "NA / %s (%s)" % (value.title, value.code) |
---|
| 137 | return title |
---|
| 138 | |
---|
[15838] | 139 | class ICustomUGApplicant(IApplicantBaseData): |
---|
[10765] | 140 | """An undergraduate applicant. |
---|
| 141 | |
---|
| 142 | This interface defines the least common multiple of all fields |
---|
| 143 | in ug application forms. In customized forms, fields can be excluded by |
---|
| 144 | adding them to the UG_OMIT* tuples. |
---|
| 145 | """ |
---|
| 146 | |
---|
[16281] | 147 | email = TextLineChoice( |
---|
[16287] | 148 | title = _(u'Email Address'), |
---|
| 149 | required = True, |
---|
[16281] | 150 | constraint=validate_email, |
---|
| 151 | source = contextual_email_source, |
---|
| 152 | ) |
---|
| 153 | |
---|
[15858] | 154 | subtype = schema.Choice( |
---|
| 155 | title = _(u'Application Subtype'), |
---|
| 156 | vocabulary = subtype_vocab, |
---|
| 157 | required = False, |
---|
| 158 | ) |
---|
[15838] | 159 | disabilities = schema.Choice( |
---|
| 160 | title = _(u'Disability'), |
---|
| 161 | source = DisabilitiesSource(), |
---|
| 162 | required = False, |
---|
| 163 | ) |
---|
| 164 | nationality = schema.Choice( |
---|
| 165 | source = nats_vocab, |
---|
| 166 | title = _(u'Nationality'), |
---|
| 167 | required = False, |
---|
| 168 | ) |
---|
| 169 | lga = schema.Choice( |
---|
| 170 | source = LGASource(), |
---|
| 171 | title = _(u'State/LGA (Nigerians only)'), |
---|
| 172 | required = False, |
---|
| 173 | ) |
---|
[15863] | 174 | sponsor = schema.Choice( |
---|
| 175 | title = _(u'Sponsor'), |
---|
| 176 | vocabulary = sponsors_vocab, |
---|
| 177 | required = False, |
---|
| 178 | ) |
---|
| 179 | heard_about = schema.Choice( |
---|
| 180 | title = _(u'How did you hear about IUO?'), |
---|
| 181 | vocabulary = heard_about_types_vocab, |
---|
| 182 | required = False, |
---|
| 183 | ) |
---|
[16287] | 184 | perm_address = schema.Text( |
---|
| 185 | title = _(u'Residential Address'), |
---|
| 186 | required = True, |
---|
| 187 | ) |
---|
[15863] | 188 | parents_name = schema.TextLine( |
---|
| 189 | title = _(u'Full Name'), |
---|
| 190 | required = False, |
---|
| 191 | readonly = False, |
---|
| 192 | ) |
---|
| 193 | parents_email = schema.ASCIILine( |
---|
| 194 | title = _(u'Email Address'), |
---|
| 195 | required = False, |
---|
| 196 | constraint=validate_email, |
---|
| 197 | ) |
---|
| 198 | parents_phone = PhoneNumber( |
---|
| 199 | title = _(u'Phone'), |
---|
| 200 | required = False, |
---|
| 201 | ) |
---|
[15838] | 202 | course1 = schema.Choice( |
---|
| 203 | title = _(u'1st Choice Course of Study'), |
---|
| 204 | source = AppCatCertificateSource(), |
---|
| 205 | required = True, |
---|
| 206 | ) |
---|
| 207 | course2 = schema.Choice( |
---|
| 208 | title = _(u'2nd Choice Course of Study'), |
---|
| 209 | source = AppCatCertificateSource(), |
---|
| 210 | required = False, |
---|
| 211 | ) |
---|
| 212 | programme_type = schema.Choice( |
---|
| 213 | title = _(u'Programme Type'), |
---|
| 214 | vocabulary = programme_types_vocab, |
---|
| 215 | required = False, |
---|
| 216 | ) |
---|
| 217 | fst_sit_fname = schema.TextLine( |
---|
| 218 | title = _(u'Full Name'), |
---|
| 219 | required = False, |
---|
| 220 | readonly = False, |
---|
| 221 | ) |
---|
| 222 | fst_sit_no = schema.TextLine( |
---|
| 223 | title = _(u'Exam Number'), |
---|
| 224 | required = False, |
---|
| 225 | readonly = False, |
---|
| 226 | ) |
---|
| 227 | fst_sit_date = FormattedDate( |
---|
| 228 | title = _(u'Exam Date'), |
---|
| 229 | required = False, |
---|
| 230 | readonly = False, |
---|
| 231 | show_year = True, |
---|
| 232 | ) |
---|
| 233 | fst_sit_type = schema.Choice( |
---|
| 234 | title = _(u'Exam Type'), |
---|
| 235 | required = False, |
---|
| 236 | readonly = False, |
---|
| 237 | vocabulary = exam_types, |
---|
| 238 | ) |
---|
| 239 | fst_sit_results = schema.List( |
---|
| 240 | title = _(u'Exam Results'), |
---|
| 241 | value_type = ResultEntryField(), |
---|
| 242 | required = False, |
---|
| 243 | readonly = False, |
---|
| 244 | defaultFactory=list, |
---|
| 245 | ) |
---|
| 246 | scd_sit_fname = schema.TextLine( |
---|
| 247 | title = _(u'Full Name'), |
---|
| 248 | required = False, |
---|
| 249 | readonly = False, |
---|
| 250 | ) |
---|
| 251 | scd_sit_no = schema.TextLine( |
---|
| 252 | title = _(u'Exam Number'), |
---|
| 253 | required = False, |
---|
| 254 | readonly = False, |
---|
| 255 | ) |
---|
| 256 | scd_sit_date = FormattedDate( |
---|
| 257 | title = _(u'Exam Date'), |
---|
| 258 | required = False, |
---|
| 259 | readonly = False, |
---|
| 260 | show_year = True, |
---|
| 261 | ) |
---|
| 262 | scd_sit_type = schema.Choice( |
---|
| 263 | title = _(u'Exam Type'), |
---|
| 264 | required = False, |
---|
| 265 | readonly = False, |
---|
| 266 | vocabulary = exam_types, |
---|
| 267 | ) |
---|
| 268 | scd_sit_results = schema.List( |
---|
| 269 | title = _(u'Exam Results'), |
---|
| 270 | value_type = ResultEntryField(), |
---|
| 271 | required = False, |
---|
| 272 | readonly = False, |
---|
| 273 | defaultFactory=list, |
---|
| 274 | ) |
---|
[15858] | 275 | hq_type = schema.Choice( |
---|
| 276 | title = _(u'Qualification Obtained'), |
---|
| 277 | required = False, |
---|
| 278 | readonly = False, |
---|
| 279 | vocabulary = high_qual, |
---|
| 280 | ) |
---|
| 281 | hq_matric_no = schema.TextLine( |
---|
| 282 | title = _(u'Former Matric Number'), |
---|
| 283 | required = False, |
---|
| 284 | readonly = False, |
---|
| 285 | ) |
---|
| 286 | hq_degree = schema.Choice( |
---|
| 287 | title = _(u'Class of Degree'), |
---|
| 288 | required = False, |
---|
| 289 | readonly = False, |
---|
| 290 | vocabulary = high_grade, |
---|
| 291 | ) |
---|
| 292 | hq_school = schema.TextLine( |
---|
| 293 | title = _(u'Institution Attended'), |
---|
| 294 | required = False, |
---|
| 295 | readonly = False, |
---|
| 296 | ) |
---|
| 297 | hq_session = schema.TextLine( |
---|
| 298 | title = _(u'Years Attended'), |
---|
| 299 | required = False, |
---|
| 300 | readonly = False, |
---|
| 301 | ) |
---|
| 302 | hq_disc = schema.TextLine( |
---|
| 303 | title = _(u'Discipline'), |
---|
| 304 | required = False, |
---|
| 305 | readonly = False, |
---|
| 306 | ) |
---|
[16533] | 307 | jamb_fname = schema.TextLine( |
---|
| 308 | title = _(u'Full Name'), |
---|
| 309 | required = False, |
---|
| 310 | readonly = False, |
---|
| 311 | ) |
---|
[15884] | 312 | #jamb_subjects = schema.Text( |
---|
| 313 | # title = _(u'Subjects and Scores'), |
---|
| 314 | # required = False, |
---|
| 315 | # ) |
---|
[15838] | 316 | jamb_subjects_list = schema.List( |
---|
| 317 | title = _(u'JAMB Subjects'), |
---|
| 318 | required = False, |
---|
| 319 | defaultFactory=list, |
---|
| 320 | value_type = schema.Choice( |
---|
| 321 | vocabulary = jambsubjects |
---|
| 322 | #source = JAMBSubjectSource(), |
---|
| 323 | ), |
---|
| 324 | ) |
---|
| 325 | jamb_score = schema.Int( |
---|
| 326 | title = _(u'Total JAMB Score'), |
---|
| 327 | required = False, |
---|
| 328 | ) |
---|
| 329 | #jamb_age = schema.Int( |
---|
| 330 | # title = _(u'Age (provided by JAMB)'), |
---|
| 331 | # required = False, |
---|
| 332 | # ) |
---|
| 333 | jamb_reg_number = schema.TextLine( |
---|
| 334 | title = _(u'JAMB Registration Number'), |
---|
| 335 | required = False, |
---|
| 336 | constraint=validate_jamb_reg_number, |
---|
[16540] | 337 | description = _(u'Use all CAPS when entering the field.'), |
---|
[15838] | 338 | ) |
---|
| 339 | notice = schema.Text( |
---|
| 340 | title = _(u'Notice'), |
---|
| 341 | required = False, |
---|
| 342 | ) |
---|
| 343 | screening_venue = schema.TextLine( |
---|
| 344 | title = _(u'Screening Venue'), |
---|
| 345 | required = False, |
---|
| 346 | ) |
---|
| 347 | screening_date = schema.TextLine( |
---|
| 348 | title = _(u'Screening Date'), |
---|
| 349 | required = False, |
---|
| 350 | ) |
---|
| 351 | screening_score = schema.Int( |
---|
| 352 | title = _(u'Screening Score (%)'), |
---|
| 353 | required = False, |
---|
| 354 | ) |
---|
| 355 | aggregate = schema.Int( |
---|
| 356 | title = _(u'Aggregate Score (%)'), |
---|
| 357 | description = _(u'(average of relative JAMB and PUTME scores)'), |
---|
| 358 | required = False, |
---|
| 359 | ) |
---|
| 360 | result_uploaded = schema.Bool( |
---|
| 361 | title = _(u'Result uploaded'), |
---|
| 362 | default = False, |
---|
| 363 | required = False, |
---|
| 364 | ) |
---|
| 365 | student_id = schema.TextLine( |
---|
| 366 | title = _(u'Student Id'), |
---|
| 367 | required = False, |
---|
| 368 | readonly = False, |
---|
| 369 | ) |
---|
| 370 | course_admitted = schema.Choice( |
---|
| 371 | title = _(u'Admitted Course of Study'), |
---|
| 372 | source = CertificateSource(), |
---|
| 373 | required = False, |
---|
| 374 | ) |
---|
| 375 | locked = schema.Bool( |
---|
| 376 | title = _(u'Form locked'), |
---|
| 377 | default = False, |
---|
| 378 | required = False, |
---|
| 379 | ) |
---|
[15793] | 380 | |
---|
[15807] | 381 | ICustomUGApplicant[ |
---|
[15858] | 382 | 'subtype'].order = ICustomUGApplicant['lga'].order |
---|
| 383 | ICustomUGApplicant[ |
---|
[15838] | 384 | 'locked'].order = ICustomUGApplicant['suspended'].order |
---|
[15807] | 385 | ICustomUGApplicant[ |
---|
[15838] | 386 | 'result_uploaded'].order = ICustomUGApplicant['suspended'].order |
---|
[15807] | 387 | |
---|
[10765] | 388 | class ICustomPGApplicant(INigeriaPGApplicant): |
---|
| 389 | """A postgraduate applicant. |
---|
| 390 | |
---|
| 391 | This interface defines the least common multiple of all fields |
---|
| 392 | in pg application forms. In customized forms, fields can be excluded by |
---|
| 393 | adding them to the PG_OMIT* tuples. |
---|
| 394 | """ |
---|
| 395 | |
---|
[16281] | 396 | email = TextLineChoice( |
---|
[16287] | 397 | title = _(u'Email Address'), |
---|
| 398 | required = True, |
---|
[16281] | 399 | constraint=validate_email, |
---|
| 400 | source = contextual_email_source, |
---|
| 401 | ) |
---|
| 402 | |
---|
[16287] | 403 | perm_address = schema.Text( |
---|
| 404 | title = _(u'Residential Address'), |
---|
| 405 | required = True, |
---|
| 406 | ) |
---|
| 407 | |
---|
[15809] | 408 | sponsor = schema.Choice( |
---|
| 409 | title = _(u'Sponsor'), |
---|
| 410 | vocabulary = sponsors_vocab, |
---|
| 411 | required = False, |
---|
| 412 | ) |
---|
[10765] | 413 | |
---|
[15809] | 414 | heard_about = schema.Choice( |
---|
| 415 | title = _(u'How did you hear about IU?'), |
---|
| 416 | vocabulary = heard_about_types_vocab, |
---|
| 417 | required = False, |
---|
| 418 | ) |
---|
| 419 | |
---|
[16049] | 420 | nysc_number = schema.Int( |
---|
| 421 | title = _(u'Nysc Number'), |
---|
| 422 | required = False, |
---|
| 423 | readonly = False, |
---|
| 424 | ) |
---|
| 425 | |
---|
| 426 | referees = schema.List( |
---|
| 427 | title = _(u'Referees'), |
---|
| 428 | value_type = RefereeEntryField(), |
---|
| 429 | required = False, |
---|
| 430 | defaultFactory=list, |
---|
| 431 | ) |
---|
| 432 | |
---|
[15809] | 433 | ICustomPGApplicant[ |
---|
[16049] | 434 | 'referees'].order = INigeriaPGApplicant['emp2_reason'].order |
---|
| 435 | ICustomPGApplicant[ |
---|
[15809] | 436 | 'sponsor'].order = ICustomPGApplicant['lga'].order |
---|
| 437 | ICustomPGApplicant[ |
---|
| 438 | 'heard_about'].order = ICustomPGApplicant['lga'].order |
---|
| 439 | ICustomPGApplicant[ |
---|
| 440 | 'sponsor'].order = ICustomPGApplicant['lga'].order |
---|
| 441 | ICustomPGApplicant[ |
---|
| 442 | 'lga'].order = ICustomPGApplicant['nationality'].order |
---|
[16049] | 443 | ICustomPGApplicant[ |
---|
| 444 | 'nysc_number'].order = ICustomPGApplicant['nysc_year'].order |
---|
[16287] | 445 | ICustomPGApplicant[ |
---|
| 446 | 'perm_address'].order = ICustomPGApplicant['lga'].order |
---|
| 447 | ICustomPGApplicant[ |
---|
| 448 | 'email'].order = ICustomPGApplicant['lga'].order |
---|
[15809] | 449 | |
---|
[16142] | 450 | class ITranscriptApplicant(IKofaObject): |
---|
| 451 | """A transcript applicant. |
---|
| 452 | """ |
---|
| 453 | |
---|
| 454 | suspended = schema.Bool( |
---|
| 455 | title = _(u'Account suspended'), |
---|
| 456 | default = False, |
---|
| 457 | required = False, |
---|
| 458 | ) |
---|
| 459 | |
---|
| 460 | locked = schema.Bool( |
---|
| 461 | title = _(u'Form locked'), |
---|
| 462 | default = False, |
---|
| 463 | required = False, |
---|
| 464 | ) |
---|
| 465 | |
---|
| 466 | applicant_id = schema.TextLine( |
---|
| 467 | title = _(u'Transcript Application Id'), |
---|
| 468 | required = False, |
---|
| 469 | readonly = False, |
---|
| 470 | ) |
---|
| 471 | |
---|
| 472 | matric_number = schema.TextLine( |
---|
| 473 | title = _(u'Matriculation Number'), |
---|
| 474 | readonly = False, |
---|
| 475 | required = True, |
---|
| 476 | ) |
---|
| 477 | |
---|
| 478 | firstname = schema.TextLine( |
---|
| 479 | title = _(u'First Name'), |
---|
| 480 | required = True, |
---|
| 481 | ) |
---|
| 482 | |
---|
| 483 | middlename = schema.TextLine( |
---|
| 484 | title = _(u'Middle Name'), |
---|
| 485 | required = False, |
---|
| 486 | ) |
---|
| 487 | |
---|
| 488 | lastname = schema.TextLine( |
---|
| 489 | title = _(u'Last Name (Surname)'), |
---|
| 490 | required = True, |
---|
| 491 | ) |
---|
| 492 | |
---|
[16165] | 493 | #date_of_birth = FormattedDate( |
---|
| 494 | # title = _(u'Date of Birth'), |
---|
| 495 | # required = False, |
---|
| 496 | # #date_format = u'%d/%m/%Y', # Use grok-instance-wide default |
---|
| 497 | # show_year = True, |
---|
| 498 | # ) |
---|
[16142] | 499 | |
---|
| 500 | sex = schema.Choice( |
---|
| 501 | title = _(u'Gender'), |
---|
| 502 | source = GenderSource(), |
---|
| 503 | required = True, |
---|
| 504 | ) |
---|
| 505 | |
---|
[16165] | 506 | #nationality = schema.Choice( |
---|
| 507 | # vocabulary = nats_vocab, |
---|
| 508 | # title = _(u'Nationality'), |
---|
| 509 | # required = False, |
---|
| 510 | # ) |
---|
[16142] | 511 | |
---|
| 512 | email = schema.ASCIILine( |
---|
| 513 | title = _(u'Email Address'), |
---|
| 514 | required = True, |
---|
| 515 | constraint=validate_email, |
---|
| 516 | ) |
---|
| 517 | |
---|
[16165] | 518 | #phone = PhoneNumber( |
---|
| 519 | # title = _(u'Phone'), |
---|
| 520 | # description = u'', |
---|
| 521 | # required = False, |
---|
| 522 | # ) |
---|
[16142] | 523 | |
---|
[16165] | 524 | #perm_address = schema.Text( |
---|
| 525 | # title = _(u'Current Local Address'), |
---|
| 526 | # required = False, |
---|
| 527 | # readonly = False, |
---|
| 528 | # ) |
---|
[16142] | 529 | |
---|
| 530 | dispatch_address = schema.Text( |
---|
| 531 | title = _(u'Dispatch Addresses'), |
---|
| 532 | description = u'Addresses to which transcripts should be posted. ' |
---|
| 533 | 'Addresses must involve same courier charges.', |
---|
| 534 | required = False, |
---|
| 535 | readonly = False, |
---|
| 536 | ) |
---|
| 537 | |
---|
| 538 | charge = schema.Choice( |
---|
| 539 | title = _(u'Courier Charge'), |
---|
| 540 | source = DestinationCostSource(), |
---|
| 541 | required = True, |
---|
| 542 | ) |
---|
| 543 | |
---|
[16165] | 544 | #entry_mode = schema.Choice( |
---|
| 545 | # title = _(u'Entry Mode'), |
---|
| 546 | # source = StudyModeSource(), |
---|
| 547 | # required = False, |
---|
| 548 | # readonly = False, |
---|
| 549 | # ) |
---|
[16142] | 550 | |
---|
[16165] | 551 | #entry_session = schema.Choice( |
---|
| 552 | # title = _(u'Entry Session'), |
---|
| 553 | # source = academic_sessions_vocab, |
---|
| 554 | # required = False, |
---|
| 555 | # readonly = False, |
---|
| 556 | # ) |
---|
[16142] | 557 | |
---|
| 558 | end_session = schema.Choice( |
---|
[16165] | 559 | title = _(u'Academic Session of Graduation'), |
---|
[16142] | 560 | source = academic_sessions_vocab, |
---|
| 561 | required = False, |
---|
| 562 | readonly = False, |
---|
| 563 | ) |
---|
| 564 | |
---|
| 565 | course_studied = schema.Choice( |
---|
[16165] | 566 | title = _(u'Course of Study'), |
---|
| 567 | source = TranscriptCertificateSource(), |
---|
| 568 | description = u'Faculty / Department / Course', |
---|
[16142] | 569 | required = False, |
---|
| 570 | readonly = False, |
---|
| 571 | ) |
---|
| 572 | |
---|
[16165] | 573 | #course_changed = schema.Choice( |
---|
| 574 | # title = _(u'Change of Study Course'), |
---|
| 575 | # description = u'If yes, select previous course of study.', |
---|
| 576 | # source = CertificateSource(), |
---|
| 577 | # readonly = False, |
---|
| 578 | # required = False, |
---|
| 579 | # ) |
---|
[16142] | 580 | |
---|
[16165] | 581 | #change_level = schema.Choice( |
---|
| 582 | # title = _(u'Change Level'), |
---|
| 583 | # description = u'If yes, select level at which you changed course of study.', |
---|
| 584 | # source = StudyLevelSource(), |
---|
| 585 | # required = False, |
---|
| 586 | # readonly = False, |
---|
| 587 | # ) |
---|
[16142] | 588 | |
---|
| 589 | no_copies = schema.Choice( |
---|
| 590 | title = _(u'Number of Copies'), |
---|
| 591 | description = u'Must correspond with the number of dispatch addresses above.', |
---|
| 592 | values=[1, 2, 3, 4], |
---|
| 593 | required = False, |
---|
| 594 | readonly = False, |
---|
| 595 | default = 1, |
---|
| 596 | ) |
---|
| 597 | |
---|
| 598 | class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant, |
---|
| 599 | ITranscriptApplicant): |
---|
[10765] | 600 | """An interface for both types of applicants. |
---|
| 601 | |
---|
| 602 | Attention: The ICustomPGApplicant field seetings will be overwritten |
---|
| 603 | by ICustomPGApplicant field settings. If a field is defined |
---|
| 604 | in both interfaces zope.schema validates only against the |
---|
| 605 | constraints in ICustomUGApplicant. This does not affect the forms |
---|
| 606 | since they are build on either ICustomUGApplicant or ICustomPGApplicant. |
---|
| 607 | """ |
---|
| 608 | |
---|
| 609 | def writeLogMessage(view, comment): |
---|
| 610 | """Adds an INFO message to the log file |
---|
| 611 | """ |
---|
| 612 | |
---|
| 613 | def createStudent(): |
---|
| 614 | """Create a student object from applicant data |
---|
| 615 | and copy applicant object. |
---|
| 616 | """ |
---|
| 617 | |
---|
[15858] | 618 | class ICustomUGApplicantEdit(ICustomUGApplicant): |
---|
[10765] | 619 | """An undergraduate applicant interface for edit forms. |
---|
| 620 | |
---|
| 621 | Here we can repeat the fields from base data and set the |
---|
| 622 | `required` and `readonly` attributes to True to further restrict |
---|
| 623 | the data access. Or we can allow only certain certificates to be |
---|
| 624 | selected by choosing the appropriate source. |
---|
| 625 | |
---|
| 626 | We cannot omit fields here. This has to be done in the |
---|
| 627 | respective form page. |
---|
| 628 | """ |
---|
| 629 | |
---|
[16105] | 630 | phone = PhoneNumber( |
---|
| 631 | title = _(u'Phone'), |
---|
| 632 | description = u'', |
---|
| 633 | required = True, |
---|
| 634 | ) |
---|
[16281] | 635 | email = TextLineChoice( |
---|
[16287] | 636 | title = _(u'Email Address'), |
---|
[16105] | 637 | constraint=validate_email, |
---|
[16281] | 638 | source = contextual_email_source, |
---|
[16544] | 639 | required = True, |
---|
[16105] | 640 | ) |
---|
| 641 | date_of_birth = FormattedDate( |
---|
| 642 | title = _(u'Date of Birth'), |
---|
| 643 | required = True, |
---|
| 644 | show_year = True, |
---|
| 645 | ) |
---|
| 646 | |
---|
[16544] | 647 | parents_name = schema.TextLine( |
---|
| 648 | title = _(u'Full Name'), |
---|
| 649 | required = True, |
---|
| 650 | readonly = False, |
---|
| 651 | ) |
---|
| 652 | |
---|
| 653 | parents_email = schema.ASCIILine( |
---|
| 654 | title = _(u'Email Address'), |
---|
| 655 | required = True, |
---|
| 656 | constraint=validate_email, |
---|
| 657 | ) |
---|
| 658 | |
---|
| 659 | parents_phone = PhoneNumber( |
---|
| 660 | title = _(u'Phone'), |
---|
| 661 | required = True, |
---|
| 662 | ) |
---|
| 663 | |
---|
[16502] | 664 | fst_sit_fname = schema.TextLine( |
---|
| 665 | title = _(u'Full Name'), |
---|
[16533] | 666 | description = _(u'As it is written on your WAEC/NECO result.'), |
---|
[16502] | 667 | required = False, |
---|
| 668 | readonly = False, |
---|
| 669 | ) |
---|
| 670 | |
---|
| 671 | scd_sit_fname = schema.TextLine( |
---|
| 672 | title = _(u'Full Name'), |
---|
[16533] | 673 | description = _(u'As it is written on your WAEC/NECO result.'), |
---|
[16502] | 674 | required = False, |
---|
| 675 | readonly = False, |
---|
| 676 | ) |
---|
| 677 | |
---|
[16533] | 678 | jamb_fname = schema.TextLine( |
---|
| 679 | title = _(u'Full Name'), |
---|
| 680 | description = _(u'As it is written on your JAMB result slip.'), |
---|
[16544] | 681 | required = True, |
---|
[16533] | 682 | readonly = False, |
---|
| 683 | ) |
---|
| 684 | |
---|
[16544] | 685 | jamb_score = schema.Int( |
---|
| 686 | title = _(u'Total JAMB Score'), |
---|
[16553] | 687 | required = False, |
---|
[16544] | 688 | ) |
---|
| 689 | |
---|
| 690 | jamb_reg_number = schema.TextLine( |
---|
| 691 | title = _(u'JAMB Registration Number'), |
---|
| 692 | required = True, |
---|
| 693 | constraint=validate_jamb_reg_number, |
---|
| 694 | description = _(u'Use all CAPS when entering the field.'), |
---|
| 695 | ) |
---|
| 696 | |
---|
[16105] | 697 | ICustomUGApplicantEdit[ |
---|
| 698 | 'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order |
---|
| 699 | ICustomUGApplicantEdit[ |
---|
| 700 | 'email'].order = ICustomUGApplicant['email'].order |
---|
| 701 | ICustomUGApplicantEdit[ |
---|
| 702 | 'phone'].order = ICustomUGApplicantEdit['email'].order |
---|
[16502] | 703 | ICustomUGApplicantEdit[ |
---|
| 704 | 'fst_sit_fname'].order = ICustomUGApplicant['fst_sit_fname'].order |
---|
| 705 | ICustomUGApplicantEdit[ |
---|
| 706 | 'scd_sit_fname'].order = ICustomUGApplicant['scd_sit_fname'].order |
---|
[16533] | 707 | ICustomUGApplicantEdit[ |
---|
| 708 | 'jamb_fname'].order = ICustomUGApplicant['jamb_fname'].order |
---|
[16544] | 709 | ICustomUGApplicantEdit[ |
---|
| 710 | 'jamb_score'].order = ICustomUGApplicant['jamb_score'].order |
---|
| 711 | ICustomUGApplicantEdit[ |
---|
| 712 | 'jamb_reg_number'].order = ICustomUGApplicant['jamb_reg_number'].order |
---|
| 713 | ICustomUGApplicantEdit[ |
---|
| 714 | 'parents_name'].order = ICustomUGApplicant['parents_name'].order |
---|
| 715 | ICustomUGApplicantEdit[ |
---|
| 716 | 'parents_email'].order = ICustomUGApplicant['parents_email'].order |
---|
| 717 | ICustomUGApplicantEdit[ |
---|
| 718 | 'parents_phone'].order = ICustomUGApplicant['parents_phone'].order |
---|
[16105] | 719 | |
---|
[15858] | 720 | class ICustomPGApplicantEdit(ICustomPGApplicant): |
---|
[10765] | 721 | """A postgraduate applicant interface for editing. |
---|
| 722 | |
---|
| 723 | Here we can repeat the fields from base data and set the |
---|
| 724 | `required` and `readonly` attributes to True to further restrict |
---|
| 725 | the data access. Or we can allow only certain certificates to be |
---|
| 726 | selected by choosing the appropriate source. |
---|
| 727 | |
---|
| 728 | We cannot omit fields here. This has to be done in the |
---|
| 729 | respective form page. |
---|
| 730 | """ |
---|
| 731 | |
---|
[16105] | 732 | phone = PhoneNumber( |
---|
| 733 | title = _(u'Phone'), |
---|
| 734 | description = u'', |
---|
| 735 | required = True, |
---|
| 736 | ) |
---|
[16281] | 737 | email = TextLineChoice( |
---|
[16287] | 738 | title = _(u'Email Address'), |
---|
[16281] | 739 | required = False, |
---|
[16105] | 740 | constraint=validate_email, |
---|
[16281] | 741 | source = contextual_email_source, |
---|
[16105] | 742 | ) |
---|
| 743 | date_of_birth = FormattedDate( |
---|
| 744 | title = _(u'Date of Birth'), |
---|
| 745 | required = True, |
---|
| 746 | show_year = True, |
---|
| 747 | ) |
---|
| 748 | |
---|
| 749 | ICustomPGApplicantEdit[ |
---|
| 750 | 'date_of_birth'].order = ICustomPGApplicant['date_of_birth'].order |
---|
| 751 | ICustomPGApplicantEdit[ |
---|
| 752 | 'email'].order = ICustomPGApplicant['email'].order |
---|
| 753 | ICustomPGApplicantEdit[ |
---|
| 754 | 'phone'].order = ICustomPGApplicantEdit['email'].order |
---|
| 755 | |
---|
[16281] | 756 | class ICustomApplicantRegisterUpdate(IApplicantRegisterUpdate): |
---|
| 757 | """This is a representation of an applicant for first-time registration. |
---|
| 758 | This interface is used when applicants use the registration page to |
---|
| 759 | update their records. |
---|
| 760 | """ |
---|
| 761 | |
---|
| 762 | email = TextLineChoice( |
---|
[16287] | 763 | title = _(u'Email Address'), |
---|
[16281] | 764 | required = False, |
---|
| 765 | constraint=validate_email, |
---|
| 766 | source = contextual_email_source, |
---|
| 767 | ) |
---|
| 768 | |
---|
[10765] | 769 | class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment): |
---|
| 770 | """An applicant payment via payment gateways. |
---|
| 771 | |
---|
| 772 | """ |
---|
| 773 | |
---|
| 774 | class IPUTMEApplicantEdit(IPUTMEApplicantEdit): |
---|
| 775 | """An undergraduate applicant interface for editing. |
---|
| 776 | |
---|
| 777 | Here we can repeat the fields from base data and set the |
---|
| 778 | `required` and `readonly` attributes to True to further restrict |
---|
| 779 | the data access. Or we can allow only certain certificates to be |
---|
| 780 | selected by choosing the appropriate source. |
---|
| 781 | |
---|
| 782 | We cannot omit fields here. This has to be done in the |
---|
| 783 | respective form page. |
---|
| 784 | """ |
---|
| 785 | |
---|
| 786 | class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo): |
---|
| 787 | """Representation of an applicant. |
---|
| 788 | |
---|
| 789 | Skip regular reg_number validation if reg_number is used for finding |
---|
| 790 | the applicant object. |
---|
| 791 | """ |
---|
[16062] | 792 | |
---|
| 793 | class ICustomApplicantRefereeReport(IApplicantRefereeReport): |
---|
| 794 | """A referee report. |
---|
| 795 | """ |
---|
| 796 | |
---|
| 797 | duration = schema.Text( |
---|
| 798 | title = _(u'How long and in what capacity have you known the candidate?'), |
---|
| 799 | required = False, |
---|
| 800 | ) |
---|
| 801 | |
---|
| 802 | itellectual = schema.Choice( |
---|
| 803 | title = _(u'Intellectual Capacity'), |
---|
| 804 | required = False, |
---|
| 805 | readonly = False, |
---|
| 806 | vocabulary = rating_vocab, |
---|
| 807 | ) |
---|
| 808 | |
---|
| 809 | persistent = schema.Choice( |
---|
| 810 | title = _(u'Capacity for Persistent and Independent Academic Study'), |
---|
| 811 | required = False, |
---|
| 812 | readonly = False, |
---|
| 813 | vocabulary = rating_vocab, |
---|
| 814 | ) |
---|
| 815 | |
---|
| 816 | imaginative = schema.Choice( |
---|
| 817 | title = _(u'Ability for Imaginative Thought'), |
---|
| 818 | required = False, |
---|
| 819 | readonly = False, |
---|
| 820 | vocabulary = rating_vocab, |
---|
| 821 | ) |
---|
| 822 | |
---|
| 823 | productive = schema.Choice( |
---|
| 824 | title = _(u'Promise of Productive Scholarship'), |
---|
| 825 | required = False, |
---|
| 826 | readonly = False, |
---|
| 827 | vocabulary = rating_vocab, |
---|
| 828 | ) |
---|
| 829 | |
---|
| 830 | previous = schema.Choice( |
---|
| 831 | title = _(u'Quality of Previous Work'), |
---|
| 832 | required = False, |
---|
| 833 | readonly = False, |
---|
| 834 | vocabulary = rating_vocab, |
---|
| 835 | ) |
---|
| 836 | |
---|
| 837 | expression = schema.Choice( |
---|
| 838 | title = _(u'Oral and Written Expression in English'), |
---|
| 839 | required = False, |
---|
| 840 | readonly = False, |
---|
| 841 | vocabulary = rating_vocab, |
---|
| 842 | ) |
---|
| 843 | |
---|
| 844 | personality = schema.Text( |
---|
| 845 | title = _(u'Please comment on the candidate\'s personality ' |
---|
| 846 | 'with particular reference to his/her moral character, emotional ' |
---|
| 847 | 'and physical stabilty'), |
---|
| 848 | required = False, |
---|
| 849 | ) |
---|
| 850 | |
---|
| 851 | promise = schema.Choice( |
---|
| 852 | title = _(u'Candidate\'s overall promise'), |
---|
| 853 | required = False, |
---|
| 854 | readonly = False, |
---|
| 855 | vocabulary = overallpromise_vocab, |
---|
| 856 | ) |
---|
| 857 | |
---|
| 858 | report = schema.Text( |
---|
| 859 | title = _(u'Any other relevant information which would help ' |
---|
| 860 | 'in determining the candidate\'s suitability?'), |
---|
| 861 | required = False, |
---|
| 862 | ) |
---|
| 863 | |
---|
| 864 | objection = schema.Text( |
---|
| 865 | title = _(u'Have you any objection to the contents of this ' |
---|
| 866 | 'evaluation being disclosed to any award-given body if ' |
---|
| 867 | 'the need arises?'), |
---|
| 868 | required = False, |
---|
| 869 | ) |
---|