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

Last change on this file since 11152 was 10382, checked in by Henrik Bettermann, 11 years ago

Change notice and remove upload fields.

  • Property svn:keywords set to Id
File size: 5.6 KB
RevLine 
[10340]1## $Id: interfaces.py 10382 2013-06-25 12:46:38Z 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
[10380]23from waeup.kofa.schema import FormattedDate, TextLineChoice
24from waeup.kofa.schoolgrades import ResultEntryField
[10340]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
[10380]40class ICustomUGApplicant(IApplicantBaseData):
[10340]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
[10380]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
[10382]133ICustomUGApplicant[
134    'locked'].order =  IApplicantBaseData['suspended'].order
135ICustomUGApplicant[
136    'result_uploaded'].order =  ICustomUGApplicant['suspended'].order
137
[10350]138class ICustomApplicant(ICustomUGApplicant):
[10340]139    """An interface for both types of applicants.
140
141    Attention: The ICustomPGApplicant field seetings will be overwritten
142    by ICustomPGApplicant field settings. If a field is defined
143    in both interfaces zope.schema validates only against the
144    constraints in ICustomUGApplicant. This does not affect the forms
145    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
146    """
147
148    def writeLogMessage(view, comment):
149        """Adds an INFO message to the log file
150        """
151
152    def createStudent():
153        """Create a student object from applicatnt data
154        and copy applicant object.
155        """
156
157class ICustomUGApplicantEdit(ICustomUGApplicant):
158    """An undergraduate applicant interface for edit forms.
159
160    Here we can repeat the fields from base data and set the
161    `required` and `readonly` attributes to True to further restrict
162    the data access. Or we can allow only certain certificates to be
163    selected by choosing the appropriate source.
164
165    We cannot omit fields here. This has to be done in the
166    respective form page.
167    """
168
169
170class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
171    """An applicant payment via payment gateways.
172
173    """
174
175class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
176    """Representation of an applicant.
177
178    Skip regular reg_number validation if reg_number is used for finding
179    the applicant object.
180    """
181
Note: See TracBrowser for help on using the repository browser.