1 | ## $Id: interfaces.py 17711 2024-03-07 12:57:10Z henrik $ |
---|
2 | ## |
---|
3 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann |
---|
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. |
---|
8 | ## |
---|
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. |
---|
13 | ## |
---|
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 | ## |
---|
18 | """Customized interfaces of the university application package. |
---|
19 | """ |
---|
20 | |
---|
21 | from zope import schema |
---|
22 | from waeup.kofa.applicants.interfaces import ( |
---|
23 | IApplicantBaseData, |
---|
24 | AppCatCertificateSource, CertificateSource) |
---|
25 | from waeup.kofa.schoolgrades import ResultEntryField |
---|
26 | from waeup.kofa.interfaces import ( |
---|
27 | SimpleKofaVocabulary, academic_sessions_vocab, validate_email) |
---|
28 | from waeup.kofa.schema import FormattedDate, TextLineChoice |
---|
29 | from waeup.kofa.students.vocabularies import nats_vocab, GenderSource |
---|
30 | from waeup.kofa.applicants.interfaces import ( |
---|
31 | contextual_reg_num_source, IApplicantBaseData, IApplicantOnlinePayment, |
---|
32 | IApplicantUpdateByRegNo) |
---|
33 | from kofacustom.nigeria.applicants.interfaces import ( |
---|
34 | LGASource, high_qual, high_grade, exam_types, |
---|
35 | INigeriaApplicantOnlinePayment) |
---|
36 | from kofacustom.udss.interfaces import MessageFactory as _ |
---|
37 | from kofacustom.udss.payments.interfaces import ICustomOnlinePayment |
---|
38 | |
---|
39 | class ICustomUGApplicant(IApplicantBaseData): |
---|
40 | """An undergraduate applicant. |
---|
41 | |
---|
42 | This interface defines the least common multiple of all fields |
---|
43 | in ug application forms. In customized forms, fields can be excluded by |
---|
44 | adding them to the UG_OMIT* tuples. |
---|
45 | """ |
---|
46 | |
---|
47 | |
---|
48 | class ICustomApplicant(ICustomUGApplicant): |
---|
49 | """An interface for both types of applicants. |
---|
50 | |
---|
51 | Attention: The ICustomPGApplicant field seetings will be overwritten |
---|
52 | by ICustomPGApplicant field settings. If a field is defined |
---|
53 | in both interfaces zope.schema validates only against the |
---|
54 | constraints in ICustomUGApplicant. This does not affect the forms |
---|
55 | since they are build on either ICustomUGApplicant or ICustomPGApplicant. |
---|
56 | """ |
---|
57 | |
---|
58 | def writeLogMessage(view, comment): |
---|
59 | """Adds an INFO message to the log file |
---|
60 | """ |
---|
61 | |
---|
62 | def createStudent(): |
---|
63 | """Create a student object from applicant data |
---|
64 | and copy applicant object. |
---|
65 | """ |
---|
66 | |
---|
67 | class ICustomUGApplicantEdit(ICustomUGApplicant): |
---|
68 | """An undergraduate applicant interface for edit forms. |
---|
69 | |
---|
70 | Here we can repeat the fields from base data and set the |
---|
71 | `required` and `readonly` attributes to True to further restrict |
---|
72 | the data access. Or we can allow only certain certificates to be |
---|
73 | selected by choosing the appropriate source. |
---|
74 | |
---|
75 | We cannot omit fields here. This has to be done in the |
---|
76 | respective form page. |
---|
77 | """ |
---|
78 | |
---|
79 | email = schema.ASCIILine( |
---|
80 | title = _(u'Email Address'), |
---|
81 | required = True, |
---|
82 | constraint=validate_email, |
---|
83 | ) |
---|
84 | date_of_birth = FormattedDate( |
---|
85 | title = _(u'Date of Birth'), |
---|
86 | required = True, |
---|
87 | show_year = True, |
---|
88 | ) |
---|
89 | |
---|
90 | class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment): |
---|
91 | """An applicant payment via payment gateways. |
---|
92 | |
---|
93 | """ |
---|
94 | |
---|
95 | class ICustomApplicantUpdateByRegNo(IApplicantUpdateByRegNo): |
---|
96 | """Representation of an applicant. |
---|
97 | |
---|
98 | Skip regular reg_number validation if reg_number is used for finding |
---|
99 | the applicant object. |
---|
100 | """ |
---|