source: main/kofacustom.lpng/trunk/src/kofacustom/lpng/applicants/interfaces.py @ 16997

Last change on this file since 16997 was 16997, checked in by Henrik Bettermann, 3 years ago

Configure registration form.

  • Property svn:keywords set to Id
File size: 6.3 KB
Line 
1## $Id: interfaces.py 16997 2022-07-06 11:38:52Z 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
21from zope import schema
22from zope.interface import Interface, Attribute, implements, directlyProvides
23from waeup.kofa.applicants.interfaces import (
24    IApplicantBaseData,
25    AppCatCertificateSource, CertificateSource)
26from waeup.kofa.schoolgrades import ResultEntryField
27from waeup.kofa.interfaces import (
28    SimpleKofaVocabulary, academic_sessions_vocab, validate_email,
29    IKofaObject)
30from waeup.kofa.schema import FormattedDate, TextLineChoice, PhoneNumber
31from waeup.kofa.students.vocabularies import (
32  nats_vocab, GenderSource,RegNumberSource)
33from waeup.kofa.applicants.interfaces import contextual_reg_num_source
34from kofacustom.lpng.interfaces import MessageFactory as _
35from kofacustom.lpng.payments.interfaces import ICustomOnlinePayment
36from kofacustom.nigeria.interfaces import LGASource
37from kofacustom.nigeria.applicants.interfaces import (
38    INigeriaApplicantOnlinePayment,)
39
40class IApplicantBaseData(IKofaObject):
41    """This is a base interface of an applicant with no field
42    required. For use with processors, forms, etc., please use one of
43    the derived interfaces below, which set more fields to required
44    state, depending on use-case.
45    """
46    state = Attribute('Application state of an applicant')
47    history = Attribute('Object history, a list of messages')
48    display_fullname = Attribute('The fullname of an applicant')
49    application_number = Attribute('The key under which the record is stored')
50    container_code = Attribute('Code of the parent container plus additional information if record is used or not')
51    translated_state = Attribute('Real name of the application state')
52    special = Attribute('True if special application')
53    payments = Attribute('List of payment objects stored in the applicant container')
54
55    application_date = Attribute('UTC datetime of submission, used for export only')
56    password = Attribute('Encrypted password of an applicant')
57
58
59    suspended = schema.Bool(
60        title = _(u'Account suspended'),
61        default = False,
62        required = False,
63        )
64
65    applicant_id = schema.TextLine(
66        title = _(u'Applicant Id'),
67        required = False,
68        readonly = False,
69        )
70
71    reg_number = TextLineChoice(
72        title = _(u'Registration Number'),
73        readonly = False,
74        required = False,
75        source = contextual_reg_num_source,
76        )
77
78    firstname = schema.TextLine(
79        title = _(u'First Name'),
80        required = True,
81        )
82
83    middlename = schema.TextLine(
84        title = _(u'Middle Name'),
85        required = False,
86        )
87
88    lastname = schema.TextLine(
89        title = _(u'Last Name (Surname)'),
90        required = True,
91        )
92
93    date_of_birth = FormattedDate(
94        title = _(u'Date of Birth'),
95        required = True,
96        show_year = True,
97        )
98
99    sex = schema.Choice(
100        title = _(u'Gender'),
101        source = GenderSource(),
102        required = True,
103        )
104
105    profession = schema.ASCIILine(
106        title = _(u'Profession'),
107        required = False,
108        )
109       
110    occupation = schema.ASCIILine(
111        title = _(u'Occupation'),
112        required = False,
113        )
114
115    nationality = schema.Choice(
116        source = nats_vocab,
117        title = _(u'Nationality'),
118        required = False,
119        )
120       
121    state_of_residence = schema.Choice(
122        source = nats_vocab,
123        title = _(u'State of Residence'),
124        required = False,
125        )
126
127    perm_address = schema.Text(
128        title = _(u'Residential Address'),
129        required = False,
130        )
131               
132    lga = schema.Choice(
133        source = LGASource(),
134        title = _(u'Local Government (Nigerians only)'),
135        required = False,
136        )
137       
138    ward = schema.ASCIILine(
139        title = _(u'Ward'),
140        required = False,
141        )
142
143    phone = PhoneNumber(
144        title = _(u'Phone'),
145        description = u'',
146        required = False,
147        )
148
149    email = schema.ASCIILine(
150        title = _(u'Email Address'),
151        required = True,
152        constraint=validate_email,
153        )
154
155    notice = schema.Text(
156        title = _(u'Notice'),
157        required = False,
158        )
159
160    student_id = schema.TextLine(
161        title = _(u'Student Id'),
162        required = False,
163        readonly = False,
164        )
165
166    locked = schema.Bool(
167        title = _(u'Form locked'),
168        default = False,
169        required = False,
170        )
171
172
173class ICustomApplicant(IApplicantBaseData):
174    """An interface for both types of applicants.
175
176    Attention: The ICustomPGApplicant field seetings will be overwritten
177    by ICustomPGApplicant field settings. If a field is defined
178    in both interfaces zope.schema validates only against the
179    constraints in ICustomUGApplicant. This does not affect the forms
180    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
181    """
182
183    def writeLogMessage(view, comment):
184        """Adds an INFO message to the log file
185        """
186
187    def createStudent():
188        """Create a student object from applicant data
189        and copy applicant object.
190        """
191
192class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
193    """An applicant payment via payment gateways.
194
195    """
196
197class ICustomApplicantUpdateByRegNo(ICustomApplicant):
198    """Representation of an applicant.
199
200    Skip regular reg_number validation if reg_number is used for finding
201    the applicant object.
202    """
203
204    reg_number = schema.TextLine(
205        title = u'Registration Number',
206        required = False,
207        )
Note: See TracBrowser for help on using the repository browser.