[13814] | 1 | # -*- coding: utf-8 -*- |
---|
[7853] | 2 | ## $Id: interfaces.py 16858 2022-03-04 13:52:51Z 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'), |
---|
[16771] | 431 | required = True, |
---|
[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(), |
---|
[16858] | 446 | required = True, |
---|
[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 | |
---|
[14140] | 584 | class ICustomUGApplicant(IApplicantBaseData, IBankAccount): |
---|
[8012] | 585 | """An undergraduate applicant. |
---|
| 586 | |
---|
[8519] | 587 | This interface defines the least common multiple of all fields |
---|
| 588 | in ug application forms. In customized forms, fields can be excluded by |
---|
| 589 | adding them to the UG_OMIT* tuples. |
---|
[8012] | 590 | """ |
---|
| 591 | |
---|
[15490] | 592 | disabilities = schema.Choice( |
---|
| 593 | title = _(u'Disabilities'), |
---|
| 594 | source = DisabilitiesSource(), |
---|
| 595 | required = False, |
---|
| 596 | ) |
---|
[14140] | 597 | nationality = schema.Choice( |
---|
| 598 | source = nats_vocab, |
---|
| 599 | title = _(u'Nationality'), |
---|
| 600 | required = False, |
---|
| 601 | ) |
---|
| 602 | lga = schema.Choice( |
---|
| 603 | source = LGASource(), |
---|
| 604 | title = _(u'State/LGA (Nigerians only)'), |
---|
| 605 | required = False, |
---|
| 606 | ) |
---|
| 607 | #perm_address = schema.Text( |
---|
| 608 | # title = _(u'Permanent Address'), |
---|
| 609 | # required = False, |
---|
| 610 | # ) |
---|
| 611 | course1 = schema.Choice( |
---|
| 612 | title = _(u'1st Choice Course of Study'), |
---|
| 613 | source = AppCatCertificateSource(), |
---|
| 614 | required = True, |
---|
| 615 | ) |
---|
| 616 | course2 = schema.Choice( |
---|
| 617 | title = _(u'2nd Choice Course of Study'), |
---|
| 618 | source = AppCatCertificateSource(), |
---|
| 619 | required = False, |
---|
| 620 | ) |
---|
| 621 | |
---|
| 622 | programme_type = schema.Choice( |
---|
| 623 | title = _(u'Programme Type'), |
---|
| 624 | vocabulary = programme_types_vocab, |
---|
| 625 | required = False, |
---|
| 626 | ) |
---|
| 627 | |
---|
| 628 | hq_type = schema.Choice( |
---|
| 629 | title = _(u'Qualification Obtained'), |
---|
| 630 | required = False, |
---|
| 631 | readonly = False, |
---|
| 632 | vocabulary = high_qual, |
---|
| 633 | ) |
---|
| 634 | hq_matric_no = schema.TextLine( |
---|
| 635 | title = _(u'Former Matric Number'), |
---|
| 636 | required = False, |
---|
| 637 | readonly = False, |
---|
| 638 | ) |
---|
| 639 | hq_degree = schema.Choice( |
---|
| 640 | title = _(u'Class of Degree'), |
---|
| 641 | required = False, |
---|
| 642 | readonly = False, |
---|
| 643 | vocabulary = high_grade, |
---|
| 644 | ) |
---|
| 645 | hq_school = schema.TextLine( |
---|
| 646 | title = _(u'Institution Attended'), |
---|
| 647 | required = False, |
---|
| 648 | readonly = False, |
---|
| 649 | ) |
---|
| 650 | hq_session = schema.TextLine( |
---|
| 651 | title = _(u'Years Attended'), |
---|
| 652 | required = False, |
---|
| 653 | readonly = False, |
---|
| 654 | ) |
---|
| 655 | hq_disc = schema.TextLine( |
---|
| 656 | title = _(u'Discipline'), |
---|
| 657 | required = False, |
---|
| 658 | readonly = False, |
---|
| 659 | ) |
---|
[14141] | 660 | fst_sit_fname = schema.TextLine( |
---|
| 661 | title = _(u'Full Name'), |
---|
| 662 | required = False, |
---|
| 663 | readonly = False, |
---|
| 664 | ) |
---|
| 665 | fst_sit_no = schema.TextLine( |
---|
| 666 | title = _(u'Exam Number'), |
---|
| 667 | required = False, |
---|
| 668 | readonly = False, |
---|
| 669 | ) |
---|
| 670 | fst_sit_date = FormattedDate( |
---|
| 671 | title = _(u'Exam Date'), |
---|
| 672 | required = False, |
---|
| 673 | readonly = False, |
---|
| 674 | show_year = True, |
---|
| 675 | ) |
---|
| 676 | fst_sit_type = schema.Choice( |
---|
| 677 | title = _(u'Exam Type'), |
---|
| 678 | required = False, |
---|
| 679 | readonly = False, |
---|
| 680 | vocabulary = exam_types, |
---|
| 681 | ) |
---|
| 682 | fst_sit_results = schema.List( |
---|
| 683 | title = _(u'Exam Results'), |
---|
| 684 | value_type = ResultEntryField(), |
---|
| 685 | required = False, |
---|
| 686 | readonly = False, |
---|
| 687 | defaultFactory=list, |
---|
| 688 | ) |
---|
| 689 | scd_sit_fname = schema.TextLine( |
---|
| 690 | title = _(u'Full Name'), |
---|
| 691 | required = False, |
---|
| 692 | readonly = False, |
---|
| 693 | ) |
---|
| 694 | scd_sit_no = schema.TextLine( |
---|
| 695 | title = _(u'Exam Number'), |
---|
| 696 | required = False, |
---|
| 697 | readonly = False, |
---|
| 698 | ) |
---|
| 699 | scd_sit_date = FormattedDate( |
---|
| 700 | title = _(u'Exam Date'), |
---|
| 701 | required = False, |
---|
| 702 | readonly = False, |
---|
| 703 | show_year = True, |
---|
| 704 | ) |
---|
| 705 | scd_sit_type = schema.Choice( |
---|
| 706 | title = _(u'Exam Type'), |
---|
| 707 | required = False, |
---|
| 708 | readonly = False, |
---|
| 709 | vocabulary = exam_types, |
---|
| 710 | ) |
---|
| 711 | scd_sit_results = schema.List( |
---|
| 712 | title = _(u'Exam Results'), |
---|
| 713 | value_type = ResultEntryField(), |
---|
| 714 | required = False, |
---|
| 715 | readonly = False, |
---|
| 716 | defaultFactory=list, |
---|
| 717 | ) |
---|
[14140] | 718 | jamb_subjects = schema.Text( |
---|
| 719 | title = _(u'Subjects and Scores'), |
---|
| 720 | required = False, |
---|
| 721 | ) |
---|
| 722 | jamb_subjects_list = schema.List( |
---|
| 723 | title = _(u'JAMB Subjects'), |
---|
| 724 | required = False, |
---|
| 725 | defaultFactory=list, |
---|
| 726 | value_type = schema.Choice( |
---|
| 727 | vocabulary = jambsubjects |
---|
| 728 | #source = JAMBSubjectSource(), |
---|
| 729 | ), |
---|
| 730 | ) |
---|
[16744] | 731 | jamb_score = schema.Float( |
---|
[14140] | 732 | title = _(u'Total JAMB Score'), |
---|
| 733 | required = False, |
---|
| 734 | ) |
---|
| 735 | #jamb_age = schema.Int( |
---|
| 736 | # title = _(u'Age (provided by JAMB)'), |
---|
| 737 | # required = False, |
---|
| 738 | # ) |
---|
| 739 | jamb_reg_number = schema.TextLine( |
---|
| 740 | title = _(u'JAMB Registration Number'), |
---|
| 741 | required = False, |
---|
| 742 | ) |
---|
| 743 | notice = schema.Text( |
---|
| 744 | title = _(u'Notice'), |
---|
| 745 | required = False, |
---|
| 746 | ) |
---|
| 747 | screening_venue = schema.TextLine( |
---|
| 748 | title = _(u'Screening Venue'), |
---|
| 749 | required = False, |
---|
| 750 | ) |
---|
| 751 | screening_date = schema.TextLine( |
---|
| 752 | title = _(u'Screening Date'), |
---|
| 753 | required = False, |
---|
| 754 | ) |
---|
[16744] | 755 | screening_score = schema.Float( |
---|
[14140] | 756 | title = _(u'Screening Score (%)'), |
---|
| 757 | required = False, |
---|
| 758 | ) |
---|
[16744] | 759 | aggregate = schema.Float( |
---|
[14140] | 760 | title = _(u'Aggregate Score (%)'), |
---|
[16742] | 761 | description = _(u'(average of relative JAMB and PUTME scores)'), |
---|
[14140] | 762 | required = False, |
---|
| 763 | ) |
---|
| 764 | result_uploaded = schema.Bool( |
---|
| 765 | title = _(u'Result uploaded'), |
---|
| 766 | default = False, |
---|
| 767 | required = False, |
---|
| 768 | ) |
---|
| 769 | student_id = schema.TextLine( |
---|
| 770 | title = _(u'Student Id'), |
---|
| 771 | required = False, |
---|
| 772 | readonly = False, |
---|
| 773 | ) |
---|
| 774 | course_admitted = schema.Choice( |
---|
| 775 | title = _(u'Admitted Course of Study'), |
---|
| 776 | source = CertificateSource(), |
---|
| 777 | required = False, |
---|
| 778 | ) |
---|
| 779 | locked = schema.Bool( |
---|
| 780 | title = _(u'Form locked'), |
---|
| 781 | default = False, |
---|
| 782 | required = False, |
---|
| 783 | ) |
---|
| 784 | |
---|
| 785 | ICustomUGApplicant[ |
---|
| 786 | 'locked'].order = IApplicantBaseData['suspended'].order |
---|
| 787 | ICustomUGApplicant[ |
---|
| 788 | 'result_uploaded'].order = ICustomUGApplicant['suspended'].order |
---|
| 789 | |
---|
[8928] | 790 | class ICustomPGApplicant(INigeriaPGApplicant): |
---|
[7853] | 791 | """A postgraduate applicant. |
---|
| 792 | |
---|
[8519] | 793 | This interface defines the least common multiple of all fields |
---|
| 794 | in pg application forms. In customized forms, fields can be excluded by |
---|
| 795 | adding them to the PG_OMIT* tuples. |
---|
[7866] | 796 | """ |
---|
| 797 | |
---|
[14106] | 798 | referees = schema.List( |
---|
| 799 | title = _(u'Referees'), |
---|
| 800 | value_type = RefereeEntryField(), |
---|
| 801 | required = False, |
---|
| 802 | defaultFactory=list, |
---|
| 803 | ) |
---|
[8012] | 804 | |
---|
[14106] | 805 | ICustomPGApplicant[ |
---|
| 806 | 'referees'].order = INigeriaPGApplicant['emp2_reason'].order |
---|
| 807 | |
---|
[13814] | 808 | class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant, |
---|
[16804] | 809 | IUnibenRegistration, ITranscriptApplicant, IFrenchApplicant): |
---|
[8012] | 810 | """An interface for both types of applicants. |
---|
| 811 | |
---|
[8928] | 812 | Attention: The ICustomPGApplicant field seetings will be overwritten |
---|
| 813 | by ICustomPGApplicant field settings. If a field is defined |
---|
[8727] | 814 | in both interfaces zope.schema validates only against the |
---|
[8928] | 815 | constraints in ICustomUGApplicant. This does not affect the forms |
---|
| 816 | since they are build on either ICustomUGApplicant or ICustomPGApplicant. |
---|
[8012] | 817 | """ |
---|
| 818 | |
---|
[8743] | 819 | def writeLogMessage(view, comment): |
---|
[8053] | 820 | """Adds an INFO message to the log file |
---|
| 821 | """ |
---|
| 822 | |
---|
| 823 | def createStudent(): |
---|
[8668] | 824 | """Create a student object from applicant data |
---|
[8053] | 825 | and copy applicant object. |
---|
| 826 | """ |
---|
| 827 | |
---|
[14212] | 828 | class ICustomUGApplicantEdit(ICustomUGApplicant): |
---|
[8727] | 829 | """An undergraduate applicant interface for edit forms. |
---|
[8012] | 830 | |
---|
| 831 | Here we can repeat the fields from base data and set the |
---|
| 832 | `required` and `readonly` attributes to True to further restrict |
---|
| 833 | the data access. Or we can allow only certain certificates to be |
---|
| 834 | selected by choosing the appropriate source. |
---|
| 835 | |
---|
| 836 | We cannot omit fields here. This has to be done in the |
---|
| 837 | respective form page. |
---|
| 838 | """ |
---|
| 839 | |
---|
[14212] | 840 | email = schema.ASCIILine( |
---|
| 841 | title = _(u'Email Address'), |
---|
| 842 | required = True, |
---|
| 843 | constraint=validate_email, |
---|
| 844 | ) |
---|
| 845 | date_of_birth = FormattedDate( |
---|
| 846 | title = _(u'Date of Birth'), |
---|
| 847 | required = True, |
---|
| 848 | show_year = True, |
---|
| 849 | ) |
---|
| 850 | |
---|
| 851 | ICustomUGApplicantEdit[ |
---|
| 852 | 'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order |
---|
| 853 | ICustomUGApplicantEdit[ |
---|
| 854 | 'email'].order = ICustomUGApplicant['email'].order |
---|
| 855 | |
---|
[9056] | 856 | class ICustomPGApplicantEdit(INigeriaPGApplicantEdit): |
---|
[7866] | 857 | """A postgraduate applicant interface for editing. |
---|
| 858 | |
---|
| 859 | Here we can repeat the fields from base data and set the |
---|
| 860 | `required` and `readonly` attributes to True to further restrict |
---|
| 861 | the data access. Or we can allow only certain certificates to be |
---|
| 862 | selected by choosing the appropriate source. |
---|
| 863 | |
---|
| 864 | We cannot omit fields here. This has to be done in the |
---|
| 865 | respective form page. |
---|
[8017] | 866 | """ |
---|
[8454] | 867 | |
---|
[14106] | 868 | referees = schema.List( |
---|
| 869 | title = _(u'Referees'), |
---|
| 870 | value_type = RefereeEntryField(), |
---|
| 871 | required = False, |
---|
| 872 | defaultFactory=list, |
---|
| 873 | ) |
---|
[13814] | 874 | |
---|
[14106] | 875 | ICustomPGApplicantEdit[ |
---|
| 876 | 'referees'].order = INigeriaPGApplicantEdit['emp2_reason'].order |
---|
| 877 | |
---|
[8928] | 878 | class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment): |
---|
[8247] | 879 | """An applicant payment via payment gateways. |
---|
| 880 | |
---|
| 881 | """ |
---|
[8530] | 882 | |
---|
[14153] | 883 | class IPUTMEApplicantEdit(ICustomUGApplicant): |
---|
[8530] | 884 | """An undergraduate applicant interface for editing. |
---|
| 885 | |
---|
| 886 | Here we can repeat the fields from base data and set the |
---|
| 887 | `required` and `readonly` attributes to True to further restrict |
---|
| 888 | the data access. Or we can allow only certain certificates to be |
---|
| 889 | selected by choosing the appropriate source. |
---|
| 890 | |
---|
| 891 | We cannot omit fields here. This has to be done in the |
---|
| 892 | respective form page. |
---|
| 893 | """ |
---|
| 894 | |
---|
[14153] | 895 | email = schema.ASCIILine( |
---|
| 896 | title = _(u'Email Address'), |
---|
| 897 | required = True, |
---|
| 898 | constraint=validate_email, |
---|
| 899 | ) |
---|
| 900 | date_of_birth = FormattedDate( |
---|
| 901 | title = _(u'Date of Birth'), |
---|
| 902 | required = True, |
---|
| 903 | show_year = True, |
---|
| 904 | ) |
---|
| 905 | nationality = schema.Choice( |
---|
| 906 | source = nats_vocab, |
---|
| 907 | title = _(u'Nationality'), |
---|
| 908 | required = True, |
---|
| 909 | ) |
---|
| 910 | |
---|
| 911 | IPUTMEApplicantEdit[ |
---|
| 912 | 'date_of_birth'].order = ICustomUGApplicant['date_of_birth'].order |
---|
| 913 | IPUTMEApplicantEdit[ |
---|
| 914 | 'email'].order = ICustomUGApplicant['email'].order |
---|
| 915 | IPUTMEApplicantEdit[ |
---|
| 916 | 'nationality'].order = ICustomUGApplicant['nationality'].order |
---|
| 917 | |
---|
[9056] | 918 | class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo): |
---|
[8582] | 919 | """Representation of an applicant. |
---|
| 920 | |
---|
| 921 | Skip regular reg_number validation if reg_number is used for finding |
---|
| 922 | the applicant object. |
---|
| 923 | """ |
---|