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