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