1 | ## $Id: interfaces.py 9463 2012-10-30 07:17:59Z 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 contextual_reg_num_source |
---|
31 | from kofacustom.nigeria.applicants.interfaces import ( |
---|
32 | LGASource, high_qual, high_grade, exam_types, |
---|
33 | INigeriaUGApplicant, INigeriaPGApplicant, |
---|
34 | INigeriaApplicantOnlinePayment, |
---|
35 | INigeriaUGApplicantEdit, INigeriaPGApplicantEdit, |
---|
36 | INigeriaApplicantUpdateByRegNo, |
---|
37 | IPUTMEApplicantEdit, |
---|
38 | OMIT_DISPLAY_FIELDS |
---|
39 | ) |
---|
40 | from waeup.fceokene.interfaces import MessageFactory as _ |
---|
41 | |
---|
42 | BEC_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS |
---|
43 | BEC_OMIT_PDF_FIELDS = BEC_OMIT_DISPLAY_FIELDS + ('phone',) |
---|
44 | BEC_OMIT_MANAGE_FIELDS = () |
---|
45 | BEC_OMIT_EDIT_FIELDS = BEC_OMIT_MANAGE_FIELDS + OMIT_DISPLAY_FIELDS + ( |
---|
46 | 'student_id', 'notice', |
---|
47 | 'screening_score', |
---|
48 | 'screening_venue', |
---|
49 | 'screening_date', |
---|
50 | #'jamb_subjects', |
---|
51 | #'jamb_score', |
---|
52 | 'aggregate') |
---|
53 | |
---|
54 | class ICustomUGApplicant(INigeriaUGApplicant): |
---|
55 | """An undergraduate applicant. |
---|
56 | |
---|
57 | This interface defines the least common multiple of all fields |
---|
58 | in ug application forms. In customized forms, fields can be excluded by |
---|
59 | adding them to the OMIT* tuples. |
---|
60 | """ |
---|
61 | |
---|
62 | olevel_type = schema.Choice( |
---|
63 | title = _(u'Qualification Obtained'), |
---|
64 | required = False, |
---|
65 | readonly = False, |
---|
66 | vocabulary = high_qual, |
---|
67 | ) |
---|
68 | olevel_matric_no = schema.TextLine( |
---|
69 | title = _(u'Former Matric Number'), |
---|
70 | required = False, |
---|
71 | readonly = False, |
---|
72 | ) |
---|
73 | olevel_degree = schema.Choice( |
---|
74 | title = _(u'Class of Degree'), |
---|
75 | required = False, |
---|
76 | readonly = False, |
---|
77 | vocabulary = high_grade, |
---|
78 | ) |
---|
79 | olevel_school = schema.TextLine( |
---|
80 | title = _(u'Institution Attended'), |
---|
81 | required = False, |
---|
82 | readonly = False, |
---|
83 | ) |
---|
84 | olevel_session = schema.TextLine( |
---|
85 | title = _(u'Years Attended'), |
---|
86 | required = False, |
---|
87 | readonly = False, |
---|
88 | ) |
---|
89 | olevel_disc = schema.TextLine( |
---|
90 | title = _(u'Discipline'), |
---|
91 | required = False, |
---|
92 | readonly = False, |
---|
93 | ) |
---|
94 | |
---|
95 | |
---|
96 | class ICustomPGApplicant(INigeriaPGApplicant): |
---|
97 | """A postgraduate applicant. |
---|
98 | |
---|
99 | This interface defines the least common multiple of all fields |
---|
100 | in pg application forms. In customized forms, fields can be excluded by |
---|
101 | adding them to the PG_OMIT* tuples. |
---|
102 | """ |
---|
103 | |
---|
104 | class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant): |
---|
105 | """An interface for both types of applicants. |
---|
106 | |
---|
107 | Attention: The ICustomPGApplicant field seetings will be overwritten |
---|
108 | by ICustomPGApplicant field settings. If a field is defined |
---|
109 | in both interfaces zope.schema validates only against the |
---|
110 | constraints in ICustomUGApplicant. This does not affect the forms |
---|
111 | since they are build on either ICustomUGApplicant or ICustomPGApplicant. |
---|
112 | """ |
---|
113 | |
---|
114 | def writeLogMessage(view, comment): |
---|
115 | """Adds an INFO message to the log file |
---|
116 | """ |
---|
117 | |
---|
118 | def createStudent(): |
---|
119 | """Create a student object from applicatnt data |
---|
120 | and copy applicant object. |
---|
121 | """ |
---|
122 | |
---|
123 | class ICustomUGApplicantEdit(INigeriaUGApplicantEdit): |
---|
124 | """An undergraduate applicant interface for edit forms. |
---|
125 | |
---|
126 | Here we can repeat the fields from base data and set the |
---|
127 | `required` and `readonly` attributes to True to further restrict |
---|
128 | the data access. Or we can allow only certain certificates to be |
---|
129 | selected by choosing the appropriate source. |
---|
130 | |
---|
131 | We cannot omit fields here. This has to be done in the |
---|
132 | respective form page. |
---|
133 | """ |
---|
134 | |
---|
135 | class ICustomPGApplicantEdit(INigeriaPGApplicantEdit): |
---|
136 | """A postgraduate applicant interface for editing. |
---|
137 | |
---|
138 | Here we can repeat the fields from base data and set the |
---|
139 | `required` and `readonly` attributes to True to further restrict |
---|
140 | the data access. Or we can allow only certain certificates to be |
---|
141 | selected by choosing the appropriate source. |
---|
142 | |
---|
143 | We cannot omit fields here. This has to be done in the |
---|
144 | respective form page. |
---|
145 | """ |
---|
146 | |
---|
147 | class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment): |
---|
148 | """An applicant payment via payment gateways. |
---|
149 | |
---|
150 | """ |
---|
151 | |
---|
152 | class IPUTMEApplicantEdit(IPUTMEApplicantEdit): |
---|
153 | """An undergraduate applicant interface for editing. |
---|
154 | |
---|
155 | Here we can repeat the fields from base data and set the |
---|
156 | `required` and `readonly` attributes to True to further restrict |
---|
157 | the data access. Or we can allow only certain certificates to be |
---|
158 | selected by choosing the appropriate source. |
---|
159 | |
---|
160 | We cannot omit fields here. This has to be done in the |
---|
161 | respective form page. |
---|
162 | """ |
---|
163 | |
---|
164 | class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo): |
---|
165 | """Representation of an applicant. |
---|
166 | |
---|
167 | Skip regular reg_number validation if reg_number is used for finding |
---|
168 | the applicant object. |
---|
169 | """ |
---|
170 | |
---|