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