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

Last change on this file since 14828 was 14755, checked in by Henrik Bettermann, 7 years ago

Add a session-based 'switch' to disable Interswitch payments. If the session configuration field interswitch_enabled is missing in custom packages, Interswitch payments are enabled by default (in contrast to Remita payments which are disabled by default).

  • Property svn:keywords set to Id
File size: 3.8 KB
Line 
1## $Id: interfaces.py 14755 2017-08-03 07:30:06Z 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 zope.i18nmessageid
20from zope import schema
21from zc.sourcefactory.basic import BasicSourceFactory
22from waeup.kofa.interfaces import (SimpleKofaVocabulary,
23    ISessionConfiguration, academic_sessions_vocab)
24from kofacustom.nigeria.utils.lgas import LGAS
25
26_ = MessageFactory = zope.i18nmessageid.MessageFactory('kofacustom.nigeria')
27
28high_qual = SimpleKofaVocabulary(
29    ('National Certificate of Education','nce'),
30    ('Pre Degree Programme','pre'),
31    ('Diploma Programme','dip'),
32    ('National Diploma','ond'),
33    ('Bachelors Degree','bd'),
34    ('Masters Degree','md'),
35    ('Professional Qualification','pq'),
36    ('Other Certification','oc'),
37    ('Higher National Diploma','hnd'),
38    ('Post Graduate Diploma','pgd'),
39    ('NCE AL OTH','nce_al_oth'),
40    ('National Defence Academy','nda'),
41    ('RMC','rmc'),
42    ('Ph.D.(Doctor of Philosophy)','phd'),
43    ('M.Phil (Master of Philosophy)','mphil'),
44    ('Awaiting Results','a_rslt'),
45    )
46
47high_grade = SimpleKofaVocabulary(
48    ('Upper Credit','upper_credit'),
49    ('Distinction','distinction'),
50    ('Credit','credit'),
51    ('Merit','merit'),
52    ('Lower Credit','lower_credit'),
53    ('First Class','first_class'),
54    ('Second Class Upper','second_class_upper'),
55    ('Second Class Lower','second_class_lower'),
56    ('Third Class','third_class'),
57    ('Pass','pass'),
58    ('Awaiting Results','a_rslt'),
59    ('A Levels','al'),
60    ('Unclassified Certificate', 'uc'),
61    )
62
63exam_types = SimpleKofaVocabulary(
64    ('SSCE','ssce'),
65    ('WAEC','waec'),
66    ('GCE O\' LEVEL','gce_o_level'),
67    ('TC II','tc_ii'),
68    ('RSA','rsa'),
69    ('NABTEB','nabteb'),
70    ('NECO','neco'),
71    ('ACE','ace'),
72    ('GCE A\' LEVEL','gce_a_level'),
73    ('IGCSE','igcse'),
74    ('WAEC Technical Examination','wte'),
75    )
76
77#lgas_vocab = SimpleKofaVocabulary(
78#    *sorted([(x[1],x[0]) for x in LGAS]))
79
80class LGASource(BasicSourceFactory):
81    """A source for school subjects used in exam documentation.
82    """
83    lga_dict = dict(LGAS)
84
85    def getValues(self):
86        return sorted(self.lga_dict.keys())
87
88    def getToken(self, value):
89        return str(value)
90
91    def getTitle(self, value):
92        return self.lga_dict.get(value,
93            _('Invalid key: ${a}', mapping = {'a':value}))
94
95class ICustomSessionConfiguration(ISessionConfiguration):
96    """A session configuration object.
97    """
98
99    remita_enabled = schema.Bool(
100        title = _(u'Remita integration enabled'),
101        default = False,
102        )
103
104    interswitch_enabled = schema.Bool(
105        title = _(u'Interswitch integration enabled'),
106        default = True,
107        )
108
109class ICustomSessionConfigurationAdd(ICustomSessionConfiguration):
110    """A session configuration object in add mode.
111    """
112
113    academic_session = schema.Choice(
114        title = _(u'Academic Session'),
115        source = academic_sessions_vocab,
116        default = None,
117        required = True,
118        readonly = False,
119        )
120
121ICustomSessionConfigurationAdd[
122    'academic_session'].order =  ICustomSessionConfiguration[
123    'academic_session'].order
Note: See TracBrowser for help on using the repository browser.