source: main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interfaces.py @ 15842

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

Add first Payoutlet components. Not yet tested.
Rename eTranzact.

  • Property svn:keywords set to Id
File size: 4.7 KB
Line 
1## $Id: interfaces.py 15702 2019-10-25 09:59:20Z 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
19import re
20import zope.i18nmessageid
21from zope import schema
22from zc.sourcefactory.basic import BasicSourceFactory
23from waeup.kofa.interfaces import (SimpleKofaVocabulary,
24    ISessionConfiguration, academic_sessions_vocab,
25    ContextualDictSourceFactoryBase)
26from kofacustom.nigeria.utils.lgas import LGAS
27
28_ = MessageFactory = zope.i18nmessageid.MessageFactory('kofacustom.nigeria')
29
30high_qual = SimpleKofaVocabulary(
31    ('National Certificate of Education','nce'),
32    ('Pre Degree Programme','pre'),
33    ('Diploma Programme','dip'),
34    ('National Diploma','ond'),
35    ('Bachelors Degree','bd'),
36    ('Masters Degree','md'),
37    ('Professional Qualification','pq'),
38    ('Other Certification','oc'),
39    ('Higher National Diploma','hnd'),
40    ('Post Graduate Diploma','pgd'),
41    ('NCE AL OTH','nce_al_oth'),
42    ('National Defence Academy','nda'),
43    ('RMC','rmc'),
44    ('Ph.D.(Doctor of Philosophy)','phd'),
45    ('M.Phil (Master of Philosophy)','mphil'),
46    ('JUPEB','jupeb'),
47    (_('Awaiting Results'),'a_rslt'),
48    )
49
50high_grade = SimpleKofaVocabulary(
51    ('Upper Credit','upper_credit'),
52    ('Distinction','distinction'),
53    ('Credit','credit'),
54    ('Merit','merit'),
55    ('Lower Credit','lower_credit'),
56    ('First Class','first_class'),
57    ('Second Class Upper','second_class_upper'),
58    ('Second Class Lower','second_class_lower'),
59    ('Third Class','third_class'),
60    ('Pass','pass'),
61    ('A Levels','al'),
62    ('Unclassified Certificate', 'uc'),
63    (_('Awaiting Results'),'a_rslt'),
64    )
65
66exam_types = SimpleKofaVocabulary(
67    ('SSCE','ssce'),
68    ('WAEC','waec'),
69    ('GCE O\' LEVEL','gce_o_level'),
70    ('TC II','tc_ii'),
71    ('RSA','rsa'),
72    ('NABTEB','nabteb'),
73    ('NECO','neco'),
74    ('ACE','ace'),
75    ('GCE A\' LEVEL','gce_a_level'),
76    ('IGCSE','igcse'),
77    ('WAEC Technical Examination','wte'),
78    )
79
80# Define a validation method for JAMB reg numbers
81class NotJAMBRegNumber(schema.ValidationError):
82    __doc__ = u"Invalid JAMB registration number"
83
84#: Regular expression to check jamb_reg_number formats.
85check_jamb_reg_number = re.compile(r"^\d{8}[A-Z]{2}$").match
86
87def validate_jamb_reg_number(value):
88    if not check_jamb_reg_number(value):
89        raise NotJAMBRegNumber(value)
90    return True
91
92#lgas_vocab = SimpleKofaVocabulary(
93#    *sorted([(x[1],x[0]) for x in LGAS]))
94
95class LGASource(BasicSourceFactory):
96    """A source for school subjects used in exam documentation.
97    """
98    lga_dict = dict(LGAS)
99
100    def getValues(self):
101        return sorted(self.lga_dict.keys())
102
103    def getToken(self, value):
104        return str(value)
105
106    def getTitle(self, value):
107        return self.lga_dict.get(value,
108            _('Invalid key: ${a}', mapping = {'a':value}))
109
110class DisabilitiesSource(ContextualDictSourceFactoryBase):
111    """A source for filtering groups of students
112    """
113    #: name of dict to deliver from kofa utils.
114    DICT_NAME = 'DISABILITIES_DICT'
115
116
117class ICustomSessionConfiguration(ISessionConfiguration):
118    """A session configuration object.
119    """
120
121    remita_enabled = schema.Bool(
122        title = _(u'Remita integration enabled'),
123        default = False,
124        )
125
126    interswitch_enabled = schema.Bool(
127        title = _(u'Interswitch integration enabled'),
128        default = True,
129        )
130
131    etranzact_webconnect_enabled = schema.Bool(
132        title = _(u'Etranzact Webconnect integration enabled'),
133        default = False,
134        )
135
136    etranzact_payoutlet_enabled = schema.Bool(
137        title = _(u'Etranzact Payoutlet integration enabled'),
138        default = False,
139        )
140
141class ICustomSessionConfigurationAdd(ICustomSessionConfiguration):
142    """A session configuration object in add mode.
143    """
144
145    academic_session = schema.Choice(
146        title = _(u'Academic Session'),
147        source = academic_sessions_vocab,
148        default = None,
149        required = True,
150        readonly = False,
151        )
152
153ICustomSessionConfigurationAdd[
154    'academic_session'].order =  ICustomSessionConfiguration[
155    'academic_session'].order
Note: See TracBrowser for help on using the repository browser.