source: main/waeup.aaue/trunk/src/waeup/aaue/applicants/interfaces.py @ 10309

Last change on this file since 10309 was 10309, checked in by Henrik Bettermann, 12 years ago

Remove screening fields.

  • Property svn:keywords set to Id
File size: 9.0 KB
RevLine 
[7853]1## $Id: interfaces.py 10309 2013-06-16 20:51:44Z 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
[8012]21from zope import schema
[10298]22from zope.interface import Attribute, invariant, Invalid
[8051]23from waeup.kofa.applicants.interfaces import (
[8053]24    IApplicantBaseData,
[8051]25    AppCatCertificateSource, CertificateSource)
26from waeup.kofa.schoolgrades import ResultEntryField
[8532]27from waeup.kofa.interfaces import (
28    SimpleKofaVocabulary, academic_sessions_vocab, validate_email)
29from waeup.kofa.schema import FormattedDate, TextLineChoice
30from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
[10298]31from waeup.kofa.applicants.interfaces import (
32    contextual_reg_num_source,
33    IApplicantBaseData)
[8931]34from kofacustom.nigeria.applicants.interfaces import (
35    LGASource, high_qual, high_grade, exam_types,
36    INigeriaUGApplicant, INigeriaPGApplicant,
37    INigeriaApplicantOnlinePayment,
[8980]38    INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,
39    INigeriaApplicantUpdateByRegNo,
40    IPUTMEApplicantEdit,
[8931]41    )
[8444]42from waeup.aaue.interfaces import MessageFactory as _
43from waeup.aaue.payments.interfaces import ICustomOnlinePayment
[7853]44
[10298]45class ICustomUGApplicant(IApplicantBaseData):
[8012]46    """An undergraduate applicant.
47
[8521]48    This interface defines the least common multiple of all fields
49    in ug application forms. In customized forms, fields can be excluded by
50    adding them to the UG_OMIT* tuples.
[8012]51    """
52
[10298]53    nationality = schema.Choice(
54        source = nats_vocab,
55        title = _(u'Nationality'),
56        required = True,
57        )
58    lga = schema.Choice(
59        source = LGASource(),
60        title = _(u'State/LGA (Nigerians only)'),
61        required = False,
62        )
63    perm_address = schema.Text(
64        title = _(u'Permanent Address'),
65        required = False,
66        )
[10308]67    home_town = schema.TextLine(
[10306]68        title = _(u'Home Town'),
69        required = False,
70        )
[10298]71    course1 = schema.Choice(
72        title = _(u'1st Choice Course of Study'),
73        source = AppCatCertificateSource(),
74        required = True,
75        )
76    course2 = schema.Choice(
77        title = _(u'2nd Choice Course of Study'),
78        source = AppCatCertificateSource(),
79        required = False,
80        )
81    fst_sit_fname = schema.TextLine(
82        title = _(u'Full Name'),
83        required = False,
84        readonly = False,
85        )
86    fst_sit_no = schema.TextLine(
87        title = _(u'Exam Number'),
88        required = False,
89        readonly = False,
90        )
91    fst_sit_date = FormattedDate(
92        title = _(u'Exam Date'),
93        required = False,
94        readonly = False,
95        show_year = True,
96        )
97    fst_sit_type = schema.Choice(
98        title = _(u'Exam Type'),
99        required = False,
100        readonly = False,
101        vocabulary = exam_types,
102        )
103    fst_sit_results = schema.List(
104        title = _(u'Exam Results'),
105        value_type = ResultEntryField(),
106        required = False,
107        readonly = False,
108        default = [],
109        )
110    scd_sit_fname = schema.TextLine(
111        title = _(u'Full Name'),
112        required = False,
113        readonly = False,
114        )
115    scd_sit_no = schema.TextLine(
116        title = _(u'Exam Number'),
117        required = False,
118        readonly = False,
119        )
120    scd_sit_date = FormattedDate(
121        title = _(u'Exam Date'),
122        required = False,
123        readonly = False,
124        show_year = True,
125        )
126    scd_sit_type = schema.Choice(
127        title = _(u'Exam Type'),
128        required = False,
129        readonly = False,
130        vocabulary = exam_types,
131        )
132    scd_sit_results = schema.List(
133        title = _(u'Exam Results'),
134        value_type = ResultEntryField(),
135        required = False,
136        readonly = False,
137        default = [],
138        )
139    alr_fname = schema.TextLine(
140        title = _(u'Full Name'),
141        required = False,
142        readonly = False,
143        )
144    alr_no = schema.TextLine(
145        title = _(u'Exam Number'),
146        required = False,
147        readonly = False,
148        )
149    alr_date = FormattedDate(
150        title = _(u'Exam Date'),
151        required = False,
152        readonly = False,
153        show_year = True,
154        )
155    alr_results = schema.List(
156        title = _(u'Exam Results'),
157        value_type = ResultEntryField(),
158        required = False,
159        readonly = False,
160        default = [],
161        )
162    jamb_score = schema.Int(
163        title = _(u'Total JAMB Score'),
164        required = False,
165        )
166    notice = schema.Text(
167        title = _(u'Notice'),
168        required = False,
169        )
[10309]170    #screening_venue = schema.TextLine(
171    #    title = _(u'Screening Venue'),
172    #    required = False,
173    #    )
174    #screening_date = schema.TextLine(
175    #    title = _(u'Screening Date'),
176    #    required = False,
177    #    )
178    #screening_score = schema.Int(
179    #    title = _(u'Screening Score (%)'),
180    #    required = False,
181    #    )
182    #aggregate = schema.Int(
183    #    title = _(u'Aggregate Score (%)'),
184    #    description = _(u'(average of relative JAMB and PUTME scores)'),
185    #    required = False,
186    #    )
[10298]187    result_uploaded = schema.Bool(
188        title = _(u'Result uploaded'),
189        default = False,
190        )
191    student_id = schema.TextLine(
192        title = _(u'Student Id'),
193        required = False,
194        readonly = False,
195        )
196    course_admitted = schema.Choice(
197        title = _(u'Admitted Course of Study'),
198        source = CertificateSource(),
199        required = False,
200        )
201    locked = schema.Bool(
202        title = _(u'Form locked'),
203        default = False,
204        )
205
206    @invariant
207    def second_choice(applicant):
208        if applicant.course1 == applicant.course2:
209            raise Invalid(_("2nd choice course must differ from 1st choice course."))
210
[8931]211class ICustomPGApplicant(INigeriaPGApplicant):
[7853]212    """A postgraduate applicant.
213
[8521]214    This interface defines the least common multiple of all fields
215    in pg application forms. In customized forms, fields can be excluded by
216    adding them to the PG_OMIT* tuples.
[7866]217    """
218
[8931]219class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
[8012]220    """An interface for both types of applicants.
221
[8931]222    Attention: The ICustomPGApplicant field seetings will be overwritten
223    by ICustomPGApplicant field settings. If a field is defined
[8728]224    in both interfaces zope.schema validates only against the
[8931]225    constraints in ICustomUGApplicant. This does not affect the forms
226    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
[8012]227    """
228
[8746]229    def writeLogMessage(view, comment):
[8053]230        """Adds an INFO message to the log file
231        """
232
233    def createStudent():
234        """Create a student object from applicatnt data
235        and copy applicant object.
236        """
237
[10298]238class ICustomUGApplicantEdit(ICustomUGApplicant):
[8728]239    """An undergraduate applicant interface for edit forms.
[8012]240
241    Here we can repeat the fields from base data and set the
242    `required` and `readonly` attributes to True to further restrict
243    the data access. Or we can allow only certain certificates to be
244    selected by choosing the appropriate source.
245
246    We cannot omit fields here. This has to be done in the
247    respective form page.
248    """
249
[8980]250class ICustomPGApplicantEdit(INigeriaPGApplicantEdit):
[7866]251    """A postgraduate applicant interface for editing.
252
253    Here we can repeat the fields from base data and set the
254    `required` and `readonly` attributes to True to further restrict
255    the data access. Or we can allow only certain certificates to be
256    selected by choosing the appropriate source.
257
258    We cannot omit fields here. This has to be done in the
259    respective form page.
[8017]260    """
[8455]261
[8931]262class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
[8247]263    """An applicant payment via payment gateways.
264
265    """
[8532]266
[8980]267class IPUTMEApplicantEdit(IPUTMEApplicantEdit):
[8532]268    """An undergraduate applicant interface for editing.
269
270    Here we can repeat the fields from base data and set the
271    `required` and `readonly` attributes to True to further restrict
272    the data access. Or we can allow only certain certificates to be
273    selected by choosing the appropriate source.
274
275    We cannot omit fields here. This has to be done in the
276    respective form page.
277    """
278
[8980]279class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
[8583]280    """Representation of an applicant.
281
282    Skip regular reg_number validation if reg_number is used for finding
283    the applicant object.
284    """
[8980]285
Note: See TracBrowser for help on using the repository browser.