1 | ## $Id: interfaces.py 13770 2016-03-08 17:21:35Z henrik $ |
---|
2 | ## |
---|
3 | ## Copyright (C) 2012 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 | |
---|
19 | from zope import schema |
---|
20 | from zc.sourcefactory.contextual import BasicContextualSourceFactory |
---|
21 | from zope.catalog.interfaces import ICatalog |
---|
22 | from zope.component import getUtility |
---|
23 | from waeup.kofa.interfaces import IKofaObject |
---|
24 | from waeup.kofa.students.vocabularies import StudyLevelSource |
---|
25 | from waeup.kofa.schema import PhoneNumber, FormattedDate |
---|
26 | from kofacustom.nigeria.interfaces import LGASource |
---|
27 | from kofacustom.nigeria.students.interfaces import ( |
---|
28 | INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance, |
---|
29 | INigeriaStudentPersonal, INigeriaStudentStudyLevel, |
---|
30 | INigeriaStudentStudyCourse, INigeriaCourseTicket, |
---|
31 | INigeriaStudentUpdateByRegNo, INigeriaStudentUpdateByMatricNo, |
---|
32 | ) |
---|
33 | from waeup.aaue.payments.interfaces import ICustomOnlinePayment |
---|
34 | from waeup.aaue.interfaces import MessageFactory as _ |
---|
35 | |
---|
36 | class ICustomStudentBase(INigeriaStudentBase): |
---|
37 | """Representation of student base data. |
---|
38 | |
---|
39 | """ |
---|
40 | |
---|
41 | class ICustomStudentPersonal(INigeriaStudentPersonal): |
---|
42 | """Student personal data. |
---|
43 | |
---|
44 | """ |
---|
45 | |
---|
46 | father_name = schema.TextLine( |
---|
47 | title = _(u'Father\'s Name'), |
---|
48 | required = False, |
---|
49 | readonly = False, |
---|
50 | ) |
---|
51 | |
---|
52 | father_address = schema.Text( |
---|
53 | title = _(u'Father\'s Permanent Address'), |
---|
54 | required = False, |
---|
55 | readonly = False, |
---|
56 | ) |
---|
57 | |
---|
58 | father_work = schema.TextLine( |
---|
59 | title = _(u'Father\'s Place of Work'), |
---|
60 | required = False, |
---|
61 | readonly = False, |
---|
62 | ) |
---|
63 | |
---|
64 | father_phone = PhoneNumber( |
---|
65 | title = _(u'Father\'s Phone'), |
---|
66 | required = False, |
---|
67 | readonly = False, |
---|
68 | ) |
---|
69 | |
---|
70 | mother_name = schema.TextLine( |
---|
71 | title = _(u'Mother\'s Name'), |
---|
72 | required = False, |
---|
73 | readonly = False, |
---|
74 | ) |
---|
75 | |
---|
76 | mother_address = schema.Text( |
---|
77 | title = _(u'Mother\'s Permanent Address'), |
---|
78 | required = False, |
---|
79 | readonly = False, |
---|
80 | ) |
---|
81 | |
---|
82 | mother_work = schema.TextLine( |
---|
83 | title = _(u'Mother\'s Place of Work'), |
---|
84 | required = False, |
---|
85 | readonly = False, |
---|
86 | ) |
---|
87 | |
---|
88 | mother_phone = PhoneNumber( |
---|
89 | title = _(u'Mother\'s Phone'), |
---|
90 | required = False, |
---|
91 | readonly = False, |
---|
92 | ) |
---|
93 | |
---|
94 | phone_personal = PhoneNumber( |
---|
95 | title = _(u'Student\'s Personal Phone'), |
---|
96 | description = u'', |
---|
97 | required = False, |
---|
98 | readonly = False, |
---|
99 | ) |
---|
100 | |
---|
101 | class ICustomStudentPersonalEdit(ICustomStudentPersonal): |
---|
102 | """Interface for editing personal data by students. |
---|
103 | |
---|
104 | Here we can repeat the fields from IStudentPersonal and set the |
---|
105 | `required` if necessary. |
---|
106 | """ |
---|
107 | |
---|
108 | perm_address = schema.Text( |
---|
109 | title = _(u'Permanent Address'), |
---|
110 | required = True, |
---|
111 | ) |
---|
112 | |
---|
113 | next_kin_name = schema.TextLine( |
---|
114 | title = _(u'Next of Kin Name'), |
---|
115 | required = True, |
---|
116 | readonly = False, |
---|
117 | ) |
---|
118 | |
---|
119 | next_kin_relation = schema.TextLine( |
---|
120 | title = _(u'Next of Kin Relationship'), |
---|
121 | required = True, |
---|
122 | readonly = False, |
---|
123 | ) |
---|
124 | |
---|
125 | next_kin_address = schema.Text( |
---|
126 | title = _(u'Next of Kin Address'), |
---|
127 | required = True, |
---|
128 | readonly = False, |
---|
129 | ) |
---|
130 | |
---|
131 | next_kin_phone = PhoneNumber( |
---|
132 | title = _(u'Next of Kin Phone'), |
---|
133 | description = u'', |
---|
134 | required = True, |
---|
135 | readonly = False, |
---|
136 | ) |
---|
137 | |
---|
138 | father_name = schema.TextLine( |
---|
139 | title = _(u'Father\'s Name'), |
---|
140 | required = True, |
---|
141 | readonly = False, |
---|
142 | ) |
---|
143 | |
---|
144 | father_address = schema.Text( |
---|
145 | title = _(u'Father\'s Permanent Address'), |
---|
146 | required = True, |
---|
147 | readonly = False, |
---|
148 | ) |
---|
149 | |
---|
150 | father_work = schema.TextLine( |
---|
151 | title = _(u'Father\'s Place of Work'), |
---|
152 | required = True, |
---|
153 | readonly = False, |
---|
154 | ) |
---|
155 | |
---|
156 | father_phone = PhoneNumber( |
---|
157 | title = _(u'Father\'s Phone'), |
---|
158 | required = True, |
---|
159 | readonly = False, |
---|
160 | ) |
---|
161 | |
---|
162 | mother_name = schema.TextLine( |
---|
163 | title = _(u'Mother\'s Name'), |
---|
164 | required = True, |
---|
165 | readonly = False, |
---|
166 | ) |
---|
167 | |
---|
168 | mother_address = schema.Text( |
---|
169 | title = _(u'Mother\'s Permanent Address'), |
---|
170 | required = True, |
---|
171 | readonly = False, |
---|
172 | ) |
---|
173 | |
---|
174 | mother_work = schema.TextLine( |
---|
175 | title = _(u'Mother\'s Place of Work'), |
---|
176 | required = True, |
---|
177 | readonly = False, |
---|
178 | ) |
---|
179 | |
---|
180 | mother_phone = PhoneNumber( |
---|
181 | title = _(u'Mother\'s Phone'), |
---|
182 | required = True, |
---|
183 | readonly = False, |
---|
184 | ) |
---|
185 | |
---|
186 | phone_personal = PhoneNumber( |
---|
187 | title = _(u'Student\'s Personal Phone'), |
---|
188 | description = u'', |
---|
189 | required = True, |
---|
190 | readonly = False, |
---|
191 | ) |
---|
192 | |
---|
193 | class ICustomUGStudentClearance(INigeriaUGStudentClearance): |
---|
194 | """Representation of ug student clearance data. |
---|
195 | |
---|
196 | """ |
---|
197 | |
---|
198 | #date_of_birth = FormattedDate( |
---|
199 | # title = _(u'Date of Birth'), |
---|
200 | # required = True, |
---|
201 | # show_year = True, |
---|
202 | # ) |
---|
203 | |
---|
204 | lga = schema.Choice( |
---|
205 | source = LGASource(), |
---|
206 | title = _(u'State / LGA'), |
---|
207 | required = True, |
---|
208 | ) |
---|
209 | |
---|
210 | ICustomUGStudentClearance['lga'].order = INigeriaUGStudentClearance[ |
---|
211 | 'lga'].order |
---|
212 | #ICustomUGStudentClearance['date_of_birth'].order = INigeriaUGStudentClearance[ |
---|
213 | # 'date_of_birth'].order |
---|
214 | |
---|
215 | |
---|
216 | class ICustomPGStudentClearance(INigeriaPGStudentClearance): |
---|
217 | """Representation of pg student clearance data. |
---|
218 | |
---|
219 | """ |
---|
220 | |
---|
221 | |
---|
222 | class ICustomStudent(ICustomStudentBase,ICustomUGStudentClearance, |
---|
223 | ICustomPGStudentClearance,ICustomStudentPersonal): |
---|
224 | """Representation of a student. |
---|
225 | |
---|
226 | """ |
---|
227 | |
---|
228 | class ICustomStudentStudyCourse(INigeriaStudentStudyCourse): |
---|
229 | """A container for student study levels. |
---|
230 | |
---|
231 | """ |
---|
232 | |
---|
233 | class ICustomStudentStudyLevel(INigeriaStudentStudyLevel): |
---|
234 | """A container for course tickets. |
---|
235 | |
---|
236 | """ |
---|
237 | |
---|
238 | total_credits_s1 = schema.Int( |
---|
239 | title = _(u'1st Semester Units'), |
---|
240 | required = False, |
---|
241 | readonly = True, |
---|
242 | ) |
---|
243 | |
---|
244 | total_credits_s2 = schema.Int( |
---|
245 | title = _(u'2nd Semester Units'), |
---|
246 | required = False, |
---|
247 | readonly = True, |
---|
248 | ) |
---|
249 | |
---|
250 | total_credits = schema.Int( |
---|
251 | title = _(u'Total Units'), |
---|
252 | required = False, |
---|
253 | readonly = True, |
---|
254 | ) |
---|
255 | |
---|
256 | class ICustomStudentOnlinePayment(ICustomOnlinePayment): |
---|
257 | """A student payment via payment gateways. |
---|
258 | |
---|
259 | This Interface does not inherit from IStudentOnlinePayment. |
---|
260 | Thus all fields from IStudentOnlinePayment have to be repeated here. |
---|
261 | """ |
---|
262 | |
---|
263 | p_current = schema.Bool( |
---|
264 | title = _(u'Current Session Payment'), |
---|
265 | default = True, |
---|
266 | required = False, |
---|
267 | ) |
---|
268 | |
---|
269 | p_level = schema.Choice( |
---|
270 | title = _(u'Payment Level'), |
---|
271 | source = StudyLevelSource(), |
---|
272 | required = False, |
---|
273 | ) |
---|
274 | |
---|
275 | ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[ |
---|
276 | 'p_session'].order |
---|
277 | |
---|
278 | class ICustomCourseTicket(INigeriaCourseTicket): |
---|
279 | """A course ticket. |
---|
280 | |
---|
281 | """ |
---|
282 | |
---|
283 | ca = schema.Int( |
---|
284 | title = _(u'Continuous Assessment'), |
---|
285 | default = None, |
---|
286 | required = False, |
---|
287 | missing_value = None, |
---|
288 | ) |
---|
289 | |
---|
290 | ICustomCourseTicket['ca'].order = ICustomCourseTicket['mandatory'].order |
---|
291 | |
---|
292 | class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo): |
---|
293 | """Representation of a student. Skip regular reg_number validation. |
---|
294 | |
---|
295 | """ |
---|
296 | |
---|
297 | class ICustomStudentUpdateByMatricNo(INigeriaStudentUpdateByMatricNo): |
---|
298 | """Representation of a student. Skip regular matric_number validation. |
---|
299 | |
---|
300 | """ |
---|