1 | ## $Id: interfaces.py 8072 2012-04-09 07:53:53Z 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 IApplicantBaseData |
---|
23 | from waeup.kofa.students.vocabularies import nats_vocab |
---|
24 | from waeup.custom.interfaces import lgas_vocab |
---|
25 | from waeup.custom.interfaces import MessageFactory as _ |
---|
26 | |
---|
27 | class IUGApplicant(IApplicantBaseData): |
---|
28 | """An undergraduate applicant. |
---|
29 | |
---|
30 | """ |
---|
31 | |
---|
32 | nationality = schema.Choice( |
---|
33 | source = nats_vocab, |
---|
34 | title = _(u'Nationality'), |
---|
35 | required = False, |
---|
36 | ) |
---|
37 | lga = schema.Choice( |
---|
38 | source = lgas_vocab, |
---|
39 | title = _(u'State/LGA (Nigerians only)'), |
---|
40 | required = False, |
---|
41 | ) |
---|
42 | |
---|
43 | # This ordering doesn't work properly. |
---|
44 | IUGApplicant[ |
---|
45 | 'nationality'].order = IApplicantBaseData['sex'].order |
---|
46 | IUGApplicant[ |
---|
47 | 'lga'].order = IUGApplicant['nationality'].order |
---|
48 | |
---|
49 | class IPGApplicant(IApplicantBaseData): |
---|
50 | """A postgraduate applicant. |
---|
51 | |
---|
52 | """ |
---|
53 | |
---|
54 | nationality = schema.Choice( |
---|
55 | source = nats_vocab, |
---|
56 | title = _(u'Nationality'), |
---|
57 | required = False, |
---|
58 | ) |
---|
59 | lga = schema.Choice( |
---|
60 | source = lgas_vocab, |
---|
61 | title = _(u'State/LGA (Nigerians only)'), |
---|
62 | required = False, |
---|
63 | ) |
---|
64 | employer = schema.TextLine( |
---|
65 | title = _(u'Employer'), |
---|
66 | required = False, |
---|
67 | readonly = False, |
---|
68 | ) |
---|
69 | |
---|
70 | # This ordering doesn't work properly. |
---|
71 | IPGApplicant[ |
---|
72 | 'nationality'].order = IApplicantBaseData['sex'].order |
---|
73 | IPGApplicant[ |
---|
74 | 'lga'].order = IPGApplicant['nationality'].order |
---|
75 | IPGApplicant[ |
---|
76 | 'student_id'].order = IPGApplicant['notice'].order |
---|
77 | |
---|
78 | class IApplicant(IUGApplicant,IPGApplicant): |
---|
79 | """An interface for both types of applicants. |
---|
80 | |
---|
81 | """ |
---|
82 | |
---|
83 | def loggerInfo(ob_class, comment): |
---|
84 | """Adds an INFO message to the log file |
---|
85 | """ |
---|
86 | |
---|
87 | def createStudent(): |
---|
88 | """Create a student object from applicatnt data |
---|
89 | and copy applicant object. |
---|
90 | """ |
---|
91 | |
---|
92 | class IUGApplicantEdit(IUGApplicant): |
---|
93 | """An undergraduate applicant interface for editing. |
---|
94 | |
---|
95 | Here we can repeat the fields from base data and set the |
---|
96 | `required` and `readonly` attributes to True to further restrict |
---|
97 | the data access. Or we can allow only certain certificates to be |
---|
98 | selected by choosing the appropriate source. |
---|
99 | |
---|
100 | We cannot omit fields here. This has to be done in the |
---|
101 | respective form page. |
---|
102 | """ |
---|
103 | |
---|
104 | class IPGApplicantEdit(IPGApplicant): |
---|
105 | """A postgraduate applicant interface for editing. |
---|
106 | |
---|
107 | Here we can repeat the fields from base data and set the |
---|
108 | `required` and `readonly` attributes to True to further restrict |
---|
109 | the data access. Or we can allow only certain certificates to be |
---|
110 | selected by choosing the appropriate source. |
---|
111 | |
---|
112 | We cannot omit fields here. This has to be done in the |
---|
113 | respective form page. |
---|
114 | """ |
---|