source: main/waeup.futminna/trunk/src/waeup/futminna/applicants/interfaces.py @ 10096

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

Enable pdf file upload of Offline Form Extension.

  • Property svn:keywords set to Id
File size: 5.6 KB
Line 
1## $Id: interfaces.py 10096 2013-04-23 09:45:04Z 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.students.vocabularies import nats_vocab
26from kofacustom.nigeria.applicants.interfaces import (
27    LGASource,
28    INigeriaUGApplicant,
29    INigeriaApplicantOnlinePayment,
30    INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,
31    INigeriaApplicantUpdateByRegNo,
32    IPUTMEApplicantEdit,
33    OMIT_DISPLAY_FIELDS,
34    UG_OMIT_DISPLAY_FIELDS,
35    UG_OMIT_PDF_FIELDS,
36    UG_OMIT_MANAGE_FIELDS,
37    UG_OMIT_EDIT_FIELDS,
38    )
39
40
41PG_OMIT_DISPLAY_FIELDS = OMIT_DISPLAY_FIELDS + ('course2',)
42PG_OMIT_PDF_FIELDS = PG_OMIT_DISPLAY_FIELDS + ('phone',)
43PG_OMIT_MANAGE_FIELDS = ('course2',)
44PG_OMIT_EDIT_FIELDS = PG_OMIT_MANAGE_FIELDS + PG_OMIT_DISPLAY_FIELDS + (
45    'student_id', 'notice',
46    'screening_score', 'screening_venue',
47    'screening_date',)
48
49from waeup.futminna.interfaces import MessageFactory as _
50
51class ICustomUGApplicant(INigeriaUGApplicant):
52    """An undergraduate applicant.
53
54    This interface defines the least common multiple of all fields
55    in ug application forms. In customized forms, fields can be excluded by
56    adding them to the UG_OMIT* tuples.
57    """
58
59class ICustomPGApplicant(IApplicantBaseData):
60    """A postgraduate applicant.
61
62    This interface defines the least common multiple of all fields
63    in pg application forms. In customized forms, fields can be excluded by
64    adding them to the PG_OMIT* tuples.
65    """
66
67    nationality = schema.Choice(
68        source = nats_vocab,
69        title = _(u'Nationality'),
70        required = True,
71        )
72    lga = schema.Choice(
73        source = LGASource(),
74        title = _(u'State/LGA (Nigerians only)'),
75        required = False,
76        )
77    perm_address = schema.Text(
78        title = _(u'Permanent Address'),
79        required = False,
80        )
81    course1 = schema.Choice(
82        title = _(u'Programme desired'),
83        source = AppCatCertificateSource(),
84        required = True,
85        )
86    notice = schema.Text(
87        title = _(u'Notice'),
88        required = False,
89        readonly = False,
90        )
91    #screening_venue = schema.TextLine(
92    #    title = _(u'Screening Venue'),
93    #    required = False,
94    #    )
95    #screening_date = schema.TextLine(
96    #    title = _(u'Screening Date'),
97    #    required = False,
98    #    )
99    #screening_score = schema.Int(
100    #    title = _(u'Screening Score (%)'),
101    #    required = False,
102    #    )
103    student_id = schema.TextLine(
104        title = _(u'Student Id'),
105        required = False,
106        readonly = False,
107        )
108    course_admitted = schema.Choice(
109        title = _(u'Admitted Course of Study'),
110        source = CertificateSource(),
111        required = False,
112        readonly = False,
113        )
114    locked = schema.Bool(
115        title = _(u'Form locked'),
116        default = False,
117        )
118
119class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
120    """An interface for both types of applicants.
121
122    Attention: The ICustomPGApplicant field seetings will be overwritten
123    by ICustomPGApplicant field settings. If a field is defined
124    in both interfaces zope.schema validates only against the
125    constraints in ICustomUGApplicant. This does not affect the forms
126    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
127    """
128
129    def writeLogMessage(view, comment):
130        """Adds an INFO message to the log file
131        """
132
133    def createStudent():
134        """Create a student object from applicatnt data
135        and copy applicant object.
136        """
137
138class ICustomUGApplicantEdit(ICustomUGApplicant):
139    """An undergraduate applicant interface for edit forms.
140
141    Here we can repeat the fields from base data and set the
142    `required` and `readonly` attributes to True to further restrict
143    the data access. Or we can allow only certain certificates to be
144    selected by choosing the appropriate source.
145
146    We cannot omit fields here. This has to be done in the
147    respective form page.
148    """
149
150class ICustomPGApplicantEdit(ICustomPGApplicant):
151    """A postgraduate applicant interface for editing.
152
153    Here we can repeat the fields from base data and set the
154    `required` and `readonly` attributes to True to further restrict
155    the data access. Or we can allow only certain certificates to be
156    selected by choosing the appropriate source.
157
158    We cannot omit fields here. This has to be done in the
159    respective form page.
160    """
161
162
163class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
164    """An applicant payment via payment gateways.
165
166    """
167
168class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
169    """Representation of an applicant.
170
171    Skip regular reg_number validation if reg_number is used for finding
172    the applicant object.
173    """
174
Note: See TracBrowser for help on using the repository browser.