[5638] | 1 | ## $Id: interfaces.py 8613 2012-06-03 13:23:06Z uli $ |
---|
[6076] | 2 | ## |
---|
[6087] | 3 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann |
---|
[5638] | 4 | ## This program is free software; you can redistribute it and/or modify |
---|
| 5 | ## it under the terms of the GNU General Public License as published by |
---|
| 6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | ## (at your option) any later version. |
---|
[6076] | 8 | ## |
---|
[5638] | 9 | ## This program is distributed in the hope that it will be useful, |
---|
| 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | ## GNU General Public License for more details. |
---|
[6076] | 13 | ## |
---|
[5638] | 14 | ## You should have received a copy of the GNU General Public License |
---|
| 15 | ## along with this program; if not, write to the Free Software |
---|
| 16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | ## |
---|
[6500] | 18 | """Interfaces of the university application package. |
---|
[5638] | 19 | """ |
---|
[5866] | 20 | from grokcore.content.interfaces import IContainer |
---|
[7795] | 21 | from zc.sourcefactory.contextual import BasicContextualSourceFactory |
---|
[5638] | 22 | from zope import schema |
---|
[8613] | 23 | from zope.component import queryUtility, getUtility |
---|
[7263] | 24 | from zope.catalog.interfaces import ICatalog |
---|
[7795] | 25 | from zope.interface import Interface, Attribute, implements, directlyProvides |
---|
[7317] | 26 | from zope.schema.interfaces import ( |
---|
| 27 | ValidationError, ISource, IContextSourceBinder) |
---|
[8149] | 28 | from waeup.kofa.schema import TextLineChoice, FormattedDate |
---|
[7811] | 29 | from waeup.kofa.interfaces import ( |
---|
[8245] | 30 | IKofaObject, year_range, validate_email, |
---|
[8033] | 31 | SimpleKofaVocabulary) |
---|
[7811] | 32 | from waeup.kofa.interfaces import MessageFactory as _ |
---|
| 33 | from waeup.kofa.payments.interfaces import IOnlinePayment |
---|
[8176] | 34 | from waeup.kofa.schema import PhoneNumber |
---|
[8069] | 35 | from waeup.kofa.students.vocabularies import GenderSource |
---|
[8613] | 36 | from waeup.kofa.university.vocabularies import AppCatSource, CertificateSource |
---|
[5638] | 37 | |
---|
[7075] | 38 | #: Maximum upload size for applicant passport photographs (in bytes) |
---|
[7086] | 39 | MAX_UPLOAD_SIZE = 1024 * 20 |
---|
[7075] | 40 | |
---|
[8611] | 41 | _marker = object() # a marker different from None |
---|
| 42 | |
---|
[7263] | 43 | class RegNumInSource(ValidationError): |
---|
| 44 | """Registration number exists already |
---|
| 45 | """ |
---|
| 46 | # The docstring of ValidationErrors is used as error description |
---|
| 47 | # by zope.formlib. |
---|
| 48 | pass |
---|
| 49 | |
---|
| 50 | class RegNumberSource(object): |
---|
| 51 | implements(ISource) |
---|
| 52 | cat_name = 'applicants_catalog' |
---|
[7270] | 53 | field_name = 'reg_number' |
---|
[7263] | 54 | validation_error = RegNumInSource |
---|
| 55 | def __init__(self, context): |
---|
| 56 | self.context = context |
---|
| 57 | return |
---|
| 58 | |
---|
| 59 | def __contains__(self, value): |
---|
| 60 | cat = queryUtility(ICatalog, self.cat_name) |
---|
| 61 | if cat is None: |
---|
| 62 | return True |
---|
| 63 | kw = {self.field_name: (value, value)} |
---|
| 64 | results = cat.searchResults(**kw) |
---|
| 65 | for entry in results: |
---|
| 66 | if entry.applicant_id != self.context.applicant_id: |
---|
| 67 | # XXX: sources should simply return False. |
---|
| 68 | # But then we get some stupid error message in forms |
---|
| 69 | # when validation fails. |
---|
| 70 | raise self.validation_error(value) |
---|
| 71 | #return False |
---|
| 72 | return True |
---|
| 73 | |
---|
| 74 | def contextual_reg_num_source(context): |
---|
| 75 | source = RegNumberSource(context) |
---|
| 76 | return source |
---|
| 77 | directlyProvides(contextual_reg_num_source, IContextSourceBinder) |
---|
| 78 | |
---|
[7795] | 79 | |
---|
[7683] | 80 | class AppCatCertificateSource(CertificateSource): |
---|
[8607] | 81 | """An application certificate source delivers all certificates |
---|
| 82 | which belong to a certain application_category. |
---|
| 83 | |
---|
| 84 | This source is meant to be used with Applicants. |
---|
| 85 | |
---|
| 86 | The application category must match the application category of |
---|
| 87 | the context parent, normally an applicants container. |
---|
[7683] | 88 | """ |
---|
[8607] | 89 | def contains(self, context, value): |
---|
| 90 | context_appcat = getattr(getattr( |
---|
[8611] | 91 | context, '__parent__', None), 'application_category', _marker) |
---|
| 92 | if context_appcat is _marker: |
---|
[8607] | 93 | # If the context (applicant) has no application category, |
---|
| 94 | # then it might be not part of a container (yet), for |
---|
| 95 | # instance during imports. We consider this correct. |
---|
| 96 | return True |
---|
| 97 | if value.application_category == context_appcat: |
---|
| 98 | return True |
---|
| 99 | return False |
---|
| 100 | |
---|
[7683] | 101 | def getValues(self, context): |
---|
| 102 | # appliction category not available when certificate was deleted. |
---|
| 103 | # shouldn't that info be part of applicant info instead? |
---|
| 104 | # when we cannot determine the appcat, we will display all courses. |
---|
| 105 | appcat = getattr(getattr(context, '__parent__', None), |
---|
| 106 | 'application_category', None) |
---|
| 107 | catalog = getUtility(ICatalog, name='certificates_catalog') |
---|
| 108 | result = catalog.searchResults( |
---|
| 109 | application_category=(appcat,appcat)) |
---|
| 110 | result = sorted(result, key=lambda value: value.code) |
---|
[8607] | 111 | # XXX: What does the following mean here? |
---|
[7683] | 112 | curr_course = context.course1 |
---|
| 113 | if curr_course is not None and curr_course not in result: |
---|
| 114 | # display also current course even if it is not catalogued |
---|
| 115 | # (any more) |
---|
| 116 | result = [curr_course,] + result |
---|
| 117 | return result |
---|
| 118 | |
---|
| 119 | class ApplicationTypeSource(BasicContextualSourceFactory): |
---|
| 120 | """An application type source delivers screening types defined in the |
---|
| 121 | portal. |
---|
| 122 | """ |
---|
| 123 | def getValues(self, context): |
---|
[7688] | 124 | appcats_dict = getUtility( |
---|
[7844] | 125 | IApplicantsUtils).APP_TYPES_DICT |
---|
[7688] | 126 | return sorted(appcats_dict.keys()) |
---|
[7683] | 127 | |
---|
| 128 | def getToken(self, context, value): |
---|
| 129 | return value |
---|
| 130 | |
---|
| 131 | def getTitle(self, context, value): |
---|
[7688] | 132 | appcats_dict = getUtility( |
---|
[7844] | 133 | IApplicantsUtils).APP_TYPES_DICT |
---|
[7688] | 134 | return appcats_dict[value][0] |
---|
[7683] | 135 | |
---|
| 136 | # Maybe Uniben still needs this ... |
---|
| 137 | #class ApplicationPinSource(BasicContextualSourceFactory): |
---|
| 138 | # """An application pin source delivers PIN prefixes for application |
---|
| 139 | # defined in the portal. |
---|
| 140 | # """ |
---|
| 141 | # def getValues(self, context): |
---|
[7688] | 142 | # apppins_dict = getUtility( |
---|
[7844] | 143 | # IApplicantsUtils).APP_TYPES_DICT |
---|
[7688] | 144 | # return sorted(appcats_dict.keys()) |
---|
[7683] | 145 | # |
---|
| 146 | # def getToken(self, context, value): |
---|
| 147 | # return value |
---|
| 148 | # |
---|
| 149 | # def getTitle(self, context, value): |
---|
[7688] | 150 | # apppins_dict = getUtility( |
---|
[7844] | 151 | # IApplicantsUtils).APP_TYPES_DICT |
---|
[7683] | 152 | # return u"%s (%s)" % ( |
---|
[7688] | 153 | # apppins_dict[value][1],self.apppins_dict[value][0]) |
---|
[7683] | 154 | |
---|
[8033] | 155 | application_modes_vocab = SimpleKofaVocabulary( |
---|
| 156 | (_('Create Application Records'), 'create'), |
---|
| 157 | (_('Update Application Records'), 'update'), |
---|
| 158 | ) |
---|
[6075] | 159 | |
---|
[7682] | 160 | class IApplicantsUtils(Interface): |
---|
| 161 | """A collection of methods which are subject to customization. |
---|
| 162 | """ |
---|
| 163 | |
---|
[7844] | 164 | APP_TYPES_DICT = Attribute(' dict of application types') |
---|
| 165 | |
---|
[7819] | 166 | class IApplicantsRoot(IKofaObject, IContainer): |
---|
[5676] | 167 | """A container for university applicants containers. |
---|
[5645] | 168 | """ |
---|
[5638] | 169 | |
---|
[8388] | 170 | description = schema.Text( |
---|
| 171 | title = _(u'Human readable description in HTML format'), |
---|
| 172 | required = False, |
---|
| 173 | default = u'''This text can been seen by anonymous users. |
---|
| 174 | Here we put multi-lingual general information about the application procedure. |
---|
| 175 | >>de<< |
---|
| 176 | Dieser Text kann von anonymen Benutzern gelesen werden. |
---|
| 177 | Hier koennen mehrsprachige Informationen fuer Antragsteller hinterlegt werden.''' |
---|
| 178 | ) |
---|
| 179 | |
---|
| 180 | description_dict = Attribute( |
---|
| 181 | """Content as language dictionary with values in HTML format.""") |
---|
| 182 | |
---|
[7819] | 183 | class IApplicantsContainer(IKofaObject): |
---|
[5676] | 184 | """An applicants container contains university applicants. |
---|
[5645] | 185 | |
---|
[5638] | 186 | """ |
---|
[6069] | 187 | |
---|
| 188 | code = schema.TextLine( |
---|
[7708] | 189 | title = _(u'Code'), |
---|
[6069] | 190 | required = True, |
---|
| 191 | readonly = True, |
---|
[6076] | 192 | ) |
---|
[6096] | 193 | |
---|
[6087] | 194 | title = schema.TextLine( |
---|
[7708] | 195 | title = _(u'Title'), |
---|
[6087] | 196 | required = True, |
---|
[8562] | 197 | readonly = False, |
---|
[6096] | 198 | ) |
---|
| 199 | |
---|
[6087] | 200 | prefix = schema.Choice( |
---|
[7708] | 201 | title = _(u'Application Target'), |
---|
[6087] | 202 | required = True, |
---|
[7683] | 203 | source = ApplicationTypeSource(), |
---|
[6087] | 204 | readonly = True, |
---|
| 205 | ) |
---|
[6076] | 206 | |
---|
[6087] | 207 | year = schema.Choice( |
---|
[7708] | 208 | title = _(u'Year of Entrance'), |
---|
[6087] | 209 | required = True, |
---|
[6158] | 210 | values = year_range(), |
---|
[6087] | 211 | readonly = True, |
---|
[6096] | 212 | ) |
---|
[6087] | 213 | |
---|
[8033] | 214 | mode = schema.Choice( |
---|
| 215 | title = _(u'Application Mode'), |
---|
| 216 | vocabulary = application_modes_vocab, |
---|
| 217 | required = True, |
---|
| 218 | ) |
---|
| 219 | |
---|
[7683] | 220 | # Maybe Uniben still needs this ... |
---|
[7376] | 221 | #ac_prefix = schema.Choice( |
---|
| 222 | # title = u'Activation code prefix', |
---|
| 223 | # required = True, |
---|
| 224 | # default = None, |
---|
[7683] | 225 | # source = ApplicationPinSource(), |
---|
[7376] | 226 | # ) |
---|
[6076] | 227 | |
---|
[6189] | 228 | application_category = schema.Choice( |
---|
[7708] | 229 | title = _(u'Category for the grouping of certificates'), |
---|
[6189] | 230 | required = True, |
---|
[7681] | 231 | source = AppCatSource(), |
---|
[6189] | 232 | ) |
---|
| 233 | |
---|
[5645] | 234 | description = schema.Text( |
---|
[8365] | 235 | title = _(u'Human readable description in HTML format'), |
---|
[5638] | 236 | required = False, |
---|
[6518] | 237 | default = u'''This text can been seen by anonymous users. |
---|
[8033] | 238 | Here we put multi-lingual information about the study courses provided, the application procedure and deadlines. |
---|
[7708] | 239 | >>de<< |
---|
| 240 | Dieser Text kann von anonymen Benutzern gelesen werden. |
---|
| 241 | Hier koennen mehrsprachige Informationen fuer Antragsteller hinterlegt werden.''' |
---|
[5638] | 242 | ) |
---|
| 243 | |
---|
[7903] | 244 | description_dict = Attribute( |
---|
| 245 | """Content as language dictionary with values in HTML format.""") |
---|
[7708] | 246 | |
---|
[8200] | 247 | startdate = schema.Datetime( |
---|
[7708] | 248 | title = _(u'Application Start Date'), |
---|
[5638] | 249 | required = False, |
---|
[8203] | 250 | description = _('Example:') + u'2011-12-01 18:30:00+01:00', |
---|
[5638] | 251 | ) |
---|
| 252 | |
---|
[8200] | 253 | enddate = schema.Datetime( |
---|
[7708] | 254 | title = _(u'Application Closing Date'), |
---|
[5638] | 255 | required = False, |
---|
[8203] | 256 | description = _('Example:') + u'2011-12-31 23:59:59+01:00', |
---|
[5638] | 257 | ) |
---|
| 258 | |
---|
[5645] | 259 | strict_deadline = schema.Bool( |
---|
[7708] | 260 | title = _(u'Forbid additions after deadline (enddate)'), |
---|
[7984] | 261 | required = False, |
---|
[5645] | 262 | default = True, |
---|
| 263 | ) |
---|
[5638] | 264 | |
---|
[8525] | 265 | application_fee = schema.Float( |
---|
| 266 | title = _(u'Application Fee'), |
---|
| 267 | default = 0.0, |
---|
| 268 | required = False, |
---|
| 269 | ) |
---|
| 270 | |
---|
[5638] | 271 | def archive(id=None): |
---|
[5676] | 272 | """Create on-dist archive of applicants stored in this term. |
---|
[5638] | 273 | |
---|
[5676] | 274 | If id is `None`, all applicants are archived. |
---|
[5638] | 275 | |
---|
| 276 | If id contains a single id string, only the respective |
---|
[5676] | 277 | applicants are archived. |
---|
[5638] | 278 | |
---|
| 279 | If id contains a list of id strings all of the respective |
---|
[5676] | 280 | applicants types are saved to disk. |
---|
[5638] | 281 | """ |
---|
| 282 | |
---|
| 283 | def clear(id=None, archive=True): |
---|
[5676] | 284 | """Remove applicants of type given by 'id'. |
---|
[5638] | 285 | |
---|
[5676] | 286 | Optionally archive the applicants. |
---|
[6076] | 287 | |
---|
[5676] | 288 | If id is `None`, all applicants are archived. |
---|
[5638] | 289 | |
---|
| 290 | If id contains a single id string, only the respective |
---|
[5676] | 291 | applicants are archived. |
---|
[5638] | 292 | |
---|
| 293 | If id contains a list of id strings all of the respective |
---|
[5676] | 294 | applicant types are saved to disk. |
---|
[5638] | 295 | |
---|
| 296 | If `archive` is ``False`` none of the archive-handling is done |
---|
[5676] | 297 | and respective applicants are simply removed from the |
---|
[5638] | 298 | database. |
---|
| 299 | """ |
---|
[6073] | 300 | |
---|
[6069] | 301 | class IApplicantsContainerAdd(IApplicantsContainer): |
---|
| 302 | """An applicants container contains university applicants. |
---|
| 303 | """ |
---|
[6087] | 304 | prefix = schema.Choice( |
---|
[7708] | 305 | title = _(u'Application Target'), |
---|
[6069] | 306 | required = True, |
---|
[7683] | 307 | source = ApplicationTypeSource(), |
---|
[6069] | 308 | readonly = False, |
---|
[6076] | 309 | ) |
---|
[6073] | 310 | |
---|
[6087] | 311 | year = schema.Choice( |
---|
[7708] | 312 | title = _(u'Year of Entrance'), |
---|
[6087] | 313 | required = True, |
---|
[6158] | 314 | values = year_range(), |
---|
[6087] | 315 | readonly = False, |
---|
[6096] | 316 | ) |
---|
[6073] | 317 | |
---|
[6096] | 318 | IApplicantsContainerAdd[ |
---|
| 319 | 'prefix'].order = IApplicantsContainer['prefix'].order |
---|
| 320 | IApplicantsContainerAdd[ |
---|
| 321 | 'year'].order = IApplicantsContainer['year'].order |
---|
[6087] | 322 | |
---|
[7819] | 323 | class IApplicantBaseData(IKofaObject): |
---|
[5753] | 324 | """The data for an applicant. |
---|
| 325 | |
---|
[7240] | 326 | This is a base interface with no field |
---|
[7933] | 327 | required. For use with processors, forms, etc., please use one of |
---|
[5753] | 328 | the derived interfaces below, which set more fields to required |
---|
| 329 | state, depending on use-case. |
---|
| 330 | """ |
---|
[8052] | 331 | |
---|
| 332 | history = Attribute('Object history, a list of messages') |
---|
[8286] | 333 | state = Attribute('The application state of an applicant') |
---|
[8052] | 334 | display_fullname = Attribute('The fullname of an applicant') |
---|
[8589] | 335 | application_date = Attribute('UTC datetime of submission, used for export only') |
---|
[8052] | 336 | password = Attribute('Encrypted password of a applicant') |
---|
| 337 | application_number = Attribute('The key under which the record is stored') |
---|
| 338 | |
---|
[7240] | 339 | applicant_id = schema.TextLine( |
---|
[7708] | 340 | title = _(u'Applicant Id'), |
---|
[7240] | 341 | required = False, |
---|
[7260] | 342 | readonly = False, |
---|
[7240] | 343 | ) |
---|
[7270] | 344 | reg_number = TextLineChoice( |
---|
[8033] | 345 | title = _(u'Registration Number'), |
---|
[7263] | 346 | readonly = False, |
---|
| 347 | required = True, |
---|
| 348 | source = contextual_reg_num_source, |
---|
[5753] | 349 | ) |
---|
[7376] | 350 | #access_code = schema.TextLine( |
---|
| 351 | # title = u'Activation Code', |
---|
| 352 | # required = False, |
---|
| 353 | # readonly = True, |
---|
| 354 | # ) |
---|
[5753] | 355 | firstname = schema.TextLine( |
---|
[7708] | 356 | title = _(u'First Name'), |
---|
[6352] | 357 | required = True, |
---|
[5753] | 358 | ) |
---|
[7356] | 359 | middlename = schema.TextLine( |
---|
[7708] | 360 | title = _(u'Middle Name'), |
---|
[5753] | 361 | required = False, |
---|
| 362 | ) |
---|
| 363 | lastname = schema.TextLine( |
---|
[7708] | 364 | title = _(u'Last Name (Surname)'), |
---|
[6352] | 365 | required = True, |
---|
[5753] | 366 | ) |
---|
[8149] | 367 | date_of_birth = FormattedDate( |
---|
[7708] | 368 | title = _(u'Date of Birth'), |
---|
[8540] | 369 | required = False, |
---|
[8154] | 370 | #date_format = u'%d/%m/%Y', # Use grok-instance-wide default |
---|
[8149] | 371 | show_year = True, |
---|
[5753] | 372 | ) |
---|
| 373 | sex = schema.Choice( |
---|
[7708] | 374 | title = _(u'Sex'), |
---|
[5753] | 375 | source = GenderSource(), |
---|
[6352] | 376 | required = True, |
---|
[5753] | 377 | ) |
---|
[6341] | 378 | email = schema.ASCIILine( |
---|
[7708] | 379 | title = _(u'Email Address'), |
---|
[8033] | 380 | required = False, |
---|
[6343] | 381 | constraint=validate_email, |
---|
[5753] | 382 | ) |
---|
[8176] | 383 | phone = PhoneNumber( |
---|
[7708] | 384 | title = _(u'Phone'), |
---|
[7331] | 385 | description = u'', |
---|
[5753] | 386 | required = False, |
---|
| 387 | ) |
---|
[7262] | 388 | course1 = schema.Choice( |
---|
[7708] | 389 | title = _(u'1st Choice Course of Study'), |
---|
[8518] | 390 | source = AppCatCertificateSource(), |
---|
[7262] | 391 | required = True, |
---|
| 392 | ) |
---|
| 393 | course2 = schema.Choice( |
---|
[7708] | 394 | title = _(u'2nd Choice Course of Study'), |
---|
[8518] | 395 | source = AppCatCertificateSource(), |
---|
[7262] | 396 | required = False, |
---|
| 397 | ) |
---|
[8044] | 398 | #school_grades = schema.List( |
---|
| 399 | # title = _(u'School Grades'), |
---|
| 400 | # value_type = ResultEntryField(), |
---|
| 401 | # required = False, |
---|
| 402 | # default = [], |
---|
| 403 | # ) |
---|
[6322] | 404 | |
---|
[8052] | 405 | notice = schema.Text( |
---|
| 406 | title = _(u'Notice'), |
---|
[5753] | 407 | required = False, |
---|
| 408 | ) |
---|
| 409 | screening_venue = schema.TextLine( |
---|
[7708] | 410 | title = _(u'Screening Venue'), |
---|
[5753] | 411 | required = False, |
---|
| 412 | ) |
---|
[8052] | 413 | screening_score = schema.Int( |
---|
| 414 | title = _(u'Screening Score'), |
---|
| 415 | required = False, |
---|
| 416 | ) |
---|
[8533] | 417 | student_id = schema.TextLine( |
---|
| 418 | title = _(u'Student Id'), |
---|
| 419 | required = False, |
---|
| 420 | readonly = False, |
---|
| 421 | ) |
---|
[6248] | 422 | course_admitted = schema.Choice( |
---|
[7708] | 423 | title = _(u'Admitted Course of Study'), |
---|
[7347] | 424 | source = CertificateSource(), |
---|
[5753] | 425 | required = False, |
---|
| 426 | ) |
---|
[6302] | 427 | locked = schema.Bool( |
---|
[7708] | 428 | title = _(u'Form locked'), |
---|
[6302] | 429 | default = False, |
---|
| 430 | ) |
---|
[5753] | 431 | |
---|
[8052] | 432 | class IApplicant(IApplicantBaseData): |
---|
[5753] | 433 | """An applicant. |
---|
| 434 | |
---|
| 435 | This is basically the applicant base data. Here we repeat the |
---|
[6195] | 436 | fields from base data if we have to set the `required` attribute |
---|
| 437 | to True (which is the default). |
---|
[5753] | 438 | """ |
---|
| 439 | |
---|
[8052] | 440 | def loggerInfo(ob_class, comment): |
---|
| 441 | """Adds an INFO message to the log file |
---|
| 442 | """ |
---|
| 443 | |
---|
[8014] | 444 | def createStudent(): |
---|
| 445 | """Create a student object from applicatnt data |
---|
| 446 | and copy applicant object. |
---|
| 447 | """ |
---|
| 448 | |
---|
[8016] | 449 | class IApplicantEdit(IApplicant): |
---|
[7867] | 450 | """An applicant interface for editing. |
---|
[5753] | 451 | |
---|
[6339] | 452 | Here we can repeat the fields from base data and set the |
---|
| 453 | `required` and `readonly` attributes to True to further restrict |
---|
[7262] | 454 | the data access. Or we can allow only certain certificates to be |
---|
| 455 | selected by choosing the appropriate source. |
---|
| 456 | |
---|
| 457 | We cannot omit fields here. This has to be done in the |
---|
[6339] | 458 | respective form page. |
---|
[6195] | 459 | """ |
---|
[7262] | 460 | |
---|
[8097] | 461 | email = schema.ASCIILine( |
---|
| 462 | title = _(u'Email Address'), |
---|
| 463 | required = True, |
---|
| 464 | constraint=validate_email, |
---|
| 465 | ) |
---|
[7262] | 466 | course1 = schema.Choice( |
---|
[7708] | 467 | title = _(u'1st Choice Course of Study'), |
---|
[7347] | 468 | source = AppCatCertificateSource(), |
---|
[7262] | 469 | required = True, |
---|
| 470 | ) |
---|
| 471 | course2 = schema.Choice( |
---|
[7708] | 472 | title = _(u'2nd Choice Course of Study'), |
---|
[7347] | 473 | source = AppCatCertificateSource(), |
---|
[7262] | 474 | required = False, |
---|
| 475 | ) |
---|
[6255] | 476 | screening_score = schema.Int( |
---|
[7708] | 477 | title = _(u'Screening Score'), |
---|
[6195] | 478 | required = False, |
---|
[5941] | 479 | readonly = True, |
---|
| 480 | ) |
---|
[6195] | 481 | screening_venue = schema.TextLine( |
---|
[7708] | 482 | title = _(u'Screening Venue'), |
---|
[5753] | 483 | required = False, |
---|
| 484 | readonly = True, |
---|
| 485 | ) |
---|
[6301] | 486 | course_admitted = schema.Choice( |
---|
[7708] | 487 | title = _(u'Admitted Course of Study'), |
---|
[7347] | 488 | source = CertificateSource(), |
---|
[5753] | 489 | required = False, |
---|
[6195] | 490 | readonly = True, |
---|
[5753] | 491 | ) |
---|
[6195] | 492 | notice = schema.Text( |
---|
[7708] | 493 | title = _(u'Notice'), |
---|
[5753] | 494 | required = False, |
---|
| 495 | readonly = True, |
---|
| 496 | ) |
---|
[5758] | 497 | |
---|
[8097] | 498 | IApplicantEdit['email'].order = IApplicantEdit[ |
---|
| 499 | 'sex'].order |
---|
| 500 | |
---|
[7268] | 501 | class IApplicantUpdateByRegNo(IApplicant): |
---|
| 502 | """Representation of an applicant. |
---|
| 503 | |
---|
[7270] | 504 | Skip regular reg_number validation if reg_number is used for finding |
---|
[7268] | 505 | the applicant object. |
---|
| 506 | """ |
---|
[7270] | 507 | reg_number = schema.TextLine( |
---|
[7268] | 508 | title = u'Registration Number', |
---|
| 509 | required = False, |
---|
| 510 | ) |
---|
| 511 | |
---|
[8037] | 512 | class IApplicantRegisterUpdate(IApplicant): |
---|
| 513 | """Representation of an applicant for first-time registration. |
---|
| 514 | |
---|
| 515 | This interface is used when apllicants use the registration page to |
---|
| 516 | update their records. |
---|
| 517 | """ |
---|
| 518 | reg_number = schema.TextLine( |
---|
| 519 | title = u'Registration Number', |
---|
| 520 | required = True, |
---|
| 521 | ) |
---|
| 522 | |
---|
| 523 | firstname = schema.TextLine( |
---|
| 524 | title = _(u'First Name'), |
---|
| 525 | required = True, |
---|
| 526 | ) |
---|
| 527 | |
---|
| 528 | email = schema.ASCIILine( |
---|
| 529 | title = _(u'Email Address'), |
---|
| 530 | required = True, |
---|
| 531 | constraint=validate_email, |
---|
| 532 | ) |
---|
| 533 | |
---|
[7250] | 534 | class IApplicantOnlinePayment(IOnlinePayment): |
---|
| 535 | """An applicant payment via payment gateways. |
---|
| 536 | |
---|
| 537 | """ |
---|
[8422] | 538 | |
---|
| 539 | def doAfterApplicantPayment(): |
---|
| 540 | """Process applicant after payment was made. |
---|
| 541 | |
---|
| 542 | """ |
---|
| 543 | |
---|
[8453] | 544 | def doAfterApplicantPaymentApproval(): |
---|
| 545 | """Process applicant after payment was approved. |
---|
| 546 | |
---|
| 547 | """ |
---|
| 548 | |
---|
[8422] | 549 | def approveApplicantPayment(): |
---|
| 550 | """Approve payment and process applicant. |
---|
| 551 | |
---|
| 552 | """ |
---|