source: main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/interfaces.py @ 8935

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

Merged with waeup.aaue 8930:8931.

  • Property svn:keywords set to Id
File size: 6.2 KB
Line 
1## $Id: interfaces.py 8933 2012-07-07 10:48:47Z 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 waeup.kofa.applicants.interfaces import (
23    IApplicantBaseData,
24    AppCatCertificateSource, CertificateSource)
25from waeup.kofa.schoolgrades import ResultEntryField
26from waeup.kofa.interfaces import (
27    SimpleKofaVocabulary, academic_sessions_vocab, validate_email)
28from waeup.kofa.schema import FormattedDate, TextLineChoice
29from waeup.kofa.students.vocabularies import nats_vocab, GenderSource
30from waeup.kofa.applicants.interfaces import contextual_reg_num_source
31from kofacustom.nigeria.applicants.interfaces import (
32    LGASource, high_qual, high_grade, exam_types,
33    INigeriaUGApplicant, INigeriaPGApplicant,
34    INigeriaApplicantOnlinePayment,
35    UG_OMIT_DISPLAY_FIELDS,
36    UG_OMIT_PDF_FIELDS,
37    UG_OMIT_MANAGE_FIELDS,
38    UG_OMIT_EDIT_FIELDS,
39    PUTME_OMIT_EDIT_FIELDS,
40    UG_OMIT_RESULT_SLIP_FIELDS,
41    PG_OMIT_DISPLAY_FIELDS,
42    PG_OMIT_PDF_FIELDS,
43    PG_OMIT_MANAGE_FIELDS,
44    PG_OMIT_EDIT_FIELDS,
45    )
46from waeup.fceokene.interfaces import MessageFactory as _
47from waeup.fceokene.payments.interfaces import ICustomOnlinePayment
48
49class ICustomUGApplicant(INigeriaUGApplicant):
50    """An undergraduate applicant.
51
52    This interface defines the least common multiple of all fields
53    in ug application forms. In customized forms, fields can be excluded by
54    adding them to the UG_OMIT* tuples.
55    """
56
57class ICustomPGApplicant(INigeriaPGApplicant):
58    """A postgraduate applicant.
59
60    This interface defines the least common multiple of all fields
61    in pg application forms. In customized forms, fields can be excluded by
62    adding them to the PG_OMIT* tuples.
63    """
64
65class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
66    """An interface for both types of applicants.
67
68    Attention: The ICustomPGApplicant field seetings will be overwritten
69    by ICustomPGApplicant field settings. If a field is defined
70    in both interfaces zope.schema validates only against the
71    constraints in ICustomUGApplicant. This does not affect the forms
72    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
73    """
74
75    def writeLogMessage(view, comment):
76        """Adds an INFO message to the log file
77        """
78
79    def createStudent():
80        """Create a student object from applicatnt data
81        and copy applicant object.
82        """
83
84class ICustomUGApplicantEdit(ICustomUGApplicant):
85    """An undergraduate applicant interface for edit forms.
86
87    Here we can repeat the fields from base data and set the
88    `required` and `readonly` attributes to True to further restrict
89    the data access. Or we can allow only certain certificates to be
90    selected by choosing the appropriate source.
91
92    We cannot omit fields here. This has to be done in the
93    respective form page.
94    """
95
96    email = schema.ASCIILine(
97        title = _(u'Email Address'),
98        required = True,
99        constraint=validate_email,
100        )
101    date_of_birth = FormattedDate(
102        title = _(u'Date of Birth'),
103        required = True,
104        show_year = True,
105        )
106
107ICustomUGApplicantEdit[
108    'date_of_birth'].order =  ICustomUGApplicant['date_of_birth'].order
109ICustomUGApplicantEdit[
110    'email'].order =  ICustomUGApplicant['email'].order
111
112class ICustomPGApplicantEdit(ICustomPGApplicant):
113    """A postgraduate applicant interface for editing.
114
115    Here we can repeat the fields from base data and set the
116    `required` and `readonly` attributes to True to further restrict
117    the data access. Or we can allow only certain certificates to be
118    selected by choosing the appropriate source.
119
120    We cannot omit fields here. This has to be done in the
121    respective form page.
122    """
123
124    email = schema.ASCIILine(
125        title = _(u'Email Address'),
126        required = True,
127        constraint=validate_email,
128        )
129    date_of_birth = FormattedDate(
130        title = _(u'Date of Birth'),
131        required = True,
132        show_year = True,
133        )
134
135ICustomPGApplicantEdit[
136    'date_of_birth'].order =  ICustomPGApplicant['date_of_birth'].order
137ICustomPGApplicantEdit[
138    'email'].order =  ICustomPGApplicant['email'].order
139
140class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
141    """An applicant payment via payment gateways.
142
143    """
144
145class IPUTMEApplicantEdit(ICustomUGApplicant):
146    """An undergraduate applicant interface for editing.
147
148    Here we can repeat the fields from base data and set the
149    `required` and `readonly` attributes to True to further restrict
150    the data access. Or we can allow only certain certificates to be
151    selected by choosing the appropriate source.
152
153    We cannot omit fields here. This has to be done in the
154    respective form page.
155    """
156    email = schema.ASCIILine(
157        title = _(u'Email Address'),
158        required = True,
159        constraint=validate_email,
160        )
161    date_of_birth = FormattedDate(
162        title = _(u'Date of Birth'),
163        required = True,
164        show_year = True,
165        )
166
167IPUTMEApplicantEdit[
168    'date_of_birth'].order =  ICustomUGApplicant['date_of_birth'].order
169IPUTMEApplicantEdit[
170    'email'].order =  ICustomUGApplicant['email'].order
171
172class ICustomApplicantUpdateByRegNo(ICustomApplicant):
173    """Representation of an applicant.
174
175    Skip regular reg_number validation if reg_number is used for finding
176    the applicant object.
177    """
178    reg_number = schema.TextLine(
179        title = u'Registration Number',
180        required = False,
181        )
Note: See TracBrowser for help on using the repository browser.