source: main/waeup.imostate/trunk/src/waeup/imostate/applicants/interfaces.py @ 10381

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

Customize form.

  • Property svn:keywords set to Id
File size: 5.4 KB
Line 
1## $Id: interfaces.py 10380 2013-06-25 05:54:25Z 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 Attribute, invariant, Invalid
23from waeup.kofa.schema import FormattedDate, TextLineChoice
24from waeup.kofa.schoolgrades import ResultEntryField
25from waeup.kofa.applicants.interfaces import (
26    IApplicantBaseData,
27    AppCatCertificateSource, CertificateSource)
28from waeup.kofa.students.vocabularies import nats_vocab
29from kofacustom.nigeria.applicants.interfaces import (
30    LGASource,
31    high_qual, high_grade, exam_types,
32    INigeriaUGApplicant,
33    INigeriaApplicantOnlinePayment,
34    INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,
35    INigeriaApplicantUpdateByRegNo,
36    )
37
38from waeup.imostate.interfaces import MessageFactory as _
39
40class ICustomUGApplicant(IApplicantBaseData):
41    """An undergraduate applicant.
42
43    This interface defines the least common multiple of all fields
44    in ug application forms. In customized forms, fields can be excluded by
45    adding them to the UG_OMIT* tuples.
46    """
47
48    nationality = schema.Choice(
49        source = nats_vocab,
50        title = _(u'Nationality'),
51        required = True,
52        )
53    lga = schema.Choice(
54        source = LGASource(),
55        title = _(u'State/LGA (Nigerians only)'),
56        required = False,
57        )
58    #perm_address = schema.Text(
59    #    title = _(u'Permanent Address'),
60    #    required = False,
61    #    )
62    course1 = schema.Choice(
63        title = _(u'Programme Desired'),
64        source = AppCatCertificateSource(),
65        required = True,
66        )
67
68    olevel_type = schema.Choice(
69        title = _(u'Qualification Obtained'),
70        required = False,
71        readonly = False,
72        vocabulary = exam_types,
73        )
74    olevel_school = schema.TextLine(
75        title = _(u'Institution Attended'),
76        required = False,
77        readonly = False,
78        )
79    olevel_exam_number = schema.TextLine(
80        title = _(u'Exam Number'),
81        required = False,
82        readonly = False,
83        )
84    olevel_exam_date = FormattedDate(
85        title = _(u'Exam Date'),
86        required = False,
87        readonly = False,
88        show_year = True,
89        )
90    olevel_results = schema.List(
91        title = _(u'Exam Results'),
92        value_type = ResultEntryField(),
93        required = False,
94        readonly = False,
95        default = [],
96        )
97
98    notice = schema.Text(
99        title = _(u'Notice'),
100        required = False,
101        )
102    screening_venue = schema.TextLine(
103        title = _(u'Screening Venue'),
104        required = False,
105        )
106    screening_date = schema.TextLine(
107        title = _(u'Screening Date'),
108        required = False,
109        )
110    screening_score = schema.Int(
111        title = _(u'Screening Score (%)'),
112        required = False,
113        )
114    result_uploaded = schema.Bool(
115        title = _(u'Result uploaded'),
116        default = False,
117        )
118    student_id = schema.TextLine(
119        title = _(u'Student Id'),
120        required = False,
121        readonly = False,
122        )
123    course_admitted = schema.Choice(
124        title = _(u'Programme Admitted'),
125        source = CertificateSource(),
126        required = False,
127        )
128    locked = schema.Bool(
129        title = _(u'Form locked'),
130        default = False,
131        )
132
133class ICustomApplicant(ICustomUGApplicant):
134    """An interface for both types of applicants.
135
136    Attention: The ICustomPGApplicant field seetings will be overwritten
137    by ICustomPGApplicant field settings. If a field is defined
138    in both interfaces zope.schema validates only against the
139    constraints in ICustomUGApplicant. This does not affect the forms
140    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
141    """
142
143    def writeLogMessage(view, comment):
144        """Adds an INFO message to the log file
145        """
146
147    def createStudent():
148        """Create a student object from applicatnt data
149        and copy applicant object.
150        """
151
152class ICustomUGApplicantEdit(ICustomUGApplicant):
153    """An undergraduate applicant interface for edit forms.
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
165class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
166    """An applicant payment via payment gateways.
167
168    """
169
170class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
171    """Representation of an applicant.
172
173    Skip regular reg_number validation if reg_number is used for finding
174    the applicant object.
175    """
176
Note: See TracBrowser for help on using the repository browser.