source: main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/interfaces.py @ 15800

Last change on this file since 15800 was 15793, checked in by Henrik Bettermann, 5 years ago

First application form customizations.

  • Property svn:keywords set to Id
File size: 5.6 KB
Line 
1## $Id: interfaces.py 15793 2019-11-10 21:17:13Z 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    INigeriaUGApplicantEdit, INigeriaPGApplicantEdit,
36    INigeriaApplicantUpdateByRegNo,
37    IPUTMEApplicantEdit,
38    )
39from kofacustom.iuokada.interfaces import MessageFactory as _
40from kofacustom.iuokada.payments.interfaces import ICustomOnlinePayment
41
42sponsors_vocab = SimpleKofaVocabulary(
43    (_('Bauchi Government'), 'bauchi'),
44    (_('Company'), 'company'),
45    (_('Federal Government (Amnesty)'), 'federalgov'),
46    (_('Dangote Group'), 'dangote'),
47    (_('Kano Government'), 'kano'),
48    (_('Parent/Guardian'), 'parent'),
49    (_('Rosula Organization'), 'rosula'),
50    (_('Self'), 'self'),
51    (_('Social Impact Project'), 'social'),
52    )
53
54heard_about_types_vocab = SimpleKofaVocabulary(
55    (_('Facebook/Twitter/Other Social Media'), 'socmedia'),
56    (_('From a Friend'), 'friend'),
57    (_('Newspaper Advertisement'), 'newspaper'),
58    (_('Radio Advertisement'), 'radio'),
59    (_('Television Advertisement'), 'television'),
60    )
61
62class ICustomUGApplicant(INigeriaUGApplicant):
63    """An undergraduate applicant.
64
65    This interface defines the least common multiple of all fields
66    in ug application forms. In customized forms, fields can be excluded by
67    adding them to the UG_OMIT* tuples.
68    """
69
70    sponsor = schema.Choice(
71        title = _(u'Sponsor'),
72        vocabulary = sponsors_vocab,
73        required = False,
74        )
75
76    heard_about = schema.Choice(
77        title = _(u'How did you hear about IU?'),
78        vocabulary = heard_about_types_vocab,
79        required = False,
80        )
81
82class ICustomPGApplicant(INigeriaPGApplicant):
83    """A postgraduate applicant.
84
85    This interface defines the least common multiple of all fields
86    in pg application forms. In customized forms, fields can be excluded by
87    adding them to the PG_OMIT* tuples.
88    """
89
90
91class ICustomApplicant(ICustomUGApplicant, ICustomPGApplicant):
92    """An interface for both types of applicants.
93
94    Attention: The ICustomPGApplicant field seetings will be overwritten
95    by ICustomPGApplicant field settings. If a field is defined
96    in both interfaces zope.schema validates only against the
97    constraints in ICustomUGApplicant. This does not affect the forms
98    since they are build on either ICustomUGApplicant or ICustomPGApplicant.
99    """
100
101    def writeLogMessage(view, comment):
102        """Adds an INFO message to the log file
103        """
104
105    def createStudent():
106        """Create a student object from applicant data
107        and copy applicant object.
108        """
109
110class ICustomUGApplicantEdit(INigeriaUGApplicantEdit):
111    """An undergraduate applicant interface for edit forms.
112
113    Here we can repeat the fields from base data and set the
114    `required` and `readonly` attributes to True to further restrict
115    the data access. Or we can allow only certain certificates to be
116    selected by choosing the appropriate source.
117
118    We cannot omit fields here. This has to be done in the
119    respective form page.
120    """
121
122class ICustomPGApplicantEdit(INigeriaPGApplicantEdit):
123    """A postgraduate applicant interface for editing.
124
125    Here we can repeat the fields from base data and set the
126    `required` and `readonly` attributes to True to further restrict
127    the data access. Or we can allow only certain certificates to be
128    selected by choosing the appropriate source.
129
130    We cannot omit fields here. This has to be done in the
131    respective form page.
132    """
133
134class ICustomApplicantOnlinePayment(INigeriaApplicantOnlinePayment):
135    """An applicant payment via payment gateways.
136
137    """
138
139class IPUTMEApplicantEdit(IPUTMEApplicantEdit):
140    """An undergraduate applicant interface for editing.
141
142    Here we can repeat the fields from base data and set the
143    `required` and `readonly` attributes to True to further restrict
144    the data access. Or we can allow only certain certificates to be
145    selected by choosing the appropriate source.
146
147    We cannot omit fields here. This has to be done in the
148    respective form page.
149    """
150
151class ICustomApplicantUpdateByRegNo(INigeriaApplicantUpdateByRegNo):
152    """Representation of an applicant.
153
154    Skip regular reg_number validation if reg_number is used for finding
155    the applicant object.
156    """
Note: See TracBrowser for help on using the repository browser.