[13814] | 1 | # -*- coding: utf-8 -*- |
---|
[7853] | 2 | ## $Id: interfaces.py 17084 2022-09-06 05:14:44Z 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 | |
---|
[13831] | 22 | #from grok import getSite |
---|
[8012] | 23 | from zope import schema |
---|
[16771] | 24 | from zope.interface import invariant, Invalid |
---|
[16152] | 25 | from zope.component import getUtility |
---|
| 26 | from zope.catalog.interfaces import ICatalog |
---|
[13814] | 27 | from zc.sourcefactory.basic import BasicSourceFactory |
---|
[8051] | 28 | from waeup.kofa.applicants.interfaces import ( |
---|
[8053] | 29 | IApplicantBaseData, |
---|
[8051] | 30 | AppCatCertificateSource, CertificateSource) |
---|
[16078] | 31 | from waeup.kofa.university.vocabularies import StudyModeSource |
---|
| 32 | from waeup.kofa.students.vocabularies import ( |
---|
| 33 | nats_vocab, GenderSource, StudyLevelSource) |
---|
[8051] | 34 | from waeup.kofa.schoolgrades import ResultEntryField |
---|
[8530] | 35 | from waeup.kofa.interfaces import ( |
---|
[13814] | 36 | SimpleKofaVocabulary, academic_sessions_vocab, validate_email, |
---|
[16131] | 37 | IKofaObject, ContextualDictSourceFactoryBase) |
---|
[13814] | 38 | from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber |
---|
[15490] | 39 | from waeup.kofa.students.vocabularies import ( |
---|
| 40 | nats_vocab, GenderSource) |
---|
[14106] | 41 | from waeup.kofa.refereeentries import RefereeEntryField |
---|
[8530] | 42 | from waeup.kofa.applicants.interfaces import contextual_reg_num_source |
---|
[15490] | 43 | from kofacustom.nigeria.interfaces import DisabilitiesSource |
---|
[8928] | 44 | from kofacustom.nigeria.applicants.interfaces import ( |
---|
| 45 | LGASource, high_qual, high_grade, exam_types, |
---|
[14140] | 46 | programme_types_vocab, jambsubjects, |
---|
[8928] | 47 | INigeriaUGApplicant, INigeriaPGApplicant, |
---|
| 48 | INigeriaApplicantOnlinePayment, |
---|
[9006] | 49 | INigeriaUGApplicantEdit, INigeriaPGApplicantEdit, |
---|
| 50 | INigeriaApplicantUpdateByRegNo, |
---|
| 51 | IPUTMEApplicantEdit, |
---|
[14140] | 52 | IBankAccount, |
---|
[8928] | 53 | ) |
---|
[8020] | 54 | from waeup.uniben.interfaces import MessageFactory as _ |
---|
[8247] | 55 | from waeup.uniben.payments.interfaces import ICustomOnlinePayment |
---|
[7853] | 56 | |
---|
[16152] | 57 | class TranscriptCertificateSource(CertificateSource): |
---|
| 58 | """Include Department and Faculty in Title. |
---|
| 59 | """ |
---|
| 60 | def getValues(self, context): |
---|
| 61 | catalog = getUtility(ICatalog, name='certificates_catalog') |
---|
| 62 | resultset = catalog.searchResults(code=(None, None)) |
---|
| 63 | resultlist = sorted(resultset, key=lambda |
---|
| 64 | value: value.__parent__.__parent__.__parent__.code + |
---|
| 65 | value.__parent__.__parent__.code + |
---|
| 66 | value.code) |
---|
| 67 | return resultlist |
---|
[13814] | 68 | |
---|
[16152] | 69 | def getTitle(self, context, value): |
---|
| 70 | """ |
---|
| 71 | """ |
---|
| 72 | try: title = "%s / %s / %s (%s)" % ( |
---|
| 73 | value.__parent__.__parent__.__parent__.title, |
---|
| 74 | value.__parent__.__parent__.title, |
---|
| 75 | value.title, value.code) |
---|
| 76 | except AttributeError: |
---|
| 77 | title = "NA / %s (%s)" % (value.title, value.code) |
---|
| 78 | return title |
---|
| 79 | |
---|
[13814] | 80 | REGISTRATION_CATS = { |
---|
| 81 | 'corporate': ('Corporate Registration', 250000, 1), |
---|
| 82 | 'group': ('Group Registration', 200000, 2), |
---|
| 83 | 'individual': ('Individual Registration', 45000, 3), |
---|
| 84 | 'student': ('Student Registration', 5000, 4), |
---|
[13824] | 85 | 'fullpage': ('Full Page Advert', 250000, 5), |
---|
| 86 | 'halfpage': ('Half Page Advert', 150000, 6), |
---|
| 87 | 'quarterpage': ('Quarter Page Advert', 100000, 7), |
---|
[13814] | 88 | } |
---|
| 89 | |
---|
| 90 | class RegTypesSource(BasicSourceFactory): |
---|
| 91 | """A source that delivers all kinds of registrations. |
---|
| 92 | """ |
---|
| 93 | def getValues(self): |
---|
| 94 | sorted_items = sorted(REGISTRATION_CATS.items(), |
---|
| 95 | key=lambda element: element[1][2]) |
---|
| 96 | return [item[0] for item in sorted_items] |
---|
| 97 | |
---|
| 98 | def getTitle(self, value): |
---|
| 99 | return u"%s @ ₦ %s" % ( |
---|
| 100 | REGISTRATION_CATS[value][0], |
---|
| 101 | REGISTRATION_CATS[value][1]) |
---|
| 102 | |
---|
[16131] | 103 | DESTINATION_COST = { |
---|
[16144] | 104 | #'none': ('To the moon', 1000000000.0, 1), |
---|
| 105 | 'nigeria': ('Within Nigeria', 20000.0, 1), |
---|
| 106 | 'africa': ('Within Africa ', 30000.0, 2), |
---|
| 107 | 'inter': ('International', 35000.0, 3), |
---|
[16182] | 108 | 'cert_nigeria': ('Certified Copy - Within Nigeria', 13000.0, 4), |
---|
| 109 | 'cert_africa': ('Certified Copy - Within Africa', 23000.0, 5), |
---|
| 110 | 'cert_inter': ('Certified Copy - International', 28000.0, 6), |
---|
[16131] | 111 | } |
---|
| 112 | |
---|
| 113 | class DestinationCostSource(BasicSourceFactory): |
---|
| 114 | """A source that delivers continents and shipment costs. |
---|
| 115 | """ |
---|
| 116 | def getValues(self): |
---|
| 117 | sorted_items = sorted(DESTINATION_COST.items(), |
---|
| 118 | key=lambda element: element[1][2]) |
---|
| 119 | return [item[0] for item in sorted_items] |
---|
| 120 | |
---|
[16151] | 121 | def getToken(self, value): |
---|
| 122 | return value |
---|
| 123 | |
---|
[16131] | 124 | def getTitle(self, value): |
---|
| 125 | return u"%s (₦ %s)" % ( |
---|
| 126 | DESTINATION_COST[value][0], |
---|
| 127 | DESTINATION_COST[value][1]) |
---|
| 128 | |
---|
[16151] | 129 | class OrderSource(BasicSourceFactory): |
---|
| 130 | """ |
---|
| 131 | """ |
---|
| 132 | def getValues(self): |
---|
| 133 | return ['o', 'c'] |
---|
| 134 | |
---|
| 135 | def getToken(self, value): |
---|
| 136 | return value |
---|
| 137 | |
---|
| 138 | def getTitle(self, value): |
---|
| 139 | if value == 'o': |
---|
| 140 | return _('Original') |
---|
| 141 | if value == 'c': |
---|
| 142 | return _('Certified True Copy') |
---|
| 143 | |
---|
[16804] | 144 | class ProficiencySource(BasicSourceFactory): |
---|
| 145 | """ |
---|
| 146 | """ |
---|
| 147 | def getValues(self): |
---|
[16809] | 148 | return ['n', 'c', 'p'] |
---|
[16804] | 149 | |
---|
| 150 | def getToken(self, value): |
---|
| 151 | return value |
---|
| 152 | |
---|
| 153 | def getTitle(self, value): |
---|
[16809] | 154 | if value == 'n': |
---|
| 155 | return _('none') |
---|
[16804] | 156 | if value == 'c': |
---|
| 157 | return _('conversational') |
---|
[16807] | 158 | if value == 'p': |
---|
[16804] | 159 | return _('professional') |
---|
| 160 | |
---|
[16807] | 161 | class PreferredSessionSource(BasicSourceFactory): |
---|
| 162 | """ |
---|
| 163 | """ |
---|
| 164 | def getValues(self): |
---|
| 165 | return ['m', 'e', 'w'] |
---|
| 166 | |
---|
| 167 | def getToken(self, value): |
---|
| 168 | return value |
---|
| 169 | |
---|
| 170 | def getTitle(self, value): |
---|
| 171 | if value == 'm': |
---|
| 172 | return _('morning') |
---|
| 173 | if value == 'e': |
---|
| 174 | return _('evening') |
---|
| 175 | if value == 'w': |
---|
| 176 | return _('weekend') |
---|
| 177 | |
---|
[13814] | 178 | class IUnibenRegistration(IKofaObject): |
---|
| 179 | """A Uniben registrant. |
---|
| 180 | """ |
---|
| 181 | |
---|
| 182 | suspended = schema.Bool( |
---|
| 183 | title = _(u'Account suspended'), |
---|
| 184 | default = False, |
---|
| 185 | required = False, |
---|
| 186 | ) |
---|
| 187 | |
---|
| 188 | locked = schema.Bool( |
---|
| 189 | title = _(u'Form locked'), |
---|
| 190 | default = False, |
---|
| 191 | required = False, |
---|
| 192 | ) |
---|
| 193 | |
---|
| 194 | applicant_id = schema.TextLine( |
---|
| 195 | title = _(u'Registrant Id'), |
---|
| 196 | required = False, |
---|
| 197 | readonly = False, |
---|
| 198 | ) |
---|
| 199 | |
---|
| 200 | firstname = schema.TextLine( |
---|
| 201 | title = _(u'First Name'), |
---|
| 202 | required = True, |
---|
| 203 | ) |
---|
| 204 | |
---|
| 205 | middlename = schema.TextLine( |
---|
| 206 | title = _(u'Middle Name'), |
---|
| 207 | required = False, |
---|
| 208 | ) |
---|
| 209 | |
---|
| 210 | lastname = schema.TextLine( |
---|
| 211 | title = _(u'Last Name (Surname)'), |
---|
| 212 | required = True, |
---|
| 213 | ) |
---|
| 214 | |
---|
[13819] | 215 | sex = schema.Choice( |
---|
| 216 | title = _(u'Sex'), |
---|
| 217 | source = GenderSource(), |
---|
| 218 | required = True, |
---|
[13814] | 219 | ) |
---|
| 220 | |
---|
| 221 | nationality = schema.Choice( |
---|
| 222 | vocabulary = nats_vocab, |
---|
| 223 | title = _(u'Nationality'), |
---|
| 224 | required = False, |
---|
| 225 | ) |
---|
| 226 | |
---|
| 227 | email = schema.ASCIILine( |
---|
| 228 | title = _(u'Email Address'), |
---|
| 229 | required = True, |
---|
| 230 | constraint=validate_email, |
---|
| 231 | ) |
---|
| 232 | |
---|
| 233 | phone = PhoneNumber( |
---|
| 234 | title = _(u'Phone'), |
---|
| 235 | description = u'', |
---|
| 236 | required = False, |
---|
| 237 | ) |
---|
| 238 | |
---|
[13819] | 239 | #perm_address = schema.Text( |
---|
| 240 | # title = _(u'Current Local Address'), |
---|
| 241 | # required = False, |
---|
| 242 | # readonly = False, |
---|
| 243 | # ) |
---|
| 244 | |
---|
| 245 | institution = schema.TextLine( |
---|
| 246 | title = _(u'Institution/Organisation'), |
---|
[13814] | 247 | required = False, |
---|
| 248 | readonly = False, |
---|
| 249 | ) |
---|
| 250 | |
---|
[13828] | 251 | city = schema.TextLine( |
---|
| 252 | title = _(u'City'), |
---|
| 253 | required = False, |
---|
| 254 | readonly = False, |
---|
| 255 | ) |
---|
| 256 | |
---|
[13819] | 257 | lga = schema.Choice( |
---|
| 258 | source = LGASource(), |
---|
| 259 | title = _(u'State/LGA'), |
---|
| 260 | required = False, |
---|
| 261 | ) |
---|
| 262 | |
---|
[13831] | 263 | matric_number = schema.TextLine( |
---|
| 264 | title = _(u'Uniben Matriculation Number'), |
---|
| 265 | required = False, |
---|
| 266 | readonly = False, |
---|
| 267 | ) |
---|
| 268 | |
---|
[13814] | 269 | registration_cats = schema.List( |
---|
| 270 | title = _(u'Registration Categories'), |
---|
| 271 | value_type = schema.Choice(source=RegTypesSource()), |
---|
| 272 | required = True, |
---|
[14020] | 273 | defaultFactory=list, |
---|
[13814] | 274 | ) |
---|
| 275 | |
---|
[13831] | 276 | # @invariant |
---|
| 277 | # def matric_number_exists(applicant): |
---|
| 278 | # if applicant.matric_number: |
---|
| 279 | # catalog = getUtility(ICatalog, name='students_catalog') |
---|
| 280 | # accommodation_session = getSite()['hostels'].accommodation_session |
---|
| 281 | # student = catalog.searchResults(matric_number=( |
---|
| 282 | # applicant.matric_number, applicant.matric_number)) |
---|
| 283 | # if len(student) != 1: |
---|
| 284 | # raise Invalid(_("Matriculation number not found.")) |
---|
[13814] | 285 | |
---|
[16078] | 286 | class ITranscriptApplicant(IKofaObject): |
---|
| 287 | """A transcript applicant. |
---|
| 288 | """ |
---|
| 289 | |
---|
| 290 | suspended = schema.Bool( |
---|
| 291 | title = _(u'Account suspended'), |
---|
| 292 | default = False, |
---|
| 293 | required = False, |
---|
| 294 | ) |
---|
| 295 | |
---|
| 296 | locked = schema.Bool( |
---|
| 297 | title = _(u'Form locked'), |
---|
| 298 | default = False, |
---|
| 299 | required = False, |
---|
| 300 | ) |
---|
| 301 | |
---|
| 302 | applicant_id = schema.TextLine( |
---|
[16131] | 303 | title = _(u'Transcript Application Id'), |
---|
[16078] | 304 | required = False, |
---|
| 305 | readonly = False, |
---|
| 306 | ) |
---|
| 307 | |
---|
[16131] | 308 | student_id = schema.TextLine( |
---|
| 309 | title = _(u'Kofa Student Id'), |
---|
| 310 | required = False, |
---|
[16078] | 311 | readonly = False, |
---|
[16131] | 312 | ) |
---|
| 313 | |
---|
| 314 | matric_number = schema.TextLine( |
---|
| 315 | title = _(u'Matriculation Number'), |
---|
| 316 | readonly = False, |
---|
[16078] | 317 | required = True, |
---|
| 318 | ) |
---|
| 319 | |
---|
| 320 | firstname = schema.TextLine( |
---|
[16151] | 321 | title = _(u'First Name in School'), |
---|
[16078] | 322 | required = True, |
---|
| 323 | ) |
---|
| 324 | |
---|
| 325 | middlename = schema.TextLine( |
---|
[16151] | 326 | title = _(u'Middle Name in School'), |
---|
[16078] | 327 | required = False, |
---|
| 328 | ) |
---|
| 329 | |
---|
| 330 | lastname = schema.TextLine( |
---|
[16151] | 331 | title = _(u'Surname in School'), |
---|
[16078] | 332 | required = True, |
---|
| 333 | ) |
---|
| 334 | |
---|
| 335 | date_of_birth = FormattedDate( |
---|
| 336 | title = _(u'Date of Birth'), |
---|
| 337 | required = False, |
---|
| 338 | #date_format = u'%d/%m/%Y', # Use grok-instance-wide default |
---|
| 339 | show_year = True, |
---|
| 340 | ) |
---|
| 341 | |
---|
| 342 | sex = schema.Choice( |
---|
| 343 | title = _(u'Gender'), |
---|
| 344 | source = GenderSource(), |
---|
| 345 | required = True, |
---|
| 346 | ) |
---|
| 347 | |
---|
[16151] | 348 | #nationality = schema.Choice( |
---|
| 349 | # vocabulary = nats_vocab, |
---|
| 350 | # title = _(u'Nationality'), |
---|
| 351 | # required = False, |
---|
| 352 | # ) |
---|
[16078] | 353 | |
---|
| 354 | email = schema.ASCIILine( |
---|
| 355 | title = _(u'Email Address'), |
---|
| 356 | required = True, |
---|
| 357 | constraint=validate_email, |
---|
| 358 | ) |
---|
| 359 | |
---|
| 360 | phone = PhoneNumber( |
---|
| 361 | title = _(u'Phone'), |
---|
| 362 | description = u'', |
---|
| 363 | required = False, |
---|
| 364 | ) |
---|
| 365 | |
---|
[16151] | 366 | #perm_address = schema.Text( |
---|
| 367 | # title = _(u'Current Local Address'), |
---|
| 368 | # required = False, |
---|
| 369 | # readonly = False, |
---|
| 370 | # ) |
---|
| 371 | |
---|
[16153] | 372 | collected = schema.Bool( |
---|
| 373 | title = _(u'Have you collected transcript before?'), |
---|
| 374 | default = False, |
---|
| 375 | required = False, |
---|
| 376 | ) |
---|
| 377 | |
---|
[16151] | 378 | entry_session = schema.Choice( |
---|
| 379 | title = _(u'Academic Session of Entry'), |
---|
| 380 | source = academic_sessions_vocab, |
---|
[16078] | 381 | required = False, |
---|
| 382 | readonly = False, |
---|
| 383 | ) |
---|
| 384 | |
---|
[16151] | 385 | end_session = schema.Choice( |
---|
| 386 | title = _(u'Academic Session of Graduation'), |
---|
| 387 | source = academic_sessions_vocab, |
---|
[16078] | 388 | required = False, |
---|
| 389 | readonly = False, |
---|
| 390 | ) |
---|
| 391 | |
---|
| 392 | entry_mode = schema.Choice( |
---|
[16151] | 393 | title = _(u'Mode of Entry'), |
---|
[16078] | 394 | source = StudyModeSource(), |
---|
| 395 | required = False, |
---|
| 396 | readonly = False, |
---|
| 397 | ) |
---|
| 398 | |
---|
| 399 | course_studied = schema.Choice( |
---|
[16151] | 400 | title = _(u'Course of Study'), |
---|
[16152] | 401 | source = TranscriptCertificateSource(), |
---|
[16201] | 402 | description = u'Faculty / Department / Course', |
---|
[16376] | 403 | required = True, |
---|
[16078] | 404 | readonly = False, |
---|
| 405 | ) |
---|
| 406 | |
---|
| 407 | course_changed = schema.Choice( |
---|
[16151] | 408 | title = _(u'Change of Study Course / Transfer'), |
---|
[16078] | 409 | description = u'If yes, select previous course of study.', |
---|
[16152] | 410 | source = TranscriptCertificateSource(), |
---|
[16078] | 411 | readonly = False, |
---|
| 412 | required = False, |
---|
| 413 | ) |
---|
| 414 | |
---|
[16153] | 415 | spillover_level = schema.Choice( |
---|
| 416 | title = _(u'Spill-over'), |
---|
| 417 | description = u'Any spill-over? If yes, select session of spill-over.', |
---|
| 418 | source = academic_sessions_vocab, |
---|
| 419 | required = False, |
---|
| 420 | readonly = False, |
---|
| 421 | ) |
---|
[16151] | 422 | |
---|
| 423 | purpose = schema.TextLine( |
---|
| 424 | title = _(u'Transcript Purpose'), |
---|
[16078] | 425 | required = False, |
---|
[16151] | 426 | ) |
---|
| 427 | |
---|
| 428 | order = schema.Choice( |
---|
| 429 | source = OrderSource(), |
---|
| 430 | title = _(u'Type of Order'), |
---|
[17084] | 431 | required = False, |
---|
[16151] | 432 | ) |
---|
| 433 | |
---|
| 434 | dispatch_address = schema.Text( |
---|
| 435 | title = _(u'Recipient Body'), |
---|
| 436 | description = u'Addresses (including email address and phone number) ' |
---|
| 437 | 'to which transcripts should be posted. ' |
---|
| 438 | 'All addresses must involve same courier charges.', |
---|
[16307] | 439 | required = True, |
---|
[16078] | 440 | readonly = False, |
---|
| 441 | ) |
---|
| 442 | |
---|
[16151] | 443 | charge = schema.Choice( |
---|
[16182] | 444 | title = _(u'Transcript Charge'), |
---|
[16151] | 445 | source = DestinationCostSource(), |
---|
[17084] | 446 | required = False, |
---|
[16198] | 447 | readonly = False, |
---|
[16151] | 448 | ) |
---|
| 449 | |
---|
[16078] | 450 | no_copies = schema.Choice( |
---|
| 451 | title = _(u'Number of Copies'), |
---|
| 452 | description = u'Must correspond with the number of dispatch addresses above.', |
---|
| 453 | values=[1, 2, 3, 4], |
---|
| 454 | required = False, |
---|
| 455 | readonly = False, |
---|
| 456 | default = 1, |
---|
| 457 | ) |
---|
| 458 | |
---|
[16471] | 459 | courier_tno = schema.TextLine( |
---|
| 460 | title = _(u'Courier Tracking Number'), |
---|
| 461 | required = False, |
---|
| 462 | ) |
---|
| 463 | |
---|
| 464 | proc_date = FormattedDate( |
---|
| 465 | title = _(u'Processing Date'), |
---|
| 466 | required = False, |
---|
| 467 | #date_format = u'%d/%m/%Y', # Use grok-instance-wide default |
---|
| 468 | show_year = True, |
---|
| 469 | ) |
---|
| 470 | |
---|
[16771] | 471 | @invariant |
---|
| 472 | def type_of_order(applicant): |
---|
[16775] | 473 | if not applicant.collected and applicant.order != 'o': |
---|
| 474 | raise Invalid(_("If you haven't collected transcript before, type of order must be 'original'.")) |
---|
[16772] | 475 | if applicant.order == 'o' and applicant.charge.startswith('cert_'): |
---|
| 476 | raise Invalid(_("You've selected the wrong transcript charge.")) |
---|
| 477 | if applicant.order == 'c' and not applicant.charge.startswith('cert_'): |
---|
| 478 | raise Invalid(_("You've selected the wrong transcript charge.")) |
---|
[16471] | 479 | |
---|
[16804] | 480 | class IFrenchApplicant(IKofaObject): |
---|
| 481 | """A transcript applicant. |
---|
| 482 | """ |
---|
[16771] | 483 | |
---|
[16804] | 484 | suspended = schema.Bool( |
---|
| 485 | title = _(u'Account suspended'), |
---|
| 486 | default = False, |
---|
| 487 | required = False, |
---|
| 488 | ) |
---|
| 489 | |
---|
| 490 | locked = schema.Bool( |
---|
| 491 | title = _(u'Form locked'), |
---|
| 492 | default = False, |
---|
| 493 | required = False, |
---|
| 494 | ) |
---|
| 495 | |
---|
| 496 | applicant_id = schema.TextLine( |
---|
| 497 | title = _(u'Applicant Id'), |
---|
| 498 | required = False, |
---|
| 499 | readonly = False, |
---|
| 500 | ) |
---|
| 501 | |
---|
| 502 | firstname = schema.TextLine( |
---|
| 503 | title = _(u'First Name'), |
---|
| 504 | required = True, |
---|
| 505 | ) |
---|
| 506 | |
---|
| 507 | middlename = schema.TextLine( |
---|
| 508 | title = _(u'Middle Name'), |
---|
| 509 | required = False, |
---|
| 510 | ) |
---|
| 511 | |
---|
| 512 | lastname = schema.TextLine( |
---|
| 513 | title = _(u'Surname'), |
---|
| 514 | required = True, |
---|
| 515 | ) |
---|
| 516 | |
---|
| 517 | date_of_birth = FormattedDate( |
---|
| 518 | title = _(u'Date of Birth'), |
---|
| 519 | required = False, |
---|
| 520 | #date_format = u'%d/%m/%Y', # Use grok-instance-wide default |
---|
| 521 | show_year = True, |
---|
| 522 | ) |
---|
| 523 | |
---|
| 524 | sex = schema.Choice( |
---|
| 525 | title = _(u'Gender'), |
---|
| 526 | source = GenderSource(), |
---|
| 527 | required = True, |
---|
| 528 | ) |
---|
| 529 | |
---|
| 530 | nationality = schema.Choice( |
---|
| 531 | vocabulary = nats_vocab, |
---|
| 532 | title = _(u'Nationality'), |
---|
| 533 | required = False, |
---|
| 534 | ) |
---|
| 535 | |
---|
| 536 | email = schema.ASCIILine( |
---|
| 537 | title = _(u'Email Address'), |
---|
| 538 | required = True, |
---|
| 539 | constraint=validate_email, |
---|
| 540 | ) |
---|
| 541 | |
---|
| 542 | phone = PhoneNumber( |
---|
| 543 | title = _(u'Phone'), |
---|
| 544 | description = u'', |
---|
| 545 | required = False, |
---|
| 546 | ) |
---|
| 547 | |
---|
| 548 | work = schema.TextLine( |
---|
| 549 | title = _(u'Place of Work'), |
---|
| 550 | required = False, |
---|
| 551 | ) |
---|
| 552 | |
---|
| 553 | hq_obtained = schema.Choice( |
---|
| 554 | title = _(u'Highest Qualification Obtained'), |
---|
| 555 | required = False, |
---|
| 556 | readonly = False, |
---|
| 557 | vocabulary = high_qual, |
---|
| 558 | ) |
---|
| 559 | |
---|
| 560 | hq_date = FormattedDate( |
---|
| 561 | title = _(u'Highest Qualification Date'), |
---|
| 562 | required = False, |
---|
| 563 | readonly = False, |
---|
| 564 | show_year = True, |
---|
| 565 | ) |
---|
[16807] | 566 | |
---|
| 567 | pref_session = schema.Choice( |
---|
| 568 | source = PreferredSessionSource(), |
---|
| 569 | title = _(u'Preferred Session'), |
---|
| 570 | required = False, |
---|
| 571 | ) |
---|
| 572 | |
---|
[16804] | 573 | proficiency = schema.Choice( |
---|
| 574 | source = ProficiencySource(), |
---|
| 575 | title = _(u'Level of Proficiency'), |
---|
| 576 | required = False, |
---|
| 577 | ) |
---|
| 578 | |
---|
| 579 | guarantor = schema.TextLine( |
---|
| 580 | title = _(u'Name of Guarantor'), |
---|
| 581 | required = False, |
---|
| 582 | ) |
---|
| 583 | |
---|
[16945] | 584 | course_admitted = schema.Choice( |
---|
| 585 | title = _(u'Admitted Course of Study'), |
---|
| 586 | source = CertificateSource(), |
---|
| 587 | required = False, |
---|
| 588 | ) |
---|
| 589 | |
---|
[14140] | 590 | class ICustomUGApplicant(IApplicantBaseData, IBankAccount): |
---|
[8012] | 591 | """An undergraduate applicant. |
---|
| 592 | |
---|
[8519] | 593 | This interface defines the least common multiple of all fields |
---|
| 594 | in ug application forms. In customized forms, fields can be excluded by |
---|
| 595 | adding them to the UG_OMIT* tuples. |
---|
[8012] | 596 | """ |
---|
| 597 | |
---|
[15490] | 598 | disabilities = schema.Choice( |
---|
| 599 | title = _(u'Disabilities'), |
---|
| 600 | source = DisabilitiesSource(), |
---|
| 601 | required = False, |
---|
| 602 | ) |
---|
[14140] | 603 | nationality = schema.Choice( |
---|
| 604 | source = nats_vocab, |
---|
| 605 | title = _(u'Nationality'), |
---|
| 606 | required = False, |
---|
| 607 | ) |
---|
| 608 | lga = schema.Choice( |
---|
| 609 | source = LGASource(), |
---|
| 610 | title = _(u'State/LGA (Nigerians only)'), |
---|
| 611 | required = False, |
---|
| 612 | ) |
---|
| 613 | #perm_address = schema.Text( |
---|
| 614 | # title = _(u'Permanent Address'), |
---|
| 615 | # required = False, |
---|
| 616 | # ) |
---|
| 617 | course1 = schema.Choice( |
---|
| 618 | title = _(u'1st Choice Course of Study'), |
---|
| 619 | source = AppCatCertificateSource(), |
---|
| 620 | required = True, |
---|
| 621 | ) |
---|
| 622 | course2 = schema.Choice( |
---|
| 623 | title = _(u'2nd Choice Course of Study'), |
---|
| 624 | source = AppCatCertificateSource(), |
---|
| 625 | required = False, |
---|
| 626 | ) |
---|
| 627 | |
---|
| 628 | programme_type = schema.Choice( |
---|
| 629 | title = _(u'Programme Type'), |
---|
| 630 | vocabulary = programme_types_vocab, |
---|
| 631 | required = False, |
---|
| 632 | ) |
---|
| 633 | |
---|
| 634 | hq_type = schema.Choice( |
---|
| 635 | title = _(u'Qualification Obtained'), |
---|
| 636 | required = False, |
---|
| 637 | readonly = False, |
---|
| 638 | vocabulary = high_qual, |
---|
| 639 | ) |
---|
| 640 | hq_matric_no = schema.TextLine( |
---|
| 641 | title = _(u'Former Matric Number'), |
---|
| 642 | required = False, |
---|
| 643 | readonly = False, |
---|
| 644 | ) |
---|
| 645 | hq_degree = schema.Choice( |
---|
| 646 | title = _(u'Class of Degree'), |
---|
| 647 | required = False, |
---|
| 648 | readonly = False, |
---|
| 649 | vocabulary = high_grade, |
---|
| 650 | ) |
---|
| 651 | hq_school = schema.TextLine( |
---|
| 652 | title = _(u'Institution Attended'), |
---|
| 653 | required = False, |
---|
| 654 | readonly = False, |
---|
| 655 | ) |
---|
| 656 | hq_session = schema.TextLine( |
---|
| 657 | title = _(u'Years Attended'), |
---|
| 658 | required = False, |
---|
| 659 | readonly = False, |
---|
| 660 | ) |
---|
| 661 | hq_disc = schema.TextLine( |
---|
| 662 | title = _(u'Discipline'), |
---|
| 663 | required = False, |
---|
| 664 | readonly = False, |
---|
| 665 | ) |
---|
[14141] | 666 | fst_sit_fname = schema.TextLine( |
---|
| 667 | title = _(u'Full Name'), |
---|
| 668 | required = False, |
---|
| 669 | readonly = False, |
---|
| 670 | ) |
---|
| 671 | fst_sit_no = schema.TextLine( |
---|
| 672 | title = _(u'Exam Number'), |
---|
| 673 | required = False, |
---|
| 674 | readonly = False, |
---|
| 675 | ) |
---|
| 676 | fst_sit_date = FormattedDate( |
---|
| 677 | title = _(u'Exam Date'), |
---|
| 678 | required = False, |
---|
| 679 | readonly = False, |
---|
| 680 | show_year = True, |
---|
| 681 | ) |
---|
| 682 | fst_sit_type = schema.Choice( |
---|
| 683 | title = _(u'Exam Type'), |
---|
| 684 | required = False, |
---|
| 685 | readonly = False, |
---|
| 686 | vocabulary = exam_types, |
---|
| 687 | ) |
---|
| 688 | fst_sit_results = schema.List( |
---|
| 689 | title = _(u'Exam Results'), |
---|
| 690 | value_type = ResultEntryField(), |
---|
| 691 | required = False, |
---|
| 692 | readonly = False, |
---|
| 693 | defaultFactory=list, |
---|
| 694 | ) |
---|
| 695 | scd_sit_fname = schema.TextLine( |
---|
| 696 | title = _(u'Full Name'), |
---|
| 697 | required = False, |
---|
| 698 | readonly = False, |
---|
| 699 | ) |
---|
| 700 | scd_sit_no = schema.TextLine( |
---|
| 701 | title = _(u'Exam Number'), |
---|
| 702 | required = False, |
---|
| 703 | readonly = False, |
---|
| 704 | ) |
---|
| 705 | scd_sit_date = FormattedDate( |
---|
| 706 | title = _(u'Exam Date'), |
---|
| 707 | required = False, |
---|
| 708 | readonly = False, |
---|
| 709 | show_year = True, |
---|
| 710 | ) |
---|
| 711 | scd_sit_type = schema.Choice( |
---|
| 712 | title = _(u'Exam Type'), |
---|
| 713 | required = False, |
---|
| 714 | readonly = False, |
---|
| 715 | vocabulary = exam_types, |
---|
| 716 | ) |
---|
| 717 | scd_sit_results = schema.List( |
---|
| 718 | title = _(u'Exam Results'), |
---|
| 719 | value_type = ResultEntryField(), |
---|
| 720 | required = False, |
---|
| 721 | readonly = False, |
---|
| 722 | defaultFactory=list, |
---|
| 723 | ) |
---|
[14140] | 724 | jamb_subjects = schema.Text( |
---|
| 725 | title = _(u'Subjects and Scores'), |
---|
| 726 | required = False, |
---|
| 727 | ) |
---|
| 728 | jamb_subjects_list = schema.List( |
---|
| 729 | title = _(u'JAMB Subjects'), |
---|
| 730 | required = False, |
---|
| 731 | defaultFactory=list, |
---|
| 732 | value_type = schema.Choice( |
---|
| 733 | vocabulary = jambsubjects |
---|
| 734 | #source = JAMBSubjectSource(), |
---|
| 735 | ), |
---|
| 736 | ) |
---|
[16744] | 737 | jamb_score = schema.Float( |
---|
[14140] | 738 | title = _(u'Total JAMB Score'), |
---|
| 739 | required = False, |
---|
| 740 | ) |
---|
| 741 | #jamb_age = schema.Int( |
---|
| 742 | # title = _(u'Age (provided by JAMB)'), |
---|
| 743 | # required = False, |
---|
| 744 | # ) |
---|
| 745 | jamb_reg_number = schema.TextLine( |
---|
| 746 | title = _(u'JAMB Registration Number'), |
---|
| 747 | required = False, |
---|
| 748 | ) |
---|
| 749 | notice = schema.Text( |
---|
| 750 | title = _(u'Notice'), |
---|
| 751 | required = False, |
---|
| 752 | ) |
---|
| 753 | screening_venue = schema.TextLine( |
---|
| 754 | title = _(u'Screening Venue'), |
---|
| 755 | required = False, |
---|
| 756 | ) |
---|
| 757 | screening_date = schema.TextLine( |
---|
| 758 | title = _(u'Screening Date'), |
---|
| 759 | required = False, |
---|
| 760 | ) |
---|
[16744] | 761 | screening_score = schema.Float( |
---|
[14140] | 762 | title = _(u'Screening Score (%)'), |
---|
| 763 | required = False, |
---|
| 764 | ) |
---|
[16744] | 765 | aggregate = schema.Float( |
---|
[14140] | 766 | title = _(u'Aggregate Score (%)'), |
---|
[16742] | 767 | description = _(u'(average of relative JAMB and PUTME scores)'), |
---|
[14140] | 768 | required = False, |
---|
| 769 | ) |
---|
| 770 | result_uploaded = schema.Bool( |
---|
| 771 | title = _(u'Result uploaded'), |
---|
| 772 | default = False, |
---|
| 773 | required = False, |
---|
| 774 | ) |
---|
| 775 | student_id = schema.TextLine( |
---|
| 776 | title = _(u'Student Id'), |
---|
| 777 | required = False, |
---|
| 778 | readonly = False, |
---|
| 779 | ) |
---|
| 780 | course_admitted = schema.Choice( |
---|
| 781 | title = _(u'Admitted Course of Study'), |
---|
| 782 | source = CertificateSource(), |
---|
| 783 | required = False, |
---|
| 784 | ) |
---|
| 785 | locked = schema.Bool( |
---|
| 786 | title = _(u'Form locked'), |
---|
| 787 | default = False, |
---|
| 788 | required = False, |
---|
| 789 | ) |
---|
| 790 | |
---|
| 791 | ICustomUGApplicant[ |
---|
| 792 | 'locked'].order = IApplicantBaseData['suspended'].order |
---|
| 793 | ICustomUGApplicant[ |
---|
| 794 | 'result_uploaded'].order = ICustomUGApplicant['suspended'].order |
---|
| 795 | |
---|
[8928] | 796 | class ICustomPGApplicant(INigeriaPGApplicant): |
---|
[7853] | 797 | """A postgraduate applicant. |
---|
| 798 | |
---|
[8519] | 799 | This interface defines the least common multiple of all fields |
---|
| 800 | in pg application forms. In customized forms, fields can be excluded by |
---|
| 801 | adding them to the PG_OMIT* tuples. |
---|
[7866] | 802 | """ |
---|
| 803 | |
---|
[14106] | 804 | referees = schema.List( |
---|
| 805 | title = _(u'Referees'), |
---|
| 806 | value_type = RefereeEntryField(), |
---|
| 807 | required = False, |
---|
| 808 | defaultFactory=list, |
---|
| 809 | ) |
---|
[8012] | 810 | |
---|
[14106] | 811 | ICustomPGApplicant[ |
---|
| 812 | 'referees'].order = INigeriaPGApplicant['emp2_reason'].order |
---|
| 813 | |
---|
[13814] | 814 | class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant, |
---|
[16804] | 815 | IUnibenRegistration, ITranscriptApplicant, IFrenchApplicant): |
---|
[8012] | 816 | """An interface for both types of applicants. |
---|
| 817 | |
---|
[8928] | 818 | Attention: The ICustomPGApplicant field seetings will be overwritten |
---|
| 819 | by ICustomPGApplicant field settings. If a field is defined |
---|
[8727] | 820 | in both interfaces zope.schema validates only against the |
---|
[8928] | 821 | constraints in ICustomUGApplicant. This does not affect the forms |
---|
| 822 | since they are build on either ICustomUGApplicant or ICustomPGApplicant. |
---|
[8012] | 823 | """ |
---|
| 824 | |
---|
[8743] | 825 | def writeLogMessage(view, comment): |
---|
[8053] | 826 | """Adds an INFO message to the log file |
---|
| 827 | """ |
---|
| 828 | |
---|
| 829 | def createStudent(): |
---|
[8668] | 830 | """Create a student object from applicant data |
---|
[8053] | 831 | and copy applicant object. |
---|
| 832 | """ |
---|
| 833 | |
---|
[14212] | 834 | class ICustomUGApplicantEdit(ICustomUGApplicant): |
---|
[8727] | 835 | """An undergraduate applicant interface for edit forms. |
---|
[8012] | 836 | |
---|
| 837 | Here we can repeat the fields from base data and set the |
---|
| 838 | `required` and `readonly` attributes to True to further restrict |
---|
| 839 | the data access. Or we can allow only certain certificates to be |
---|
| 840 | selected by choosing the appropriate source. |
---|
| 841 | |
---|
| 842 | We cannot omit fields here. This has to be done in the |
---|
| 843 | respective form page. |
---|
| 844 | """ |
---|
| 845 | |
---|
[14212] | 846 | email = schema.ASCIILine( |
---|
| 847 | title = _(u'Email Address'), |
---|
| 848 | required = True, |
---|
| 849 | constraint=validate_email, |
---|
| 850 | ) |
---|
| 851 | date_of_birth = FormattedDate( |
---|
| 852 | title = _(u'Date of Birth'), |
---|
| 853 | required = True, |
---|
| 854 | show_year = True, |
---|
| 855 | ) |
---|
| 856 | |
---|
| 857 | ICustomUGApplicantEdit[ |
---|
| 858 | 'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order |
---|
| 859 | ICustomUGApplicantEdit[ |
---|
| 860 | 'email'].order = ICustomUGApplicant['email'].order |
---|
| 861 | |
---|
[9056] | 862 | class ICustomPGApplicantEdit(INigeriaPGApplicantEdit): |
---|
[7866] | 863 | """A postgraduate applicant interface for editing. |
---|
| 864 | |
---|
| 865 | Here we can repeat the fields from base data and set the |
---|
| 866 | `required` and `readonly` attributes to True to further restrict |
---|
| 867 | the data access. Or we can allow only certain certificates to be |
---|
| 868 | selected by choosing the appropriate source. |
---|
| 869 | |
---|
| 870 | We cannot omit fields here. This has to be done in the |
---|
| 871 | respective form page. |
---|
[8017] | 872 | """ |
---|
[8454] | 873 | |
---|
[14106] | 874 | referees = schema.List( |
---|
| 875 | title = _(u'Referees'), |
---|
| 876 | value_type = RefereeEntryField(), |
---|
| 877 | required = False, |
---|
| 878 | defaultFactory=list, |
---|
| 879 | ) |
---|
[13814] | 880 | |
---|
[14106] | 881 | ICustomPGApplicantEdit[ |
---|
| 882 | 'referees'].order = INigeriaPGApplicantEdit['emp2_reason'].order |
---|
| 883 | |
---|
[8928] | 884 | class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment): |
---|
[8247] | 885 | """An applicant payment via payment gateways. |
---|
| 886 | |
---|
| 887 | """ |
---|
[8530] | 888 | |
---|
[14153] | 889 | class IPUTMEApplicantEdit(ICustomUGApplicant): |
---|
[8530] | 890 | """An undergraduate applicant interface for editing. |
---|
| 891 | |
---|
| 892 | Here we can repeat the fields from base data and set the |
---|
| 893 | `required` and `readonly` attributes to True to further restrict |
---|
| 894 | the data access. Or we can allow only certain certificates to be |
---|
| 895 | selected by choosing the appropriate source. |
---|
| 896 | |
---|
| 897 | We cannot omit fields here. This has to be done in the |
---|
| 898 | respective form page. |
---|
| 899 | """ |
---|
| 900 | |
---|
[14153] | 901 | email = schema.ASCIILine( |
---|
| 902 | title = _(u'Email Address'), |
---|
| 903 | required = True, |
---|
| 904 | constraint=validate_email, |
---|
| 905 | ) |
---|
| 906 | date_of_birth = FormattedDate( |
---|
| 907 | title = _(u'Date of Birth'), |
---|
| 908 | required = True, |
---|
| 909 | show_year = True, |
---|
| 910 | ) |
---|
| 911 | nationality = schema.Choice( |
---|
| 912 | source = nats_vocab, |
---|
| 913 | title = _(u'Nationality'), |
---|
| 914 | required = True, |
---|
| 915 | ) |
---|
| 916 | |
---|
| 917 | IPUTMEApplicantEdit[ |
---|
| 918 | 'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order |
---|
| 919 | IPUTMEApplicantEdit[ |
---|
| 920 | 'email'].order = ICustomUGApplicant['email'].order |
---|
| 921 | IPUTMEApplicantEdit[ |
---|
| 922 | 'nationality'].order = ICustomUGApplicant['nationality'].order |
---|
| 923 | |
---|
[9056] | 924 | class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo): |
---|
[8582] | 925 | """Representation of an applicant. |
---|
| 926 | |
---|
| 927 | Skip regular reg_number validation if reg_number is used for finding |
---|
| 928 | the applicant object. |
---|
| 929 | """ |
---|