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

Last change on this file since 8649 was 8537, checked in by Henrik Bettermann, 13 years ago

See r8535.

  • Property svn:keywords set to Id
File size: 4.6 KB
Line 
1## $Id: interfaces.py 8537 2012-05-28 05:26:18Z 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 waeup.fceokene.utils.lgas import LGAS
25
26_ = MessageFactory = zope.i18nmessageid.MessageFactory('waeup.custom')
27
28high_qual = SimpleKofaVocabulary(
29    ('National Certificate of Education','nce'),
30    ('Pre Degree Programme','pre'),
31    ('Diploma Programme','dip'),
32    ('Ordinary 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    ('NCE AL OTH','nce_al_oth'),
39    ('National Defence Academy','nda'),
40    ('Awaiting Results','a_rslt'),
41    ('RMC','rmc'),
42    )
43
44high_grade = SimpleKofaVocabulary(
45    ('Upper Credit','upper_credit'),
46    ('Distinction','distinction'),
47    ('Credit','credit'),
48    ('Merit','merit'),
49    ('Lower Credit','lower_credit'),
50    ('First Class','first_class'),
51    ('Second Class Upper','second_class_upper'),
52    ('Second Class Lower','second_class_lower'),
53    ('Third Class','third_class'),
54    ('Pass','pass'),
55    ('Awaiting Results','a_rslt'),
56    ('A Levels','al'),
57    )
58
59exam_types = SimpleKofaVocabulary(
60    ('SSCE','ssce'),
61    ('WAEC','waec'),
62    ('GCE O\' LEVEL','gce_o_level'),
63    ('TC II','tc_ii'),
64    ('RSA','rsa'),
65    ('NABTEB','nabteb'),
66    ('NECO','neco'),
67    ('ACE','ace'),
68    ('GCE A\' LEVEL','gce_a_level'),
69    ('IGCSE','igcse'),
70    )
71
72#lgas_vocab = SimpleKofaVocabulary(
73#    *sorted([(x[1],x[0]) for x in LGAS]))
74
75class LGASource(BasicSourceFactory):
76    """A source for school subjects used in exam documentation.
77    """
78    lga_dict = dict(LGAS)
79
80    def getValues(self):
81        return sorted(self.lga_dict.keys())
82
83    def getToken(self, value):
84        return str(value)
85
86    def getTitle(self, value):
87        return self.lga_dict.get(value,
88            _('Invalid key: ${a}', mapping = {'a':value}))
89
90# It's recommended to replicate all fields from the base package here.
91class ICustomSessionConfiguration(ISessionConfiguration):
92    """A session configuration object.
93    """
94
95    # Base fees, do not remove.
96
97    school_fee_base = schema.Float(
98        title = _(u'School Fee (ignored)'),
99        default = 0.0,
100        required = False,
101        )
102
103    application_fee = schema.Float(
104        title = _(u'Application Fee (fallback)'),
105        default = 0.0,
106        required = False,
107        )
108
109    clearance_fee = schema.Float(
110        title = _(u'Clearance Fee (ignored)'),
111        default = 0.0,
112        required = False,
113        )
114
115    booking_fee = schema.Float(
116        title = _(u'Booking Fee'),
117        default = 0.0,
118        required = False,
119        )
120
121    # Additional fees in custom package
122
123    maint_fee = schema.Float(
124        title = _(u'Maintenance Fee (ignored)'),
125        default = 0.0,
126        required = False,
127        )
128
129    gown = schema.Float(
130        title = _(u'Gown Fee'),
131        default = 0.0,
132        required = False,
133        )
134
135    transfer = schema.Float(
136        title = _(u'Transfer Fee'),
137        default = 0.0,
138        required = False,
139        )
140
141    def getSessionString():
142        """Returns the session string from the vocabulary.
143        """
144
145
146class ICustomSessionConfigurationAdd(ICustomSessionConfiguration):
147    """A session configuration object in add mode.
148    """
149
150    academic_session = schema.Choice(
151        title = _(u'Academic Session'),
152        source = academic_sessions_vocab,
153        default = None,
154        required = True,
155        readonly = False,
156        )
157
158ICustomSessionConfigurationAdd[
159    'academic_session'].order =  ICustomSessionConfiguration[
160    'academic_session'].order
Note: See TracBrowser for help on using the repository browser.